diff --git a/src/views/modules/yieldReport/com_abnormal_continue_roll.vue b/src/views/modules/yieldReport/com_abnormal_continue_roll.vue index 981e6ad..2913bf2 100644 --- a/src/views/modules/yieldReport/com_abnormal_continue_roll.vue +++ b/src/views/modules/yieldReport/com_abnormal_continue_roll.vue @@ -13,7 +13,7 @@ border style="width: 100%; margin-top: 10px;" max-height="150" - @row-dblclick="selectRollNo" + @row-click="selectRollNo" highlight-current-row> diff --git a/src/views/modules/yieldReport/com_separate_roll.vue b/src/views/modules/yieldReport/com_separate_roll.vue index b5141b8..ed198f9 100644 --- a/src/views/modules/yieldReport/com_separate_roll.vue +++ b/src/views/modules/yieldReport/com_separate_roll.vue @@ -761,13 +761,12 @@ export default { } try { - // ========== 第一步:执行产量报告 ========== + // ========== 第一步:执行产量报告 + 保存缓存数据 ========== // 计算分卷 const rowsPerRoll = Math.floor(this.pageData.rowCount / this.pageData.rollCount); const remainingRows = this.pageData.rowCount % this.pageData.rollCount; let currentRowIndex = 0; - let newRollNo = ''; // 用于保存产量报告返回的新卷号 const allPrintList = []; // 收集所有打印数据 // 循环创建每一卷 @@ -782,6 +781,9 @@ export default { // 获取当前卷的备注 let rollRemark = ''; + // 收集当前卷的行数据 + const currentRollRowDataList = []; + for (let i = 0; i < currentRollRows; i++) { const row = this.rowDataList[currentRowIndex + i]; totalGoodQty += row.goodQty || 0; @@ -800,6 +802,16 @@ export default { totalQty: row.totalQty || 0, remark: row.remark || '' }); + + // 收集当前卷的行数据用于保存缓存 + currentRollRowDataList.push({ + rowNumber: row.rowNumber, + goodQty: row.goodQty || 0, + surfaceLossQty: row.surfaceLossQty || 0, + poorPerformanceQty: row.poorPerformanceQty || 0, + defectQty: row.defectQty || 0, + remark: row.remark || '' + }); } // 构建请求数据 @@ -819,13 +831,36 @@ export default { throw new Error(data.msg); } - // 保存返回的新卷号(取最后一个卷的卷号) + // 获取当前卷返回的新卷号 + let currentNewRollNo = ''; if (data.printList && data.printList.length > 0) { - newRollNo = data.printList[0].rollNo || ''; + currentNewRollNo = data.printList[0].rollNo || ''; // 收集打印数据 allPrintList.push(...data.printList); } + const abnormalRollData = { + site: this.scheduleData.site, + buNo: this.scheduleData.buNo, + orderNo: this.scheduleData.orderNo, + seqNo: parseInt(this.scheduleData.seqNo) || 0, + fixtureNo: this.pageData.fixture, + shiftFrom: this.scheduleData.shiftNo || '', + rowCount: currentRollRows, + rollCount: 1, + createdBy: this.pageData.operatorId, + currentRollNo: this.scheduleData.rollNo || '', + newRollNo: currentNewRollNo, + operatorId: this.pageData.operatorId, + rowDataList: currentRollRowDataList + }; + + const {data: abnormalData} = await saveAbnormalRollData(abnormalRollData); + + if (!abnormalData || abnormalData.code !== 0) { + console.error(`第${rollIndex + 1}卷缓存数据保存失败:`, abnormalData && abnormalData.msg); + } + this.$message.success(`第${rollIndex + 1}/${this.pageData.rollCount}卷创建成功`); currentRowIndex += currentRollRows; @@ -847,49 +882,18 @@ export default { } } - // ========== 第二步:保存异常截卷缓存数据 ========== - const abnormalRollData = { - site: this.scheduleData.site, - buNo: this.scheduleData.buNo, - orderNo: this.scheduleData.orderNo, - seqNo: parseInt(this.scheduleData.seqNo) || 0, - fixtureNo: this.pageData.fixture, - shiftFrom: this.scheduleData.shiftNo || '', - rowCount: this.pageData.rowCount, - rollCount: this.pageData.rollCount, - createdBy: this.pageData.operatorId, - // 新增字段 - currentRollNo: this.scheduleData.rollNo || '', // 当前卷号(机台工作台的当前卷号) - newRollNo: newRollNo, // 新卷号(产量报告返回的卷号) - operatorId: this.pageData.operatorId, // 操作人 - rowDataList: this.rowDataList.map(row => ({ - rowNumber: row.rowNumber, - goodQty: row.goodQty || 0, - surfaceLossQty: row.surfaceLossQty || 0, - poorPerformanceQty: row.poorPerformanceQty || 0, - defectQty: row.defectQty || 0, - remark: row.remark || '' - })) - }; + this.$message.success('异常截卷操作完成!数据已保存。'); - const {data: abnormalData} = await saveAbnormalRollData(abnormalRollData); - - if (abnormalData && abnormalData.code === 0) { - this.$message.success('异常截卷操作完成!数据已保存。'); - - // ========== 第三步:打印标签(和产量报告一样)========== - if (allPrintList.length > 0) { - await this.printLabelsWithTemplate(allPrintList); - } - - // 延时关闭弹窗 - setTimeout(() => { - this.closeDialog(); - }, 1000); - } else { - this.$message.error(abnormalData.msg || '异常截卷缓存数据保存失败'); + // ========== 第二步:打印标签(和产量报告一样)========== + if (allPrintList.length > 0) { + await this.printLabelsWithTemplate(allPrintList); } + // 延时关闭弹窗 + setTimeout(() => { + this.closeDialog(); + }, 1000); + } catch (error) { console.error('异常截卷操作失败:', error); this.$message.error('异常截卷操作失败:' + error.message);