Browse Source

2026-08-04

TID接口
master
fengyuan_yang 12 hours ago
parent
commit
d7f08e16d7
  1. 22
      src/views/modules/yieldReport/com_produce_report_normal.vue
  2. 475
      src/views/modules/yieldReport/com_tid_get_shift.vue
  3. 9
      src/views/modules/yieldReport/com_tid_upload_mt_log.vue
  4. 102
      src/views/modules/yieldReport/com_tid_upload_order.vue

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

@ -278,7 +278,7 @@
<el-button type="primary" size="small" icon="el-icon-document-copy" @click="openUploadMtLogDialog"> <el-button type="primary" size="small" icon="el-icon-document-copy" @click="openUploadMtLogDialog">
上传MT日志 上传MT日志
</el-button> </el-button>
<el-button type="primary" size="small" icon="el-icon-data-analysis" @click="showMesFeatureTip('获取班次')">
<el-button type="primary" size="small" icon="el-icon-data-analysis" @click="openGetShiftDialog">
获取班次 获取班次
</el-button> </el-button>
</div> </div>
@ -842,6 +842,9 @@
<!-- TID上传MT日志组件 --> <!-- TID上传MT日志组件 -->
<comTidUploadMtLog ref="comTidUploadMtLog" :visible.sync="showTidUploadMtLogFlag"></comTidUploadMtLog> <comTidUploadMtLog ref="comTidUploadMtLog" :visible.sync="showTidUploadMtLogFlag"></comTidUploadMtLog>
<!-- TID获取班次组件 -->
<comTidGetShift ref="comTidGetShift" :visible.sync="showTidGetShiftFlag"></comTidGetShift>
<!-- SOP预览弹出框 --> <!-- SOP预览弹出框 -->
<el-dialog :visible.sync="showSopPreviewFlag" width="50%" top="5vh" :before-close="closeSopPreview"> <el-dialog :visible.sync="showSopPreviewFlag" width="50%" top="5vh" :before-close="closeSopPreview">
<span slot="title" class="sop-preview-title"> <span slot="title" class="sop-preview-title">
@ -1086,6 +1089,7 @@ import ComMrbRegister from "./com_mrb_register";/*MRB异常单登记组件*/
import comAbnormalContinueRoll from "./com_abnormal_continue_roll";/*异常续卷组件*/ import comAbnormalContinueRoll from "./com_abnormal_continue_roll";/*异常续卷组件*/
import comTidUploadOrder from "./com_tid_upload_order";/*TID上传订单组件*/ import comTidUploadOrder from "./com_tid_upload_order";/*TID上传订单组件*/
import comTidUploadMtLog from "./com_tid_upload_mt_log";/*TID上传MT日志组件*/ import comTidUploadMtLog from "./com_tid_upload_mt_log";/*TID上传MT日志组件*/
import comTidGetShift from "./com_tid_get_shift";/*TID获取班次组件*/
var functionId = 'C10000002'; var functionId = 'C10000002';
export default { export default {
mixins: [labelPrintTemplates], // mixin mixins: [labelPrintTemplates], // mixin
@ -1102,6 +1106,7 @@ export default {
showMrbRegisterFlag: false,// MRB showMrbRegisterFlag: false,// MRB
showTidUploadOrderFlag: false,// TID showTidUploadOrderFlag: false,// TID
showTidUploadMtLogFlag: false,// TIDMT showTidUploadMtLogFlag: false,// TIDMT
showTidGetShiftFlag: false,// TID
finishShiftLoading: false,// finishShiftLoading: false,//
showAbnormalContinueRollFlag: false,// showAbnormalContinueRollFlag: false,//
showDefault: false, showDefault: false,
@ -4099,6 +4104,7 @@ export default {
comAbnormalContinueRoll,/*异常续卷组件*/ comAbnormalContinueRoll,/*异常续卷组件*/
comTidUploadOrder,/*TID上传订单组件*/ comTidUploadOrder,/*TID上传订单组件*/
comTidUploadMtLog,/*TID上传MT日志组件*/ comTidUploadMtLog,/*TID上传MT日志组件*/
comTidGetShift,/*TID获取班次组件*/
}, },
methods: { methods: {
// //
@ -5548,6 +5554,20 @@ export default {
}) })
}, },
// TID
openGetShiftDialog() {
if (!this.scheduleData.seqNo) {
this.$message.warning('请先选择派工单!')
return
}
this.showTidGetShiftFlag = true
this.$nextTick(() => {
if (this.$refs.comTidGetShift) {
this.$refs.comTidGetShift.init(this.scheduleData)
}
})
},
// MES // MES
async handleFinishMesShift() { async handleFinishMesShift() {
if (this.finishShiftLoading) { if (this.finishShiftLoading) {

475
src/views/modules/yieldReport/com_tid_get_shift.vue

@ -0,0 +1,475 @@
<template>
<div class="customer-css">
<el-dialog
:title="titleCon"
v-drag
width="1200px"
top="4vh"
custom-class="machine-workbench-dialog"
:close-on-click-modal="false"
v-bind="$attrs"
v-on="$listeners"
@closed="handleDialogClosed">
<div class="get-shift-layout" :style="{ height: layoutHeight + 'px' }">
<div class="shift-panel">
<div class="panel-header">
<span>{{ queryForm.type === 'MT' ? 'MT班次数据' : '班次数据' }}</span>
<el-button type="text" size="mini" @click="loadMesShiftData()" :loading="shiftLoading">刷新班次</el-button>
</div>
<div class="summary-grid">
<div class="summary-item">
<div class="summary-label">成功卷数</div>
<div class="summary-value">{{ getMesFieldValue('rollCountSuccess') }}</div>
</div>
<div class="summary-item">
<div class="summary-label">失败卷数</div>
<div class="summary-value">{{ getMesFieldValue('rollCountFail') }}</div>
</div>
<div class="summary-item">
<div class="summary-label">上传总数</div>
<div class="summary-value">{{ getMesFieldValue('quantityTotal') }}</div>
</div>
<div class="summary-item">
<div class="summary-label">良品数</div>
<div class="summary-value">{{ getMesFieldValue('quantityGood') }}</div>
</div>
<div class="summary-item">
<div class="summary-label">不良数</div>
<div class="summary-value">{{ getMesFieldValue('quantityBad') }}</div>
</div>
</div>
<el-table
:data="mesShiftLogs"
border
:height="leftTableHeight"
v-loading="shiftLoading"
style="width: 100%; margin-top: 10px;">
<el-table-column prop="filename" label="文件名" min-width="180" show-overflow-tooltip></el-table-column>
<el-table-column label="状态" width="90" align="center">
<template slot-scope="scope">
<el-tag :type="getLogStatusType(scope.row.status)">
{{ Number(scope.row.status) === 1 ? '成功' : '失败' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="message" label="结果" min-width="140" show-overflow-tooltip></el-table-column>
</el-table>
</div>
<div class="query-panel">
<div class="panel-card config-card">
<div class="panel-header panel-header-card">
<span class="panel-title"><i class="el-icon-data-analysis"></i>查询条件</span>
</div>
<el-form label-position="top" label-width="90px" class="query-form">
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="日志类型">
<el-select v-model="queryForm.type" style="width: 100%;" @change="handleTypeChange">
<el-option label="订单日志" value=""></el-option>
<el-option label="MT日志" value="MT"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机器账号">
<el-input v-model="queryForm.machineNo" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="班次">
<el-input v-model="queryForm.shift" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期">
<el-input v-model="queryForm.date" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="query-tip-wrap">
<div class="query-tip-title">说明</div>
<div class="query-tip-text">- 日志类型切换后会自动刷新班次数据</div>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog" size="small">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getMesShiftData, getScheduleDateShift } from '@/api/yieldReport/produce_report_normal.js'
export default {
data () {
return {
titleCon: '获取班次',
shiftLoading: false,
pageData: {
site: '',
resourceId: '',
resourceDesc: '',
shiftNo: ''
},
queryForm: {
machineNo: '',
shift: '',
date: '',
type: ''
},
mesShiftData: {},
mesShiftLogs: [],
layoutHeight: 560,
leftTableHeight: 340
}
},
mounted () {
this.updateDialogLayout()
window.addEventListener('resize', this.updateDialogLayout)
},
beforeDestroy () {
window.removeEventListener('resize', this.updateDialogLayout)
},
methods: {
async init (scheduleData) {
this.pageData = {
site: scheduleData.site || '',
resourceId: scheduleData.resourceId || '',
resourceDesc: scheduleData.resourceDesc || '',
shiftNo: scheduleData.shiftNo || ''
}
this.queryForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || ''
this.queryForm.shift = scheduleData.shiftNo || ''
this.queryForm.date = this.getTodayDateString()
this.queryForm.type = ''
this.mesShiftData = {}
this.mesShiftLogs = []
this.updateDialogLayout()
await this.loadCurrentScheduleShift()
await this.loadMesShiftData(true)
},
updateDialogLayout () {
const viewportHeight = window.innerHeight || 900
let nextLayoutHeight = viewportHeight - 230
if (nextLayoutHeight > 620) {
nextLayoutHeight = 620
}
if (nextLayoutHeight < 500) {
nextLayoutHeight = 500
}
this.layoutHeight = nextLayoutHeight
let nextLeftTableHeight = nextLayoutHeight - 230
if (nextLeftTableHeight < 220) {
nextLeftTableHeight = 220
}
this.leftTableHeight = nextLeftTableHeight
},
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
},
getShiftValueForApi () {
return this.queryForm.shift ? String(this.queryForm.shift).trim() : ''
},
async loadCurrentScheduleShift () {
if (!this.pageData.site || !this.pageData.resourceId) {
return
}
this.queryForm.date = this.getTodayDateString()
const params = {
site: this.pageData.site,
resourceId: this.pageData.resourceId,
currentDateTime: this.getCurrentDateTimeString()
}
try {
const { data } = await getScheduleDateShift(params)
const map = (data && data.map) || {}
const shiftNo = map.ShiftNo || map.shiftNo || ''
if (shiftNo) {
this.queryForm.shift = shiftNo
}
} catch (e) {
this.$message.warning(this.extractErrorMessage(e, '获取当前班次失败'))
}
},
async loadMesShiftData (showWarning = true) {
if (!this.queryForm.machineNo) {
this.mesShiftData = {}
this.mesShiftLogs = []
return
}
const currentDate = this.getTodayDateString()
const shiftValue = this.getShiftValueForApi()
this.queryForm.date = currentDate
const params = {
machineNo: this.queryForm.machineNo,
date: currentDate,
shift: shiftValue,
type: this.queryForm.type || ''
}
this.shiftLoading = true
try {
const { data } = await getMesShiftData(params)
if (data && data.code === 0) {
this.mesShiftData = data.row || {}
this.mesShiftLogs = Array.isArray(this.mesShiftData.logs) ? this.mesShiftData.logs : []
} else {
this.mesShiftData = {}
this.mesShiftLogs = []
if (showWarning) {
this.$message.warning((data && data.msg) || '获取班次数据失败')
}
}
} catch (e) {
this.mesShiftData = {}
this.mesShiftLogs = []
if (showWarning) {
this.$message.error(this.extractErrorMessage(e, '获取班次数据失败'))
}
} finally {
this.shiftLoading = false
}
},
handleTypeChange () {
this.loadMesShiftData(true)
},
getMesFieldValue (fieldName) {
if (!this.mesShiftData || this.mesShiftData[fieldName] === undefined || this.mesShiftData[fieldName] === null || this.mesShiftData[fieldName] === '') {
return '-'
}
return this.mesShiftData[fieldName]
},
getLogStatusType (status) {
return Number(status) === 1 ? 'success' : 'danger'
},
extractErrorMessage (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
},
closeDialog () {
this.$emit('update:visible', false)
},
handleDialogClosed () {
this.mesShiftData = {}
this.mesShiftLogs = []
}
}
}
</script>
<style scoped lang="scss">
.get-shift-layout {
display: flex;
gap: 10px;
align-items: stretch;
}
.shift-panel {
width: 62%;
height: 100%;
display: flex;
flex-direction: column;
}
.query-panel {
width: 38%;
height: 100%;
display: flex;
flex-direction: column;
}
.panel-card,
.shift-panel {
background: #ffffff;
border: 1px solid #dfe6ee;
border-radius: 8px;
padding: 10px;
box-sizing: border-box;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
color: #2f3b4f;
}
.panel-title {
display: inline-flex;
align-items: center;
font-size: 15px;
}
.panel-title i {
margin-right: 6px;
color: #18a5a3;
}
.panel-header-card {
margin-bottom: 8px;
padding-bottom: 6px;
border-bottom: 1px solid #edf1f7;
}
.shift-panel /deep/ .el-button--text {
color: #18a5a3;
font-weight: 500;
}
.summary-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
margin-top: 8px;
}
.summary-item {
border: 1px solid #edf2f7;
border-left: 3px solid #18a5a3;
border-radius: 6px;
padding: 8px;
background: #fcfdff;
min-height: 54px;
box-sizing: border-box;
}
.summary-label {
font-size: 12px;
color: #7c8797;
}
.summary-value {
margin-top: 4px;
font-size: 16px;
color: #1f2d3d;
font-weight: 700;
line-height: 1;
}
.shift-panel /deep/ .el-table {
margin-top: 12px;
}
.query-form {
margin-bottom: 4px;
}
.query-tip-wrap {
margin-top: 8px;
padding: 10px;
border: 1px dashed #d5dde8;
border-radius: 6px;
background: #fafcfe;
}
.query-tip-title {
font-size: 13px;
font-weight: 600;
color: #44536a;
margin-bottom: 6px;
}
.query-tip-text {
font-size: 12px;
color: #66758d;
line-height: 18px;
}
.query-panel /deep/ .el-form-item {
margin-bottom: 6px;
}
.query-panel /deep/ .el-form-item__label {
padding-bottom: 2px;
line-height: 18px;
color: #627089;
font-size: 12px;
}
.shift-panel /deep/ .el-table td {
padding-top: 8px !important;
padding-bottom: 8px !important;
}
.shift-panel /deep/ .el-table .cell {
height: auto !important;
line-height: 20px !important;
}
.shift-panel /deep/ .el-tag {
height: 20px;
line-height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
@media (max-width: 1280px) {
.get-shift-layout {
flex-direction: column;
height: auto !important;
}
.shift-panel,
.query-panel {
width: 100%;
height: auto;
}
}
</style>

9
src/views/modules/yieldReport/com_tid_upload_mt_log.vue

@ -205,7 +205,7 @@ export default {
} }
this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || '' this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || ''
this.uploadForm.shift = scheduleData.shiftNo || 'A'
this.uploadForm.shift = scheduleData.shiftNo || ''
this.uploadForm.date = this.getTodayDateString() this.uploadForm.date = this.getTodayDateString()
this.mesShiftData = {} this.mesShiftData = {}
this.mesShiftLogs = [] this.mesShiftLogs = []
@ -269,11 +269,10 @@ export default {
getShiftValueForApi () { getShiftValueForApi () {
const shiftValue = this.uploadForm.shift ? String(this.uploadForm.shift).trim() : '' const shiftValue = this.uploadForm.shift ? String(this.uploadForm.shift).trim() : ''
const finalShift = shiftValue || 'A'
if (this.uploadForm.shift !== finalShift) {
this.uploadForm.shift = finalShift
if (this.uploadForm.shift !== shiftValue) {
this.uploadForm.shift = shiftValue
} }
return finalShift
return shiftValue
}, },
async loadCurrentScheduleShift () { async loadCurrentScheduleShift () {

102
src/views/modules/yieldReport/com_tid_upload_order.vue

@ -44,15 +44,23 @@
:height="leftTableHeight" :height="leftTableHeight"
v-loading="shiftLoading" v-loading="shiftLoading"
style="width: 100%; margin-top: 10px;"> style="width: 100%; margin-top: 10px;">
<el-table-column prop="filename" label="文件名" min-width="180" show-overflow-tooltip></el-table-column>
<el-table-column label="文件名" min-width="180" show-overflow-tooltip>
<template slot-scope="scope">
{{ getMesLogFileName(scope.row) }}
</template>
</el-table-column>
<el-table-column label="状态" width="90" align="center"> <el-table-column label="状态" width="90" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getLogStatusType(scope.row.status)" size="mini">
{{ Number(scope.row.status) === 1 ? '成功' : '失败' }}
<el-tag :type="getLogStatusType(getMesLogStatus(scope.row))">
{{ getMesLogStatusText(scope.row) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="message" label="结果" min-width="140" show-overflow-tooltip></el-table-column>
<el-table-column label="结果" min-width="140" show-overflow-tooltip>
<template slot-scope="scope">
{{ getMesLogResultMessage(scope.row) }}
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
@ -200,7 +208,7 @@ export default {
saveLoading: false, saveLoading: false,
shiftLoading: false, shiftLoading: false,
processOptions: [ processOptions: [
{ label: 'bonging', value: 'bonging' },
{ label: 'bonding', value: 'bonding' },
{ label: 'testing', value: 'testing' } { label: 'testing', value: 'testing' }
], ],
pageData: { pageData: {
@ -214,7 +222,7 @@ export default {
scheduledDate: '' scheduledDate: ''
}, },
uploadForm: { uploadForm: {
process: 'bonging',
process: 'bonding',
machineNo: '', machineNo: '',
shift: '', shift: '',
operatorNo: '', operatorNo: '',
@ -251,7 +259,7 @@ export default {
scheduledDate: scheduleData.scheduledDate || '' scheduledDate: scheduleData.scheduledDate || ''
} }
this.uploadForm.process = 'bonging'
this.uploadForm.process = 'bonding'
this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || '' this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || ''
this.uploadForm.shift = scheduleData.shiftNo || '' this.uploadForm.shift = scheduleData.shiftNo || ''
this.uploadForm.operatorNo = '' this.uploadForm.operatorNo = ''
@ -359,11 +367,10 @@ export default {
getShiftValueForApi () { getShiftValueForApi () {
const shiftValue = this.uploadForm.shift ? String(this.uploadForm.shift).trim() : '' const shiftValue = this.uploadForm.shift ? String(this.uploadForm.shift).trim() : ''
const finalShift = shiftValue || 'A'
if (this.uploadForm.shift !== finalShift) {
this.uploadForm.shift = finalShift
if (this.uploadForm.shift !== shiftValue) {
this.uploadForm.shift = shiftValue
} }
return finalShift
return shiftValue
}, },
async loadOperatorOptions () { async loadOperatorOptions () {
@ -448,8 +455,56 @@ export default {
return this.mesShiftData[fieldName] return this.mesShiftData[fieldName]
}, },
getMesLogFieldValue (row, fieldList) {
if (!row || !Array.isArray(fieldList)) {
return ''
}
for (let i = 0; i < fieldList.length; i++) {
const fieldName = fieldList[i]
const fieldValue = row[fieldName]
if (fieldValue !== undefined && fieldValue !== null && fieldValue !== '') {
return fieldValue
}
}
return ''
},
getMesLogFileName (row) {
const value = this.getMesLogFieldValue(row, ['logFilename'])
return value || '-'
},
getMesLogResultMessage (row) {
const value = this.getMesLogFieldValue(row, ['message', 'msg', 'Message', 'result'])
return value || '-'
},
getMesLogStatus (row) {
return this.getMesLogFieldValue(row, ['status', 'Status', 'state', 'State'])
},
getMesLogStatusText (row) {
const statusValue = this.getMesLogStatus(row)
const statusText = String(statusValue)
if (statusText === '1') {
return '成功'
}
if (statusText === '0') {
return '失败'
}
const messageText = String(this.getMesLogResultMessage(row)).toLowerCase()
if (messageText.indexOf('成功') > -1 || messageText.indexOf('success') > -1) {
return '成功'
}
if (messageText && messageText !== '-') {
return '失败'
}
return '-'
},
getLogStatusType (status) { getLogStatusType (status) {
return Number(status) === 1 ? 'success' : 'danger'
return String(status) === '1' ? 'success' : 'danger'
}, },
triggerOrderFileSelect () { triggerOrderFileSelect () {
@ -548,6 +603,10 @@ export default {
this.$message.warning('机器账号不能为空') this.$message.warning('机器账号不能为空')
return false return false
} }
if (!this.getShiftValueForApi()) {
this.$message.warning('班次为空,暂不能上传')
return false
}
if (!this.uploadForm.operatorNo) { if (!this.uploadForm.operatorNo) {
this.$message.warning('请先维护上岗人员后再上传') this.$message.warning('请先维护上岗人员后再上传')
return false return false
@ -758,6 +817,25 @@ export default {
margin-top: 12px; margin-top: 12px;
} }
.shift-panel /deep/ .el-table td {
padding-top: 2px !important;
padding-bottom: 2px !important;
}
.shift-panel /deep/ .el-table .cell {
height: auto !important;
line-height: 20px !important;
}
.shift-panel /deep/ .el-tag {
height: 20px;
line-height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
.upload-form { .upload-form {
margin-bottom: 0; margin-bottom: 0;
} }

Loading…
Cancel
Save