From dcecb039035f4b2e82e31c39b74db9402444c536 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期二, 08 四月 2025 21:35:39 +0800 Subject: [PATCH] 代码更新,优化等内容 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs | 46 ++++++++++++++++++++++++++++++---------------- 1 files changed, 30 insertions(+), 16 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs" index a368baf..5ea4fd0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderDetailService.cs" @@ -4,6 +4,7 @@ using System.Text; using System.Threading.Tasks; using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.OrderEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -14,6 +15,7 @@ using WIDESEA_IRecordService; using WIDESEA_IStockService; using WIDESEA_Model.Models; +using WIDESEA_OutboundRepository; namespace WIDESEA_OutboundService { @@ -50,6 +52,12 @@ proStockInfoDetails.AddRange(item.proStockInfoDetails); } _stockInfoService.ProStockInfoDetailService.Repository.UpdateData(proStockInfoDetails); + Dt_ProOutOrder proOutOrder = _proOutOrderRepository.QueryFirst(x => x.Id == proOutOrderDetails.FirstOrDefault().ProOrderId); + if (proOutOrder.ProOrderStatus == OutOrderStatusEnum.鏈紑濮�.ObjToInt()) + { + proOutOrder.ProOrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt(); + _proOutOrderRepository.UpdateData(proOutOrder); + } BaseDal.UpdateData(proOutOrderDetails); List<Dt_OutProStockInfo> addOutStockLockInfos = outProStockInfos.Where(x => x.Id == 0).ToList(); @@ -115,14 +123,18 @@ //鑾峰彇鍑哄簱搴撳瓨 List<Dt_ProStockInfo> assignOutStocks = _stockInfoService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); item.LockQtyPcs += needQty - residueQuantity; + if (item.QtyPcs> item.LockQtyPcs) + { + throw new Exception($"浜у搧缂栫爜{item.PCode}鍙垎閰嶆暟閲忎笉瓒�,鍙敤鏁伴噺{item.LockQtyPcs}"); + } outStocks.AddRange(assignOutStocks); float assignQuantity = needQty - residueQuantity; - bool isCanLot = !string.IsNullOrEmpty(item.PLot); - bool isCanDate = !string.IsNullOrEmpty(item.DateCode); + bool isCanLot = string.IsNullOrEmpty(item.PLot); + bool isCanDate = string.IsNullOrEmpty(item.DateCode); List<Dt_ProOutOrderDetail> details = proOutOrderDetails - .Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer - && (isCanLot ? x.PLot == item.PLot : true) - && (isCanDate ? x.DateCode == item.DateCode : true)) + .Where(x =>x.PCode == item.PCode && x.PVer == item.PVer + && (isCanLot ? isCanLot : x.PLot == item.PLot) + && (isCanDate ? isCanDate : x.DateCode == item.DateCode)) .ToList(); for (int i = 0; i < details.Count; i++) @@ -130,19 +142,21 @@ float orderQuantity = details[i].QtyPcs; for (int j = 0; j < assignOutStocks.Count; j++) { - float detailAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer - && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) - && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false) - && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity);//鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲� + //鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲� + float detailAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + && (isCanLot ? isCanLot : x.PLot == item.PLot) + && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity); - float palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer - && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) - && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false - && x.PalletCode == assignOutStocks[j].PalletCode)).Sum(x => x.AssignQuantity); + float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + && (isCanLot ? isCanLot : x.PLot == item.PLot) + && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity); //鍑哄簱璇︽儏宸插垎閰嶆暟閲� - palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer - && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) - && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false && x.PalletCode == assignOutStocks[j].PalletCode)).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲� + palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + && (isCanLot ? isCanLot : x.PLot == item.PLot) + && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲� float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭� { -- Gitblit v1.9.3