From 00c11a4515829fe344ebb4d6254395b64d84244a Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Thu, 9 Nov 2023 15:20:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/ModuleConsts.cs | 2 +- .../Tnb.WarehouseMgr/WareHouseService.cs | 31 +++++++++++-------- .../WmsPDAScanInStockService.cs | 4 +++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs index 77cdcdf4..a267545b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs @@ -184,7 +184,7 @@ public class ModuleConsts public const string MODULE_WMSPOINT_ID = "26099196480805"; /// - /// 模块标识-PDA寄存出库 + /// 模块标识-PDA扫码入库 /// public const string MODULE_WMSSCANCODEINSTOCKPDA_ID = "28576495374869"; /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 6a201aa8..956f9f38 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -267,7 +267,8 @@ namespace Tnb.WarehouseMgr preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x => x.endlocation_code).Contains(it.endlocation_code)).ToList(); IEnumerable firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault()); - agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)); + //agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)).DistinctBy(x=>x.endlocation_code).ToList(); + agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty().ToList(); preTasks = preTasks.Concat(agvElevatorTasks).ToList(); @@ -291,24 +292,26 @@ namespace Tnb.WarehouseMgr int itemsCount = items.Count; int mod = itemsCount % moveNum > 0 ? (itemsCount / moveNum) + 1 : itemsCount / moveNum; WmsDistaskH[] arrary = items.ToArray(); - for (int i = 1; i <= mod; i++) + //for (int i = 1; i <= mod; i++) { - string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); + if (moveNum >= 1) { List areaPreTasks = itGroup.ToList(); - if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1) || areaPreTasks.Any(x => x.third_eqp_type.ToEnum() != EnumTaskChainType.CTU)) + if ( areaPreTasks.Any(x => x.third_eqp_type.ToEnum() != EnumTaskChainType.CTU)) { - items.ForEach(x => + foreach (var x in items) { + string groupCode = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).Result; x.is_chain = 0; - }); - items[0].groups = groupCode; - items[0].bill_code = $"{groupCode}-1"; + x.groups = groupCode; + x.bill_code = $"{groupCode}-1"; + } } else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) { + string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); items.ForEach(x => x.is_chain = 1); int start = 0; @@ -948,7 +951,7 @@ namespace Tnb.WarehouseMgr List points = await LocPathCalcAlgorithms(pStartId, pEndId, roads); try { - if (points.FindAll(x => x.location_code != null && x.location_code.Contains("ELE"))?.Count > 0) + if (points.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0) { //查询当前电梯点 List curEleDs = await _db.Queryable().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync(); @@ -957,14 +960,16 @@ namespace Tnb.WarehouseMgr { //当前电梯 WmsElevatorH curEle = await _db.Queryable().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1); - if (curEle == null) + //同电梯组电梯 + List sGpEle = await _db.Queryable().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync(); + + if (curEle == null && sGpEle?.Count > 0) { throw new AppFriendlyException("电梯被禁用或未配置", 500); } - //同电梯组电梯 - List sGpEle = await _db.Queryable().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync(); + //判断电梯组中各电梯任务数 - if (sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0) + if (curEle == null || sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0) { List sGpDs = await _db.Queryable().Where(it => it.bill_id == sGpEle.First().id).ToListAsync(); if (sGpDs?.Count > 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs index 89bc2bce..236fff07 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs @@ -322,6 +322,10 @@ namespace Tnb.WarehouseMgr await _db.Ado.RollbackTranAsync(); throw; } + finally + { + _ = InvokeGenPretaskExcute(); + } return Task.FromResult(true); } } From 7e0a89b0a2d18a0a16bd6e27be81de9bc4cab486 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Thu, 9 Nov 2023 15:31:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=A2=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=96=B0=E5=A2=9E=E5=BA=93=E4=BD=8D=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=8D=A0=E7=94=A8=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 956f9f38..9a50c27f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -252,9 +252,10 @@ namespace Tnb.WarehouseMgr //获取所有未下发的预任务申请 List preTasks = await db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id) .InnerJoin((a, b, c) => a.area_id == c.id) + .InnerJoin((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0") .Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id)) .OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code }) - .Select((a, b, c) => new WmsPretaskH + .Select((a, b, c,d) => new WmsPretaskH { move_num = c.move_num, third_eqp_type = c.third_eqp_type, @@ -299,7 +300,7 @@ namespace Tnb.WarehouseMgr { List areaPreTasks = itGroup.ToList(); - if ( areaPreTasks.Any(x => x.third_eqp_type.ToEnum() != EnumTaskChainType.CTU)) + if (areaPreTasks.Any(x => x.third_eqp_type.ToEnum() != EnumTaskChainType.CTU)) { foreach (var x in items) { From 869c05c7904694743da8bab8bd325960d1789a9f Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Thu, 9 Nov 2023 15:56:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A2=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=94=9F=E6=88=90=E6=89=A7=E8=A1=8C=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=E5=8D=A0=E7=94=A8=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 6 +++++- WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs | 2 +- WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs | 2 +- WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 9a50c27f..7c8ea061 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -255,7 +255,7 @@ namespace Tnb.WarehouseMgr .InnerJoin((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0") .Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id)) .OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code }) - .Select((a, b, c,d) => new WmsPretaskH + .Select((a, b, c, d) => new WmsPretaskH { move_num = c.move_num, third_eqp_type = c.third_eqp_type, @@ -925,6 +925,10 @@ namespace Tnb.WarehouseMgr Expression> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId; _ = await _db.Updateable().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync(); } + if (input.CarryStartLocationId.IsNullOrWhiteSpace() == false) + { + _ = await _db.Updateable().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); + } //根据所有库位更新库位的锁定状态为“锁定” if (setLocaionColumbExp != null && input.LocationIds?.Count > 0) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 90845eb4..ce05775b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -466,7 +466,7 @@ namespace Tnb.WarehouseMgr _ = await _db.Insertable(carryCodes).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, - it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); + it => new BasLocation { is_lock = 1 }); if (instockCOdes?.Count > 0) { _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 72119a86..1ba5f236 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -264,7 +264,7 @@ namespace Tnb.WarehouseMgr // 更新临时条码表 状态is_end await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, source_id = input.data[nameof(WmsOutstockH.source_id)].ToString(), source_code = input.data[nameof(WmsOutstockH.source_code)].ToString() }, - it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); + it => new BasLocation { is_lock = 1 }); if (instockCOdes?.Count > 0) { _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs index 236fff07..86b3c6ac 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs @@ -308,7 +308,7 @@ namespace Tnb.WarehouseMgr //回更状态 await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, - it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); + it => new BasLocation { is_lock = 1 }); _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync(); _ = await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();