Browse Source

2026-07-15

异常规则配置
master
fengyuan_yang 2 weeks ago
parent
commit
bb609a33a6
  1. 6
      src/api/yieldReport/com_separate_roll.js
  2. 53
      src/views/modules/yieldReport/com_produce_report_normal.vue
  3. 222
      src/views/modules/yieldReport/com_separate_roll.vue

6
src/api/yieldReport/com_separate_roll.js

@ -6,6 +6,12 @@ export const checkCreateSplitSfdcRoll = data => createAPI('schedule/checkCreateS
// 创建分卷前异常规则校验 // 创建分卷前异常规则校验
export const checkSplitRollExceptionRule = data => createAPI('schedule/checkSplitRollExceptionRule', 'POST', data) export const checkSplitRollExceptionRule = data => createAPI('schedule/checkSplitRollExceptionRule', 'POST', data)
// 查询创建分卷异常规则锁定状态
export const getSplitRuleLockStatus = data => createAPI('schedule/getSplitRuleLockStatus', 'POST', data)
// 创建分卷放行后回写操作标识
export const completeSplitRuleTodoOperation = data => createAPI('schedule/completeSplitRuleTodoOperation', 'POST', data)
// 执行创建分卷的操作 // 执行创建分卷的操作
export const createSplitSfdcRoll = data => createAPI('schedule/createSplitSfdcRoll', 'POST', data) export const createSplitSfdcRoll = data => createAPI('schedule/createSplitSfdcRoll', 'POST', data)

53
src/views/modules/yieldReport/com_produce_report_normal.vue

@ -700,7 +700,8 @@
@refreshPageData="refreshPageData" @refreshPageData="refreshPageData"
@openDefectByExceptionRule="onSeparateRuleOpenDefect" @openDefectByExceptionRule="onSeparateRuleOpenDefect"
@openDownTimeByExceptionRule="onSeparateRuleOpenDownTime" @openDownTimeByExceptionRule="onSeparateRuleOpenDownTime"
@lockPageByExceptionRule="onSeparateRuleLockPage">
@lockPageByExceptionRule="onSeparateRuleLockPage"
@unlockPageByExceptionRule="onSeparateRuleUnlockPage">
</comSeparateRoll> </comSeparateRoll>
@ -1011,6 +1012,9 @@ import {
import { import {
getUserSpecialSecurity, getUserSpecialSecurity,
} from '@/api/yieldReport/produce_order.js' } from '@/api/yieldReport/produce_order.js'
import {
getSplitRuleLockStatus
} from '@/api/yieldReport/com_separate_roll.js'
import { sopListSearch, downloadSopFile } from '@/api/qc/qc.js' import { sopListSearch, downloadSopFile } from '@/api/qc/qc.js'
/*打印标签专用的js*/ /*打印标签专用的js*/
import { import {
@ -4656,6 +4660,7 @@ export default {
// //
async refreshPageButtons() { async refreshPageButtons() {
await this.syncSeparateRuleForceLockStatus()
if (this.exceptionRuleForceLock) { if (this.exceptionRuleForceLock) {
this.lockWorkbenchButtonsByRule() this.lockWorkbenchButtonsByRule()
return return
@ -4783,6 +4788,32 @@ export default {
this.checkProcessInspectionPendingCount(); this.checkProcessInspectionPendingCount();
}, },
async syncSeparateRuleForceLockStatus () {
if (!this.scheduleData.site || !this.scheduleData.buNo || !this.scheduleData.orderNo || !this.scheduleData.seqNo) {
this.exceptionRuleForceLock = false
return
}
try {
const { data } = await getSplitRuleLockStatus({
site: this.scheduleData.site,
buNo: this.scheduleData.buNo,
orderNo: this.scheduleData.orderNo,
seqNo: this.scheduleData.seqNo
})
if (!data || data.code === 500) {
return
}
const resultMap = data.resultMap || {}
const wasLocked = this.exceptionRuleForceLock
this.exceptionRuleForceLock = !!resultMap.locked
if (wasLocked && !this.exceptionRuleForceLock && resultMap.bypassByAudit) {
this.$message.success('QC已审核,已解除锁定,可继续操作。')
}
} catch (error) {
console.error('同步创建分卷规则锁定状态失败:', error)
}
},
// //
initOperatorData(operatorData) { initOperatorData(operatorData) {
this.showOperatorFlag = false; this.showOperatorFlag = false;
@ -4901,13 +4932,23 @@ export default {
}, },
onSeparateRuleLockPage (resultMap) { onSeparateRuleLockPage (resultMap) {
this.showSeparateFlag = false
const wasLocked = this.exceptionRuleForceLock
this.exceptionRuleForceLock = true this.exceptionRuleForceLock = true
this.lockWorkbenchButtonsByRule() this.lockWorkbenchButtonsByRule()
this.$alert((resultMap && resultMap.message) || '触发强制异常规则,当前页面已锁定。', '提示', {
confirmButtonText: '确定',
type: 'warning'
})
if (!wasLocked) {
this.$alert((resultMap && resultMap.message) || '触发强制异常规则,当前页面已锁定。', '提示', {
confirmButtonText: '确定',
type: 'warning'
})
}
},
onSeparateRuleUnlockPage () {
if (!this.exceptionRuleForceLock) {
return
}
this.exceptionRuleForceLock = false
this.refreshPageButtons()
}, },
/*创建分卷的modal调用*/ /*创建分卷的modal调用*/

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

@ -1,6 +1,6 @@
<template> <template>
<div class="customer-css"> <div class="customer-css">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" width="820px" style="height: 680px;" class="customer-dialog">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" width="820px" style="height: 680px;" class="customer-dialog" :show-close="!exceptionRuleLocked" @close="onDialogClosed">
<el-form :inline="true" label-position="top" style="height: auto;"> <el-form :inline="true" label-position="top" style="height: auto;">
<!-- 时间和固定载具 --> <!-- 时间和固定载具 -->
<el-row style="margin-top: -10px;"> <el-row style="margin-top: -10px;">
@ -143,15 +143,19 @@
</el-table> </el-table>
</div> </div>
</el-form> </el-form>
<div v-if="exceptionRuleLocked" class="exception-rule-lock-tip">
{{ exceptionRuleLockMessage }}
</div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="checkCreateSeparateRolllBun" :loading="yieldReportLoading" :disabled="exceptionRuleLocked">产量报告</el-button> <el-button type="primary" @click="checkCreateSeparateRolllBun" :loading="yieldReportLoading" :disabled="exceptionRuleLocked">产量报告</el-button>
<el-button type="success" @click="saveShiftChangeTransfer" :loading="shiftChangeLoading" :disabled="exceptionRuleLocked">换班结转</el-button> <el-button type="success" @click="saveShiftChangeTransfer" :loading="shiftChangeLoading" :disabled="exceptionRuleLocked">换班结转</el-button>
<el-button type="warning" @click="executeAbnormalRollCut" :loading="abnormalCutLoading" :disabled="exceptionRuleLocked">异常截卷</el-button> <el-button type="warning" @click="executeAbnormalRollCut" :loading="abnormalCutLoading" :disabled="exceptionRuleLocked">异常截卷</el-button>
<el-button @click="closeDialog" :disabled="exceptionRuleLocked">{{ buttons.closeButton }}</el-button> <el-button @click="closeDialog" :disabled="exceptionRuleLocked">{{ buttons.closeButton }}</el-button>
</span> </span>
<div v-if="exceptionRuleLocked" class="exception-rule-mask">
<div class="exception-rule-mask-content">
<i class="el-icon-lock" />
<div class="exception-rule-mask-message">{{ exceptionRuleLockMessage || '当前异常代办尚未审核,已锁定创建分卷操作。' }}</div>
<div class="exception-rule-mask-sub">请等待QC审核通过后继续操作</div>
</div>
</div>
</el-dialog> </el-dialog>
<!-- 分卷不良原因对话框 --> <!-- 分卷不良原因对话框 -->
@ -388,6 +392,8 @@
<script> <script>
import { import {
checkSplitRollExceptionRule,/*创建分卷前异常规则校验*/ checkSplitRollExceptionRule,/*创建分卷前异常规则校验*/
getSplitRuleLockStatus,/*查询创建分卷规则锁定状态*/
completeSplitRuleTodoOperation,/*创建分卷完成后回写代办操作标识*/
createSplitSfdcRoll,/*执行创建分卷的操作*/ createSplitSfdcRoll,/*执行创建分卷的操作*/
getFixedCarrierList,/*获取固定载具列表*/ getFixedCarrierList,/*获取固定载具列表*/
getUnprocessedShiftChangeData,/*查询未处理的换班结转数据*/ getUnprocessedShiftChangeData,/*查询未处理的换班结转数据*/
@ -546,6 +552,7 @@ export default {
cachedDataCount: 0, // cachedDataCount: 0, //
cachedRowDataList: [], // cachedRowDataList: [], //
isLoadingCachedData: false, // handleRowCountChange isLoadingCachedData: false, // handleRowCountChange
lockStatusTimer: null, //
buttons: { buttons: {
confirmButton: '确定', confirmButton: '确定',
closeButton: '关闭', closeButton: '关闭',
@ -714,6 +721,18 @@ export default {
this.initRowDataList(); this.initRowDataList();
} }
//
try {
await this.refreshSplitRuleLockStatus(false);
} catch (error) {
console.error('初始化锁定状态失败:', error);
}
if (this.exceptionRuleLocked) {
this.startSplitRuleLockPolling();
} else {
this.stopSplitRuleLockPolling();
}
// //
this.isLoadingCachedData = false; this.isLoadingCachedData = false;
}, },
@ -1354,6 +1373,7 @@ export default {
// //
const requestData = { const requestData = {
...this.pageData, ...this.pageData,
buNo: this.scheduleData.buNo,
rollQty: totalGoodQty, rollQty: totalGoodQty,
rollNums: 1, rollNums: 1,
totalDefectQty: totalDefectQty, totalDefectQty: totalDefectQty,
@ -1428,6 +1448,15 @@ export default {
await this.printLabelsWithTemplate(allPrintList); await this.printLabelsWithTemplate(allPrintList);
} }
// operate_flag=Y
try {
await this.completeSplitRuleTodoOperationIfNeeded();
await this.refreshSplitRuleLockStatus(false);
} catch (completeError) {
console.error('回写代办操作状态失败:', completeError);
this.$message.warning(completeError.message || '回写代办操作状态失败,请联系管理员检查');
}
// //
setTimeout(() => { setTimeout(() => {
this.closeDialog(); this.closeDialog();
@ -1653,12 +1682,86 @@ export default {
/*关闭modal*/ /*关闭modal*/
closeDialog(){ closeDialog(){
this.stopSplitRuleLockPolling()
// //
this.$emit('refreshPageData'); this.$emit('refreshPageData');
// //
this.$emit('update:visible', false); this.$emit('update:visible', false);
}, },
onDialogClosed () {
this.stopSplitRuleLockPolling()
},
buildSplitRuleStatusPayload () {
return {
site: this.scheduleData.site,
buNo: this.scheduleData.buNo,
orderNo: this.scheduleData.orderNo,
seqNo: this.scheduleData.seqNo
}
},
async refreshSplitRuleLockStatus (showUnlockHint) {
const payload = this.buildSplitRuleStatusPayload()
if (!payload.site || !payload.buNo || !payload.orderNo || !payload.seqNo) {
return
}
const wasLocked = this.exceptionRuleLocked
const { data } = await getSplitRuleLockStatus(payload)
if (!data || data.code === 500) {
return
}
const resultMap = data.resultMap || {}
const locked = !!resultMap.locked
this.exceptionRuleLocked = locked
if (locked) {
this.exceptionRuleLockMessage = resultMap.message || '当前异常代办尚未审核,已锁定创建分卷操作。'
if (!wasLocked) {
this.$emit('lockPageByExceptionRule', resultMap)
}
if (!this.lockStatusTimer) {
this.startSplitRuleLockPolling()
}
return
}
this.stopSplitRuleLockPolling()
this.exceptionRuleLockMessage = ''
this.$emit('unlockPageByExceptionRule', resultMap)
if (wasLocked && showUnlockHint && resultMap.bypassByAudit) {
this.$message.success('QC已审核,已解除锁定,可继续操作。')
}
},
startSplitRuleLockPolling () {
this.stopSplitRuleLockPolling()
this.lockStatusTimer = setInterval(() => {
this.refreshSplitRuleLockStatus(true).catch(err => {
console.error('轮询锁定状态失败:', err)
})
}, 10000)
},
stopSplitRuleLockPolling () {
if (this.lockStatusTimer) {
clearInterval(this.lockStatusTimer)
this.lockStatusTimer = null
}
},
async completeSplitRuleTodoOperationIfNeeded () {
const payload = this.buildSplitRuleStatusPayload()
if (!payload.site || !payload.buNo || !payload.orderNo || !payload.seqNo) {
return
}
payload.operatorId = this.pageData.operatorId
payload.functionName = this.scheduleData.functionName || ''
const { data } = await completeSplitRuleTodoOperation(payload)
if (data && data.code === 500) {
throw new Error(data.msg || '回写代办操作状态失败')
}
},
buildSplitRuleCheckPayload (actionName) { buildSplitRuleCheckPayload (actionName) {
return { return {
site: this.scheduleData.site, site: this.scheduleData.site,
@ -1694,6 +1797,12 @@ export default {
throw new Error((data && data.msg) || '异常规则校验失败') throw new Error((data && data.msg) || '异常规则校验失败')
} }
const resultMap = data.resultMap || {} const resultMap = data.resultMap || {}
if (resultMap.bypassByAudit) {
this.exceptionRuleLocked = false
this.exceptionRuleLockMessage = ''
this.stopSplitRuleLockPolling()
this.$emit('unlockPageByExceptionRule', resultMap)
}
if (!resultMap.matched) { if (!resultMap.matched) {
return true return true
} }
@ -1717,6 +1826,7 @@ export default {
this.exceptionRuleLockMessage = message this.exceptionRuleLockMessage = message
this.$message.error(message) this.$message.error(message)
this.$emit('lockPageByExceptionRule', resultMap) this.$emit('lockPageByExceptionRule', resultMap)
this.startSplitRuleLockPolling()
return false return false
} }
return true return true
@ -1783,48 +1893,9 @@ export default {
} }
} }
// //
// let rollQty = parseFloat(this.pageData.rollQty);
// //
// if (rollQty <= 0 || !Number.isInteger(rollQty)){
// this.$message.error(this.labels.approvedQtyMustMoreTanZeroAndBeInteger);
// return false;
// }
// //
// let rollNums = parseFloat(this.pageData.rollNums);
// //
// if (rollNums <= 0 || !Number.isInteger(rollNums)){
// this.$message.error(this.labels.rollQtyMustMoreTanZeroAndBeInteger);
// return false;
// }
// loading // loading
this.yieldReportLoading = true; this.yieldReportLoading = true;
// //
// checkCreateSplitSfdcRoll(this.pageData)
// .then(({data}) => {
// //
// if (data.code == 500) {
// this.$message.error(data.msg);
// this.yieldReportLoading = false;
// } else if (data.resultMap.resultCode == '201') {
// //
// this.$confirm(data.resultMap.resultMsg, '', {
// confirmButtonText: this.labels.confirmLabel,
// celButtonText: this.labels.cancelLabel,
// type: 'warning'
// }).then(() => {
// //
// this.createSeparateRolllOperation();
// }).catch(() => {
// this.yieldReportLoading = false;
// });
// } else { //
// this.createSeparateRolllOperation();
// }
// }).catch(() => {
// this.yieldReportLoading = false;
// });
this.createSeparateRolllOperation(); this.createSeparateRolllOperation();
}, },
@ -1849,7 +1920,7 @@ export default {
} }
try { try {
const passRuleCheck = await this.checkSplitRuleBeforeAction('量报告')
const passRuleCheck = await this.checkSplitRuleBeforeAction('量报告')
if (!passRuleCheck) { if (!passRuleCheck) {
this.yieldReportLoading = false this.yieldReportLoading = false
return false return false
@ -1908,6 +1979,7 @@ export default {
// rollNums1 // rollNums1
const requestData = { const requestData = {
...this.pageData, ...this.pageData,
buNo: this.scheduleData.buNo,
rollQty: totalGoodQty, // rollQty: totalGoodQty, //
rollNums: 1, // 1 rollNums: 1, // 1
defectQty: totalDefectQty, // defectQty: totalDefectQty, //
@ -1960,6 +2032,15 @@ export default {
await this.printLabelsWithTemplate(allPrintList) await this.printLabelsWithTemplate(allPrintList)
} }
// operate_flag=Y
try {
await this.completeSplitRuleTodoOperationIfNeeded()
await this.refreshSplitRuleLockStatus(false)
} catch (completeError) {
console.error('回写代办操作状态失败:', completeError)
this.$message.warning(completeError.message || '回写代办操作状态失败,请联系管理员检查')
}
// //
setTimeout(() =>{ setTimeout(() =>{
// //
@ -2146,6 +2227,9 @@ export default {
created() { created() {
// this.factoryList() // this.factoryList()
// this.getLanguageList() // this.getLanguageList()
},
beforeDestroy() {
this.stopSplitRuleLockPolling()
} }
} }
@ -2296,13 +2380,51 @@ export default {
overflow-y: auto !important; overflow-y: auto !important;
} }
.exception-rule-lock-tip {
margin-top: 10px;
padding: 8px 12px;
border-radius: 4px;
background: #fde2e2;
.customer-dialog /deep/ .el-dialog {
position: relative;
}
.exception-rule-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 30;
background: rgba(255, 255, 255, 0.75);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(1px);
}
.exception-rule-mask-content {
width: 75%;
max-width: 560px;
padding: 22px 26px;
border-radius: 8px;
text-align: center;
background: #ffffff;
border: 1px solid #f5c2c7;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
color: #c45656; color: #c45656;
}
.exception-rule-mask-content .el-icon-lock {
font-size: 26px;
margin-bottom: 8px;
}
.exception-rule-mask-message {
font-size: 15px;
font-weight: 600;
line-height: 1.6;
}
.exception-rule-mask-sub {
margin-top: 8px;
font-size: 13px; font-size: 13px;
color: #909399;
} }
/* 分卷不良原因对话框 */ /* 分卷不良原因对话框 */

Loading…
Cancel
Save