Compare commits
3 Commits
ec0e9a96ab
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2f7ff57d9 | ||
|
|
0d9b3f6d80 | ||
|
|
123034aeb4 |
File diff suppressed because it is too large
Load Diff
@@ -449,14 +449,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi, updateProgramVersionApi } from '@/../static/config'
|
||||||
|
|
||||||
// ==================== 常量定义 ====================
|
// ==================== 常量定义 ====================
|
||||||
|
|
||||||
/** 程序版本 PLC 字符串信号标识 */
|
|
||||||
const PROGRAM_VERSION_TAG_ID = '208640'
|
|
||||||
|
|
||||||
/** 程序版本下拉选项 */
|
|
||||||
/** 程序版本可选项(PLC 实际可写的字符值) */
|
/** 程序版本可选项(PLC 实际可写的字符值) */
|
||||||
const PROGRAM_VERSION_OPTIONS = []
|
const PROGRAM_VERSION_OPTIONS = []
|
||||||
|
|
||||||
@@ -491,7 +487,7 @@ const POLL_TOTAL_COUNT = 120
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
opNameType: '底架上线',
|
opNameType: '底架上线', // 底架上线 转台上线
|
||||||
opName: '',
|
opName: '',
|
||||||
clickOpName: '',
|
clickOpName: '',
|
||||||
opNameList: [],
|
opNameList: [],
|
||||||
@@ -620,6 +616,16 @@ export default {
|
|||||||
}, { timeout: 5000 })
|
}, { timeout: 5000 })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 写入程序版本到PLC(使用 web_update_materialcodecode 接口) */
|
||||||
|
async writeProgramVersionToPLC(opName, version) {
|
||||||
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
|
return axios.post(updateProgramVersionApi, {
|
||||||
|
OpCode: opName,
|
||||||
|
SortNo: result.扫码物料编码 || '',
|
||||||
|
V: version
|
||||||
|
}, { timeout: 5000 })
|
||||||
|
},
|
||||||
|
|
||||||
/** 根据工位名获取对应的状态对象和托盘对象 */
|
/** 根据工位名获取对应的状态对象和托盘对象 */
|
||||||
getWorkstationData(opName) {
|
getWorkstationData(opName) {
|
||||||
const isWs1 = opName === this.opNameList[0]
|
const isWs1 = opName === this.opNameList[0]
|
||||||
@@ -981,7 +987,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 实际执行 PLC 写值上线流程;成功后写入手动上线记录 */
|
/** 实际执行 PLC 写值上线流程;成功后写入手动上线记录
|
||||||
|
* 注意:程序版本已在选择弹窗确认时写入 PLC,此处不再重复写 */
|
||||||
async doPartLoad(opName) {
|
async doPartLoad(opName) {
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
const partLoadStatus = opName === this.opNameList[0] ? this.ws1PartLoadStatus : this.ws2PartLoadStatus
|
const partLoadStatus = opName === this.opNameList[0] ? this.ws1PartLoadStatus : this.ws2PartLoadStatus
|
||||||
@@ -998,8 +1005,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const r1 = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, programVersion)
|
|
||||||
if (r1.data.code != 0) throw new Error(r1.data.msg || '程序版本写入失败')
|
|
||||||
const r2 = await this.writePLCValue(opName, '205015', 'true')
|
const r2 = await this.writePLCValue(opName, '205015', 'true')
|
||||||
if (r2.data.code == 0) {
|
if (r2.data.code == 0) {
|
||||||
partLoadStatus.success = true
|
partLoadStatus.success = true
|
||||||
@@ -1061,20 +1066,29 @@ export default {
|
|||||||
this.versionDialog.visible = true
|
this.versionDialog.visible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 首次扫码:从数据库取该物料最近一次的程序版本,直接回填,不弹窗 */
|
/** 首次扫码:从数据库取该物料最近一次的程序版本,直接回填 + 写PLC,不弹窗 */
|
||||||
async autoFillFirstVersion(opName) {
|
async autoFillFirstVersion(opName) {
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
const partCode = result.扫码物料编码 || ''
|
const partCode = result.扫码物料编码 || ''
|
||||||
if (!partCode) return
|
if (!partCode) return
|
||||||
const historyList = await this.loadHistoryVersions(partCode)
|
const historyList = await this.loadHistoryVersions(partCode)
|
||||||
if (historyList && historyList.length > 0) {
|
if (!historyList || historyList.length === 0) return
|
||||||
result.程序版本 = historyList[0]
|
const version = historyList[0]
|
||||||
this.setLastUsedVersion(opName, historyList[0])
|
try {
|
||||||
|
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||||
|
if (r.data.code != 0) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result.程序版本 = version
|
||||||
|
this.setLastUsedVersion(opName, version)
|
||||||
|
} catch (error) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + error.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** "选择程序版本"弹窗确定:把版本回填到对应工位,不自动上线 */
|
/** "选择程序版本"弹窗确定:把版本回填 + 立即写入 PLC,不自动上线 */
|
||||||
confirmVersionDialog() {
|
async confirmVersionDialog() {
|
||||||
const version = this.versionDialog.selectedVersion ? this.versionDialog.selectedVersion.toString() : ''
|
const version = this.versionDialog.selectedVersion ? this.versionDialog.selectedVersion.toString() : ''
|
||||||
if (!version) {
|
if (!version) {
|
||||||
this.$message.warning('请选择或输入程序版本!')
|
this.$message.warning('请选择或输入程序版本!')
|
||||||
@@ -1082,9 +1096,19 @@ export default {
|
|||||||
}
|
}
|
||||||
const opName = this.versionDialog.opName
|
const opName = this.versionDialog.opName
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
result.程序版本 = version
|
try {
|
||||||
this.setLastUsedVersion(opName, version)
|
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||||
this.versionDialog.visible = false
|
if (r.data.code != 0) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result.程序版本 = version
|
||||||
|
this.setLastUsedVersion(opName, version)
|
||||||
|
this.versionDialog.visible = false
|
||||||
|
this.$message.success('程序版本已写入 PLC')
|
||||||
|
} catch (error) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + error.message)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 读取该工位上一次使用的程序版本(localStorage) */
|
/** 读取该工位上一次使用的程序版本(localStorage) */
|
||||||
|
|||||||
@@ -449,14 +449,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi } from '@/../static/config'
|
import { mqttIp, mqttTopic, mqttInitRequestTopic, writePlcApi_BtnType, selectOpNameApi, multiReadPlcApi, partUnloadedApi, updateProgramVersionApi } from '@/../static/config'
|
||||||
|
|
||||||
// ==================== 常量定义 ====================
|
// ==================== 常量定义 ====================
|
||||||
|
|
||||||
/** 程序版本 PLC 字符串信号标识 */
|
|
||||||
const PROGRAM_VERSION_TAG_ID = '208640'
|
|
||||||
|
|
||||||
/** 程序版本下拉选项 */
|
|
||||||
/** 程序版本可选项(PLC 实际可写的字符值) */
|
/** 程序版本可选项(PLC 实际可写的字符值) */
|
||||||
const PROGRAM_VERSION_OPTIONS = []
|
const PROGRAM_VERSION_OPTIONS = []
|
||||||
|
|
||||||
@@ -491,7 +487,7 @@ const POLL_TOTAL_COUNT = 120
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
opNameType: '转台上线',
|
opNameType: '转台上线', // 底架上线 转台上线
|
||||||
opName: '',
|
opName: '',
|
||||||
clickOpName: '',
|
clickOpName: '',
|
||||||
opNameList: [],
|
opNameList: [],
|
||||||
@@ -620,6 +616,16 @@ export default {
|
|||||||
}, { timeout: 5000 })
|
}, { timeout: 5000 })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 写入程序版本到PLC(使用 web_update_materialcodecode 接口) */
|
||||||
|
async writeProgramVersionToPLC(opName, version) {
|
||||||
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
|
return axios.post(updateProgramVersionApi, {
|
||||||
|
OpCode: opName,
|
||||||
|
SortNo: result.扫码物料编码 || '',
|
||||||
|
V: version
|
||||||
|
}, { timeout: 5000 })
|
||||||
|
},
|
||||||
|
|
||||||
/** 根据工位名获取对应的状态对象和托盘对象 */
|
/** 根据工位名获取对应的状态对象和托盘对象 */
|
||||||
getWorkstationData(opName) {
|
getWorkstationData(opName) {
|
||||||
const isWs1 = opName === this.opNameList[0]
|
const isWs1 = opName === this.opNameList[0]
|
||||||
@@ -981,7 +987,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 实际执行 PLC 写值上线流程;成功后写入手动上线记录 */
|
/** 实际执行 PLC 写值上线流程;成功后写入手动上线记录
|
||||||
|
* 注意:程序版本已在选择弹窗确认时写入 PLC,此处不再重复写 */
|
||||||
async doPartLoad(opName) {
|
async doPartLoad(opName) {
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
const partLoadStatus = opName === this.opNameList[0] ? this.ws1PartLoadStatus : this.ws2PartLoadStatus
|
const partLoadStatus = opName === this.opNameList[0] ? this.ws1PartLoadStatus : this.ws2PartLoadStatus
|
||||||
@@ -998,8 +1005,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const r1 = await this.writePLCValue(opName, PROGRAM_VERSION_TAG_ID, programVersion)
|
|
||||||
if (r1.data.code != 0) throw new Error(r1.data.msg || '程序版本写入失败')
|
|
||||||
const r2 = await this.writePLCValue(opName, '205015', 'true')
|
const r2 = await this.writePLCValue(opName, '205015', 'true')
|
||||||
if (r2.data.code == 0) {
|
if (r2.data.code == 0) {
|
||||||
partLoadStatus.success = true
|
partLoadStatus.success = true
|
||||||
@@ -1061,20 +1066,29 @@ export default {
|
|||||||
this.versionDialog.visible = true
|
this.versionDialog.visible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 首次扫码:从数据库取该物料最近一次的程序版本,直接回填,不弹窗 */
|
/** 首次扫码:从数据库取该物料最近一次的程序版本,直接回填 + 写PLC,不弹窗 */
|
||||||
async autoFillFirstVersion(opName) {
|
async autoFillFirstVersion(opName) {
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
const partCode = result.扫码物料编码 || ''
|
const partCode = result.扫码物料编码 || ''
|
||||||
if (!partCode) return
|
if (!partCode) return
|
||||||
const historyList = await this.loadHistoryVersions(partCode)
|
const historyList = await this.loadHistoryVersions(partCode)
|
||||||
if (historyList && historyList.length > 0) {
|
if (!historyList || historyList.length === 0) return
|
||||||
result.程序版本 = historyList[0]
|
const version = historyList[0]
|
||||||
this.setLastUsedVersion(opName, historyList[0])
|
try {
|
||||||
|
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||||
|
if (r.data.code != 0) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result.程序版本 = version
|
||||||
|
this.setLastUsedVersion(opName, version)
|
||||||
|
} catch (error) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + error.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** "选择程序版本"弹窗确定:把版本回填到对应工位,不自动上线 */
|
/** "选择程序版本"弹窗确定:把版本回填 + 立即写入 PLC,不自动上线 */
|
||||||
confirmVersionDialog() {
|
async confirmVersionDialog() {
|
||||||
const version = this.versionDialog.selectedVersion ? this.versionDialog.selectedVersion.toString() : ''
|
const version = this.versionDialog.selectedVersion ? this.versionDialog.selectedVersion.toString() : ''
|
||||||
if (!version) {
|
if (!version) {
|
||||||
this.$message.warning('请选择或输入程序版本!')
|
this.$message.warning('请选择或输入程序版本!')
|
||||||
@@ -1082,9 +1096,19 @@ export default {
|
|||||||
}
|
}
|
||||||
const opName = this.versionDialog.opName
|
const opName = this.versionDialog.opName
|
||||||
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
const result = opName === this.opNameList[0] ? this.ws1Result : this.ws2Result
|
||||||
result.程序版本 = version
|
try {
|
||||||
this.setLastUsedVersion(opName, version)
|
const r = await this.writeProgramVersionToPLC(opName, version)
|
||||||
this.versionDialog.visible = false
|
if (r.data.code != 0) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + (r.data.msg || ''))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result.程序版本 = version
|
||||||
|
this.setLastUsedVersion(opName, version)
|
||||||
|
this.versionDialog.visible = false
|
||||||
|
this.$message.success('程序版本已写入 PLC')
|
||||||
|
} catch (error) {
|
||||||
|
this.$message.error('程序版本写入PLC失败:' + error.message)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 读取该工位上一次使用的程序版本(localStorage) */
|
/** 读取该工位上一次使用的程序版本(localStorage) */
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const writePlcApi_BtnType = api + `/api/Web_WritePLC_BtnType`
|
|||||||
export const multiReadPlcApi = api + `/api/Web_MultReadPLC`
|
export const multiReadPlcApi = api + `/api/Web_MultReadPLC`
|
||||||
export const selectOpNameApi = api + `/api/Web_SetScanPoint`
|
export const selectOpNameApi = api + `/api/Web_SetScanPoint`
|
||||||
export const partUnloadedApi = api + `/api/Web_PartUnloaded`
|
export const partUnloadedApi = api + `/api/Web_PartUnloaded`
|
||||||
|
export const updateProgramVersionApi = api + `/api/web_update_materialcodecode`
|
||||||
|
|
||||||
export const readFile_config = url + `/webpage/file/` // invoice
|
export const readFile_config = url + `/webpage/file/` // invoice
|
||||||
export const readImg_config = url + `/webpage/img/` // delivery/MS/performancebond
|
export const readImg_config = url + `/webpage/img/` // delivery/MS/performancebond
|
||||||
|
|||||||
Reference in New Issue
Block a user