|
|
|
@ -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,37 +882,9 @@ 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 || '' |
|
|
|
})) |
|
|
|
}; |
|
|
|
|
|
|
|
const {data: abnormalData} = await saveAbnormalRollData(abnormalRollData); |
|
|
|
|
|
|
|
if (abnormalData && abnormalData.code === 0) { |
|
|
|
this.$message.success('异常截卷操作完成!数据已保存。'); |
|
|
|
|
|
|
|
// ========== 第三步:打印标签(和产量报告一样)========== |
|
|
|
// ========== 第二步:打印标签(和产量报告一样)========== |
|
|
|
if (allPrintList.length > 0) { |
|
|
|
await this.printLabelsWithTemplate(allPrintList); |
|
|
|
} |
|
|
|
@ -886,9 +893,6 @@ export default { |
|
|
|
setTimeout(() => { |
|
|
|
this.closeDialog(); |
|
|
|
}, 1000); |
|
|
|
} else { |
|
|
|
this.$message.error(abnormalData.msg || '异常截卷缓存数据保存失败'); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('异常截卷操作失败:', error); |
|
|
|
|