From 189ef97da64b5e3156199320c28e897c19b06eb9 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期四, 16 一月 2025 17:20:19 +0800 Subject: [PATCH] 入库上报优化 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index b7ab61d..92e8817 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -752,28 +752,33 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒板簱瀛樻槑缁嗕俊鎭�"); } - List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => stockInfoDetails.Select(x => x.StockId).ToList().Contains(x.Id)); + //鑾峰彇璇ュ叆搴撳崟鎵�鏈夊簱瀛� + List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => stockInfoDetails.GroupBy(x => x.StockId).Select(x => x.Key).Contains(x.Id)).Includes(x => x.Details).ToList(); Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == inboundOrder.WarehouseId); if (warehouse == null) { return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�"); } List<ERPInboundDetailModel>? detailModels = new List<ERPInboundDetailModel>(); - foreach (var item in stockInfoDetails) + foreach (var stockInfo in stockInfos) { - ERPInboundDetailModel detailModel = new ERPInboundDetailModel() + foreach (var item in stockInfo.Details.GroupBy(x=>x.InboundOrderRowNo).Select(x=>x.Key)) { - ExpiryDate = item.EffectiveDate ?? "", - LocationCode = warehouse.WarehouseCode, - MaterialsCode = item.MaterielCode, - MfgDate = item.ProductionDate ?? "", - QtyCustoms = "0", - Quantity = item.StockQuantity.ToString(), - Rack = stockInfos.FirstOrDefault(x => x.Id == item.StockId).LocationCode, - ReceiptCode = inboundOrder.UpperOrderNo, - ReceiptSerNo = item.InboundOrderRowNo.ToString() - }; - detailModels.Add(detailModel); + Dt_StockInfoDetail? dt_StockInfoDetail = stockInfo.Details.Where(x => x.InboundOrderRowNo == item).FirstOrDefault(); + ERPInboundDetailModel detailModel = new ERPInboundDetailModel() + { + ExpiryDate = dt_StockInfoDetail?.EffectiveDate ?? "", + LocationCode = warehouse.WarehouseCode, + MaterialsCode = dt_StockInfoDetail.MaterielCode, + MfgDate = dt_StockInfoDetail.ProductionDate ?? "", + QtyCustoms = "0", + Quantity = stockInfo.Details.Where(x => x.InboundOrderRowNo == item).Sum(x => x.StockQuantity).ToString(), + Rack = stockInfo.LocationCode, + ReceiptCode = inboundOrder.UpperOrderNo, + ReceiptSerNo = item.ToString() + }; + detailModels.Add(detailModel); + } } ERPInboundModel model = new ERPInboundModel() { -- Gitblit v1.9.3