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 | 59 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 36 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 1ecc986..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" @@ -206,7 +206,8 @@ { return content.Error($"鏁伴噺瓒呭嚭"); } - if (checkResult.Result == InspectResultEnum.Return.ToString())//閫�璐� + //鍒ゆ柇妫�楠岀粨鏋� + if (checkResult.Result == InspectResultEnum.Return.ToString()) { checkOrder.DefectedNote = checkResult.Note; checkOrder.ReturnQuantity += checkResult.Quantity; @@ -234,32 +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) - { - checkResult.Quantity = 0; - item.StockQuantity -= checkResult.Quantity; - 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()) { @@ -287,6 +281,7 @@ checkOrder.QualifiedQuantity = checkOrder.ReceivedQuantity; } checkOrder.CheckUserName = App.User.UserName; + List<Dt_StockInfoDetail> initialStockDetails = stockInfo.Details.Where(x=> !(stockInfoDetails.Select(v=>v.Id).ToList()).Contains(x.Id)).ToList(); _unitOfWorkManage.BeginTran(); if (checkOrderResult != null) @@ -296,7 +291,20 @@ //娓呴櫎搴撳瓨鏁伴噺 if (stockInfoDetails.Count>0) { + stockInfoDetails.ForEach(x => + { + x.Status = StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt(); + }); _stockRepository.StockInfoDetailRepository.UpdateData(stockInfoDetails); + } + if (initialStockDetails.Count>0) + { + initialStockDetails.ForEach(x => + { + x.OutboundQuantity = 0; + x.Status = StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt(); + }); + _stockRepository.StockInfoDetailRepository.UpdateData(initialStockDetails); } if (DelStockDetails.Count>0) { @@ -306,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