wangxinhui
2025-01-16 189ef97da64b5e3156199320c28e897c19b06eb9
´úÂë¹ÜÀí/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()
                {