From fb8b33fd8115592efa524b015e0d9889b696c70a Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期三, 15 十月 2025 11:03:36 +0800
Subject: [PATCH] pda周转箱调拨

---
 service/Warehouse/MesInvItemInCDetailsManager.cs |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/service/Warehouse/MesInvItemInCDetailsManager.cs b/service/Warehouse/MesInvItemInCDetailsManager.cs
index c8271a1..11ce169 100644
--- a/service/Warehouse/MesInvItemInCDetailsManager.cs
+++ b/service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -1223,6 +1223,18 @@
                 "SELECT 1 FROM MES_INV_ITEM_CGYT_C_DETAILS WHERE ITEM_BARCODE = @barcode",
                 sqlParams);
 
+            // 浣跨敤鍙傛暟鍖栨煡璇㈠苟蹇界暐澶у皬鍐欙紙閫傜敤浜庢敮鎸佺殑鏁版嵁搴擄級
+            var itemBarcode = Db.Queryable<MesInvItemBarcodes>()
+                .Where(it => it.ItemBarcode.Trim().ToLower() == entity.returnBarcode.Trim().ToLower())
+                .First() ?? throw new InvalidOperationException($"鏈壘鍒版潯鐮� '{entity.returnBarcode}' 鐨勫尮閰嶄俊鎭�");
+
+            // 鍒ゆ柇楠岄��鏁伴噺鏄惁澶т簬鏉$爜鐨勬暟閲忥紙鍋囪鏉$爜鏁伴噺瀛楁涓篞uantity锛�
+            if (entity.returnQuantity > itemBarcode.Quantity)
+            {
+                throw new ArgumentException($"楠岄��鏁伴噺涓嶈兘澶т簬鏉$爜鐨勬暟閲忥紝褰撳墠鏉$爜鏁伴噺涓�: {itemBarcode.Quantity}", nameof(entity.returnQuantity));
+            }
+            // 灏嗘煡璇㈠埌鐨勬潯鐮佷俊鎭祴鍊肩粰杩斿洖妯″瀷
+            res.itemBarcodeDetails = itemBarcode;
 
             // 璋冪敤瀛樺偍杩囩▼ prc_pda_bar_cf_before
             string strMsg = "";
@@ -1320,13 +1332,7 @@
                 }
             }
 
-            // 浣跨敤鍙傛暟鍖栨煡璇㈠苟蹇界暐澶у皬鍐欙紙閫傜敤浜庢敮鎸佺殑鏁版嵁搴擄級
-            var itemBarcode = Db.Queryable<MesInvItemBarcodes>()
-                .Where(it => it.ItemBarcode.Trim().ToLower() == entity.returnBarcode.Trim().ToLower())
-                .First() ?? throw new InvalidOperationException($"鏈壘鍒版潯鐮� '{entity.returnBarcode}' 鐨勫尮閰嶄俊鎭�");
-
-            // 灏嗘煡璇㈠埌鐨勬潯鐮佷俊鎭祴鍊肩粰杩斿洖妯″瀷
-            res.itemBarcodeDetails = itemBarcode;
+            
 
             // 浼樺寲鏌ヨ锛堝幓闄ょ┖鏍煎苟蹇界暐澶у皬鍐欙級
             var mesInvItemInCDetails = Db.Queryable<MesInvItemInCDetails>()

--
Gitblit v1.9.3