refactor: 程序版本写入PLC改用 Web_WritePLC 接口
This commit is contained in:
@@ -449,7 +449,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
||||
|
||||
// ==================== 常量定义 ====================
|
||||
|
||||
@@ -491,7 +491,7 @@ const POLL_TOTAL_COUNT = 120
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
opNameType: '底架上线',
|
||||
opNameType: '底架上线', // 底架上线 转台上线
|
||||
opName: '',
|
||||
clickOpName: '',
|
||||
opNameList: [],
|
||||
@@ -620,6 +620,15 @@ export default {
|
||||
}, { timeout: 5000 })
|
||||
},
|
||||
|
||||
/** 写入程序版本到PLC(使用 Web_WritePLC 接口) */
|
||||
async writeProgramVersionToPLC(opName, version) {
|
||||
return axios.post(writePlcApi, {
|
||||
tagTypeCodeID: PROGRAM_VERSION_TAG_ID,
|
||||
OPName: opName,
|
||||
tagValue: version
|
||||
}, { timeout: 5000 })
|
||||
},
|
||||
|
||||
/** 根据工位名获取对应的状态对象和托盘对象 */
|
||||
getWorkstationData(opName) {
|
||||
const isWs1 = opName === this.opNameList[0]
|
||||
@@ -1069,7 +1078,7 @@ export default {
|
||||
if (!historyList || historyList.length === 0) return
|
||||
const version = historyList[0]
|
||||
try {
|
||||
const r = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, version)
|
||||
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||
if (r.data.code != 0) {
|
||||
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||
return
|
||||
@@ -1091,7 +1100,7 @@ export default {
|
||||
const opName = this.versionDialog.opName
|
||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||
try {
|
||||
const r = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, version)
|
||||
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||
if (r.data.code != 0) {
|
||||
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||
return
|
||||
|
||||
@@ -449,7 +449,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
||||
|
||||
// ==================== 常量定义 ====================
|
||||
|
||||
@@ -491,7 +491,7 @@ const POLL_TOTAL_COUNT = 120
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
opNameType: '转台上线',
|
||||
opNameType: '转台上线', // 底架上线 转台上线
|
||||
opName: '',
|
||||
clickOpName: '',
|
||||
opNameList: [],
|
||||
@@ -620,6 +620,15 @@ export default {
|
||||
}, { timeout: 5000 })
|
||||
},
|
||||
|
||||
/** 写入程序版本到PLC(使用 Web_WritePLC 接口) */
|
||||
async writeProgramVersionToPLC(opName, version) {
|
||||
return axios.post(writePlcApi, {
|
||||
tagTypeCodeID: PROGRAM_VERSION_TAG_ID,
|
||||
OPName: opName,
|
||||
tagValue: version
|
||||
}, { timeout: 5000 })
|
||||
},
|
||||
|
||||
/** 根据工位名获取对应的状态对象和托盘对象 */
|
||||
getWorkstationData(opName) {
|
||||
const isWs1 = opName === this.opNameList[0]
|
||||
@@ -1069,7 +1078,7 @@ export default {
|
||||
if (!historyList || historyList.length === 0) return
|
||||
const version = historyList[0]
|
||||
try {
|
||||
const r = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, version)
|
||||
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||
if (r.data.code != 0) {
|
||||
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||
return
|
||||
@@ -1091,7 +1100,7 @@ export default {
|
||||
const opName = this.versionDialog.opName
|
||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||
try {
|
||||
const r = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, version)
|
||||
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||
if (r.data.code != 0) {
|
||||
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user