From 475fc7c0176aafe0e0833ba4dd5cab9fd5c18160 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期三, 03 十二月 2025 15:26:37 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs |   96 +++++++++++++++++++++++++++--------------------
 1 files changed, 55 insertions(+), 41 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/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 4f86ab1..341570f 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)
@@ -1953,7 +1966,7 @@
                     .Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
                     .ToListAsync();
 
-                var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode })
+                var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
                    .Select(group => new AllocateDtoDetail
                    {
                        MaterialCode = group.Key.MaterielCode,
@@ -1961,13 +1974,13 @@
                        WarehouseCode = group.Key.WarehouseCode,
                        Qty = group.Sum(x => x.PickedQty),
 
-                       Unit = group.Key.Unit,
+                       Unit = group.Key.BarcodeUnit,
                        Barcodes = group.Select(row => new BarcodeInfo
                        {
                            Barcode = row.CurrentBarcode,
                            SupplyCode = row.SupplyCode,
                            BatchNo = row.BatchNo,
-                           Unit = row.Unit,
+                           Unit = row.BarcodeUnit,
                            Qty = row.PickedQty
                        }).ToList()
 
@@ -2023,8 +2036,8 @@
                            materialCode = group.Key.MaterielCode,
                            lineNo = group.Key.lineNo,
                            warehouseCode = group.Key.WarehouseCode,
-                           qty = group.Sum(x => x.BarcodeQty),
-                           currentDeliveryQty = group.Sum(x => x.BarcodeQty),
+                           qty = group.Sum(x => x.PickedQty),
+                           currentDeliveryQty = group.Sum(x => x.PickedQty),
                            unit = group.Key.BarcodeUnit,
                            barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
                            {
@@ -2032,7 +2045,7 @@
                                supplyCode = row.SupplyCode,
                                batchNo = row.BatchNo,
                                unit = row.BarcodeUnit,
-                               qty = row.BarcodeQty
+                               qty = row.PickedQty
                            }).ToList()
                        }).ToList();
 
@@ -2847,33 +2860,34 @@
                                         (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
                         .ToListAsync();
 
-                    var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
-                            .Select(group => new FeedbackOutboundDetailsModel
-                            {
-                                materialCode = group.Key.MaterielCode,
-                                lineNo = group.Key.lineNo,  
-                                warehouseCode = group.Key.WarehouseCode,
-                                qty = group.Sum(x => x.BarcodeQty),
-                                currentDeliveryQty = group.Sum(x => x.BarcodeQty),
-                                unit = group.Key.BarcodeUnit,
-                                barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
-                                {
-                                    barcode = lockInfo.CurrentBarcode,
-                                    supplyCode = lockInfo.SupplyCode,
-                                    batchNo = lockInfo.BatchNo,
-                                    unit = lockInfo.BarcodeUnit,
-                                    qty = lockInfo.BarcodeQty
-                                }).ToList()
-                            }).ToList();
-                    outfeedmodel.details.AddRange(groupdata);
-                }
-                var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
-                if (result != null && result.code == 200)
-                {
-                    await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
-                        .SetColumns(x => x.ReturnToMESStatus == 1)
-                        .Where(x => x.OrderId == outboundOrder.Id)
-                        .ExecuteCommandAsync();
+                        var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
+                              .Select(group => new FeedbackOutboundDetailsModel
+                              {
+
+                                  materialCode = group.Key.MaterielCode,
+                                  lineNo = group.Key.lineNo,
+                                  warehouseCode = group.Key.WarehouseCode,
+                                  qty = group.Sum(x => x.PickedQty),
+                                  currentDeliveryQty = group.Sum(x => x.PickedQty),
+                                  unit = group.Key.BarcodeUnit,
+                                  barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
+                                  {
+                                      barcode = lockInfo.CurrentBarcode,
+                                      supplyCode = lockInfo.SupplyCode,
+                                      batchNo = lockInfo.BatchNo,
+                                      unit = lockInfo.BarcodeUnit,
+                                      qty = lockInfo.PickedQty
+                                  }).ToList()
+                              }).ToList();
+                        feedmodel.details.AddRange(groupdata);
+                    }
+                    var result = await _invokeMESService.FeedbackOutbound(feedmodel);
+                    if (result != null && result.code == 200)
+                    {
+                        await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+                            .SetColumns(x => x.ReturnToMESStatus == 1)
+                            .Where(x => x.OrderId == outboundOrder.Id)
+                            .ExecuteCommandAsync();
 
                     await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
                         .SetColumns(x => x.ReturnToMESStatus == 1)

--
Gitblit v1.9.3