Browse Source

2025-12-12

过站采集-》车间工作平台->创建分卷-》异常截卷功能
master
fengyuan_yang 1 month ago
parent
commit
fa6b1b8ada
  1. 11
      src/api/yieldReport/com_separate_roll.js
  2. 198
      src/views/modules/yieldReport/com_separate_roll.vue

11
src/api/yieldReport/com_separate_roll.js

@ -37,3 +37,14 @@ export const markShiftChangeAsProcessed = data => createAPI('schedule/shiftChang
// 校验数据条数 // 校验数据条数
export const validateShiftChangeDataCount = data => createAPI('schedule/shiftChange/validateDataCount', 'POST', data) export const validateShiftChangeDataCount = data => createAPI('schedule/shiftChange/validateDataCount', 'POST', data)
// ==================== 异常截卷相关接口 ====================
// 保存异常截卷数据
export const saveAbnormalRollData = data => createAPI('schedule/abnormalRoll/saveAbnormalRollData', 'POST', data)
// 查询未处理的异常截卷数据
export const getUnprocessedAbnormalRollData = data => createAPI('schedule/abnormalRoll/getUnprocessedData', 'POST', data)
// 更新异常截卷数据为已处理
export const markAbnormalRollAsProcessed = data => createAPI('schedule/abnormalRoll/markAsProcessed', 'POST', data)

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

@ -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);
// // // //

Loading…
Cancel
Save