对比接口-也要加仓库编码-去筛选对应明细
This commit is contained in:
@@ -434,10 +434,10 @@ namespace WMS.Web.Domain.Services
|
||||
var task = await _inStockTaskRepositories.Get(dto.TaskId);
|
||||
if (task == null)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.OrderNoData);
|
||||
////2.找到箱对应的物料信息--弃用(这个是单个箱)
|
||||
//var box = await _boxRepositories.GetByNo(dto.BoxBillNo);
|
||||
//if (box == null)
|
||||
// return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
|
||||
|
||||
|
||||
//1.1筛选出对应仓库的明细
|
||||
var task_details = task.Details.Where(x => x.StockCode == dto.StockCode).ToList();
|
||||
|
||||
//2.找到箱对应的物料信息:多个箱
|
||||
var boxs = await _boxRepositories.GetEntityListByNos(dto.BoxBillNos);
|
||||
@@ -448,7 +448,7 @@ namespace WMS.Web.Domain.Services
|
||||
var boxDetails = boxs.SelectMany(x => x.Details).GroupBy(x => x.MaterialId).Select(x => new { MaterialId = x.Key, Qty = x.Sum(t => t.Qty) }).ToList();
|
||||
|
||||
//3.比对:false为比对失败;
|
||||
bool isRight = boxDetails.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count <= task.Details.Count;
|
||||
bool isRight = boxDetails.All(x => task_details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count <= task_details.Count;
|
||||
if (!isRight)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user