对比接口优化

This commit is contained in:
tongfei
2023-11-09 14:39:24 +08:00
parent f964567193
commit c44d637fe3
2 changed files with 8 additions and 2 deletions

View File

@@ -343,12 +343,17 @@ namespace WMS.Web.Domain.Services
if (box == null) if (box == null)
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData); return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
//3.比对 //3.比对false为比对失败;
bool isRight = box.Details.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty == x.Qty)) && box.Details.Count == task.Details.Count; bool isRight = box.Details.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty == x.Qty)) && box.Details.Count == task.Details.Count;
if(!isRight) if(!isRight)
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError); return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
//4.返回对比结果true为比对成功false为比对失败;并把箱ID和箱号返回 //4.是否存在箱号判断:存在的话,就不能收货或者非采购上架
bool isHave = task.Boxs.Where(x => x.BoxBillNo == box.BoxBillNo).Any();
if(isHave)
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
//4.返回对比结果true为比对成功并把箱ID和箱号返回
var response = new ContrastMaterialsResponse(); var response = new ContrastMaterialsResponse();
response.BoxBillNo = box.BoxBillNo; response.BoxBillNo = box.BoxBillNo;
response.BoxId = box.Id; response.BoxId = box.Id;

View File

@@ -39,6 +39,7 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败请稍候再试"); public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败请稍候再试");
public static ValueTuple<int, string> ErpStockError = (80006, "获取Erp相关仓库数据失败请稍候再试"); public static ValueTuple<int, string> ErpStockError = (80006, "获取Erp相关仓库数据失败请稍候再试");
public static ValueTuple<int, string> ErpMaterialError = (80007, "获取Erp相关物料数据失败请稍候再试"); public static ValueTuple<int, string> ErpMaterialError = (80007, "获取Erp相关物料数据失败请稍候再试");
public static ValueTuple<int, string> BoxHaveError = (80008, "该箱信息已被记录,请重新选择箱号!");
} }
} }