Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -56,7 +56,8 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
//数据库里已经存在箱信息 移除
|
||||
var box = list.FirstOrDefault(f => f.BoxBillNo.Equals(s));
|
||||
list.Remove(box);
|
||||
if (box != null)
|
||||
list.Remove(box);
|
||||
}
|
||||
var boxs = _mapper.Map<List<Box>>(list);
|
||||
|
||||
@@ -75,13 +76,14 @@ namespace WMS.Web.Domain.Services
|
||||
var ops_box = list.FirstOrDefault(f => f.OpsBoxId == b.OpsBoxId);
|
||||
foreach (var sn in ops_box.Details.SelectMany(s => s.SerialNumbers))
|
||||
{
|
||||
var detail = ops_box.Details.FirstOrDefault(f => f.SerialNumbers.Select(s=>s.SerialNumber).Equals(sn.SerialNumber));
|
||||
if (detail == null) continue;
|
||||
var detail = ops_box.Details.FirstOrDefault(f => f.SerialNumbers.Select(s => s.SerialNumber).Contains(sn.SerialNumber));
|
||||
if (detail == null)
|
||||
continue;
|
||||
var opsSerial = list.FirstOrDefault(f => f.OpsBoxId == b.OpsBoxId).Details
|
||||
.SelectMany(s => s.SerialNumbers)
|
||||
.FirstOrDefault(s => s.SerialNumber.Equals(sn.SerialNumber));
|
||||
//序列号
|
||||
SerialNumbers s = new SerialNumbers(sn.SerialNumber, detail.MaterialId,b.Id,b.OpsBoxId, opsSerial.BarCereateUser,opsSerial.BarCreateTime);
|
||||
SerialNumbers s = new SerialNumbers(sn.SerialNumber, detail.MaterialId, b.Id, b.OpsBoxId, opsSerial.BarCereateUser, opsSerial.BarCreateTime);
|
||||
sList.Add(s);
|
||||
//序列号记录(序列号生成)
|
||||
SerialNumberOperate so = new SerialNumberOperate(sn.SerialNumber, SerialNumberOperateType.Generate, detail.MaterialId, opsSerial.BarCereateUser, "", b.SupplierId, b.OrgId, null, opsSerial.BarCreateTime);
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace WMS.Web.Domain.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo, bool isTransaction = false)
|
||||
{
|
||||
//1.有原箱时 需要判断 物料对应的序列号是否存在
|
||||
|
||||
List<Box> boxList = new List<Box>();
|
||||
//原箱有可能没有
|
||||
var srcBox = await _boxRepositories.Get(dto.SrcBoxId);
|
||||
@@ -70,6 +72,8 @@ namespace WMS.Web.Domain.Services
|
||||
if (destBox != null)
|
||||
boxList.Add(destBox);
|
||||
|
||||
//2.修改库存时需要区别 有原箱和没有原箱的情况
|
||||
|
||||
//var entity = _mapper.Map<ChangeBoxRecord>(dto);\
|
||||
List<ChangeBoxRecord> list = new List<ChangeBoxRecord>();
|
||||
foreach (var d in dto.Details)
|
||||
@@ -111,6 +115,8 @@ namespace WMS.Web.Domain.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
|
||||
{
|
||||
//1.下架时 需要验证箱是否在库存里
|
||||
|
||||
List<MoveBoxRecord> entityList = new List<MoveBoxRecord>();
|
||||
foreach (var d in dto)
|
||||
{
|
||||
@@ -118,8 +124,8 @@ namespace WMS.Web.Domain.Services
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entityList.Add(entity);
|
||||
}
|
||||
//需要填写规格型号
|
||||
//需要修改库存
|
||||
|
||||
//2.需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
|
||||
@@ -6,15 +6,18 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.OutStock;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Erp;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
@@ -62,10 +65,10 @@ namespace WMS.Web.Domain.Services
|
||||
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
|
||||
if (ex.Count() > 0)
|
||||
return Result.ReFailure(ResultCodes.OutStockMaterialError);
|
||||
//1.需要验证物料对应箱和序列号是否存在库存
|
||||
|
||||
var mIds = dto.Details.GroupBy(g => g.MaterialId).Select(s => s.Key).ToList();
|
||||
OutStock entity = new OutStock();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
foreach (var mid in mIds)
|
||||
{
|
||||
//任务单明细
|
||||
@@ -90,6 +93,8 @@ namespace WMS.Web.Domain.Services
|
||||
outd.SerialNumbers.AddRange(dtoDetails.SelectMany(s => s.SerialNumbers));
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
@@ -122,13 +127,43 @@ namespace WMS.Web.Domain.Services
|
||||
var list = await _outStockRepositories.GetEntityList(dto.Ids);
|
||||
foreach (var entity in list)
|
||||
{
|
||||
//下推金蝶
|
||||
var res = await _erpService.Push(new Core.Dto.Erp.ErpPushDto() { });
|
||||
entity.Sync(new List<string>(), res.IsSuccess, loginInfo.UserInfo.StaffId, res.Message);
|
||||
if (entity.SuccessSync) continue;
|
||||
List<string> failList = entity.SuccessSyncFail.Clone();//同步失败的来源单号
|
||||
//找到单据里需要同步的单据
|
||||
var sourcNos = entity.Details.SelectMany(s => s.ErpDetails).GroupBy(s => s.SourceBillNo).Select(s => s.Key);
|
||||
foreach (var s in failList)
|
||||
{
|
||||
var erp_details = entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.Erp_DetailId).ToList();
|
||||
var erpDto = new ErpPushDto() {
|
||||
FormId = FormIdParam.SAL_DELIVERYNOTICE.ToString(),
|
||||
Numbers = new List<string>() { s },
|
||||
Type="",
|
||||
DetailsId = string.Join(",", erp_details)
|
||||
};
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto);
|
||||
if (res.IsSuccess)
|
||||
entity.SyncSuccess(s, loginInfo.UserInfo.StaffId);
|
||||
else
|
||||
entity.SyncFail(res.Message, loginInfo.UserInfo.StaffId);
|
||||
}
|
||||
entity.SuccessSync = entity.SuccessSyncFail.Count() > 0 ? false : true;
|
||||
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
|
||||
var isSuccess = await _outStockRepositories.Edit(entity, true);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
var isSuccess = await _outStockRepositories.EditEntityList(list, true);
|
||||
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 下推
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> Push(ErpPushDto dto)
|
||||
{
|
||||
var res = await _erpService.Push(dto);
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1623,7 +1623,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//4.仓库:wms系统的仓库值---现在这个没有加,因为还单点没有和金蝶同步 FBillTypeID
|
||||
param.FilterString = "FDocumentStatus='C' and FAffairType='Dassembly' and FBillTypeID='3441ac133848446f824d0ab760c8b3c7'";
|
||||
//string srt = JsonConvert.SerializeObject(stocks_codes);
|
||||
param.FilterString += " and FSrcStockID in (" + stocks_codes + ")";
|
||||
param.FilterString += " and FStockID in (" + stocks_codes + ")";
|
||||
|
||||
//根据原订单号查询
|
||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||
@@ -1779,7 +1779,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//4.仓库:wms系统的仓库值---现在这个没有加,因为还单点没有和金蝶同步 FBillTypeID
|
||||
param.FilterString = "FDocumentStatus='C' and FAffairType='Assembly' and FBillTypeID='3441ac133848446f824d0ab760c8b3c7'";
|
||||
//string srt = JsonConvert.SerializeObject(stocks_codes);
|
||||
param.FilterString += " and FSrcStockID in (" + stocks_codes + ")";
|
||||
param.FilterString += " and FStockIDSETY in (" + stocks_codes + ")";
|
||||
|
||||
//根据原订单号查询
|
||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||
|
||||
Reference in New Issue
Block a user