From 3b4b9ca5932f68e9451e37473f6cfa07357ea1d3 Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Wed, 21 Feb 2024 11:06:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml | 5 ++ src/WMS.Web.Domain/Entitys/BoxMark.cs | 11 ++- src/WMS.Web.Domain/Entitys/BoxMarkBillNo.cs | 5 ++ src/WMS.Web.Domain/Services/BoxMarkService.cs | 84 +++++++++---------- .../BoxMarkRepositories.cs | 2 + 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index adff555c..59d8062e 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -393,6 +393,11 @@ 是否是尾箱 + + + 排序 + + 生成编号 diff --git a/src/WMS.Web.Domain/Entitys/BoxMark.cs b/src/WMS.Web.Domain/Entitys/BoxMark.cs index 0891f850..8435e4f3 100644 --- a/src/WMS.Web.Domain/Entitys/BoxMark.cs +++ b/src/WMS.Web.Domain/Entitys/BoxMark.cs @@ -129,10 +129,13 @@ namespace WMS.Web.Domain.Entitys if (hasPart) boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag)); - for (int i = 0; i < boxCount; i++) + for (int i = 1; i <= boxCount; i++) { //添加编号生成 - var bill = new BoxMarkBillNo(); + var bill = new BoxMarkBillNo(); + bill.Sort = i; + if (hasPart && i == boxCount) + bill.IsTail = true; bill.GenerateBillNo(firstBillNo, lastBillNo); this.BillNos.Add(bill); @@ -141,8 +144,8 @@ namespace WMS.Web.Domain.Entitys lastBillNo = bill.LastBillNo; } //判断有小数点,那么它就有尾箱,把当前第一条的编号是否是尾箱字段改为true - if (this.BillNos.Count != 0 && hasPart) - this.BillNos[0].IsTail = true; + //if (this.BillNos.Count != 0 && hasPart) + // this.BillNos[0].IsTail = true; } } diff --git a/src/WMS.Web.Domain/Entitys/BoxMarkBillNo.cs b/src/WMS.Web.Domain/Entitys/BoxMarkBillNo.cs index 45b668f5..d2004218 100644 --- a/src/WMS.Web.Domain/Entitys/BoxMarkBillNo.cs +++ b/src/WMS.Web.Domain/Entitys/BoxMarkBillNo.cs @@ -43,6 +43,11 @@ namespace WMS.Web.Domain.Entitys /// public bool IsTail { 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 368a9ba5..a8f51070 100644 --- a/src/WMS.Web.Domain/Services/BoxMarkService.cs +++ b/src/WMS.Web.Domain/Services/BoxMarkService.cs @@ -62,7 +62,7 @@ namespace WMS.Web.Domain.Services var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId); - var resultList = new List(); + //var resultList = new List(); if (list != null && list.Count != 0) { //处理-总数量 @@ -72,31 +72,31 @@ namespace WMS.Web.Domain.Services }); - 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 itemDetailId = 0; + // foreach (var item in list) + // { + // if (id == item.Id) + // { - var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault(); + // 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 newItem = item; + // if (current == null) + // newItem.Sort = 1; + // else + // newItem.Sort = current.Sort + 1; + // resultList.Add(newItem); + // itemDetailId = item.DetailId; + // } + // } + //} } - return ResultList.ReSuccess(resultList); + return ResultList.ReSuccess(list); } /// @@ -109,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) { @@ -119,28 +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 (resultList, count); + return (list, count); } /// diff --git a/src/WMS.Web.Repositories/BoxMarkRepositories.cs b/src/WMS.Web.Repositories/BoxMarkRepositories.cs index bc13ed7b..02d82da5 100644 --- a/src/WMS.Web.Repositories/BoxMarkRepositories.cs +++ b/src/WMS.Web.Repositories/BoxMarkRepositories.cs @@ -152,6 +152,7 @@ namespace WMS.Web.Repositories TailboxNetWeightQty = s.order.TailboxNetWeightQty, TailboxGrossWeightQty = s.order.TailboxGrossWeightQty, IsTail=s.detail.IsTail, + Sort = s.detail.Sort, Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId), CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Remark = s.order.Remark, @@ -239,6 +240,7 @@ namespace WMS.Web.Repositories TailboxNetWeightQty = s.order.TailboxNetWeightQty, TailboxGrossWeightQty = s.order.TailboxGrossWeightQty, IsTail = s.detail.IsTail, + Sort=s.detail.Sort, Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId), CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Remark = s.order.Remark,