From 16f4bb3c28fc85cffcc511718c903ada9fdab134 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期五, 26 十二月 2025 16:59:45 +0800
Subject: [PATCH] 调用mes导入工程参数修改,Excel表数据流程卡号一致;增加读取层号/工程号方法; 工程号一致覆盖更新

---
 mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue b/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
index 7d4eb7c..aced2f8 100644
--- a/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
+++ b/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
@@ -398,7 +398,7 @@
   try {
     clearLoading.value = true
     const response = await deviceInteractionApi.executeOperation({
-      deviceId: loadDeviceId.value,
+      id: loadDeviceId.value,
       operation: 'clearPlc',
       params: {}
     })
@@ -566,6 +566,16 @@
       headerStr === '瀹㈡埛鍚嶇О') {
       headerMap.customerName = index
     }
+    // 灞傚彿
+    else if (headerStr.includes('灞傚彿') || headerStr.includes('layer') ||
+      headerStr === '灞�') {
+      headerMap.layer = index
+    }
+    // 宸ョ▼鍙�
+    else if (headerStr.includes('宸ョ▼鍙�') || headerStr.includes('engineeringid') ||
+      headerStr.includes('engineering') || headerStr === '宸ョ▼id') {
+      headerMap.engineeringId = index
+    }
   })
 
   // 濡傛灉娌℃湁鎵惧埌琛ㄥご锛屽皾璇曚娇鐢ㄧ涓�琛屼綔涓鸿〃澶达紙绱㈠紩鏂瑰紡锛�
@@ -578,6 +588,7 @@
     headerMap.quantity = 4
   }
 
+  const padTwoZero = (num) => num.toString().padStart(2, '0')
   // 瑙f瀽鏁版嵁琛�
   const result = []
   for (let i = 1; i < jsonData.length; i++) {
@@ -593,6 +604,8 @@
     const flowCardId = row[headerMap.flowCardId] ? String(row[headerMap.flowCardId]).trim() : ''
     const productName = row[headerMap.productName] ? String(row[headerMap.productName]).trim() : ''
     const customerName = row[headerMap.customerName] ? String(row[headerMap.customerName]).trim() : ''
+    const layer = row[headerMap.layer] ? String(row[headerMap.layer]).trim() : ''
+    const engineeringId = row[headerMap.engineeringId] ? String(row[headerMap.engineeringId]).trim() : ''
 
     // 璺宠繃绌鸿
     if (!glassId && !width && !length && !thickness && !quantity) {
@@ -612,11 +625,13 @@
       return isNaN(num) ? '0' : String(num)
     }
 
-    // 澶勭悊鏁伴噺锛氬鏋滄暟閲忓ぇ浜�1锛岄渶瑕佺敓鎴愬鏉¤褰�
+    // 澶勭悊鏁伴噺锛氭牴鎹暟閲忕敓鎴愬鏉¤褰曪紝姣忔潯璁板綍閮借琛ラ綈搴忓彿
     const qty = parseInt(quantity) || 1
     for (let j = 0; j < qty; j++) {
-      // 濡傛灉鏁伴噺澶т簬1锛屼负姣忔潯璁板綍鐢熸垚鍞竴鐨勭幓鐠僆D锛堣拷鍔犲簭鍙凤級
-      const finalGlassId = qty > 1 ? `${glassId}${j + 1}` : glassId
+      // 涓烘瘡鏉¤褰曠敓鎴愬敮涓�鐨勭幓鐠僆D锛堣拷鍔犲簭鍙凤紝鍗充娇鏁伴噺涓�1涔熻琛ラ綈锛�
+      // 渚嬪锛歡lassId="1", quantity=2 -> "101", "102"
+      //       glassId="2", quantity=1 -> "201"
+      const finalGlassId = `${glassId}${padTwoZero(j + 1)}`
 
       result.push({
         glassId: finalGlassId,
@@ -625,9 +640,11 @@
         thickness: parseNumber(thickness),
         quantity: '1', // 姣忔潯璁板綍鏁伴噺涓�1
         filmsId: filmsId,
-        flowCardId: flowCardId || finalGlassId,
+        flowCardId: flowCardId || '', // 濡傛灉Excel涓病鏈夋祦绋嬪崱ID锛屼紶绌哄瓧绗︿覆璁╁悗绔敓鎴�
         productName: productName,
-        customerName: customerName
+        customerName: customerName,
+        layer: layer || '', // 灞傚彿锛屽鏋淓xcel涓病鏈夊垯涓虹┖
+        engineeringId: engineeringId || '' // 宸ョ▼鍙凤紝濡傛灉Excel涓病鏈夊垯涓虹┖
       })
     }
   }

--
Gitblit v1.8.0