From a20ad9f8206381b480cc90fcd02a34608dc83d21 Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Tue, 20 Feb 2024 16:30:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml | 5 + .../Dto/BoxMark/BoxMarkQueryResponse.cs | 8 +- src/WMS.Web.Domain/Services/BoxMarkService.cs | 94 +++++++++---------- 3 files changed, 52 insertions(+), 55 deletions(-) diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index c0538678..6b6b58c8 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -450,6 +450,11 @@ 产品数量 + + + 排序 + + 生成箱唛dto diff --git a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs index cf2f0953..c85f3f5d 100644 --- a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs +++ b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs @@ -108,9 +108,9 @@ namespace WMS.Web.Core.Dto /// public decimal ProductQty { get; set; } - ///// - ///// 排序 - ///// - //public int Sort { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } } } diff --git a/src/WMS.Web.Domain/Services/BoxMarkService.cs b/src/WMS.Web.Domain/Services/BoxMarkService.cs index 48f36b14..368a9ba5 100644 --- a/src/WMS.Web.Domain/Services/BoxMarkService.cs +++ b/src/WMS.Web.Domain/Services/BoxMarkService.cs @@ -61,8 +61,8 @@ namespace WMS.Web.Domain.Services //返回列表-对应刚刚生成的数据和编号集合 var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId); - - + + var resultList = new List(); if (list != null && list.Count != 0) { //处理-总数量 @@ -72,34 +72,31 @@ namespace WMS.Web.Domain.Services }); - //var resultList = new List(); - //var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); - //foreach (var id in ids) - //{ + var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); + foreach (var id in ids) + { - // var itemDetailId = 0; - // foreach (var item in list) - // { - // if (id == item.Id) - // { - - // var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); - - // var newItem = item; - // if (current == null) - // newItem.Sort = 1; - // else - // newItem.Sort = current.Sort + 1; - // resultList.Add(newItem); - // itemDetailId = item.DetailId; - // } - // } - //} + var itemDetailId = 0; + foreach (var item in list) + { + if (id == item.Id) + { + var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); + var newItem = item; + if (current == null) + newItem.Sort = 1; + else + newItem.Sort = current.Sort + 1; + resultList.Add(newItem); + itemDetailId = item.DetailId; + } + } + } } - return ResultList.ReSuccess(list); + return ResultList.ReSuccess(resultList); } /// @@ -112,7 +109,7 @@ namespace WMS.Web.Domain.Services { var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId); - //var resultList = new List(); + var resultList = new List(); if (list != null && list.Count != 0) { @@ -122,33 +119,28 @@ namespace WMS.Web.Domain.Services }); - //var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); - //foreach (var id in ids) - //{ - - // var itemDetailId = 0; - // foreach (var item in list) - // { - // if (id == item.Id) - // { - - // var current= resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); - - // var newItem = item; - // if (current == null) - // newItem.Sort =1; - // else - // newItem.Sort = current.Sort+ 1; - // resultList.Add(newItem); - // itemDetailId = item.DetailId; - // } - // } - //} - - + var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList(); + foreach (var id in ids) + { + var itemDetailId = 0; + foreach (var item in list) + { + if (id == item.Id) + { + var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); + var newItem = item; + if (current == null) + newItem.Sort = 1; + else + newItem.Sort = current.Sort + 1; + resultList.Add(newItem); + itemDetailId = item.DetailId; + } + } + } } - return (list, count); + return (resultList, count); } ///