优化
This commit is contained in:
@@ -103,6 +103,9 @@ namespace WMS.Web.Domain.Entitys
|
||||
//如果明细全部作废,则单据状态作废
|
||||
if (this.Details.All(x => x.IsRepeal == true))
|
||||
this.Status = InstockStatus.Repeal;
|
||||
else
|
||||
this.ChangeInstockStatus();//重新计算单据的状态
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -142,23 +145,36 @@ namespace WMS.Web.Domain.Entitys
|
||||
this.ReceiveTime = DateTime.Now;
|
||||
}
|
||||
|
||||
//改变状态
|
||||
public void ChangeInstockStatus()
|
||||
{
|
||||
//明细中:所有的应入数量之和
|
||||
var totalAccruedQty = this.Details.Where(x => x.IsRepeal != true).Sum(x => x.AccruedQty);
|
||||
|
||||
//明细中:所有的入库数量之和
|
||||
var totalRealityQty = this.Details.Where(x => x.IsRepeal != true && x.AccruedQty > 0).Sum(x => x.RealityQty);
|
||||
|
||||
//明细中:所有的收货数量之和
|
||||
var totalReceiveQty = this.Details.Where(x => x.IsRepeal != true && x.AccruedQty > 0).Sum(x => x.ReceiveQty);
|
||||
|
||||
if (totalAccruedQty <= totalRealityQty)
|
||||
this.Status = InstockStatus.Already;
|
||||
else if(totalReceiveQty<=0)
|
||||
this.Status = InstockStatus.Wait;
|
||||
else if(totalRealityQty<=0)
|
||||
this.Status = InstockStatus.WaitInStock;
|
||||
else
|
||||
this.Status = InstockStatus.Part;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上架
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Shelf(int creatorId)
|
||||
{
|
||||
//明细中:所有的应入数量之和
|
||||
var totalAccruedQty= this.Details.Sum(x => x.AccruedQty);
|
||||
////明细中:所有的收货数量之和
|
||||
//var totalReceiveQty = this.Details.Sum(x => x.ReceiveQty);
|
||||
//明细中:所有的入库数量之和
|
||||
var totalRealityQty = this.Details.Where(x=>x.AccruedQty>0).Sum(x => x.RealityQty);
|
||||
|
||||
if (totalAccruedQty <= totalRealityQty)
|
||||
this.Status = InstockStatus.Already;
|
||||
else
|
||||
this.Status = InstockStatus.Part;
|
||||
this.ChangeInstockStatus();
|
||||
this.ShelferId = creatorId;
|
||||
this.ShelfTime = DateTime.Now;
|
||||
}
|
||||
@@ -169,17 +185,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <param name="creatorId"></param>
|
||||
public void NoPurchaseShelf(int creatorId)
|
||||
{
|
||||
//明细中:所有的应入数量之和
|
||||
var totalAccruedQty = this.Details.Sum(x => x.AccruedQty);
|
||||
////明细中:所有的收货数量之和
|
||||
//var totalReceiveQty = this.Details.Sum(x => x.ReceiveQty);
|
||||
//明细中:所有的入库数量之和
|
||||
var totalRealityQty = this.Details.Where(x => x.AccruedQty > 0).Sum(x => x.RealityQty);
|
||||
|
||||
if (totalAccruedQty <= totalRealityQty)
|
||||
this.Status = InstockStatus.Already;
|
||||
else
|
||||
this.Status = InstockStatus.Part;
|
||||
this.ChangeInstockStatus();
|
||||
this.ReceiverId = creatorId;
|
||||
this.ReceiveTime = DateTime.Now;
|
||||
this.ShelferId = creatorId;
|
||||
|
||||
Reference in New Issue
Block a user