From e1dd1dc9ba7135e3d64a65587d6c1be2c3e18c5a Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期三, 25 六月 2025 11:01:22 +0800 Subject: [PATCH] 提交最新优化代码 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs | 48 +++++++++++++++++++++++++----------------------- 1 files changed, 25 insertions(+), 23 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" index 607da70..5e86d4c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" @@ -235,33 +235,25 @@ Note = checkResult.Note, SampleCount = checkResult.SampleCount, }; - if (Math.Round(checkResult.Quantity,2) == Math.Round(stockInfoDetails.Sum(x=>x.StockQuantity),2)) + foreach (var item in stockInfo.Details) { - DelStockDetails = stockInfo.Details; - } - else - { - foreach (var item in stockInfo.Details) + if (checkResult.Quantity == 0) { - if (checkResult.Quantity == 0) - { - break; - } - else if(checkResult.Quantity< item.StockQuantity) - { - item.StockQuantity -= checkResult.Quantity; - item.OutboundQuantity = 0; - checkResult.Quantity = 0; - stockInfoDetails.Add(item); - } - else if (checkResult.Quantity >= item.StockQuantity) - { - checkResult.Quantity = (float)Math.Round((checkResult.Quantity-item.StockQuantity), 2); - DelStockDetails.Add(item); - } + break; + } + else if (checkResult.Quantity < item.StockQuantity) + { + item.StockQuantity -= checkResult.Quantity; + item.OutboundQuantity = 0; + checkResult.Quantity = 0; + stockInfoDetails.Add(item); + } + else if (checkResult.Quantity >= item.StockQuantity) + { + checkResult.Quantity = (float)Math.Round((checkResult.Quantity - item.StockQuantity), 2); + DelStockDetails.Add(item); } } - } if (IsAccept == InspectAcceptEnum.Accept.ObjToInt()) { @@ -299,6 +291,10 @@ //娓呴櫎搴撳瓨鏁伴噺 if (stockInfoDetails.Count>0) { + stockInfoDetails.ForEach(x => + { + x.Status = StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt(); + }); _stockRepository.StockInfoDetailRepository.UpdateData(stockInfoDetails); } if (initialStockDetails.Count>0) @@ -306,6 +302,7 @@ initialStockDetails.ForEach(x => { x.OutboundQuantity = 0; + x.Status = StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt(); }); _stockRepository.StockInfoDetailRepository.UpdateData(initialStockDetails); } @@ -317,6 +314,11 @@ { _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); } + else + { + stockInfo.StockStatus = StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt(); + _stockRepository.StockInfoRepository.UpdateData(stockInfo); + } //ERP涓婃姤 WebResponseContent responseContent = _checkOrderService.FeedbackInspectResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); if (!responseContent.Status) -- Gitblit v1.9.3