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 |   47 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue b/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
index 05e0b07..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: {}
     })
@@ -531,10 +531,10 @@
       headerStr === 'w' || headerStr === '瀹藉害') {
       headerMap.width = index
     }
-    // 楂樺害
-    else if (headerStr.includes('楂�') || headerStr.includes('height') ||
-      headerStr === 'h' || headerStr === '楂樺害') {
-      headerMap.height = index
+    // 闀垮害
+    else if (headerStr.includes('闀�') || headerStr.includes('length') ||
+      headerStr === 'l' || headerStr === '闀垮害') {
+      headerMap.length = index
     }
     // 鍘氬害
     else if (headerStr.includes('鍘�') || headerStr.includes('thickness') ||
@@ -566,18 +566,29 @@
       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
+    }
   })
 
   // 濡傛灉娌℃湁鎵惧埌琛ㄥご锛屽皾璇曚娇鐢ㄧ涓�琛屼綔涓鸿〃澶达紙绱㈠紩鏂瑰紡锛�
   if (Object.keys(headerMap).length === 0 && jsonData.length > 1) {
-    // 榛樿鏍煎紡锛氱幓鐠僆D, 瀹�, 楂�, 鍘�, 鏁伴噺锛堟寜鍒楅『搴忥級
+    // 榛樿鏍煎紡锛氱幓鐠僆D, 瀹�, 闀�, 鍘�, 鏁伴噺锛堟寜鍒楅『搴忥級
     headerMap.glassId = 0
     headerMap.width = 1
-    headerMap.height = 2
+    headerMap.length = 2
     headerMap.thickness = 3
     headerMap.quantity = 4
   }
 
+  const padTwoZero = (num) => num.toString().padStart(2, '0')
   // 瑙f瀽鏁版嵁琛�
   const result = []
   for (let i = 1; i < jsonData.length; i++) {
@@ -586,16 +597,18 @@
 
     const glassId = row[headerMap.glassId] ? String(row[headerMap.glassId]).trim() : ''
     const width = row[headerMap.width] ? String(row[headerMap.width]).trim() : ''
-    const height = row[headerMap.height] ? String(row[headerMap.height]).trim() : ''
+    const length = row[headerMap.length] ? String(row[headerMap.length]).trim() : ''
     const thickness = row[headerMap.thickness] ? String(row[headerMap.thickness]).trim() : ''
     const quantity = row[headerMap.quantity] ? String(row[headerMap.quantity]).trim() : ''
     const filmsId = row[headerMap.filmsId] ? String(row[headerMap.filmsId]).trim() : ''
     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 && !height && !thickness && !quantity) {
+    if (!glassId && !width && !length && !thickness && !quantity) {
       continue
     }
 
@@ -612,22 +625,26 @@
       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,
         width: parseNumber(width),
-        height: parseNumber(height),
+        length: parseNumber(length),
         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