修复bug
This commit is contained in:
Binary file not shown.
@@ -92,25 +92,25 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// <param name="materialId"></param>
|
/// <param name="materialId"></param>
|
||||||
/// <param name="qty"></param>
|
/// <param name="qty"></param>
|
||||||
/// <returns></returns>
|
/// <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)
|
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)
|
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);
|
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)
|
if ((detail.AccruedQty - detail.RealityQty) < qty)
|
||||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReFailure(ResultCodes.OutStockQtyError);
|
return Result<List<(int erpDetailId, decimal qty)>>.ReFailure(ResultCodes.OutStockQtyError);
|
||||||
List<(string sourceBillNo, decimal qty)> resList = new List<(string sourceBillNo, decimal qty)>();
|
List<(int erpDetailId, decimal qty)> resList = new List<(int erpDetailId, decimal qty)>();
|
||||||
var mQty = qty;
|
var mQty = qty;
|
||||||
foreach (var d in detail.ErpDetails)
|
foreach (var d in detail.ErpDetails)
|
||||||
{
|
{
|
||||||
if ((d.AccruedQty - d.RealityQty) >= mQty)
|
if ((d.AccruedQty - d.RealityQty) >= mQty)
|
||||||
{
|
{
|
||||||
d.RealityQty += qty;
|
d.RealityQty += qty;
|
||||||
resList.Add((d.SourceBillNo, mQty));
|
resList.Add((d.Erp_DetailId, mQty));
|
||||||
break;//本次出库数量已经分配完毕 调出循环
|
break;//本次出库数量已经分配完毕 调出循环
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -119,7 +119,7 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
var cQty = d.AccruedQty - d.RealityQty;//本次出货数量
|
var cQty = d.AccruedQty - d.RealityQty;//本次出货数量
|
||||||
mQty -= cQty;
|
mQty -= cQty;
|
||||||
d.RealityQty = d.AccruedQty;
|
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
|
else
|
||||||
this.Status = OutStockStatus.Part;
|
this.Status = OutStockStatus.Part;
|
||||||
|
|
||||||
return Result<List<(string sourceBillNo, decimal qty)>>.ReSuccess(resList);
|
return Result<List<(int erpDetailId, decimal qty)>>.ReSuccess(resList);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成单据号
|
/// 生成单据号
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
//循环添加erp同步明细
|
//循环添加erp同步明细
|
||||||
foreach (var c in res.Data)
|
foreach (var c in res.Data)
|
||||||
{
|
{
|
||||||
var tErpDetail = tDetail.ErpDetails.FirstOrDefault(f => f.SourceBillNo.Equals(c.sourceBillNo));
|
var tErpDetail = tDetail.ErpDetails.FirstOrDefault(f => f.Erp_DetailId==c.erpDetailId);
|
||||||
var oErpDetail = _mapper.Map<OutStockErpDetails>(tErpDetail);
|
var oErpDetail = _mapper.Map<OutStockErpDetails>(tErpDetail);
|
||||||
oErpDetail.Qty = c.qty;
|
oErpDetail.Qty = c.qty;
|
||||||
outd.ErpDetails.Add(oErpDetail);
|
outd.ErpDetails.Add(oErpDetail);
|
||||||
|
|||||||
Reference in New Issue
Block a user