From a7e44da36abba1226fe208fbaac56abcf035a129 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 20 五月 2026 17:15:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_NEW_pro

---
 src/views/productionManagement/productStructure/Detail/index.vue       |   12 +++---
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   37 +++++++++++++++---
 src/views/salesManagement/salesLedger/index.vue                        |   23 +++++++++--
 3 files changed, 55 insertions(+), 17 deletions(-)

diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 92a2fa1..eaf6397 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -1166,15 +1166,15 @@
     row.processId = value || "";
     syncProcessOperationFields(row);
     
-    // 鍚屼竴灞傜骇鍙兘閫変竴鏍风殑宸ュ簭
+    // 妫�鏌ュ悓涓�灞傜骇鏄惁宸茬粡鏈夊叾浠栦笉鍚岀殑宸ュ簭琚�変腑
     const siblings = findSiblings(bomDataValue.value.dataList, row.tempId);
     if (siblings && value) {
-      siblings.forEach(sibling => {
-        if (sibling.tempId !== row.tempId) {
-          sibling.processId = value;
-          syncProcessOperationFields(sibling);
-        }
+      const hasDifferentProcess = siblings.some(sibling => {
+        return sibling.tempId !== row.tempId && sibling.processId && sibling.processId !== value;
       });
+      if (hasDifferentProcess) {
+        ElMessage.warning("鍚屼竴灞傜骇宸插瓨鍦ㄤ笉鍚岀殑宸ュ簭锛岃鍏堢粺涓�宸ュ簭鍚庡啀杩涜淇敼");
+      }
     }
   };
 
@@ -1391,10 +1391,35 @@
       }
     };
 
+    // 鏍¢獙鍚屼竴灞傜骇鐨勫伐搴忔槸鍚︿竴鑷�
+    const validateProcessConsistency = (items) => {
+      if (!items || items.length === 0) return;
+
+      // 妫�鏌ュ綋鍓嶅眰绾�
+      const processes = items.filter(item => item.processId).map(item => item.processId);
+      if (processes.length > 1) {
+        const uniqueProcesses = [...new Set(processes)];
+        if (uniqueProcesses.length > 1) {
+          ElMessage.error("鍚屼竴灞傜骇鐨勫伐搴忓繀椤讳竴鑷�");
+          isValid = false;
+          return;
+        }
+      }
+
+      // 閫掑綊妫�鏌ュ瓙绾�
+      items.forEach(item => {
+        if (item.children && item.children.length > 0) {
+          validateProcessConsistency(item.children);
+        }
+      });
+    };
+
     bomDataValue.value.dataList.forEach(item => {
       validateItem(item, true);
     });
 
+    validateProcessConsistency(bomDataValue.value.dataList);
+
     return isValid;
   };
 
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 76c67dc..5cb08e8 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -336,15 +336,15 @@
     row.processId = value || "";
     syncProcessOperationFields(row);
     
-    // 鍚屼竴灞傜骇鍙兘閫変竴鏍风殑宸ュ簭
+    // 妫�鏌ュ悓涓�灞傜骇鏄惁宸茬粡鏈夊叾浠栦笉鍚岀殑宸ュ簭琚�変腑
     const siblings = findSiblings(dataValue.dataList, row.tempId);
     if (siblings && value) {
-      siblings.forEach(sibling => {
-        if (sibling.tempId !== row.tempId) {
-          sibling.processId = value;
-          syncProcessOperationFields(sibling);
-        }
+      const hasDifferentProcess = siblings.some(sibling => {
+        return sibling.tempId !== row.tempId && sibling.processId && sibling.processId !== value;
       });
+      if (hasDifferentProcess) {
+        ElMessage.warning("鍚屼竴灞傜骇宸插瓨鍦ㄤ笉鍚岀殑宸ュ簭锛岃鍏堢粺涓�宸ュ簭鍚庡啀杩涜淇敼");
+      }
     }
   };
 
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index a4ebbdf..904979c 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -284,10 +284,15 @@
           <el-col :span="12">
             <el-form-item label="閿�鍞悎鍚屽彿锛�"
                           prop="salesContractNo">
-              <el-input v-model="form.salesContractNo"
-                        placeholder="鑷姩鐢熸垚"
-                        clearable
-                        disabled />
+              <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
+                <el-checkbox v-model="form.autoGenerateContractNo" v-if="operationType === 'add'">鑷姩鐢熸垚
+                </el-checkbox>
+                <el-input v-model="form.salesContractNo"
+                          :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
+                          clearable
+                          :disabled="form.autoGenerateContractNo" />
+
+              </div>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -1069,6 +1074,7 @@
     },
     form: {
       salesContractNo: "",
+      autoGenerateContractNo: true,
       salesman: "",
       customerId: "",
       entryPerson: "",
@@ -1587,6 +1593,8 @@
       form.value.entryDate = getCurrentDate();
       // 绛捐鏃ユ湡榛樿涓哄綋澶�
       form.value.executionDate = getCurrentDate();
+      // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+      form.value.autoGenerateContractNo = true;
     } else {
       currentId.value = row.id;
       getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -1594,6 +1602,8 @@
         form.value.entryPerson = Number(res.entryPerson);
         productData.value = form.value.productData;
         fileList.value = form.value.storageBlobVOs;
+        // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+        form.value.autoGenerateContractNo = false;
       });
     }
     // let userAll = await userStore.getInfo()
@@ -1730,6 +1740,9 @@
         }
         form.value.storageBlobDTOs = fileList;
         form.value.type = 1;
+        if (form.value.autoGenerateContractNo) {
+          form.value.salesContractNo = '';
+        }
         addOrUpdateSalesLedger(form.value).then(res => {
           proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
           closeDia();
@@ -3007,4 +3020,4 @@
       page-break-after: avoid;
     }
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3