From 64840e4e6d97d177b8a765ba8c53888abcf86d16 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期二, 13 一月 2026 18:48:20 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 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/OutboundService.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/OutboundService.cs"
index 253ad0d..13dbfe3 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/OutboundService.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/OutboundService.cs"
@@ -193,10 +193,16 @@
                     UpdateStockStatus(pickedDetails.Select(x => x.PalletCode).ToList(), StockStatusEmun.鍑哄簱閿佸畾.ObjToInt());
                     UpdateLocationStatus(pickedDetails.Select(x => x.LocationCode).ToList(), LocationStatusEnum.Lock.ObjToInt());
                 }
-                UpdateOutStockLockInfo(outStockLockInfos);
+                //閲嶆鍗曚笉鎷i�夛紝鍘绘帀閿佸畾璁板綍鍥炲簱锛屽啀娆$粍鐩樻椂鎵i櫎鍘熸潯鐮�
+                if (outboundOrder.OrderType != InOrderTypeEnum.ReCheck.ObjToInt())
+                {
+                    UpdateOutStockLockInfo(outStockLockInfos);
+                }
+                
                 if (tasks.Any()) _taskRepository.AddData(tasks);
 
-                _unitOfWorkManage.CommitTran();
+                
+                    _unitOfWorkManage.CommitTran();
 
                 // 4. 鏋勯�犲搷搴旓細鍖哄垎銆屽叏閮ㄥ垎閰嶃�嶅拰銆岄儴鍒嗗垎閰嶃��
                 string responseMsg = totalActualAllocate == totalNeedAllocate
@@ -484,7 +490,7 @@
                 x => request.StockDetailIds.Contains(x.Id)
                 && x.MaterielCode == materielCalc.MaterielCode
                 && x.StockQuantity > 0
-                && (x.Status == (int)StockStatusEmun.鍏ュ簱瀹屾垚 || x.Status == (int)StockStatusEmun.鎵嬪姩瑙i攣));
+                && (x.Status == (int)StockStatusEmun.鍏ュ簱瀹屾垚 || x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨)|| x.Status == (int)StockStatusEmun.鎵嬪姩瑙i攣);
 
             if (!specifiedStockDetails.Any())
             {
@@ -670,15 +676,13 @@
                     decimal totalAllocatedQuantity = CalcTotalAllocatedQuantity(lockInfos, stockInfo.Id, detail.MaterielCode);
                     lockInfo.AssignQuantity += actualAllocatedQuantity;
                     lockInfo.AllocatedQuantity = totalAllocatedQuantity;
-                    // 瀛橀噺閿佸畾璁板綍涔熸洿鏂癘riginalQuantity涓烘墭鐩樻�诲簱瀛橈紙鍙�夛紝淇濇寔鏁版嵁涓�鑷达級
                     if (palletMaterielTotalStock > 0)
                         lockInfo.OriginalQuantity = palletMaterielTotalStock;
                     lockInfoList.Add(lockInfo);
                 }
                 else
                 {
-                    // ===== 鏍稿績浼樺寲2锛歄riginalQuantity璧嬪�间负鎵樼洏鐗╂枡鎬诲簱瀛� =====
-                    decimal originalQuantity = palletMaterielTotalStock; // 鏇夸唬鍘熸湁灞�閮ㄦ槑缁嗘暟閲�
+                    decimal originalQuantity = palletMaterielTotalStock;
 
                     List<string> allDetailIds = outboundOrder.Details.Where(x =>
                         x.OrderId == outboundOrder.Id && x.MaterielCode == detail.MaterielCode
@@ -978,7 +982,7 @@
                     // 鏁寸鍑哄簱鏃犻渶鎷嗗寘
                     PerformFullOutboundOperation(stockInfo, request, lockInfo.TaskNum.GetValueOrDefault());
 
-                    if (outboundOrder.OrderType != 0)
+                    if (outboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt())
                     {
                         Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
                         if (allocateOrder != null)
@@ -1004,6 +1008,29 @@
                             }
                             _allocateMaterialInfoRepository.AddData(allocateMaterialInfos);
                         }
+                    }
+                    else if(outboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt())
+                    {
+                        List<Dt_AllocateMaterialInfo> allocateMaterialInfos = new List<Dt_AllocateMaterialInfo>();
+                        foreach (var item in stockInfo.Details)
+                        {
+                            Dt_AllocateMaterialInfo allocateMaterialInfo = new Dt_AllocateMaterialInfo()
+                            {
+                                Barcode = item.Barcode??"",
+                                BatchNo = item.BatchNo,
+                                FactoryArea = item.FactoryArea,
+                                MaterialCode = item.MaterielCode,
+                                MaterialName = item.MaterielName,
+                                OrderId = outboundOrder.Id,
+                                OrderNo = outboundOrder.OrderNo,
+                                Quantity = item.StockQuantity,
+                                SupplyCode = item.SupplyCode??"",
+                                Unit = item.Unit,
+                                WarehouseCode = item.WarehouseCode??""
+                            };
+                            allocateMaterialInfos.Add(allocateMaterialInfo);
+                        }
+                        _allocateMaterialInfoRepository.AddData(allocateMaterialInfos);
                     }
 
                     decimal allocatedQuantity = actualOutboundQuantity;
@@ -1364,7 +1391,7 @@
 
                         MaterialCodeReturnDTO returnDTO = returnDTOs.First(x => x.Barcode == newBarcode);
 
-                        if (outboundOrder.OrderType != 0)
+                        if (outboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()||outboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt())
                         {
                             allocateMaterialInfo = new Dt_AllocateMaterialInfo()
                             {
@@ -1386,7 +1413,7 @@
                     {
                         PerformFullOutboundOperation(stockDetail, stockInfo, actualOutboundQuantity, request, beforeQuantity, lockInfo.TaskNum.GetValueOrDefault());
 
-                        if (outboundOrder.OrderType != 0)
+                        if (outboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt() || outboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt())
                         {
                             allocateMaterialInfo = new Dt_AllocateMaterialInfo()
                             {
@@ -1405,8 +1432,8 @@
 
                     }
 
-                    // 鍒ゆ柇鏄惁鏄皟鎷ㄥ崟
-                    if (outboundOrder.OrderType != 0)
+                    // 鍒ゆ柇鏄惁鏄櫤浠撹皟鏅轰粨鍗�
+                    if ( outboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt())
                     {
                         Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
                         if (allocateOrder != null)
@@ -1523,7 +1550,6 @@
                         _feedbackMesService.BarcodeFeedback(newBarcode);
                     }
 
-                    // 鍒犻櫎閿佸畾璁板綍锛堝鏋滃嚭搴撴槑缁嗗叏閮ㄥ畬鎴愶級 涓嶤alculateActualOutboundQuantity鏂规硶閲岄潰娉ㄩ噴浠g爜2閫�1浣跨敤
                     if (CheckOutboundOrderDetailCompletedByMatCode(request.OrderNo, lockInfo.MaterielCode, outboundOrderDetails.First()))
                     {
                         Func<Dt_OutStockLockInfo, bool> supWhere = x => string.IsNullOrEmpty(outboundOrderDetails.First().SupplyCode) ? true : x.SupplyCode == outboundOrderDetails.First().SupplyCode;
@@ -1538,6 +1564,7 @@
                             _outboundLockInfoRepository.DeleteAndMoveIntoHty(stockLockInfos, WIDESEA_Core.Enums.OperateTypeEnum.鑷姩鍒犻櫎);
                         }
                     }
+                    
 
                     // 妫�鏌ュ嚭搴撳崟鏄惁瀹屾垚
                     if (CheckOutboundOrderCompleted(request.OrderNo))

--
Gitblit v1.9.3