From 8894ca77e6c957a37bd8b934df19edab7d2b4136 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 11 Aug 2023 17:47:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=E5=B0=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=BD=BD=E5=85=B7=E3=80=81=E8=BD=BD=E5=85=B7=E6=9D=A1?= =?UTF-8?q?=E7=A0=81=E6=94=B9=E4=B8=BA=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index d2093b7f..2110d885 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -499,18 +499,37 @@ namespace Tnb.WarehouseMgr //更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位 var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList(); + var locWhIdMap = await _db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); + List carryIts = new(); + List carryCodeIts = new(); for (int i = 0; i < multiList.Count; i++) { - await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - //更新条码的库位和仓库信息 - var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); - if (carryCodes?.Count > 0) + WmsCarryH carry = new() { - var loc = await _db.Queryable().SingleAsync(it => it.id == multiList[i].endlocation_id); - await _db.Updateable().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - } - } + id = multiList[i].carry_id, + is_lock = 0, + location_id = multiList[i].endlocation_id, + location_code = multiList[i].endlocation_code + }; + WmsCarryCode carryCode = new() + { + warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), + location_id = multiList[i].endlocation_id, + location_code = multiList[i].endlocation_code + }; + carryIts.Add(carry); + carryCodeIts.Add(carryCode); + //await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); + ////更新条码的库位和仓库信息 + //var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); + //if (carryCodes?.Count > 0) + //{ + // await _db.Updateable().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); + //} + } + await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); + await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); for (int i = 0; i < multis.Count; i++) From 767bfe2d4927706acf3e6326fea01261e8811919 Mon Sep 17 00:00:00 2001 From: FanLian Date: Mon, 14 Aug 2023 09:07:59 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=93=BE=E5=A2=9E=E5=8A=A0=E8=BD=BD=E5=85=B7=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index d2093b7f..1f78ed98 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -354,7 +354,8 @@ namespace Tnb.WarehouseMgr { taskCode = it.bill_code, sourceName = it.startpoint_code, - targetName = it.endpoint_code + targetName = it.endpoint_code, + carryCode = it.carry_code, })); Log.Information($"请求地址:{url}"); foreach (var (k, v) in taskChainCodeDic) From ca3d04cb836c061f75fba77d11f6f5ef6ea89b3c Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:12:10 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B0=86=E5=8E=9F=E5=BA=93=E4=BD=8D=E6=9B=B4=E6=96=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4=E4=B8=BA=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 2110d885..d43b80c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -498,10 +498,11 @@ namespace Tnb.WarehouseMgr await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync(); //更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位 - var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList(); + var multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList(); var locWhIdMap = await _db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); List carryIts = new(); List carryCodeIts = new(); + List locIts = new(); for (int i = 0; i < multiList.Count; i++) { WmsCarryH carry = new() @@ -520,8 +521,14 @@ namespace Tnb.WarehouseMgr carryIts.Add(carry); carryCodeIts.Add(carryCode); + BasLocation loc = new(); + loc.is_lock = 0; + if (multiList[i].carry_status.ToEnum() == EnumCarryStatus.空闲) + { + loc.is_use = ((int)EnumCarryStatus.占用).ToString(); + } + locIts.Add(loc); //await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - ////更新条码的库位和仓库信息 //var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); //if (carryCodes?.Count > 0) //{ @@ -529,19 +536,21 @@ namespace Tnb.WarehouseMgr //} } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); + //更新条码的库位和仓库信息 await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 - var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); - for (int i = 0; i < multis.Count; i++) - { - var carryStatus = multis[i].carry_status; - if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) - { - carryStatus = ((int)EnumCarryStatus.占用).ToString(); - } - var cStatus = carryStatus.ParseToInt(); - await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); - } + await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ExecuteCommandAsync(); + //var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); + //for (int i = 0; i < multis.Count; i++) + //{ + // var carryStatus = multis[i].carry_status; + // if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) + // { + // carryStatus = ((int)EnumCarryStatus.占用).ToString(); + // } + // var cStatus = carryStatus.ParseToInt(); + // await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + //} //更新业务主表的单据状态 foreach (var dt in disTasks) From 962ab7cab901ac8da67e0cfd054ba7e6fdf53a28 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:14:07 +0800 Subject: [PATCH 4/5] 1 --- .../Tnb.WarehouseMgr/WareHouseService.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 05a1a2a4..e6a50e70 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -529,30 +529,13 @@ namespace Tnb.WarehouseMgr loc.is_use = ((int)EnumCarryStatus.占用).ToString(); } locIts.Add(loc); - //await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - //var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); - //if (carryCodes?.Count > 0) - //{ - // await _db.Updateable().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - //} + } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新条码的库位和仓库信息 await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ExecuteCommandAsync(); - //var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); - //for (int i = 0; i < multis.Count; i++) - //{ - // var carryStatus = multis[i].carry_status; - // if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) - // { - // carryStatus = ((int)EnumCarryStatus.占用).ToString(); - // } - // var cStatus = carryStatus.ParseToInt(); - // await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); - //} - //更新业务主表的单据状态 foreach (var dt in disTasks) { From 4c1e3c8c408b76a061ec6f05a7b0bbf7b21708bc Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:15:24 +0800 Subject: [PATCH 5/5] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index e6a50e70..67d3f20b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -504,7 +504,7 @@ namespace Tnb.WarehouseMgr List carryIts = new(); List carryCodeIts = new(); List locIts = new(); - for (int i = 0; i < multiList.Count; i++) + for (int i = 0, cnt = multiList.Count; i < cnt; i++) { WmsCarryH carry = new() { @@ -529,7 +529,7 @@ namespace Tnb.WarehouseMgr loc.is_use = ((int)EnumCarryStatus.占用).ToString(); } locIts.Add(loc); - + } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新条码的库位和仓库信息