From 0d13eb93aaa1e2ee5da7f3e26445aeb263ffb18e Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 30 Jun 2023 19:13:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BD=90=E5=A5=97=E5=87=BA=E5=BA=93=E3=80=81?= =?UTF-8?q?=E5=88=86=E6=8B=A3=E4=B8=9A=E5=8A=A1=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/WmsWareHouseConst.cs | 4 +++ .../Entity/WmsCarrybindCode.cs | 5 --- .../WmsKittingInStkService.cs | 34 ++++++++++++++++--- .../WmsRobotCallbackService.cs | 9 ++++- .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 5 +++ .../Tnb.WarehouseMgr/WmskittingOutService.cs | 26 +++++++++++--- 6 files changed, 68 insertions(+), 15 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index 3fc8e29a..49684e7a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -180,6 +180,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// 条码打印状态-已完成 /// public const string BARCODE_PRINT_STATUS_COMPLETE_ID = "26191372853541"; + /// + /// 载具规格-料架 + /// + public const string CARRY_LJSTD_ID = "26037267399717"; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindCode.cs index 7918c05c..5ef5de09 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindCode.cs @@ -49,11 +49,6 @@ public partial class WmsCarrybindCode : BaseEntity /// public decimal? codeqty { get; set; } - /// - /// 行号 - /// - public int? no { get; set; } - /// /// 子载具ID /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index 204c1d43..aac5ea10 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -31,7 +31,7 @@ namespace Tnb.WarehouseMgr /// [OverideVisualDev(ModuleConsts.MODULE_WMSKITTINGINSTK_ID)] [ServiceModule(BizTypeId)] - public class WmsKittingInStkService : BaseWareHouseService + public class WmsKittingInStkService : BaseWareHouseService, IWmsKittingInStkService { private const string BizTypeId = "26165655816741"; private readonly ISqlSugarClient _db; @@ -125,7 +125,7 @@ namespace Tnb.WarehouseMgr carryCodes = input.data["tablefield130"].ToObject>(); } } - + List pretaskCodes = new(); foreach (var pt in preTasks) { @@ -166,8 +166,10 @@ namespace Tnb.WarehouseMgr await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); var status = ((int)EnumCarryStatus.齐套).ToString(); var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsHandleH.carry_id)].ToString()); - if (carry?.out_status != status) { - if (carryCodes?.Count>0) { + if (carry?.out_status != status) + { + if (carryCodes?.Count > 0) + { carryCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -176,7 +178,7 @@ namespace Tnb.WarehouseMgr x.create_time = DateTime.Now; }); await _db.Insertable(carryCodes).ExecuteCommandAsync(); - } + } } await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH @@ -207,6 +209,28 @@ namespace Tnb.WarehouseMgr { if (input == null) throw new ArgumentNullException(nameof(input)); var row = await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + var kittingIn = await _db.Queryable().SingleAsync(it => it.id == input.requireId); + if (kittingIn != null) + { + var kittingOut = await _db.Queryable().SingleAsync(it => it.id == kittingIn.source_id); + if (kittingOut != null) + { + var locaion = await _db.Queryable().SingleAsync(it => it.id == kittingOut.location_id); + if (locaion != null && locaion.is_type.ToEnum() != EnumLocationType.存储库位) + { + kittingOut.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID; + + } + else + { + kittingOut.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; + } + kittingOut.carry_id = kittingIn.carry_id; + kittingOut.carry_code = kittingIn.carry_code; + await _db.Updateable(kittingOut).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); + + } + } if (row < 1) throw Oops.Oh(ErrorCode.COM1001); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs index 8dcc7be3..aaa2e876 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs @@ -51,7 +51,11 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _wmsKittingInStkService = wmsKittingInStkService; } - + /// + /// 机器人完成任务后回调接口 + /// + /// + /// [HttpPost] public async Task RobotCallback(RobotCallBackInput input) { @@ -92,6 +96,9 @@ namespace Tnb.WarehouseMgr visualDevModelCrInput.data[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID; visualDevModelCrInput.data[nameof(WmsKittingInstock.create_id)] = _userManager.UserId; visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now; + visualDevModelCrInput.data[nameof(WmsKittingInstock.location_id)] = carry.location_id; + visualDevModelCrInput.data[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult(); + visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.id; var location = await _db.Queryable().SingleAsync(it => it.id == kittingout.location_id); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index f8990c98..db3b429a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -278,6 +278,11 @@ namespace Tnb.WarehouseMgr } } await _db.Updateable(curSortingDetails).ExecuteCommandAsync(); + if(curSortingDetails.All(it=>it.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) + { + + await _db.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + } var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); if (carry != null) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index c1dd5be0..6e688fc6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -203,6 +203,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); var carryId = input.carryIds[^input.carryIds.Count]; + var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + var kods = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); //当前载具对应的所有条码插入 var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); @@ -242,11 +244,27 @@ namespace Tnb.WarehouseMgr } await _db.Updateable(curKittingoutDetails).ExecuteCommandAsync(); var isOk = await _db.Updateable().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - if (carry != null) + //if (carry != null) + //{ + // row = await _carryService.UpdateNullCarry(carry); + // isOk = row > 0; + //} + //判断当前载具是否为料架,如果是料架 清空所有料架/料箱数据, + if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) { - row = await _carryService.UpdateNullCarry(carry); - isOk = row > 0; + var carryds = await _db.Queryable().Where(it => it.id == carryId).ToListAsync(); + var mids = carryds.Select(x => x.membercarry_id).ToList(); + var carrys = await _db.Queryable().Where(it => mids.Contains(it.id)).ToListAsync(); + carrys.Add(carry); + if (carrys?.Count > 0) + { + var tasks = new List>(); + foreach (var carryIt in carrys) + { + tasks.Add(_carryService.UpdateNullCarry(carryIt)); + } + await Task.WhenAll(tasks); + } } if (!isOk) throw Oops.Oh(ErrorCode.COM1001);