From 6e5f39c120fed5355fc4af51b1c82c082576a210 Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Tue, 20 Feb 2024 09:40:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AE=B1=E5=94=9B=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BoxMarkController.cs | 2 +- src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml | 10 +++++ src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml | 24 +++++++++++ .../Dto/BoxMark/BoxMarkQueryResponse.cs | 10 +++++ .../IService/IBoxMarkService.cs | 8 ++++ src/WMS.Web.Domain/Services/BoxMarkService.cs | 41 +++++++++++++++++++ .../BoxMarkRepositories.cs | 6 ++- 7 files changed, 99 insertions(+), 2 deletions(-) diff --git a/src/WMS.Web.Api/Controllers/BoxMarkController.cs b/src/WMS.Web.Api/Controllers/BoxMarkController.cs index 6065e0f6..82a98ce4 100644 --- a/src/WMS.Web.Api/Controllers/BoxMarkController.cs +++ b/src/WMS.Web.Api/Controllers/BoxMarkController.cs @@ -49,7 +49,7 @@ namespace WMS.Web.Api.Controllers var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); if (loginInfo == null || loginInfo.UserInfo == null) return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); - var (list, count) = await _boxMarkRepositories.GetPagedList(dto, loginInfo.UserInfo.CompanyId); + var (list, count) = await _boxMarkService.GetPagedList(dto, loginInfo.UserInfo.CompanyId); return ResultPagedList.ReSuccess(list, count); } diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index 25e4435d..c0538678 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -440,6 +440,16 @@ 是否是尾箱 + + + 装箱总数 + + + + + 产品数量 + + 生成箱唛dto diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index 79d26275..adff555c 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -2803,6 +2803,14 @@ + + + 列表-分页 + + + + + 改箱 移箱服务 @@ -4103,6 +4111,22 @@ + + + 列表分页 + + + + + + + + 装箱总数 + + + + + 箱服务信息 diff --git a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs index a1630c9b..ab552fa3 100644 --- a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs +++ b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs @@ -97,5 +97,15 @@ namespace WMS.Web.Core.Dto /// 是否是尾箱 /// public bool IsTail { get; set; } + + /// + /// 装箱总数 + /// + public int BoxSortCount { get; set; } + + /// + /// 产品数量 + /// + public decimal ProductQty { get; set; } } } diff --git a/src/WMS.Web.Domain/IService/IBoxMarkService.cs b/src/WMS.Web.Domain/IService/IBoxMarkService.cs index 71645a22..85528c8d 100644 --- a/src/WMS.Web.Domain/IService/IBoxMarkService.cs +++ b/src/WMS.Web.Domain/IService/IBoxMarkService.cs @@ -20,5 +20,13 @@ namespace WMS.Web.Domain.IService /// /// Task> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo); + + /// + /// 列表-分页 + /// + /// + /// + /// + Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, int companyId); } } diff --git a/src/WMS.Web.Domain/Services/BoxMarkService.cs b/src/WMS.Web.Domain/Services/BoxMarkService.cs index 0ca9e9f9..d234b04d 100644 --- a/src/WMS.Web.Domain/Services/BoxMarkService.cs +++ b/src/WMS.Web.Domain/Services/BoxMarkService.cs @@ -61,5 +61,46 @@ namespace WMS.Web.Domain.Services var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId); return ResultList.ReSuccess(list); } + + /// + /// 列表分页 + /// + /// + /// + /// + public async Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, int companyId) + { + var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId); + + if (list != null && list.Count != 0) + { + list.ForEach(x => + { + x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty); + }); + } + + return (list, count); + } + + /// + /// 装箱总数 + /// + /// + /// + /// + private int GetSortCount(decimal productQty, decimal cratingQty) + { + //计算要装的箱数量 + var boxCount_tag = productQty / cratingQty; + var boxCount = Convert.ToInt32(boxCount_tag); + //判断是否存在小数点;true表明有尾箱数,false没有尾箱数 + var hasPart = Math.Floor(boxCount_tag) != boxCount_tag; + + //有小数点向上取整 + if (hasPart) + boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag)); + return boxCount; + } } } diff --git a/src/WMS.Web.Repositories/BoxMarkRepositories.cs b/src/WMS.Web.Repositories/BoxMarkRepositories.cs index 79aa9541..e3a698b7 100644 --- a/src/WMS.Web.Repositories/BoxMarkRepositories.cs +++ b/src/WMS.Web.Repositories/BoxMarkRepositories.cs @@ -120,6 +120,8 @@ namespace WMS.Web.Repositories var mids = materials.Select(x => x.MaterialId).ToList(); query = query.Where(w => mids.Contains(w.order.MaterialId)); } + else + query = query.Where(w => w.order.MaterialId == 0); } if (cr_ids.Count != 0) @@ -152,7 +154,9 @@ namespace WMS.Web.Repositories IsTail=s.detail.IsTail, Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId), CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), - Remark = s.order.Remark + Remark = s.order.Remark, + ProductQty=s.order.ProductQty, + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); return (list, total);