From c250cf01f8cdb00559f40e821ec4e01b47ed66f2 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 24 Jul 2023 10:03:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=BD=90=E5=A5=97?= =?UTF-8?q?=E5=87=BA=E5=BA=93=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=A9=BA=E8=BD=BD?= =?UTF-8?q?=E5=85=B7=EF=BC=8C=E5=B9=B6=E8=A1=8C=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IWmsCarryService.cs | 5 +++-- .../Tnb.WarehouseMgr/WareHouseService.cs | 16 +++++++++------- WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs | 16 ++++++++++++---- .../Tnb.WarehouseMgr/WmskittingOutService.cs | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs index 4eeff321..f51fba77 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs @@ -1,4 +1,5 @@ -using Tnb.WarehouseMgr.Entities; +using System.Runtime.CompilerServices; +using Tnb.WarehouseMgr.Entities; namespace Tnb.WarehouseMgr.Interfaces { @@ -12,6 +13,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// - Task UpdateNullCarry(WmsCarryH carryObj); + Task UpdateNullCarry(WmsCarryH carryObj, Func> parallelUpdate=null, [CallerMemberName] string original = ""); } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c0b294a5..02249c8a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -210,15 +210,17 @@ namespace Tnb.WarehouseMgr var arrary = items.ToArray(); for (int i = 1; i <= mod; i++) { - if (start >= itemsCount) break; - var subArray = arrary[start..end]; - for (int j = 0, arrLen = subArray.Length; j < arrLen; j++) + while (start < itemsCount) { - subArray[j].groups = groupCode; - subArray[j].bill_code = $"{groupCode}-{i}"; + var subArray = arrary[start..end]; + for (int j = 0, arrLen = subArray.Length; j < arrLen; j++) + { + subArray[j].groups = groupCode; + subArray[j].bill_code = $"{groupCode}-{i}"; + } + start = end; + end = Math.Min((end + moveNum), arrary.Length); } - start = end; - end = Math.Min((end + moveNum), arrary.Length); } } }); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index ad7988b0..408acddb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Contracts; +using System.Runtime.CompilerServices; +using JNPF.Common.Contracts; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; @@ -155,7 +156,7 @@ namespace Tnb.WarehouseMgr } [NonAction] - public async Task UpdateNullCarry(WmsCarryH carryObj) + public async Task UpdateNullCarry(WmsCarryH carryObj, Func> parallelUpdate = null, [CallerMemberName] string original = "") { var row = 1; try @@ -172,8 +173,15 @@ namespace Tnb.WarehouseMgr carryObj.collocation_scheme_code = null; carryObj.source_id = null; carryObj.source_code = null; - Task.Run(() => _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync()); - //row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync(); + if (parallelUpdate != null) + { + parallelUpdate(carryObj); + } + else + { + row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync(); + } + //Task.Run(() => _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync()); //删除对应明细表 //删除载具明细 await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 56df10e8..cd498d19 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -309,7 +309,7 @@ namespace Tnb.WarehouseMgr var tasks = new List>(); foreach (var carryIt in carrys) { - tasks.Add(_carryService.UpdateNullCarry(carryIt)); + tasks.Add(_carryService.UpdateNullCarry(carryIt, carryIt => Task.Run(() => _db.CopyNew().Updateable(carryIt).ExecuteCommandAsync()))); } var all = await Task.WhenAll(tasks); await _db.Ado.CommitTranAsync(); From 9621ccac0e5ce6b03f2dcef538e70e60513c2bc8 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 24 Jul 2023 11:15:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IWmsCarryService.cs | 2 +- .../Tnb.WarehouseMgr/WareHouseService.cs | 35 ++----------------- .../Tnb.WarehouseMgr/WmsCarryService.cs | 6 ++-- 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs index f51fba77..d8e1515f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs @@ -13,6 +13,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// - Task UpdateNullCarry(WmsCarryH carryObj, Func> parallelUpdate=null, [CallerMemberName] string original = ""); + Task UpdateNullCarry(WmsCarryH carryObj, Func> updateTask=null, [CallerMemberName] string original = ""); } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 02249c8a..c502c66a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -200,7 +200,7 @@ namespace Tnb.WarehouseMgr items[0].groups = groupCode; items[0].bill_code = $"{groupCode}-1"; } - else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) + else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) { items.ForEach(x => x.is_chain = 1); var itemsCount = items.Count; @@ -253,40 +253,11 @@ namespace Tnb.WarehouseMgr { items[i].id = SnowflakeIdHelper.NextId(); items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; - //items[i].groups = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); } - - if (moveNum == 1) - { - items.ForEach(x => - { - x.is_chain = 0; - //x.chain_type = "3"; - }); - } - else if (moveNum > 1) + if (moveNum >= 1) { var areaPreTasks = itGroup.ToList(); - //搬运数量==预任务数,可以生成任务执行,为任务链 - if (moveNum == areaPreTasks.Count) - { - await _taskChainAttrHandle(items, areaPreTasks, moveNum); - } - else if (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1) //搬运数量>预任务数,且预任务数等于1,不是任务链,预任务数据平替到任务执行 - { - await _taskChainAttrHandle(items, areaPreTasks, moveNum); - } - else if (moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) //搬运数量>预任务数,且预任务数大于1,可以执行时,可以生成任务执行,为任务链 - { - await _taskChainAttrHandle(items, areaPreTasks, moveNum); - } - else if (false) //搬运数量>预任务数,且预任务数大于1,不可以执行时,先空着 - { - } - else if (moveNum < areaPreTasks.Count) //搬运数量<预任务数, 按照预任务先后顺序,生成对应搬运数量的任务组 - { - await _taskChainAttrHandle(items, areaPreTasks, moveNum); - } + await _taskChainAttrHandle(items, areaPreTasks, moveNum); } if (preTaskCodes?.Count > 0) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index 408acddb..5aa85612 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -156,7 +156,7 @@ namespace Tnb.WarehouseMgr } [NonAction] - public async Task UpdateNullCarry(WmsCarryH carryObj, Func> parallelUpdate = null, [CallerMemberName] string original = "") + public async Task UpdateNullCarry(WmsCarryH carryObj, Func> updateTask = null, [CallerMemberName] string original = "") { var row = 1; try @@ -173,9 +173,9 @@ namespace Tnb.WarehouseMgr carryObj.collocation_scheme_code = null; carryObj.source_id = null; carryObj.source_code = null; - if (parallelUpdate != null) + if (updateTask != null) { - parallelUpdate(carryObj); + updateTask(carryObj); } else { From 89baed0d9a3e34647d852b49fdbdb04f99e8e03b Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 24 Jul 2023 11:16:10 +0800 Subject: [PATCH 3/3] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c502c66a..301b9f70 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -224,7 +224,6 @@ namespace Tnb.WarehouseMgr } } }); - } //获取所有未下发的预任务申请