From b5537a1ccd13305c2843f28280dbbe051a4d93ce Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Thu, 30 Nov 2023 16:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8D=95=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=8F=98=E6=9B=B4=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96?= 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/InstockTask.cs | 26 +++++++++++++++++-- src/WMS.Web.Domain/Values/InstockStatus.cs | 7 ++++- .../InStockTaskRepositories.cs | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index e4420d6b..9d9a8fb4 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -4829,6 +4829,11 @@ 已作废 + + + 待入库 + + 入库类型 diff --git a/src/WMS.Web.Domain/Entitys/InstockTask.cs b/src/WMS.Web.Domain/Entitys/InstockTask.cs index 5dd18af3..afc8a850 100644 --- a/src/WMS.Web.Domain/Entitys/InstockTask.cs +++ b/src/WMS.Web.Domain/Entitys/InstockTask.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; using System.Text; using WMS.Web.Core; using WMS.Web.Domain.Values; @@ -74,7 +75,10 @@ namespace WMS.Web.Domain.Entitys /// public void Create(InstockType type,string sourceBillNo, DateTime createTime) { - this.Status = InstockStatus.Wait; + if (type == InstockType.Purchase) + this.Status = InstockStatus.Wait; + else + this.Status = InstockStatus.WaitInStock; this.Type = type; this.SourceBillNo = sourceBillNo; this.CreateTime = createTime; @@ -119,6 +123,7 @@ namespace WMS.Web.Domain.Entitys /// public void Receive(int creatorId) { + this.Status = InstockStatus.WaitInStock; this.ReceiverId = creatorId; this.ReceiveTime = DateTime.Now; } @@ -129,6 +134,15 @@ namespace WMS.Web.Domain.Entitys /// public void Shelf(int creatorId) { + //明细中:所有的应入数量之和 + var totalAccruedQty= this.Details.Sum(x => x.AccruedQty); + //明细中:所有的收货数量之和 + var totalReceiveQty = this.Details.Sum(x => x.ReceiveQty); + + if (totalAccruedQty == totalReceiveQty) + this.Status = InstockStatus.Already; + else + this.Status = InstockStatus.Part; this.ShelferId = creatorId; this.ShelfTime = DateTime.Now; } @@ -139,7 +153,15 @@ namespace WMS.Web.Domain.Entitys /// public void NoPurchaseShelf(int creatorId) { - this.ReceiverId = creatorId; + //明细中:所有的应入数量之和 + var totalAccruedQty = this.Details.Sum(x => x.AccruedQty); + //明细中:所有的收货数量之和 + var totalReceiveQty = this.Details.Sum(x => x.ReceiveQty); + + if (totalAccruedQty == totalReceiveQty) + this.Status = InstockStatus.Already; + else + this.ReceiverId = creatorId; this.ReceiveTime = DateTime.Now; this.ShelferId = creatorId; this.ShelfTime = DateTime.Now; diff --git a/src/WMS.Web.Domain/Values/InstockStatus.cs b/src/WMS.Web.Domain/Values/InstockStatus.cs index 0231cba3..ec137ca3 100644 --- a/src/WMS.Web.Domain/Values/InstockStatus.cs +++ b/src/WMS.Web.Domain/Values/InstockStatus.cs @@ -29,6 +29,11 @@ namespace WMS.Web.Domain.Values /// 已作废 /// [EnumRemark("已作废")] - Repeal = 4 + Repeal = 4, + /// + /// 待入库 + /// + [EnumRemark("待入库")] + WaitInStock = 5 } } diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs index 3e35a6b3..71ffd3b1 100644 --- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs @@ -330,7 +330,7 @@ namespace WMS.Web.Repositories //这里只查状态为:部分入库和等待收货 var task_query = _context.InStockTask - .Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait)); + .Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait || w.Status==InstockStatus.WaitInStock)); //找到头列表 var taskList = await task_query