任务单的数量变更问题优化

This commit is contained in:
tongfei
2023-11-30 16:26:15 +08:00
parent f8ad28fecb
commit b5537a1ccd
4 changed files with 36 additions and 4 deletions

View File

@@ -4829,6 +4829,11 @@
已作废 已作废
</summary> </summary>
</member> </member>
<member name="F:WMS.Web.Domain.Values.InstockStatus.WaitInStock">
<summary>
待入库
</summary>
</member>
<member name="T:WMS.Web.Domain.Values.InstockType"> <member name="T:WMS.Web.Domain.Values.InstockType">
<summary> <summary>
入库类型 入库类型

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text; using System.Text;
using WMS.Web.Core; using WMS.Web.Core;
using WMS.Web.Domain.Values; using WMS.Web.Domain.Values;
@@ -74,7 +75,10 @@ namespace WMS.Web.Domain.Entitys
/// <param name="createTime"></param> /// <param name="createTime"></param>
public void Create(InstockType type,string sourceBillNo, DateTime createTime) 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.Type = type;
this.SourceBillNo = sourceBillNo; this.SourceBillNo = sourceBillNo;
this.CreateTime = createTime; this.CreateTime = createTime;
@@ -119,6 +123,7 @@ namespace WMS.Web.Domain.Entitys
/// <param name="creatorId"></param> /// <param name="creatorId"></param>
public void Receive(int creatorId) public void Receive(int creatorId)
{ {
this.Status = InstockStatus.WaitInStock;
this.ReceiverId = creatorId; this.ReceiverId = creatorId;
this.ReceiveTime = DateTime.Now; this.ReceiveTime = DateTime.Now;
} }
@@ -129,6 +134,15 @@ namespace WMS.Web.Domain.Entitys
/// <param name="creatorId"></param> /// <param name="creatorId"></param>
public void Shelf(int creatorId) 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.ShelferId = creatorId;
this.ShelfTime = DateTime.Now; this.ShelfTime = DateTime.Now;
} }
@@ -139,7 +153,15 @@ namespace WMS.Web.Domain.Entitys
/// <param name="creatorId"></param> /// <param name="creatorId"></param>
public void NoPurchaseShelf(int creatorId) 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.ReceiveTime = DateTime.Now;
this.ShelferId = creatorId; this.ShelferId = creatorId;
this.ShelfTime = DateTime.Now; this.ShelfTime = DateTime.Now;

View File

@@ -29,6 +29,11 @@ namespace WMS.Web.Domain.Values
/// 已作废 /// 已作废
/// </summary> /// </summary>
[EnumRemark("已作废")] [EnumRemark("已作废")]
Repeal = 4 Repeal = 4,
/// <summary>
/// 待入库
/// </summary>
[EnumRemark("待入库")]
WaitInStock = 5
} }
} }

View File

@@ -330,7 +330,7 @@ namespace WMS.Web.Repositories
//这里只查状态为:部分入库和等待收货 //这里只查状态为:部分入库和等待收货
var task_query = _context.InStockTask 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 var taskList = await task_query