From f5df33d51a8555d709a4e8369fa98ce70759ddfc Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期一, 17 十一月 2025 13:39:17 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
index a7686c9..7635616 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
@@ -62,14 +62,32 @@
                     return WebResponseContent.Instance.Error($"鎷嗗寘鏁伴噺涓嶈兘澶т簬鍓╀綑閿佸畾鏁伴噺锛屽墿浣欙細{remainingLockQuantity}");
 
                 var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
-               .Where(x => x.Barcode == request.OriginalBarcode)
+               .Where(x => x.Barcode == request.OriginalBarcode && x.StockId == lockInfo.StockId)
                .FirstAsync();
+                if (stockDetail == null)
+                    throw new Exception($"鏈壘鍒版潯鐮亄request.OriginalBarcode}瀵瑰簲鐨勫簱瀛樿褰�");
 
                 var seq = await _dailySequenceService.GetNextSequenceAsync();
                 // 3. 鐢熸垚鏂版潯鐮�
                 string newBarcode = "WSLOT" + DateTime.Now.ToString("yyyyMMdd") + seq.ToString()?.PadLeft(5, '0');
 
                 decimal remainingQty = remainingLockQuantity - request.SplitQuantity;
+
+                // 涓烘媶鍖呬骇鐢熺殑鏂版潯鐮佸垱寤哄簱瀛樿褰�
+                var newStockDetail = new Dt_StockInfoDetail
+                {                    
+                    StockId = lockInfo.StockId,
+                    MaterielCode = lockInfo.MaterielCode,
+                    OrderNo = lockInfo.OrderNo,
+                    BatchNo = lockInfo.BatchNo,
+                    StockQuantity = remainingQty,
+                    OutboundQuantity = remainingQty, // 閿佸畾鍏ㄩ儴鏁伴噺
+                    Barcode = newBarcode,
+                    InboundOrderRowNo = stockDetail.InboundOrderRowNo,
+                  
+                };
+                await _outStockLockInfoService.Db.Insertable(newStockDetail).ExecuteCommandAsync();
+
                 // 4. 鍒涘缓鏂扮殑鍑哄簱閿佸畾淇℃伅锛堟柊鏉$爜锛�
                 var newLockInfo = new Dt_OutStockLockInfo
                 {
@@ -99,7 +117,7 @@
                 await _outStockLockInfoService.Db.Insertable(newLockInfo).ExecuteCommandAsync();
 
                 // 5. 鏇存柊鍘熼攣瀹氫俊鎭殑鍒嗛厤鏁伴噺锛堝噺灏戞媶鍖呮暟閲忥級
-                lockInfo.AssignQuantity -= request.SplitQuantity;
+                lockInfo.AssignQuantity = request.SplitQuantity;
                 await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
 
                 // 6. 璁板綍鎷嗗寘鍘嗗彶锛堢敤浜庤拷韪級

--
Gitblit v1.9.3