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

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 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 7635616..54ae514 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"
@@ -57,7 +57,7 @@
                     return WebResponseContent.Instance.Error("鏈壘鍒版湁鏁堢殑鍑哄簱閿佸畾淇℃伅");
 
                 // 2. 妫�鏌ュ墿浣欓攣瀹氭暟閲�
-                decimal remainingLockQuantity = lockInfo.AssignQuantity - lockInfo.PickedQty;
+                decimal remainingLockQuantity = lockInfo.OriginalQuantity - lockInfo.PickedQty;
                 if (request.SplitQuantity > remainingLockQuantity)
                     return WebResponseContent.Instance.Error($"鎷嗗寘鏁伴噺涓嶈兘澶т簬鍓╀綑閿佸畾鏁伴噺锛屽墿浣欙細{remainingLockQuantity}");
 
@@ -67,6 +67,11 @@
                 if (stockDetail == null)
                     throw new Exception($"鏈壘鍒版潯鐮亄request.OriginalBarcode}瀵瑰簲鐨勫簱瀛樿褰�");
 
+                stockDetail.StockQuantity = request.SplitQuantity;
+                stockDetail.OutboundQuantity = request.SplitQuantity;
+                _stockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>(stockDetail).ExecuteCommand();
+
+
                 var seq = await _dailySequenceService.GetNextSequenceAsync();
                 // 3. 鐢熸垚鏂版潯鐮�
                 string newBarcode = "WSLOT" + DateTime.Now.ToString("yyyyMMdd") + seq.ToString()?.PadLeft(5, '0');
@@ -75,23 +80,29 @@
 
                 // 涓烘媶鍖呬骇鐢熺殑鏂版潯鐮佸垱寤哄簱瀛樿褰�
                 var newStockDetail = new Dt_StockInfoDetail
-                {                    
+                {
+                    SupplyCode = stockDetail.SupplyCode,
+                    WarehouseCode = stockDetail.WarehouseCode,
+                    BarcodeQty = stockDetail.BarcodeQty,
+                    BarcodeUnit = stockDetail.Barcode,
+                    BusinessType = stockDetail.BusinessType,
+                    Unit = stockDetail.Unit,
                     StockId = lockInfo.StockId,
-                    MaterielCode = lockInfo.MaterielCode,
-                    OrderNo = lockInfo.OrderNo,
-                    BatchNo = lockInfo.BatchNo,
+                    MaterielCode = stockDetail.MaterielCode,
+                    OrderNo = stockDetail.OrderNo,
+                    BatchNo = stockDetail.BatchNo,
                     StockQuantity = remainingQty,
                     OutboundQuantity = remainingQty, // 閿佸畾鍏ㄩ儴鏁伴噺
                     Barcode = newBarcode,
                     InboundOrderRowNo = stockDetail.InboundOrderRowNo,
-                  
+
                 };
                 await _outStockLockInfoService.Db.Insertable(newStockDetail).ExecuteCommandAsync();
 
                 // 4. 鍒涘缓鏂扮殑鍑哄簱閿佸畾淇℃伅锛堟柊鏉$爜锛�
                 var newLockInfo = new Dt_OutStockLockInfo
                 {
-                    
+
                     OrderNo = lockInfo.OrderNo,
                     OrderDetailId = lockInfo.OrderDetailId,
                     BatchNo = lockInfo.BatchNo,
@@ -108,7 +119,7 @@
                     Status = (int)OutLockStockStatusEnum.鍑哄簱涓�,
                     Unit = lockInfo.Unit,
                     SupplyCode = lockInfo.SupplyCode,
-                    OrderType=lockInfo.OrderType,
+                    OrderType = lockInfo.OrderType,
                     CurrentBarcode = newBarcode, // 鏂版潯鐮�
                     OriginalLockQuantity = request.SplitQuantity,
                     IsSplitted = 1,
@@ -124,7 +135,7 @@
                 var splitHistory = new Dt_SplitPackageRecord
                 {
                     FactoryArea = lockInfo.FactoryArea,
-                    TaskNum=lockInfo.TaskNum,
+                    TaskNum = lockInfo.TaskNum,
                     OutStockLockInfoId = lockInfo.Id,
                     StockId = stockDetail?.StockId ?? 0,
                     Operator = App.User.UserName,
@@ -132,7 +143,7 @@
                     OriginalBarcode = lockInfo.CurrentBarcode,
                     NewBarcode = newBarcode,
                     SplitQty = request.SplitQuantity,
-                    RemainQuantity = lockInfo.RemainQuantity - request.SplitQuantity,
+                    RemainQuantity = lockInfo.OriginalQuantity - request.SplitQuantity,
                     MaterielCode = lockInfo.MaterielCode,
                     SplitTime = DateTime.Now,
                     OrderNo = request.OrderNo,

--
Gitblit v1.9.3