diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 88261f3e..466be6d1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -71,6 +71,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// public const string BILLSTATUS_ON_ID = "25065143245845"; /// + /// 单据状态-完成 + /// + public const string BILLSTATUS_COMPLETE_ID = "25065149810453"; + /// /// 任务类型-入库TypeId /// public const string WMS_PRETASK_INSTOCK_TYPE_ID = "26126748597797"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs index f6d1ae3f..8e1a68b1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs @@ -19,5 +19,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// 任务执行Ids /// public List disTaskIds { get; set; } + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs index f571d010..cb1d601e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs @@ -19,5 +19,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto /// 单据业务类型Id /// public string bizTypeId { get; set; } + /// + /// 任务执行条码表 + /// + public List distaskCodes { get; set; } + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index bc391286..55adc7d5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -441,11 +441,12 @@ namespace Tnb.WarehouseMgr { foreach (var dt in disTasks) { - if (_userManager.User.LoginType == "App") + if (_userManager.UserOrigin.Equals("app", StringComparison.OrdinalIgnoreCase)) { dt.biz_type = $"pda{dt.biz_type}"; } - var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id }; + var disTaskCodes = await _db.Queryable().Where(it => it.bill_id == dt.id).ToListAsync(); + var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes }; if (dt.is_chain == 0) { await DoUpdate(upInput); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs index 7aa45c35..7ec20b89 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs @@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr [ServiceModule(BizTypeId)] public class WmsPDACarryMoveInStockService : BaseWareHouseService { - private const string BizTypeId = "26121988909861"; + private const string BizTypeId = "pda26121988909861"; private const string ModuleId = "26476127634469"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; @@ -116,7 +116,7 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks,null); + var isOk = await _wareHouseService.GenPreTask(preTasks, null); if (isOk) { var preTaskUpInput = new GenPreTaskUpInput(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 3e6da716..73103c43 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -213,7 +213,7 @@ namespace Tnb.WarehouseMgr var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); if (b != null) { - b.barcode = jo.Value(nameof(WmsInstockCode.barcode)); + b.barcode = jo.Value(nameof(WmsInstockCode.barcode))!; b.barcode_qty = jo.Value(nameof(WmsInstockCode.barcode_qty)); instockCOdes.Add(b); } @@ -245,7 +245,39 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { + if (input == null) throw new ArgumentNullException("input"); + //更具distaskCode的barcode 更新 instockcode 的 is_end 为 1 + if (input.distaskCodes?.Count > 0) + { + var barCodes = input.distaskCodes.Select(x => x.barcode); + await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync(); + var instockCodes = await _db.Queryable().Where(it => barCodes.Contains(it.barcode)).Select(it => new + { + id = it.bill_d_id, + barcode_qty = it.barcode_qty, + }).ToListAsync(); + var dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList()); + var ids = instockCodes.Select(it => it.id).ToList(); + var instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); + foreach (var item in instockDetails) + { + if (dic.ContainsKey(item.id)) + { + item.qty += dic[item.id].Sum(x => x); + if (item.qty >= item.pr_qty) + { + item.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; + } + } + } + await _db.Updateable(instockDetails).ExecuteCommandAsync(); + if (instockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) + { + await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + //如果是自动单据,需要回更上层系统 + } + } } } } diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs index e6e41ea0..a0683e33 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs @@ -7,10 +7,11 @@ namespace JNPF.Systems.Entitys.Permission; /// /// 用户信息基类. /// -public partial class UserEntity +public partial class UserEntity { /// /// 登录类型 /// + [SugarColumn(IsIgnore = true)] public string LoginType { get; set; } } \ No newline at end of file