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); } ///