diff --git a/src/WMS.Web.Domain/Services/InStockService.cs b/src/WMS.Web.Domain/Services/InStockService.cs index f13a93d9..329a4ecd 100644 --- a/src/WMS.Web.Domain/Services/InStockService.cs +++ b/src/WMS.Web.Domain/Services/InStockService.cs @@ -391,10 +391,10 @@ namespace WMS.Web.Domain.Services //1.1.2判断上架数量不能超过应入库数量 var dtoDetails = dto.Boxs.SelectMany(x => x.Details).ToList(); - var dtoTotalDetails = dtoDetails.GroupBy(x => new { x.ErpDetailId }).Select(x => new { ErpDetailId = x.Key.ErpDetailId, Qty = x.Sum(t => t.Qty) }).ToList(); + var dtoTotalDetails = dtoDetails.GroupBy(x => new { x.ErpDetailId,x.MaterialId }).Select(x => new { ErpDetailId = x.Key.ErpDetailId, MaterialId=x.Key.MaterialId, Qty = x.Sum(t => t.Qty) }).ToList(); foreach (var item in task.Details) { - var current_det = dtoTotalDetails.Where(x => x.ErpDetailId == item.ErpDetailId).FirstOrDefault(); + var current_det = dtoTotalDetails.Where(x => x.ErpDetailId == item.ErpDetailId && x.MaterialId==item.MaterialId).FirstOrDefault(); if (current_det != null && current_det.ErpDetailId == item.ErpDetailId && (item.AccruedQty - item.RealityQty) < current_det.Qty) return Result.ReFailure(ResultCodes.ShelfNoPurchaseSave_Qty_Error); }