From 9714d2b6f256d568ae22273bd2114dbcb9c5bfa8 Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Tue, 5 Dec 2023 17:04:37 +0800 Subject: [PATCH] tt --- .../InStockTaskRepositories.cs | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs index 6ec6a41e..1222d987 100644 --- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs @@ -275,7 +275,7 @@ namespace WMS.Web.Repositories Qty = s.detail.AccruedQty, DeliveredQty = s.detail.DeliveredQty, ReceiveQty = s.detail.ReceiveQty, - //可入库数量=应入库数量-收货数量-已交数量+该明细的入库数量之和; + //采购:可入库数量=应入库数量-收货数量-已交数量+该明细的入库数量之和; AvailableQty = s.detail.AccruedQty - s.detail.ReceiveQty- s.detail.DeliveredQty, Remark = s.detail.Remark, ErpDetailId=s.detail.ErpDetailId @@ -352,29 +352,12 @@ namespace WMS.Web.Repositories Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId), Qty = s.AccruedQty, DeliveredQty = s.DeliveredQty, - //可入库数量=应入库数量-收货数量-已交数量+该明细的入库数量之和; - AvailableQty = s.AccruedQty - s.ReceiveQty- s.DeliveredQty, + //非采购:可入库数量=应入库数量-收货数量; + AvailableQty = s.AccruedQty - s.ReceiveQty, Remark = s.Remark, ErpDetailId=s.ErpDetailId }).ToListAsync(); - - //找到入库单:通过erp明细ID - var erpDetIds = task_details.GroupBy(x => x.ErpDetailId).Select(x => x.Key).ToList(); - var instockDets = await _context.InStockDetails.Where(x => erpDetIds.Contains(x.ErpDetailId)).ToListAsync(); - if (instockDets != null && instockDets.Count != 0) - { - task_details.ForEach(x => - { - var current_instock_dets = instockDets.Where(t => t.ErpDetailId == x.ErpDetailId).ToList(); - if (current_instock_dets != null && current_instock_dets.Count != 0 && x.ErpDetailId == current_instock_dets.FirstOrDefault().ErpDetailId) - { - //+该明细的入库数量之和;在这里处理 - var instock_qty = current_instock_dets.Sum(x => x.Qty); - x.AvailableQty = x.AvailableQty + instock_qty; - } - }); - } - + //找箱 var task_box = await _context.InstockTaskBox.Where(x => ids.Contains(x.TaskId)) .Select(s => new SourceBillNoNoPurchaseBoxQueryResponse()