|
|
@ -122,6 +122,7 @@ |
|
|
<span slot="footer" class="dialog-footer"> |
|
|
<span slot="footer" class="dialog-footer"> |
|
|
<el-button type="primary" @click="checkCreateSeparateRolllBun">产量报告</el-button> |
|
|
<el-button type="primary" @click="checkCreateSeparateRolllBun">产量报告</el-button> |
|
|
<el-button type="success" @click="saveShiftChangeTransfer">换班结转</el-button> |
|
|
<el-button type="success" @click="saveShiftChangeTransfer">换班结转</el-button> |
|
|
|
|
|
<el-button type="warning" @click="executeAbnormalRollCut">异常截卷</el-button> |
|
|
<el-button @click="closeDialog">{{ buttons.closeButton }}</el-button> |
|
|
<el-button @click="closeDialog">{{ buttons.closeButton }}</el-button> |
|
|
</span> |
|
|
</span> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
@ -230,6 +231,7 @@ |
|
|
saveShiftChangeData,/*保存换班结转数据*/ |
|
|
saveShiftChangeData,/*保存换班结转数据*/ |
|
|
markShiftChangeAsProcessed,/*更新换班结转数据为已处理*/ |
|
|
markShiftChangeAsProcessed,/*更新换班结转数据为已处理*/ |
|
|
validateShiftChangeDataCount,/*校验数据条数*/ |
|
|
validateShiftChangeDataCount,/*校验数据条数*/ |
|
|
|
|
|
saveAbnormalRollData,/*保存异常截卷数据*/ |
|
|
} from '@/api/yieldReport/com_separate_roll.js'; |
|
|
} from '@/api/yieldReport/com_separate_roll.js'; |
|
|
|
|
|
|
|
|
/*打印标签专用的js*/ |
|
|
/*打印标签专用的js*/ |
|
|
@ -332,6 +334,7 @@ export default { |
|
|
saveLoading: false, // 保存loading状态 |
|
|
saveLoading: false, // 保存loading状态 |
|
|
hasCachedData: false, // 是否有缓存数据 |
|
|
hasCachedData: false, // 是否有缓存数据 |
|
|
cachedDataCount: 0, // 缓存数据条数 |
|
|
cachedDataCount: 0, // 缓存数据条数 |
|
|
|
|
|
cachedRowDataList: [], // 缓存的原始行数据(用于校验) |
|
|
isLoadingCachedData: false, // 是否正在加载缓存数据(防止触发handleRowCountChange) |
|
|
isLoadingCachedData: false, // 是否正在加载缓存数据(防止触发handleRowCountChange) |
|
|
buttons: { |
|
|
buttons: { |
|
|
confirmButton: '确定', |
|
|
confirmButton: '确定', |
|
|
@ -477,6 +480,7 @@ export default { |
|
|
// 重置缓存数据标记 |
|
|
// 重置缓存数据标记 |
|
|
this.hasCachedData = false; |
|
|
this.hasCachedData = false; |
|
|
this.cachedDataCount = 0; |
|
|
this.cachedDataCount = 0; |
|
|
|
|
|
this.cachedRowDataList = []; // 重置缓存的原始行数据 |
|
|
// 清空行数据列表 |
|
|
// 清空行数据列表 |
|
|
this.rowDataList = []; |
|
|
this.rowDataList = []; |
|
|
//判断是否启用多语言 |
|
|
//判断是否启用多语言 |
|
|
@ -542,6 +546,9 @@ export default { |
|
|
remark: item.remark || '' |
|
|
remark: item.remark || '' |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
// 保存缓存的原始数据(用于产量报告时校验) |
|
|
|
|
|
this.cachedRowDataList = JSON.parse(JSON.stringify(this.rowDataList)); |
|
|
|
|
|
|
|
|
console.log('恢复后的行数据:', this.rowDataList); |
|
|
console.log('恢复后的行数据:', this.rowDataList); |
|
|
|
|
|
|
|
|
this.$message.info(`已加载上次换班结转的缓存数据(${this.cachedDataCount}条)`); |
|
|
this.$message.info(`已加载上次换班结转的缓存数据(${this.cachedDataCount}条)`); |
|
|
@ -715,6 +722,171 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 异常截卷操作(产量报告 + 换班结转) |
|
|
|
|
|
async executeAbnormalRollCut() { |
|
|
|
|
|
// 人员判断 |
|
|
|
|
|
if (this.pageData.operatorId === '' || this.pageData.operatorId == null) { |
|
|
|
|
|
this.$message.error(this.labels.pleaseSwitchOperator); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 基础校验 |
|
|
|
|
|
if (this.pageData.rowCount <= 0) { |
|
|
|
|
|
this.$message.warning('请输入有效的排数'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.pageData.rollCount <= 0) { |
|
|
|
|
|
this.$message.warning('请输入有效的卷数'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.pageData.rollCount > this.pageData.rowCount) { |
|
|
|
|
|
this.$message.warning('卷数不能大于排数'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证排数据 |
|
|
|
|
|
if (!this.validateRowData()) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 确认框 |
|
|
|
|
|
try { |
|
|
|
|
|
await this.$confirm('确定执行异常截卷操作吗?该操作将执行产量报告(不打印)并保存缓存数据。', '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}); |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return false; // 用户取消 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// ========== 第一步:执行产量报告(不打印)========== |
|
|
|
|
|
// 计算分卷 |
|
|
|
|
|
const rowsPerRoll = Math.floor(this.pageData.rowCount / this.pageData.rollCount); |
|
|
|
|
|
const remainingRows = this.pageData.rowCount % this.pageData.rollCount; |
|
|
|
|
|
|
|
|
|
|
|
let currentRowIndex = 0; |
|
|
|
|
|
let newRollNo = ''; // 用于保存产量报告返回的新卷号 |
|
|
|
|
|
|
|
|
|
|
|
// 循环创建每一卷 |
|
|
|
|
|
for (let rollIndex = 0; rollIndex < this.pageData.rollCount; rollIndex++) { |
|
|
|
|
|
const currentRollRows = rowsPerRoll + (rollIndex < remainingRows ? 1 : 0); |
|
|
|
|
|
|
|
|
|
|
|
// 计算当前卷的良品和不良总数 |
|
|
|
|
|
let totalGoodQty = 0; |
|
|
|
|
|
let totalDefectQty = 0; |
|
|
|
|
|
const rollRows = []; |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前卷的备注 |
|
|
|
|
|
let rollRemark = ''; |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < currentRollRows; i++) { |
|
|
|
|
|
const row = this.rowDataList[currentRowIndex + i]; |
|
|
|
|
|
totalGoodQty += row.goodQty || 0; |
|
|
|
|
|
totalDefectQty += row.defectQty || 0; |
|
|
|
|
|
|
|
|
|
|
|
if (i === 0) { |
|
|
|
|
|
rollRemark = row.remark || ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rollRows.push({ |
|
|
|
|
|
rowNumber: row.rowNumber, |
|
|
|
|
|
goodQty: row.goodQty || 0, |
|
|
|
|
|
surfaceLossQty: row.surfaceLossQty || 0, |
|
|
|
|
|
poorPerformanceQty: row.poorPerformanceQty || 0, |
|
|
|
|
|
defectQty: row.defectQty || 0, |
|
|
|
|
|
totalQty: row.totalQty || 0, |
|
|
|
|
|
remark: row.remark || '' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 构建请求数据 |
|
|
|
|
|
const requestData = { |
|
|
|
|
|
...this.pageData, |
|
|
|
|
|
rollQty: totalGoodQty, |
|
|
|
|
|
rollNums: 1, |
|
|
|
|
|
totalDefectQty: totalDefectQty, |
|
|
|
|
|
rollRows: rollRows, |
|
|
|
|
|
remark: rollRemark |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 调用后端创建单个卷 |
|
|
|
|
|
const {data} = await createSplitSfdcRoll(requestData); |
|
|
|
|
|
|
|
|
|
|
|
if (data.code === 500) { |
|
|
|
|
|
throw new Error(data.msg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 保存返回的新卷号(取最后一个卷的卷号) |
|
|
|
|
|
if (data.printList && data.printList.length > 0) { |
|
|
|
|
|
newRollNo = data.printList[0].rollNo || ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$message.success(`第${rollIndex + 1}/${this.pageData.rollCount}卷创建成功`); |
|
|
|
|
|
|
|
|
|
|
|
currentRowIndex += currentRollRows; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果有换班结转缓存数据,标记为已处理 |
|
|
|
|
|
if (this.hasCachedData) { |
|
|
|
|
|
try { |
|
|
|
|
|
await markShiftChangeAsProcessed({ |
|
|
|
|
|
site: this.scheduleData.site, |
|
|
|
|
|
orderNo: this.scheduleData.orderNo, |
|
|
|
|
|
seqNo: parseInt(this.scheduleData.seqNo) || 0, |
|
|
|
|
|
processedBy: this.pageData.operatorId |
|
|
|
|
|
}); |
|
|
|
|
|
this.hasCachedData = false; |
|
|
|
|
|
this.cachedDataCount = 0; |
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
console.error('标记换班结转数据为已处理失败:', err); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ========== 第二步:保存异常截卷缓存数据 ========== |
|
|
|
|
|
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('异常截卷操作完成!数据已保存。'); |
|
|
|
|
|
// 延时关闭弹窗 |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.closeDialog(); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(abnormalData.msg || '异常截卷缓存数据保存失败'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('异常截卷操作失败:', error); |
|
|
|
|
|
this.$message.error('异常截卷操作失败:' + error.message); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 表格合并行方法(备注列根据卷数合并) |
|
|
// 表格合并行方法(备注列根据卷数合并) |
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) { |
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) { |
|
|
// 只对备注列进行合并(最后一列) |
|
|
// 只对备注列进行合并(最后一列) |
|
|
@ -999,6 +1171,32 @@ export default { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果有缓存数据,校验缓存中带过来的数据的良品数、面损、性能不良不能小于缓存中的数据 |
|
|
|
|
|
if (this.hasCachedData && this.cachedRowDataList.length > 0) { |
|
|
|
|
|
for (let i = 0; i < this.cachedRowDataList.length; i++) { |
|
|
|
|
|
const cachedRow = this.cachedRowDataList[i]; |
|
|
|
|
|
const currentRow = this.rowDataList[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (currentRow) { |
|
|
|
|
|
// 校验良品数不能小于缓存值 |
|
|
|
|
|
if ((currentRow.goodQty || 0) < (cachedRow.goodQty || 0)) { |
|
|
|
|
|
this.$message.error(`第${i + 1}排的良品数量(${currentRow.goodQty})不能小于缓存值(${cachedRow.goodQty})`); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
// 校验面损数量不能小于缓存值 |
|
|
|
|
|
if ((currentRow.surfaceLossQty || 0) < (cachedRow.surfaceLossQty || 0)) { |
|
|
|
|
|
this.$message.error(`第${i + 1}排的面损数量(${currentRow.surfaceLossQty})不能小于缓存值(${cachedRow.surfaceLossQty})`); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
// 校验性能不良数量不能小于缓存值 |
|
|
|
|
|
if ((currentRow.poorPerformanceQty || 0) < (cachedRow.poorPerformanceQty || 0)) { |
|
|
|
|
|
this.$message.error(`第${i + 1}排的性能不良数量(${currentRow.poorPerformanceQty})不能小于缓存值(${cachedRow.poorPerformanceQty})`); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// //获取当前是的数量 |
|
|
// //获取当前是的数量 |
|
|
// let rollQty = parseFloat(this.pageData.rollQty); |
|
|
// let rollQty = parseFloat(this.pageData.rollQty); |
|
|
// //判断是否可以修改 |
|
|
// //判断是否可以修改 |
|
|
|