更新转台程序 增加程序号
This commit is contained in:
@@ -48,6 +48,18 @@
|
|||||||
<el-input v-model="ws1Result.错误消息" readonly size="small" style="width: 100%;color:red;" />
|
<el-input v-model="ws1Result.错误消息" readonly size="small" style="width: 100%;color:red;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="程序版本" style="width: 100%;">
|
||||||
|
<el-select v-model="ws1Result.程序版本" filterable allow-create default-first-option size="small" style="width: 100%;">
|
||||||
|
<el-option v-for="item in programVersionOptions" :key="item" :label="item" :value="item" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="14">
|
||||||
|
<div style="height: 32px;"></div>
|
||||||
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="验证结果" style="width: 100%;">
|
<el-form-item label="验证结果" style="width: 100%;">
|
||||||
<div v-if="ws1Result.验证结果 == 1"
|
<div v-if="ws1Result.验证结果 == 1"
|
||||||
@@ -211,6 +223,18 @@
|
|||||||
<el-input v-model="ws2Result.错误消息" readonly size="small" style="width: 100%;color:red;" />
|
<el-input v-model="ws2Result.错误消息" readonly size="small" style="width: 100%;color:red;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="程序版本" style="width: 100%;">
|
||||||
|
<el-select v-model="ws2Result.程序版本" filterable allow-create default-first-option size="small" style="width: 100%;">
|
||||||
|
<el-option v-for="item in programVersionOptions" :key="item" :label="item" :value="item" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="14">
|
||||||
|
<div style="height: 32px;"></div>
|
||||||
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="验证结果" style="width: 100%;">
|
<el-form-item label="验证结果" style="width: 100%;">
|
||||||
<div v-if="ws2Result.验证结果 == 1"
|
<div v-if="ws2Result.验证结果 == 1"
|
||||||
@@ -338,8 +362,14 @@ import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpN
|
|||||||
|
|
||||||
// ==================== 常量定义 ====================
|
// ==================== 常量定义 ====================
|
||||||
|
|
||||||
|
/** 程序版本 PLC 字符串信号标识 */
|
||||||
|
const PROGRAM_VERSION_TAG_ID = '208640'
|
||||||
|
|
||||||
|
/** 程序版本下拉选项 */
|
||||||
|
const PROGRAM_VERSION_OPTIONS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
|
||||||
|
|
||||||
/** 轮询读取的所有 PLC 信号标识 */
|
/** 轮询读取的所有 PLC 信号标识 */
|
||||||
const POLL_TAG_IDS = ['200004', '200005', '200006', '200007', '200380', '203240', '200440']
|
const POLL_TAG_IDS = ['200004', '200005', '200006', '200007', '200380', '203240', '200440', PROGRAM_VERSION_TAG_ID]
|
||||||
|
|
||||||
/** 状态灯信号 → data 属性映射 */
|
/** 状态灯信号 → data 属性映射 */
|
||||||
const STATUS_TAG_MAP = {
|
const STATUS_TAG_MAP = {
|
||||||
@@ -372,8 +402,9 @@ export default {
|
|||||||
opNameList: [],
|
opNameList: [],
|
||||||
mqtt: window.mqtt,
|
mqtt: window.mqtt,
|
||||||
// 双工位扫码验证数据
|
// 双工位扫码验证数据
|
||||||
ws1Result: { 扫码值: '', 工单号: '', 扫码物料编码: '', 扫码序列号: '', 错误消息: '', 验证结果: '' },
|
ws1Result: { 扫码值: '', 工单号: '', 扫码物料编码: '', 扫码序列号: '', 错误消息: '', 验证结果: '', 程序版本: '' },
|
||||||
ws2Result: { 扫码值: '', 工单号: '', 扫码物料编码: '', 扫码序列号: '', 错误消息: '', 验证结果: '' },
|
ws2Result: { 扫码值: '', 工单号: '', 扫码物料编码: '', 扫码序列号: '', 错误消息: '', 验证结果: '', 程序版本: '' },
|
||||||
|
programVersionOptions: PROGRAM_VERSION_OPTIONS,
|
||||||
// 双工位托盘信息
|
// 双工位托盘信息
|
||||||
ws1Tray: { 托盘号: '', 托盘物料编码: '', 托盘工件状态: '' },
|
ws1Tray: { 托盘号: '', 托盘物料编码: '', 托盘工件状态: '' },
|
||||||
ws2Tray: { 托盘号: '', 托盘物料编码: '', 托盘工件状态: '' },
|
ws2Tray: { 托盘号: '', 托盘物料编码: '', 托盘工件状态: '' },
|
||||||
@@ -451,12 +482,22 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 写入单个PLC信号值 */
|
||||||
|
async writePLCValue(opName, tagID, tagValue) {
|
||||||
|
return axios.post(writePlcApi_BtnType, {
|
||||||
|
tagTypeCodeID: tagID,
|
||||||
|
OPName: opName,
|
||||||
|
tagValue
|
||||||
|
}, { timeout: 5000 })
|
||||||
|
},
|
||||||
|
|
||||||
/** 根据工位名获取对应的状态对象和托盘对象 */
|
/** 根据工位名获取对应的状态对象和托盘对象 */
|
||||||
getWorkstationData(opName) {
|
getWorkstationData(opName) {
|
||||||
const isWs1 = opName === this.opNameList[0]
|
const isWs1 = opName === this.opNameList[0]
|
||||||
return {
|
return {
|
||||||
status: isWs1 ? this.ws1Status : this.ws2Status,
|
status: isWs1 ? this.ws1Status : this.ws2Status,
|
||||||
tray: isWs1 ? this.ws1Tray : this.ws2Tray
|
tray: isWs1 ? this.ws1Tray : this.ws2Tray,
|
||||||
|
result: isWs1 ? this.ws1Result : this.ws2Result
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -466,7 +507,7 @@ export default {
|
|||||||
signalValues.forEach(item => {
|
signalValues.forEach(item => {
|
||||||
valueMap[item.tagTypeCodeID] = item.tagValue
|
valueMap[item.tagTypeCodeID] = item.tagValue
|
||||||
})
|
})
|
||||||
const { status, tray } = this.getWorkstationData(opName)
|
const { status, tray, result } = this.getWorkstationData(opName)
|
||||||
// 更新四个状态灯
|
// 更新四个状态灯
|
||||||
Object.entries(STATUS_TAG_MAP).forEach(([tagId, key]) => {
|
Object.entries(STATUS_TAG_MAP).forEach(([tagId, key]) => {
|
||||||
if (valueMap[tagId] !== undefined) {
|
if (valueMap[tagId] !== undefined) {
|
||||||
@@ -477,6 +518,7 @@ export default {
|
|||||||
if (valueMap['200380'] !== undefined) tray.托盘号 = valueMap['200380']
|
if (valueMap['200380'] !== undefined) tray.托盘号 = valueMap['200380']
|
||||||
if (valueMap['203240'] !== undefined) this.convertMaterialCode(opName, valueMap['203240'])
|
if (valueMap['203240'] !== undefined) this.convertMaterialCode(opName, valueMap['203240'])
|
||||||
if (valueMap['200440'] !== undefined) tray.托盘工件状态 = TRAY_STATUS_TEXT[valueMap['200440']] || ''
|
if (valueMap['200440'] !== undefined) tray.托盘工件状态 = TRAY_STATUS_TEXT[valueMap['200440']] || ''
|
||||||
|
if (valueMap[PROGRAM_VERSION_TAG_ID] !== undefined) result.程序版本 = valueMap[PROGRAM_VERSION_TAG_ID] || ''
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 将PLC读取到的物料号通过存储过程转换为物料编码 */
|
/** 将PLC读取到的物料号通过存储过程转换为物料编码 */
|
||||||
@@ -756,6 +798,12 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const programVersion = result.程序版本 ? result.程序版本.toString() : ''
|
||||||
|
if (!programVersion) {
|
||||||
|
this.$message.warning('请先选择或输入程序版本!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.$confirm('确定要执行手动请求上线操作吗?', '确认操作', {
|
await this.$confirm('确定要执行手动请求上线操作吗?', '确认操作', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -776,11 +824,13 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
axios.post(writePlcApi_BtnType, {
|
this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, programVersion)
|
||||||
tagTypeCodeID: '205015',
|
.then(response => {
|
||||||
OPName: opName,
|
if (response.data.code != 0) {
|
||||||
tagValue: 'true'
|
return Promise.reject(new Error(response.data.msg || '程序版本写入失败'))
|
||||||
}, { timeout: 5000 })
|
}
|
||||||
|
return this.writePLCValue(opName, '205015', 'true')
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.code == 0) {
|
if (response.data.code == 0) {
|
||||||
partLoadStatus.success = true
|
partLoadStatus.success = true
|
||||||
|
|||||||
Reference in New Issue
Block a user