From 366fe40a67783f7f22d13f59f9863c2cb6eac5b5 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 02 十二月 2025 22:35:38 +0800
Subject: [PATCH] 提交

---
 /dev/null                                                                           |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs    |   33 +++++++---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs               |   78 ++++++++++++++------------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs             |   49 ++++++++--------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs |    2 
 5 files changed, 91 insertions(+), 71 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
deleted file mode 100644
index 3009c83..0000000
--- "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
+++ /dev/null
Binary files differ
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
deleted file mode 100644
index 7e80632..0000000
--- "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
+++ /dev/null
Binary files differ
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_BasicService/InvokeMESService.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_BasicService/InvokeMESService.cs"
index 307f953..59d58ee 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_BasicService/InvokeMESService.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_BasicService/InvokeMESService.cs"
@@ -283,7 +283,7 @@
                                                    Qty = row.BarcodeQty,
                                                    BatchNo = row.BatchNo,
                                                    SupplyCode = row.SupplyCode,
-                                                   Unit = row.Unit
+                                                   Unit = row.BarcodeUnit
                                                }).ToList()
                                            }).ToList();
                                         allocatefeedmodel.Details = groupedData;
@@ -399,11 +399,7 @@
                 var pendingDetails = orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList();
                 foreach (var detail in pendingDetails)
                 {
-                    if (detail.OverOutQuantity >= detail.NeedOutQuantity)
-                    {
-                        detailIds.Add(detail.Id);
-                    }
-                    else
+                    if (detail.OverOutQuantity < detail.NeedOutQuantity)
                     {
                         allCompleted = false;
                     }
@@ -449,7 +445,7 @@
                 };
 
                 // 濉厖鏄庣粏鍜屾潯鐮佷俊鎭�
-                foreach (var detail in orderDetails.Where(x => detailIds.Contains(x.Id)).ToList())
+                foreach (var detail in orderDetails )
                 {
                     // 鏌ヨ璇ユ槑缁嗗搴旂殑閿佸畾鏉$爜璁板綍
                     var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
@@ -473,27 +469,30 @@
                     // 濉厖鏉$爜淇℃伅锛堝惈鍗曚綅杞崲锛�
                     foreach (var item in detailLocks)
                     {
-                        var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+                        if (item.PickedQty > 0)
                         {
-                            barcode = item.CurrentBarcode,
-                            supplyCode = item.SupplyCode,
-                            batchNo = item.BatchNo,
-                            unit = item.BarcodeUnit,
-                            qty = item.BarcodeQty
-                        };
+                            var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+                            {
+                                barcode = item.CurrentBarcode,
+                                supplyCode = item.SupplyCode,
+                                batchNo = item.BatchNo,
+                                unit = item.BarcodeUnit,
+                                qty = item.BarcodeQty
+                            };
 
-                        // 鍗曚綅涓嶄竴鑷存椂杞崲
-                        if (item.BarcodeUnit != item.Unit)
-                        {
-                            var convertResult = await _materialUnitService.ConvertAsync(
-                                item.MaterielCode, item.BarcodeQty, item.Unit, item.BarcodeUnit);
-                            barModel.unit = convertResult.Unit;
-                            barModel.qty = convertResult.Quantity;
+                            // 鍗曚綅涓嶄竴鑷存椂杞崲
+                            if (item.BarcodeUnit != item.Unit)
+                            {
+                                var convertResult = await _materialUnitService.ConvertAsync(
+                                    item.MaterielCode, item.BarcodeQty, item.Unit, item.BarcodeUnit);
+                                barModel.unit = convertResult.Unit;
+                                barModel.qty = convertResult.Quantity;
+                            }
+
+                            detailModel.qty += barModel.qty;
+                            detailModel.currentDeliveryQty += barModel.qty;
+                            detailModel.barcodes.Add(barModel);
                         }
-
-                        detailModel.qty += barModel.qty;
-                        detailModel.currentDeliveryQty += barModel.qty;
-                        detailModel.barcodes.Add(barModel);
                     }
 
                     feedModel.details.Add(detailModel);
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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
index de23f20..3e953a2 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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
@@ -147,5 +147,7 @@
         [SqlSugar.SugarColumn(IsIgnore = true)]
         public decimal RemainQuantity => AssignQuantity - PickedQty;
 
+        public int ReturnToMESStatus { get; set; }
+
     }
 }
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/OutboundPickingService.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/OutboundPickingService.cs"
index aaf10c0..fd76615 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/OutboundPickingService.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/OutboundPickingService.cs"
@@ -477,10 +477,21 @@
                     var completedLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                         .Where(it => it.CurrentBarcode == barcode &&
                                    (it.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� ||
+                                    it.Status == (int)OutLockStockStatusEnum.宸查噴鏀� ||
+                                    it.Status == (int)OutLockStockStatusEnum.宸插彇璧� ||
                                     it.PickedQty >= it.AssignQuantity)).FirstAsync();
 
                     if (completedLockInfo != null)
-                        throw new Exception($"鏉$爜{barcode}宸茬粡瀹屾垚鍒嗘嫞锛屼笉鑳介噸澶嶅垎鎷�");
+                    {
+                        string statusMsg = completedLockInfo.Status switch
+                        {
+                            (int)OutLockStockStatusEnum.鎷i�夊畬鎴� => "宸茬粡瀹屾垚鍒嗘嫞",
+                            (int)OutLockStockStatusEnum.宸查噴鏀� => "宸茬粡閲婃斁",
+                            (int)OutLockStockStatusEnum.宸插彇璧� => "宸茬粡鍙栬蛋",
+                            _ => "宸茬粡瀹屾垚鍒嗘嫞"
+                        };
+                        throw new Exception($"鏉$爜{barcode}{statusMsg}锛屼笉鑳介噸澶嶅垎鎷�");
+                    }
                     else
                         return null;
                 }
@@ -816,13 +827,13 @@
 
         private async Task<bool> CanCancelPicking(Dt_OutStockLockInfo lockInfo, Dt_StockInfoDetail stockDetail)
         {
+            if (lockInfo.Status == (int)OutLockStockStatusEnum.宸查噴鏀� || lockInfo.Status == (int)OutLockStockStatusEnum.宸插彇璧�)
+                return false;
             // 閿佸畾淇℃伅鐘舵�佹鏌�
             if (lockInfo.Status != (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
                 return false;
 
-            ////// 搴撳瓨鐘舵�佹鏌�
-            ////if (stockDetail.Status == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
-            ////    return false;
+
 
             // 濡傛灉鏄媶鍖呰褰曪紝杩橀渶瑕佹鏌ョ埗閿佸畾淇℃伅鐘舵��
             if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue)
@@ -830,7 +841,9 @@
                 var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                     .FirstAsync(x => x.Id == lockInfo.ParentLockId.Value);
 
-                if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.鍥炲簱涓�)
+                if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.鍥炲簱涓� ||
+                        parentLock.Status == (int)OutLockStockStatusEnum.宸查噴鏀� ||
+                        parentLock.Status == (int)OutLockStockStatusEnum.宸插彇璧�)
                     return false;
             }
 
@@ -1388,8 +1401,8 @@
             await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
                 .SetColumns(it => new Dt_OutStockLockInfo
                 {
-                    Status = (int)OutLockStockStatusEnum.宸查噴鏀�, // 闇�瑕佹柊澧炶繖涓姸鎬�
-                                                              // ReleaseTime = DateTime.Now,
+                    Status = (int)OutLockStockStatusEnum.宸查噴鏀�,
+
                     Operator = App.User.UserName
                 })
                 .Where(it => lockIds.Contains(it.Id))
@@ -1805,7 +1818,7 @@
 
                     _logger.LogInformation($"璁㈠崟鐘舵�佹洿鏂� - OrderNo: {orderNo}, 鏃х姸鎬�: {outboundOrder.OrderStatus}, 鏂扮姸鎬�: {newStatus}");
 
-                   
+
                 }
             }
             catch (Exception ex)
@@ -2829,7 +2842,7 @@
                               {
 
                                   materialCode = group.Key.MaterielCode,
-                                  lineNo = group.Key.lineNo,  
+                                  lineNo = group.Key.lineNo,
                                   warehouseCode = group.Key.WarehouseCode,
                                   qty = group.Sum(x => x.BarcodeQty),
                                   currentDeliveryQty = group.Sum(x => x.BarcodeQty),
@@ -2840,7 +2853,7 @@
                                       supplyCode = lockInfo.SupplyCode,
                                       batchNo = lockInfo.BatchNo,
                                       unit = lockInfo.BarcodeUnit,
-                                      qty = lockInfo.BarcodeQty  
+                                      qty = lockInfo.BarcodeQty
                                   }).ToList()
                               }).ToList();
                         feedmodel.details.AddRange(groupdata);
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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 76d06f2..fe67834 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -830,17 +830,17 @@
                 int newStatus = orderDetail.OrderDetailStatus;
 
                 // 鏍规嵁瀹為檯鏋氫妇鍊艰皟鏁�
-                // 1. 妫�鏌ユ槸鍚﹀凡瀹屾垚锛堝凡鍑哄簱鏁伴噺 >= 闇�姹傛暟閲忥級
+                //  妫�鏌ユ槸鍚﹀凡瀹屾垚锛堝凡鍑哄簱鏁伴噺 >= 闇�姹傛暟閲忥級
                 if (orderDetail.OverOutQuantity >= orderDetail.NeedOutQuantity)
                 {
                     newStatus = (int)OrderDetailStatusEnum.Over; // 宸插畬鎴�
                 }
-                // 2. 妫�鏌ユ槸鍚︽湁閮ㄥ垎鍑哄簱鎴栨湁閿佸畾鏁伴噺
+                //  妫�鏌ユ槸鍚︽湁閮ㄥ垎鍑哄簱鎴栨湁閿佸畾鏁伴噺
                 else if (orderDetail.OverOutQuantity > 0 || orderDetail.LockQuantity > 0)
                 {
                     newStatus = (int)OrderDetailStatusEnum.Outbound; // 閮ㄥ垎瀹屾垚/杩涜涓�
                 }
-                // 3. 鍚﹀垯涓烘柊璁㈠崟
+                // 鍚﹀垯涓烘柊璁㈠崟
                 else
                 {
                     newStatus = (int)OrderDetailStatusEnum.New; // 鏂板缓
@@ -1054,24 +1054,27 @@
                             };
                             foreach (var item in detailLocks)
                             {
-                                var barModel = new BarcodeInfo
+                                if (item.PickedQty > 0)
                                 {
-                                    Barcode = item.CurrentBarcode,
-                                    SupplyCode = item.SupplyCode,
-                                    BatchNo = item.BatchNo,
-                                    Unit = item.BarcodeUnit,
-                                    Qty = 0
-                                };
-                                // 鍗曚綅涓嶄竴鑷存椂杞崲
-                                if (item.BarcodeUnit != item.Unit)
-                                {
-                                    var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
-                                    barModel.Unit = convertResult.Unit;
-                                    barModel.Qty = convertResult.Quantity;
-                                }
+                                    var barModel = new BarcodeInfo
+                                    {
+                                        Barcode = item.CurrentBarcode,
+                                        SupplyCode = item.SupplyCode,
+                                        BatchNo = item.BatchNo,
+                                        Unit = item.BarcodeUnit,
+                                        Qty = 0
+                                    };
+                                    // 鍗曚綅涓嶄竴鑷存椂杞崲
+                                    if (item.BarcodeUnit != item.Unit)
+                                    {
+                                        var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
+                                        barModel.Unit = convertResult.Unit;
+                                        barModel.Qty = convertResult.Quantity;
+                                    }
 
-                                detailModel.Qty += barModel.Qty;
-                                detailModel.Barcodes.Add(barModel);
+                                    detailModel.Qty += barModel.Qty;
+                                    detailModel.Barcodes.Add(barModel);
+                                }
                             }
 
 
@@ -1135,25 +1138,28 @@
                             };
                             foreach (var item in detailLocks)
                             {
-                                var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+                                if (item.PickedQty > 0)
                                 {
-                                    barcode = item.CurrentBarcode,
-                                    supplyCode = item.SupplyCode,
-                                    batchNo = item.BatchNo,
-                                    unit = item.BarcodeUnit,
-                                    qty = item.PickedQty
-                                };
-                                // 鍗曚綅涓嶄竴鑷存椂杞崲
-                                if (item.BarcodeUnit != item.Unit)
-                                {
-                                    var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
-                                    barModel.unit = convertResult.Unit;
-                                    barModel.qty = convertResult.Quantity;
-                                }
+                                    var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+                                    {
+                                        barcode = item.CurrentBarcode,
+                                        supplyCode = item.SupplyCode,
+                                        batchNo = item.BatchNo,
+                                        unit = item.BarcodeUnit,
+                                        qty = item.PickedQty
+                                    };
+                                    // 鍗曚綅涓嶄竴鑷存椂杞崲
+                                    if (item.BarcodeUnit != item.Unit)
+                                    {
+                                        var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
+                                        barModel.unit = convertResult.Unit;
+                                        barModel.qty = convertResult.Quantity;
+                                    }
 
-                                detailModel.qty += barModel.qty;
-                                detailModel.currentDeliveryQty += barModel.qty;
-                                detailModel.barcodes.Add(barModel);
+                                    detailModel.qty += barModel.qty;
+                                    detailModel.currentDeliveryQty += barModel.qty;
+                                    detailModel.barcodes.Add(barModel);
+                                }
                             }
                             feedmodel.details.Add(detailModel);
                         }

--
Gitblit v1.9.3