+
+
+
+
生产质量指标 / QUALITY METRICS
-
-
派工单
-
{{ scheduleData.seqNo || '--' }}
+
+
+ 不良品率 / DEFECT RATE
+ {{ formatExceptionRuleDefectRateText() }}
+
+
+ 影响数量 / AFFECTED
+ {{ formatExceptionRuleAffectedQtyText() }}
+
+
+ 已生产数量 / PRODUCED
+ {{ formatExceptionRuleProducedQtyText() }}
+
-
-
订单号
-
{{ scheduleData.orderNo || '--' }}
+
+
实时监控中
+
+ REAL-TIME MONITORING
+
+
-
{{ exceptionRuleLockMessage || '当前异常代办尚未审核,已锁定创建分卷操作。' }}
-
请等待审核通过后继续操作
@@ -469,6 +597,14 @@ export default {
abnormalCutLoading: false, // 异常截卷loading
exceptionRuleLocked: false, // 异常规则触发后的强制锁定
exceptionRuleLockMessage: '', // 锁定提示文案
+ exceptionRuleWarningLevel: '', // 预警等级(轻微/一般/严重)
+ exceptionRuleLockedAt: '', // 锁定时间
+ exceptionRuleMatchedRollIndex: null, // 触发规则卷序号
+ exceptionRuleMatchedDefectRate: null, // 触发规则卷不良率
+ exceptionRuleMatchedTotalQty: null, // 触发规则卷总数
+ exceptionRuleClockDate: '', // 锁定页面日期
+ exceptionRuleClockTime: '', // 锁定页面时间
+ exceptionRuleClockTimer: null, // 锁定页面时钟定时器
pendingRuleFollowupAction: '', // 提示类规则在成功后需打开的功能动作
pendingRuleFollowupResultMap: null,
scheduleData: {
@@ -720,6 +856,11 @@ export default {
// 重置异常规则锁定状态
this.exceptionRuleLocked = false;
this.exceptionRuleLockMessage = '';
+ this.exceptionRuleWarningLevel = '';
+ this.exceptionRuleLockedAt = '';
+ this.exceptionRuleMatchedRollIndex = null;
+ this.exceptionRuleMatchedDefectRate = null;
+ this.exceptionRuleMatchedTotalQty = null;
this.resetPendingRuleFollowup();
// 重置缓存数据标记
this.hasCachedData = false;
@@ -1717,6 +1858,7 @@ export default {
/*关闭modal*/
closeDialog(){
this.stopSplitRuleLockPolling()
+ this.clearExceptionRuleVisualMeta()
this.resetPendingRuleFollowup()
//刷新报工的页面
this.$emit('refreshPageData');
@@ -1726,6 +1868,136 @@ export default {
onDialogClosed () {
this.stopSplitRuleLockPolling()
+ this.clearExceptionRuleVisualMeta()
+ },
+
+ normalizeWarningLevel (value) {
+ return String(value || '').trim()
+ },
+
+ isWarningLevelStyle () {
+ const warningLevel = this.normalizeWarningLevel(this.exceptionRuleWarningLevel)
+ return warningLevel === '轻微' || warningLevel === '一般'
+ },
+
+ getExceptionRuleTitleCn () {
+ return this.isWarningLevelStyle() ? '过程质量预警' : '过程质量异常'
+ },
+
+ getExceptionRuleTitleLock () {
+ return this.isWarningLevelStyle() ? '系统预警 / SYSTEM WARNING' : '系统锁定 / SYSTEM LOCKDOWN'
+ },
+
+ getExceptionRuleActiveText () {
+ return this.isWarningLevelStyle() ? 'WARNING ACTIVE' : 'LOCKDOWN ACTIVE'
+ },
+
+ getNowDateText () {
+ return this.dayjs(new Date()).format('YYYY-MM-DD')
+ },
+
+ getNowTimeText () {
+ return this.dayjs(new Date()).format('HH:mm:ss')
+ },
+
+ refreshExceptionRuleClock () {
+ const now = this.dayjs(new Date())
+ this.exceptionRuleClockDate = now.format('YYYY-MM-DD')
+ this.exceptionRuleClockTime = now.format('HH:mm:ss')
+ },
+
+ startExceptionRuleClock () {
+ this.refreshExceptionRuleClock()
+ if (this.exceptionRuleClockTimer) {
+ return
+ }
+ this.exceptionRuleClockTimer = setInterval(() => {
+ this.refreshExceptionRuleClock()
+ }, 1000)
+ },
+
+ stopExceptionRuleClock () {
+ if (this.exceptionRuleClockTimer) {
+ clearInterval(this.exceptionRuleClockTimer)
+ this.exceptionRuleClockTimer = null
+ }
+ },
+
+ toRuleNumber (value) {
+ const num = Number(value)
+ return Number.isFinite(num) ? num : null
+ },
+
+ formatRuleNumber (value, scale) {
+ const num = this.toRuleNumber(value)
+ if (num === null) {
+ return '--'
+ }
+ const digits = Number.isInteger(scale) && scale >= 0 ? scale : 2
+ const fixed = num.toFixed(digits)
+ return fixed.replace(/\.?0+$/, '')
+ },
+
+ getExceptionRuleEquipmentText () {
+ return this.scheduleData.resourceDesc || this.scheduleData.resourceId || '--'
+ },
+
+ getExceptionRuleLockedTimeText () {
+ return this.exceptionRuleLockedAt || `${this.getNowDateText()} ${this.getNowTimeText()}`
+ },
+
+ getExceptionRuleWorkOrderText () {
+ return this.scheduleData.orderNo || '--'
+ },
+
+ formatExceptionRuleDefectRateText () {
+ const text = this.formatRuleNumber(this.exceptionRuleMatchedDefectRate, 2)
+ return text === '--' ? '--' : `${text}%`
+ },
+
+ formatExceptionRuleAffectedQtyText () {
+ const text = this.formatRuleNumber(this.exceptionRuleMatchedTotalQty, 2)
+ return text === '--' ? '--' : `${text} pcs`
+ },
+
+ formatExceptionRuleProducedQtyText () {
+ const text = this.formatRuleNumber(this.scheduleData.qtyApprove, 2)
+ return text === '--' ? '--' : `${text} pcs`
+ },
+
+ applyExceptionRuleVisualMeta (resultMap, refreshLockTime) {
+ this.startExceptionRuleClock()
+ const warningLevel = this.normalizeWarningLevel(resultMap && resultMap.warningLevel)
+ if (warningLevel) {
+ this.exceptionRuleWarningLevel = warningLevel
+ }
+ const lockedTime = String((resultMap && resultMap.lockedTime) || '').trim()
+ if (lockedTime) {
+ this.exceptionRuleLockedAt = lockedTime
+ } else if (refreshLockTime || !this.exceptionRuleLockedAt) {
+ this.exceptionRuleLockedAt = `${this.getNowDateText()} ${this.getNowTimeText()}`
+ }
+
+ if (resultMap && Object.prototype.hasOwnProperty.call(resultMap, 'matchedRollIndex')) {
+ this.exceptionRuleMatchedRollIndex = resultMap.matchedRollIndex
+ }
+ if (resultMap && Object.prototype.hasOwnProperty.call(resultMap, 'matchedDefectRate')) {
+ this.exceptionRuleMatchedDefectRate = resultMap.matchedDefectRate
+ }
+ if (resultMap && Object.prototype.hasOwnProperty.call(resultMap, 'matchedTotalQty')) {
+ this.exceptionRuleMatchedTotalQty = resultMap.matchedTotalQty
+ }
+ },
+
+ clearExceptionRuleVisualMeta () {
+ this.stopExceptionRuleClock()
+ this.exceptionRuleWarningLevel = ''
+ this.exceptionRuleLockedAt = ''
+ this.exceptionRuleMatchedRollIndex = null
+ this.exceptionRuleMatchedDefectRate = null
+ this.exceptionRuleMatchedTotalQty = null
+ this.exceptionRuleClockDate = ''
+ this.exceptionRuleClockTime = ''
},
buildSplitRuleStatusPayload () {
@@ -1751,6 +2023,7 @@ export default {
const locked = !!resultMap.locked
this.exceptionRuleLocked = locked
if (locked) {
+ this.applyExceptionRuleVisualMeta(resultMap, !wasLocked)
this.exceptionRuleLockMessage = resultMap.message || '当前异常代办尚未审核,已锁定创建分卷操作。'
if (!wasLocked) {
this.$emit('lockPageByExceptionRule', resultMap)
@@ -1762,6 +2035,7 @@ export default {
}
this.stopSplitRuleLockPolling()
this.exceptionRuleLockMessage = ''
+ this.clearExceptionRuleVisualMeta()
this.$emit('unlockPageByExceptionRule', resultMap)
if (wasLocked && showUnlockHint && resultMap.bypassByAudit) {
this.$message.success('QC已审核,已解除锁定,可继续操作。')
@@ -1861,6 +2135,7 @@ export default {
if (resultMap.bypassByAudit) {
this.exceptionRuleLocked = false
this.exceptionRuleLockMessage = ''
+ this.clearExceptionRuleVisualMeta()
this.stopSplitRuleLockPolling()
this.$emit('unlockPageByExceptionRule', resultMap)
}
@@ -1884,6 +2159,7 @@ export default {
}
if (action === 'LOCK_PAGE') {
this.exceptionRuleLocked = true
+ this.applyExceptionRuleVisualMeta(resultMap, true)
this.exceptionRuleLockMessage = message
this.$emit('lockPageByExceptionRule', resultMap)
this.startSplitRuleLockPolling()
@@ -2295,12 +2571,15 @@ export default {
},
beforeDestroy() {
this.stopSplitRuleLockPolling()
+ this.stopExceptionRuleClock()
}
}