| | |
| | | }, |
| | | |
| | | { |
| | | field: 'building_number', |
| | | field: 'buildingNumber', |
| | | title: t('order.buildingNumber'), |
| | | sortable: true, |
| | | filters: [{data: ''}], |
| | |
| | | form.productionId = productionId |
| | | request.post(`/processCard/processCardAutoRack`,form).then(res => { |
| | | xGridLeft.value.reloadData(res.data.orderDetailList) |
| | | console.log(res.data.orderDetailList) |
| | | xGrid.value.reloadData(res.data.orderDetailsNotScope) |
| | | }) |
| | | }, |
| | |
| | | const leftDataList = $gridLeft.getTableData().fullData |
| | | const baseProcessId = productionId // 固定前缀 |
| | | |
| | | // 工具:取ID末尾数字(没有数字则返回极大值,防止相减 NaN/错序) |
| | | // 取ID末尾数字(没有数字则返回极大值,防止相减 NaN/错序) |
| | | const tailNum = (id) => { |
| | | const m = String(id ?? '').match(/(\d+)$/) |
| | | return m ? parseInt(m[1], 10) : Number.MAX_SAFE_INTEGER |
| | | } |
| | | |
| | | // 1) 先按原 processId 分组 |
| | | // 先按原 processId 分组 |
| | | const groupedByOld = leftDataList.reduce((acc, row) => { |
| | | const pid = row.processId |
| | | if (!acc[pid]) acc[pid] = [] |
| | |
| | | return acc |
| | | }, {}) |
| | | |
| | | // 2) 拿到去重后的旧 processId 列表,并按“末尾数字”正序(小到大)排列 |
| | | // 拿到去重后的旧 processId 列表,并按“末尾数字”正序(小到大)排列 |
| | | const oldIds = Object.keys(groupedByOld).sort((a, b) => { |
| | | const da = tailNum(a) |
| | | const db = tailNum(b) |
| | |
| | | return String(a).localeCompare(String(b)) |
| | | }) |
| | | |
| | | // 3) 构建从旧 processId -> 新 processId 的映射:001, 002, ... 正序递增 |
| | | // 构建从旧 processId -> 新 processId 的映射:001, 002, ... 正序递增 |
| | | const pidMap = new Map() |
| | | oldIds.forEach((oldId, idx) => { |
| | | const newPid = `${baseProcessId}${String(idx + 1).padStart(3, '0')}` |
| | | pidMap.set(oldId, newPid) |
| | | }) |
| | | |
| | | // 4) 应用映射,并设置 landingSequence:同组同序号,且从 1 开始递增 |
| | | |
| | | oldIds.forEach((oldId, idx) => { |
| | | const group = groupedByOld[oldId] |
| | | const newPid = pidMap.get(oldId) |
| | |
| | | // (plain.computeGrossArea || 0) - (plain.width * plain.height * qtyToMove) / 1000000 |
| | | // ).toFixed(2) |
| | | } |
| | | $gridLeft.insertAt(newRow, -1) // ✅ 永远插到表尾 |
| | | $gridLeft.insertAt(newRow, -1) // 永远插到表尾 |
| | | } |
| | | } |
| | | |
| | |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'saveFlowCard': { |
| | | |
| | | gridLeftOptions.toolbarConfig.buttons[0].disabled=true |
| | | const $table = xGridLeft.value |
| | | const $tableRight = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | // const selectRight = $tableRight.getCheckboxRecords() |
| | | let leftData = $tableRight.getTableData().fullData |
| | | // if (selectRecords.length === 0) { |
| | | // ElMessage.warning(t('processCard.pleaseSelectTheSavedDataFirst')) |
| | | // gridLeftOptions.toolbarConfig.buttons[0].disabled=false |
| | | // return |
| | | // } |
| | | |
| | | let data = $table.getTableData().fullData |
| | | if (leftData.length > 0) { |
| | | ElMessage.warning(t('processCard.pleaseFirstCreateAProcessCardForAllTheDataOnTheRightSideAndSaveIt')) |
| | |
| | | gridLeftOptions.toolbarConfig.buttons[0].disabled = false; |
| | | return; |
| | | } |
| | | // if (leftData.length!=selectRecords.length){ |
| | | // ElMessage.warning('请勾选所有数据进行保存') |
| | | // gridLeftOptions.toolbarConfig.buttons[0].disabled=false |
| | | // return; |
| | | // } |
| | | gridOptions.loading=true |
| | | gridLeftOptions.loading=true |
| | | let flowCardData = ref({ |
| | | flowCard: data, |
| | | userName: username, |
| | |
| | | request.post(`/processCard/addFlowCard/${orderId}`, flowCardData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | //router.push('/main/processCard/SplittingDetails?orderId=${orderId}') |
| | | router.push({ |
| | | path: '/main/processCard/AddProcessCard', |
| | | query: {orderId: orderId, productionId: productionId, random: Math.random()} |
| | | }) |
| | | |
| | | //location.reload(); |
| | | gridOptions.loading=false |
| | | gridLeftOptions.loading=false |
| | | } else { |
| | | gridOptions.loading=false |
| | | gridLeftOptions.loading=false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |