From e7ccf9dafa1dac3c5000ff85f16f8d0ca1c2a6a7 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 30 十月 2026 20:48:18 +0800
Subject: [PATCH] 1

---
 src/views/mes/pro/bagCode/index.vue |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/views/mes/pro/bagCode/index.vue b/src/views/mes/pro/bagCode/index.vue
index 9f0df83..891aaca 100644
--- a/src/views/mes/pro/bagCode/index.vue
+++ b/src/views/mes/pro/bagCode/index.vue
@@ -251,15 +251,6 @@
   function handleBindPallet() {
     const records = getSelectedRecords();
     if (!records) return;
-    if (records.some((record) => !record.batchId)) {
-      message.warning("璇峰厛褰曞叆鐢熶骇鎵规锛屽啀缁戝畾鎵樼洏");
-      return;
-    }
-    const batchIds = new Set(records.map((record) => record.batchId));
-    if (batchIds.size > 1) {
-      message.warning("璇烽�夋嫨鍚屼竴鎵规涓嬬殑琚嬬爜杩涜缁戝畾");
-      return;
-    }
     if (records.some((record) => record.palletId)) {
       message.warning("鎵�閫夎鐮佷腑瀛樺湪宸茬粦瀹氭墭鐩樼殑璁板綍锛岃鍏堣В缁�");
       return;
@@ -272,11 +263,31 @@
       message.warning("宸蹭綔搴熺殑琚嬬爜涓嶅厑璁哥粦瀹氭墭鐩�");
       return;
     }
+    const withBatch = records.filter((record) => record.batchId);
+    // 宸插綍鎵规涓庢湭褰曟壒娆℃贩閫夋椂鍙�夋墭鐩樿寖鍥翠笉涓�鑷达紝瑕佹眰鍒嗗紑鎿嶄綔
+    if (withBatch.length > 0 && withBatch.length < records.length) {
+      message.warning("鎵�閫夎鐮侀儴鍒嗗凡褰曞叆鎵规锛岃鍒嗗紑閫夋嫨鍚庡啀缁戝畾鎵樼洏");
+      return;
+    }
     const first = records[0]!;
+    if (withBatch.length > 0) {
+      const batchIds = new Set(records.map((record) => record.batchId));
+      if (batchIds.size > 1) {
+        message.warning("璇烽�夋嫨鍚屼竴鎵规涓嬬殑琚嬬爜杩涜缁戝畾");
+        return;
+      }
+    } else {
+      const itemIds = new Set(records.map((record) => record.itemId));
+      if (itemIds.size > 1) {
+        message.warning("璇烽�夋嫨鍚屼竴鍝佺涓嬬殑琚嬬爜杩涜缁戝畾");
+        return;
+      }
+    }
     bindPalletFormModalApi
       .setData({
         batchId: first.batchId,
         batchCode: first.batchCode,
+        itemId: first.itemId,
         ids: records.map((record) => record.id!),
       })
       .open();

--
Gitblit v1.9.3