From 670c33b9874a434a733f718f655fd6d7ca920b14 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Tue, 4 Aug 2026 13:02:59 +0800 Subject: [PATCH] =?UTF-8?q?2026-08-04=20TID=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/yieldReport/produce_report_normal.js | 6 + .../yieldReport/com_produce_report_normal.vue | 153 +++- .../yieldReport/com_tid_upload_mt_log.vue | 778 ++++++++++++++++++ .../yieldReport/com_tid_upload_order.vue | 34 +- 4 files changed, 955 insertions(+), 16 deletions(-) create mode 100644 src/views/modules/yieldReport/com_tid_upload_mt_log.vue diff --git a/src/api/yieldReport/produce_report_normal.js b/src/api/yieldReport/produce_report_normal.js index 7ebb105..196d902 100644 --- a/src/api/yieldReport/produce_report_normal.js +++ b/src/api/yieldReport/produce_report_normal.js @@ -121,3 +121,9 @@ export const getMesShiftData = data => createAPI('schedule/getMesShiftData', 'PO // MES上传订单日志 export const uploadMesOrderLog = data => createFormAPI('schedule/uploadMesOrderLog', 'POST', data) + +// MES结束班次 +export const finishMesShift = data => createAPI('schedule/finishMesShift', 'POST', data) + +// MES上传MT日志 +export const uploadMesMtLog = data => createFormAPI('schedule/uploadMesMtLog', 'POST', data) diff --git a/src/views/modules/yieldReport/com_produce_report_normal.vue b/src/views/modules/yieldReport/com_produce_report_normal.vue index 8635af7..e6d424a 100644 --- a/src/views/modules/yieldReport/com_produce_report_normal.vue +++ b/src/views/modules/yieldReport/com_produce_report_normal.vue @@ -272,10 +272,10 @@ 上传订单 - + 结束班次 - + 上传MT日志 @@ -839,6 +839,9 @@ + + + @@ -1019,7 +1022,9 @@ import { getOrderNotesByOrderNo, // 新增 openMaterialRoll, // 打开材料卷 getMaterialRecordList, // 获取领料记录 - updateProductionStatus // 暂停生产/继续生产(调用 UspUpdateProductionStatus) + updateProductionStatus, // 暂停生产/继续生产(调用 UspUpdateProductionStatus) + getScheduleDateShift, + finishMesShift } from "@/api/yieldReport/produce_report_normal.js"; import { getUserSpecialSecurity, @@ -1080,6 +1085,7 @@ import ComProcessInspection from "./com_process_inspection";/*过程检验组件 import ComMrbRegister from "./com_mrb_register";/*MRB异常单登记组件*/ import comAbnormalContinueRoll from "./com_abnormal_continue_roll";/*异常续卷组件*/ import comTidUploadOrder from "./com_tid_upload_order";/*TID上传订单组件*/ +import comTidUploadMtLog from "./com_tid_upload_mt_log";/*TID上传MT日志组件*/ var functionId = 'C10000002'; export default { mixins: [labelPrintTemplates], // 添加标签打印模板 mixin @@ -1095,6 +1101,8 @@ export default { processInspectionButtonStyle: '', // 过程检验按钮样式 showMrbRegisterFlag: false,// MRB异常单登记弹窗显示状态 showTidUploadOrderFlag: false,// TID上传订单弹窗显示状态 + showTidUploadMtLogFlag: false,// TID上传MT日志弹窗显示状态 + finishShiftLoading: false,// 结束班次处理中 showAbnormalContinueRollFlag: false,// 异常续卷弹窗显示状态 showDefault: false, popoverFlag: false, @@ -4090,6 +4098,7 @@ export default { ComMrbRegister,/*MRB异常单登记组件*/ comAbnormalContinueRoll,/*异常续卷组件*/ comTidUploadOrder,/*TID上传订单组件*/ + comTidUploadMtLog,/*TID上传MT日志组件*/ }, methods: { // 删除不良 @@ -5525,6 +5534,144 @@ export default { }) }, + // 打开TID上传MT日志对话框 + openUploadMtLogDialog() { + if (!this.scheduleData.seqNo) { + this.$message.warning('请先选择派工单!') + return + } + this.showTidUploadMtLogFlag = true + this.$nextTick(() => { + if (this.$refs.comTidUploadMtLog) { + this.$refs.comTidUploadMtLog.init(this.scheduleData) + } + }) + }, + + // 结束MES班次 + async handleFinishMesShift() { + if (this.finishShiftLoading) { + return + } + if (!this.scheduleData.seqNo) { + this.$message.warning('请先选择派工单!') + return + } + const machineNo = this.getMesMachineNo() + if (!machineNo) { + this.$message.warning('机器账号不能为空') + return + } + + const date = this.getTodayDateString() + const shift = await this.getCurrentMesShiftNo(machineNo) + + try { + await this.$confirm( + '确认结束班次?机器账号:' + machineNo + ',日期:' + date + ',班次:' + shift, + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + } + ) + } catch (e) { + return + } + + this.finishShiftLoading = true + try { + const { data } = await finishMesShift({ + machineNo: machineNo, + date: date, + shift: shift + }) + if (data && data.code === 0) { + this.$message.success((data && data.msg) || '结束班次成功') + if (this.$refs.comTidUploadOrder && this.showTidUploadOrderFlag) { + this.$refs.comTidUploadOrder.loadMesShiftData(false) + } + if (this.$refs.comTidUploadMtLog && this.showTidUploadMtLogFlag) { + this.$refs.comTidUploadMtLog.loadMesShiftData(false) + } + } else { + this.$message.warning((data && data.msg) || '结束班次失败') + } + } catch (e) { + this.$message.error(this.extractMesErrorMessage(e, '结束班次失败')) + } finally { + this.finishShiftLoading = false + } + }, + + getMesMachineNo() { + return this.scheduleData.resourceId || this.scheduleData.resourceDesc || '' + }, + + async getCurrentMesShiftNo(machineNo) { + const fallbackShift = this.scheduleData.shiftNo ? String(this.scheduleData.shiftNo).trim() : '' + const defaultShift = fallbackShift || '' + const resourceId = this.scheduleData.resourceId || machineNo || '' + if (!this.scheduleData.site || !resourceId) { + return defaultShift + } + const params = { + site: this.scheduleData.site, + resourceId: resourceId, + currentDateTime: this.getCurrentDateTimeString() + } + try { + const { data } = await getScheduleDateShift(params) + const map = (data && data.map) || {} + const shiftNo = map.ShiftNo || map.shiftNo || map.shiftNO || '' + const shiftValue = shiftNo ? String(shiftNo).trim() : '' + return shiftValue || defaultShift + } catch (e) { + return defaultShift + } + }, + + getCurrentDateTimeString() { + const now = new Date() + const year = now.getFullYear() + const month = this.padZero(now.getMonth() + 1) + const day = this.padZero(now.getDate()) + const hour = this.padZero(now.getHours()) + const minute = this.padZero(now.getMinutes()) + const second = this.padZero(now.getSeconds()) + return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second + }, + + getTodayDateString() { + return this.formatDateValue(new Date()) + }, + + formatDateValue(dateObj) { + const year = dateObj.getFullYear() + const month = dateObj.getMonth() + 1 + const day = dateObj.getDate() + return year + '-' + this.padZero(month) + '-' + this.padZero(day) + }, + + padZero(value) { + return value < 10 ? '0' + value : '' + value + }, + + extractMesErrorMessage(error, defaultMessage) { + if (error && error.response && error.response.data) { + const responseData = error.response.data + if (typeof responseData === 'string') { + return responseData + } + return responseData.msg || responseData.message || defaultMessage + } + if (error && error.message) { + return error.message + } + return defaultMessage + }, + // TID区域其他功能占位 showMesFeatureTip(featureName) { this.$message.info(featureName + '功能开发中') diff --git a/src/views/modules/yieldReport/com_tid_upload_mt_log.vue b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue new file mode 100644 index 0000000..f5cc9e4 --- /dev/null +++ b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue @@ -0,0 +1,778 @@ + + + + + diff --git a/src/views/modules/yieldReport/com_tid_upload_order.vue b/src/views/modules/yieldReport/com_tid_upload_order.vue index 64a62e8..2845c57 100644 --- a/src/views/modules/yieldReport/com_tid_upload_order.vue +++ b/src/views/modules/yieldReport/com_tid_upload_order.vue @@ -255,7 +255,7 @@ export default { this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || '' this.uploadForm.shift = scheduleData.shiftNo || '' this.uploadForm.operatorNo = '' - this.uploadForm.date = this.extractDatePart(scheduleData.scheduledDate) + this.uploadForm.date = this.getTodayDateString() this.uploadResults = [] this.uploadOrderFileList = [] this.mesShiftData = {} @@ -307,6 +307,7 @@ export default { if (!this.pageData.site || !this.pageData.resourceId) { return } + this.uploadForm.date = this.getTodayDateString() const params = { site: this.pageData.site, resourceId: this.pageData.resourceId, @@ -316,13 +317,9 @@ export default { const { data } = await getScheduleDateShift(params) const map = (data && data.map) || {} const shiftNo = map.ShiftNo || map.shiftNo || '' - const scheduleDate = map.scheduleddate || map.scheduledDate || map.ScheduleDate || map.scheduleDate || '' if (shiftNo) { this.uploadForm.shift = shiftNo } - if (scheduleDate) { - this.uploadForm.date = this.extractDatePart(scheduleDate) - } } catch (e) { // keep fallback values from schedule data when lookup fails } @@ -360,6 +357,15 @@ export default { return value < 10 ? '0' + value : '' + value }, + getShiftValueForApi () { + const shiftValue = this.uploadForm.shift ? String(this.uploadForm.shift).trim() : '' + const finalShift = shiftValue || 'A' + if (this.uploadForm.shift !== finalShift) { + this.uploadForm.shift = finalShift + } + return finalShift + }, + async loadOperatorOptions () { if (!this.pageData.seqNo) { return @@ -402,10 +408,13 @@ export default { this.mesShiftLogs = [] return } + const currentDate = this.getTodayDateString() + const shiftValue = this.getShiftValueForApi() + this.uploadForm.date = currentDate const params = { machineNo: this.uploadForm.machineNo, - date: this.getTodayDateString(), - shift: this.uploadForm.shift, + date: currentDate, + shift: shiftValue, type: '' } this.shiftLoading = true @@ -539,10 +548,6 @@ export default { this.$message.warning('机器账号不能为空') return false } - if (!this.uploadForm.shift) { - this.$message.warning('班次为空,暂不能上传') - return false - } if (!this.uploadForm.operatorNo) { this.$message.warning('请先维护上岗人员后再上传') return false @@ -558,6 +563,9 @@ export default { if (!this.validateUploadOrderForm()) { return } + const currentDate = this.getTodayDateString() + const shiftValue = this.getShiftValueForApi() + this.uploadForm.date = currentDate this.saveLoading = true const resultList = [] let successCount = 0 @@ -578,8 +586,8 @@ export default { const formData = new FormData() formData.append('process', this.uploadForm.process) formData.append('machineNo', this.uploadForm.machineNo) - formData.append('date', this.uploadForm.date) - formData.append('shift', this.uploadForm.shift) + formData.append('date', currentDate) + formData.append('shift', shiftValue) formData.append('operatorNo', this.uploadForm.operatorNo) formData.append('log', realFile, fileItem.name || realFile.name || ('log_' + (i + 1) + '.txt'))