上架数量不能超过应入库数量-非采购入库-按产品
This commit is contained in:
@@ -323,12 +323,21 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
x.Details.RemoveAll(t => t.Qty == 0);
|
||||
});
|
||||
|
||||
//1.获取来源单
|
||||
var task = await _inStockTaskRepositories.Get(dto.TaskId);
|
||||
if (task == null)
|
||||
return Result.ReFailure(ResultCodes.SourceBillNoDateError);
|
||||
|
||||
//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();
|
||||
foreach (var item in task.Details)
|
||||
{
|
||||
var current_det= dtoTotalDetails.Where(x => x.ErpDetailId == item.ErpDetailId).FirstOrDefault();
|
||||
if(current_det!=null && current_det.ErpDetailId==item.ErpDetailId && item.AccruedQty<current_det.Qty)
|
||||
return Result.ReFailure(ResultCodes.ShelfNoPurchaseSave_Qty_Error);
|
||||
}
|
||||
|
||||
//2.生成:入库单
|
||||
var entity = new InStock();
|
||||
entity.Type = task.Type;
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace WMS.Web.Domain.Values
|
||||
public static ValueTuple<int, string> Contrast_Purchase_Count_Error = (80003, "箱内产品和采购单不一致");
|
||||
public static ValueTuple<int, string> Contrast_Count_Error = (80003, "箱内产品和来源单不一致");
|
||||
public static ValueTuple<int, string> Contrast_Qty_Error = (80003, "箱内产品数量超过可入库数量");
|
||||
public static ValueTuple<int, string> ShelfNoPurchaseSave_Qty_Error = (80003, "上架数量不能大于当前应入库数量");
|
||||
|
||||
public static ValueTuple<int, string> ErpOrgError = (80004, "获取Erp相关组织数据失败,请稍候再试!");
|
||||
public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败,请稍候再试!");
|
||||
|
||||
Reference in New Issue
Block a user