From 06f5f3e474bb8d9e255a899b62d16f671cfdb940 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期四, 26 六月 2025 17:34:33 +0800 Subject: [PATCH] 代码更新 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" index 8aa4a5d..e77b019 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" @@ -1,4 +1,5 @@ -锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; +锘縰sing MailKit.Search; +using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using System; using System.Collections.Generic; using System.Linq; @@ -8,6 +9,7 @@ using WIDESEA_Common.LocationEnum; using WIDESEA_Common.OrderEnum; using WIDESEA_Common.StockEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -237,8 +239,8 @@ } Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); - List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo, }).ToList(); - + List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo }).ToList(); + Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x=>x.WarehouseId== outboundOrder.WarehouseId); List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); foreach (var item in groupDetails) @@ -253,6 +255,13 @@ throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨"); } List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out float residueQuantity); + if (warehouse.WarehouseCode==WarehouseEnum.HA152.ToString()) + { + if (needQuantity< autoAssignStocks.Count) + { + throw new Exception($"绯荤粺瓒呮椂,璇风◢鍚庡啀璇�"); + } + } item.LockQuantity += needQuantity - residueQuantity; outStocks.AddRange(autoAssignStocks); float assignQuantity = needQuantity - residueQuantity; @@ -403,7 +412,20 @@ List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); foreach (var item in stockInfos) { + foreach (var detail in item.Details) + { + // 杩涜瀹夊叏杞崲 + if (detail.OutboundQuantity != null && decimal.TryParse(detail.OutboundQuantity.ToString(), out decimal outboundDecimal)) + { + decimal outboundDecimal1 = Convert.ToDecimal(detail.OutboundQuantity); + } + else + { + detail.OutboundQuantity = 0; // 榛樿鍊兼垨璁板綍閿欒 + } + } stockInfoDetails.AddRange(item.Details); + } _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetails); BaseDal.UpdateData(outboundOrderDetails); -- Gitblit v1.9.3