Browse Source

2025-12-15

过站采集-》车间工作平台->异常截卷增加打印
master
fengyuan_yang 10 months ago
parent
commit
91eff371b5
  1. 8
      src/views/modules/yieldReport/com_abnormal_continue_roll.vue
  2. 47
      src/views/modules/yieldReport/com_separate_roll.vue

8
src/views/modules/yieldReport/com_abnormal_continue_roll.vue

@ -15,9 +15,9 @@
max-height="150"
@row-dblclick="selectRollNo"
highlight-current-row>
<el-table-column prop="currentRollNo" label="当前卷号" align="center" min-width="200">
<el-table-column prop="currentRollNo" label="主卷号" align="center" min-width="200">
</el-table-column>
<el-table-column prop="newRollNo" label="新卷号" align="center" min-width="200">
<el-table-column prop="newRollNo" label="分卷卷号" align="center" min-width="200">
</el-table-column>
</el-table>
</div>
@ -27,12 +27,12 @@
<!-- 卷信息行 -->
<el-row>
<el-col :span="12">
<el-form-item label="当前卷号">
<el-form-item label="主卷号">
<el-input v-model="selectedRollNo.currentRollNo" readonly style="width: 200px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="新卷号">
<el-form-item label="分卷卷号">
<el-input v-model="selectedRollNo.newRollNo" readonly style="width: 200px;"></el-input>
</el-form-item>
</el-col>

47
src/views/modules/yieldReport/com_separate_roll.vue

@ -456,7 +456,7 @@ export default {
async init(scheduleData, operatorData) {
// 设置标记,防止初始化过程中触发handleRowCountChange
this.isLoadingCachedData = true;
//初始化参数
this.scheduleData = scheduleData;
//初始化操作员对象
@ -490,15 +490,15 @@ export default {
this.$refs.rollQty && this.$refs.rollQty.focus();
});
this.titleCon = this.labels.componentTitle;//重置标题
// 查询是否有缓存的换班结转数据(等待完成)
await this.loadCachedShiftChangeData();
// 如果没有缓存数据,初始化空白行
if (!this.hasCachedData) {
this.initRowDataList();
}
// 取消标记
this.isLoadingCachedData = false;
},
@ -511,29 +511,29 @@ export default {
orderNo: this.scheduleData.orderNo,
seqNo: parseInt(this.scheduleData.seqNo) || 0
};
console.log('查询缓存数据参数:', params);
const {data} = await getUnprocessedShiftChangeData(params);
console.log('查询缓存数据结果:', data);
if (data && data.code === 0 && data.data && data.data.length > 0) {
// 有缓存数据,恢复到界面
this.hasCachedData = true;
this.cachedDataCount = data.count;
const cachedList = data.data;
console.log('缓存数据列表:', cachedList);
// 恢复排数和卷数
if (cachedList.length > 0) {
this.pageData.rowCount = cachedList[0].rowCount || 0;
this.pageData.rollCount = cachedList[0].rollCount || 0;
this.pageData.fixture = cachedList[0].fixtureNo || '';
}
// 恢复行数据列表
this.rowDataList = cachedList.map(item => ({
rowNumber: item.rowBumber,
@ -545,12 +545,12 @@ export default {
totalQty: (Number(item.goodQty) || 0) + (Number(item.defectQty) || 0),
remark: item.remark || ''
}));
// 保存缓存的原始数据(用于产量报告时校验)
this.cachedRowDataList = JSON.parse(JSON.stringify(this.rowDataList));
console.log('恢复后的行数据:', this.rowDataList);
this.$message.info(`已加载上次换班结转的缓存数据(${this.cachedDataCount}条)`);
}
// 如果没有缓存数据,不做任何处理,由init方法负责初始化
@ -559,7 +559,7 @@ export default {
// 加载失败时不做处理,由init方法负责初始化
}
},
// 计算良率
calculateYieldRate(goodQty, defectQty) {
const totalQty = goodQty + defectQty;
@ -751,7 +751,7 @@ export default {
// 确认框
try {
await this.$confirm('确定执行异常截卷操作吗?该操作将执行产量报告(不打印)并保存缓存数据。', '提示', {
await this.$confirm('确定执行异常截卷操作吗?该操作将执行产量报告。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@ -761,13 +761,14 @@ 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 = []; // 收集所有打印数据
// 循环创建每一卷
for (let rollIndex = 0; rollIndex < this.pageData.rollCount; rollIndex++) {
@ -821,6 +822,8 @@ export default {
// 保存返回的新卷号(取最后一个卷的卷号)
if (data.printList && data.printList.length > 0) {
newRollNo = data.printList[0].rollNo || '';
// 收集打印数据
allPrintList.push(...data.printList);
}
this.$message.success(`第${rollIndex + 1}/${this.pageData.rollCount}卷创建成功`);
@ -873,6 +876,12 @@ export default {
if (abnormalData && abnormalData.code === 0) {
this.$message.success('异常截卷操作完成!数据已保存。');
// ========== 第三步:打印标签(和产量报告一样)==========
if (allPrintList.length > 0) {
await this.printLabelsWithTemplate(allPrintList);
}
// 延时关闭弹窗
setTimeout(() => {
this.closeDialog();
@ -1176,7 +1185,7 @@ export default {
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)) {

Loading…
Cancel
Save