huang
3 天以前 9c489617b002e71859597097c9d1d2f1b9fc0e56
mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
@@ -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') ||
@@ -570,14 +570,15 @@
  // 如果没有找到表头,尝试使用第一行作为表头(索引方式)
  if (Object.keys(headerMap).length === 0 && jsonData.length > 1) {
    // 默认格式:玻璃ID, 宽, 高, 厚, 数量(按列顺序)
    // 默认格式:玻璃ID, 宽, 长, 厚, 数量(按列顺序)
    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')
  // 解析数据行
  const result = []
  for (let i = 1; i < jsonData.length; i++) {
@@ -586,7 +587,7 @@
    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() : ''
@@ -595,7 +596,7 @@
    const customerName = row[headerMap.customerName] ? String(row[headerMap.customerName]).trim() : ''
    // 跳过空行
    if (!glassId && !width && !height && !thickness && !quantity) {
    if (!glassId && !width && !length && !thickness && !quantity) {
      continue
    }
@@ -616,12 +617,12 @@
    const qty = parseInt(quantity) || 1
    for (let j = 0; j < qty; j++) {
      // 如果数量大于1,为每条记录生成唯一的玻璃ID(追加序号)
      const finalGlassId = qty > 1 ? `${glassId}${j + 1}` : glassId
      const finalGlassId = qty > 1 ? `${glassId}${padTwoZero(j + 1)}` : glassId
      result.push({
        glassId: finalGlassId,
        width: parseNumber(width),
        height: parseNumber(height),
        length: parseNumber(length),
        thickness: parseNumber(thickness),
        quantity: '1', // 每条记录数量为1
        filmsId: filmsId,