修复bug
This commit is contained in:
@@ -92,25 +92,25 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <param name="materialId"></param>
|
||||
/// <param name="qty"></param>
|
||||
/// <returns></returns>
|
||||
public Result<List<(string sourceBillNo, decimal qty)>> OutStock(int materialId, decimal qty)
|
||||
public Result<List<(int erpDetailId, decimal qty)>> OutStock(int materialId, decimal qty)
|
||||
{
|
||||
if (this.Status == OutStockStatus.Already)
|
||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReFailure(ResultCodes.OutStockTaskAlready);
|
||||
return Result<List<(int erpDetailId, decimal qty)>>.ReFailure(ResultCodes.OutStockTaskAlready);
|
||||
if (this.Status == OutStockStatus.Repeal)
|
||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReFailure(ResultCodes.OutStockTaskRepeal);
|
||||
return Result<List<(int erpDetailId, decimal qty)>>.ReFailure(ResultCodes.OutStockTaskRepeal);
|
||||
|
||||
var detail = this.Details.FirstOrDefault(f => f.MaterialId == materialId);
|
||||
if (detail == null) return Result<List<(string sourceBillNo, decimal qty)>>.ReFailure(ResultCodes.OrderNoData);
|
||||
if (detail == null) return Result<List<(int erpDetailId, decimal qty)>>.ReFailure(ResultCodes.OrderNoData);
|
||||
if ((detail.AccruedQty - detail.RealityQty) < qty)
|
||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReFailure(ResultCodes.OutStockQtyError);
|
||||
List<(string sourceBillNo, decimal qty)> resList = new List<(string sourceBillNo, decimal qty)>();
|
||||
return Result<List<(int erpDetailId, decimal qty)>>.ReFailure(ResultCodes.OutStockQtyError);
|
||||
List<(int erpDetailId, decimal qty)> resList = new List<(int erpDetailId, decimal qty)>();
|
||||
var mQty = qty;
|
||||
foreach (var d in detail.ErpDetails)
|
||||
{
|
||||
if ((d.AccruedQty - d.RealityQty) >= mQty)
|
||||
{
|
||||
d.RealityQty += qty;
|
||||
resList.Add((d.SourceBillNo, mQty));
|
||||
resList.Add((d.Erp_DetailId, mQty));
|
||||
break;//本次出库数量已经分配完毕 调出循环
|
||||
}
|
||||
else
|
||||
@@ -119,7 +119,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
var cQty = d.AccruedQty - d.RealityQty;//本次出货数量
|
||||
mQty -= cQty;
|
||||
d.RealityQty = d.AccruedQty;
|
||||
resList.Add((d.SourceBillNo, cQty));
|
||||
resList.Add((d.Erp_DetailId, cQty));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
else
|
||||
this.Status = OutStockStatus.Part;
|
||||
|
||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReSuccess(resList);
|
||||
return Result<List<(int erpDetailId, decimal qty)>>.ReSuccess(resList);
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成单据号
|
||||
|
||||
Reference in New Issue
Block a user