From 638a684258fb4bc6adf76a1964bdf0d7f99e404f Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期一, 31 三月 2025 02:18:54 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" index 07384b3..342a677 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" @@ -36,7 +36,11 @@ { return WebResponseContent.Instance.Error($"璇ユ墭鐩樿繕鏈嚭搴撳畬鎴�"); } - List<Dt_OutStockLockInfo> outStockLockInfos = Repository.QueryData(x => x.PalletCode == palletCode); + List<Dt_OutStockLockInfo> outStockLockInfos = Repository.QueryData(x => x.PalletCode == palletCode && x.Status == OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt()); + if (outStockLockInfos == null || outStockLockInfos.Count == 0) + { + return WebResponseContent.Instance.Error("璇ユ墭鐩樺凡鍏ㄩ儴鍒嗘嫞瀹屾垚"); + } for (int i = 0; i < outStockLockInfos.Count; i++) { outStockLockInfos[i].Status = OutLockStockStatusEnum.鎷i�夊畬鎴�.ObjToInt(); @@ -44,6 +48,7 @@ List<Dt_StockInfoDetail> beforeDetaile = stockInfo.Details.GroupBy(x => x.MaterielCode).Select(x => new Dt_StockInfoDetail { MaterielCode = x.Key, StockQuantity = x.Sum(v => v.StockQuantity) }).ToList(); List<Dt_StockInfoDetail> updateDetailList = new List<Dt_StockInfoDetail>(); List<Dt_StockInfoDetail> deleteDetailList = new List<Dt_StockInfoDetail>(); + List<Dt_StockInfoDetail> residueDetailList = new List<Dt_StockInfoDetail>(); for (int i = 0; i < stockInfo.Details.Count; i++) { if (stockInfo.Details[i].OutboundQuantity > 0) @@ -58,32 +63,31 @@ deleteDetailList.Add(stockInfo.Details[i]); } } + else + { + residueDetailList.Add(stockInfo.Details[i]); + } } - + stockInfo.StockStatus = StockStatusEmun.鎷i�夊畬鎴�.ObjToInt(); List<string> mCodes = stockInfo.Details.GroupBy(x => x.MaterielCode).Select(x => x.Key).ToList(); _unitOfWorkManage.BeginTran(); foreach (string code in mCodes) { - _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, updateDetailList, deleteDetailList, StockChangeTypeEnum.Outbound); + _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, residueDetailList, updateDetailList, deleteDetailList, StockChangeTypeEnum.Outbound); } updateDetailList.ForEach(x => { x.OutboundQuantity = 0; }); - stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); - //_stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(deleteDetailList, OperateTypeEnum.鑷姩瀹屾垚); - if (stockInfo.Details.Sum(x=>x.StockQuantity)== stockInfo.Details.Sum(x => x.OutboundQuantity)) - { - _stockService.StockInfoService.Repository.DeleteData(stockInfo); - } - else - { + if (stockInfo.Details.Count > deleteDetailList.Count) _stockService.StockInfoService.Repository.UpdateData(stockInfo); - } + else + _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, OperateTypeEnum.鑷姩瀹屾垚); + _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(deleteDetailList, OperateTypeEnum.鑷姩瀹屾垚); _stockService.StockInfoDetailService.Repository.UpdateData(updateDetailList); - _stockService.StockInfoDetailService.Repository.DeleteData(deleteDetailList); + //_stockService.StockInfoDetailService.Repository.DeleteData(deleteDetailList); BaseDal.UpdateData(outStockLockInfos); - _unitOfWorkManage.BeginTran(); + _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK(); } catch (Exception ex) -- Gitblit v1.9.3