比对接口
This commit is contained in:
@@ -222,5 +222,33 @@ namespace WMS.Web.Domain.Services
|
||||
else
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 采购订单物料明细和箱物料明细-对比
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result<ContrastMaterialsResponse>> Contrast(ContrastMaterialsRequest dto)
|
||||
{
|
||||
//1.找到任务单的明细信息
|
||||
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);
|
||||
|
||||
//3.比对
|
||||
bool isRight = box.Details.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty == x.Qty)) && box.Details.Count == task.Details.Count;
|
||||
|
||||
//4.返回对比结果:true为比对成功,false为比对失败;并把箱ID和箱号返回
|
||||
var response = new ContrastMaterialsResponse();
|
||||
response.BoxBillNo = box.BoxBillNo;
|
||||
response.BoxId = box.Id;
|
||||
response.IsRight = isRight;
|
||||
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user