diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs index 1a23c508..64ee7215 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs @@ -70,7 +70,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 齐套明细Json /// - public string CollocationSchemeDsJson { get; set; } + public string CollocationSchemeDsJson { get; set; }=string.Empty; [JsonIgnore] public List? list { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c2114d31..f38354e8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -25,6 +25,7 @@ using Mapster; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; +using NPOI.HPSF; using NPOI.OpenXmlFormats.Wordprocessing; using Polly.Timeout; using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; @@ -187,6 +188,7 @@ namespace Tnb.WarehouseMgr //任务链属性处理内部函数 async Task _taskChainAttrHandle(List items, List areaPreTasks, int moveNum) { + var groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); await Task.Run(() => { if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1)) @@ -194,19 +196,34 @@ namespace Tnb.WarehouseMgr items.ForEach(x => { x.is_chain = 0; - }); + items[^items.Count].groups = $"{groupCode}-1"; } else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) { items.ForEach(x => x.is_chain = 1); - //items[0].chain_type = "1"; - //for (int i = 0; i < items.Count; i++) - //{ - // if (i == 0 || i == items.Count - 1) continue; - // items[i].chain_type = "2"; - //} - //items[^1].chain_type = "3"; + var mod = items.Count % moveNum > 0 ? items.Count / moveNum + 1 : items.Count / moveNum; + int start = 0, end = moveNum; + var arrary = items.ToArray(); + var itemsCount = items.Count; + 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++) + { + subArray[j].groups = $"{groupCode}-{i}"; + } + start = end; + if ((end + moveNum) >= arrary.Length) + { + end = arrary.Length; + } + else + { + end = end + moveNum; + } + } } }); @@ -234,12 +251,13 @@ namespace Tnb.WarehouseMgr { var moveNum = itGroup.First().move_num; var items = itGroup.Adapt>(); - items.ForEach(x => + for (int i = 0, cnt = items.Count; i < cnt; i++) { - x.id = SnowflakeIdHelper.NextId(); - x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; - x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult(); - }); + var num = i + 1; + items[i].id = SnowflakeIdHelper.NextId(); + items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; + items[i].bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); + } if (moveNum == 1) {