接口修改

This commit is contained in:
24kycj
2024-11-27 16:51:53 +08:00
parent f7ff04bc4d
commit f125b5cace
+23 -8
View File
@@ -10,6 +10,12 @@ const PrinterStatus = {
P: '正在打印' P: '正在打印'
} }
// 打印机报错
const printer_errors = {
'0x00010': '光盘仓为空',
'0x00011': '抓取光盘错误',
}
// 提交任务报错 // 提交任务报错
const submitErros = { const submitErros = {
'0x00001': '读取任务JSON失败', '0x00001': '读取任务JSON失败',
@@ -27,6 +33,7 @@ const submitErros = {
'0x0000E': '更新任务数据失败', '0x0000E': '更新任务数据失败',
} }
// 错误状态 // 错误状态
const Error1 = { const Error1 = {
0: '托盘移动错误', 0: '托盘移动错误',
@@ -218,10 +225,6 @@ const getDefaultState = () => {
serviceStatus: false, serviceStatus: false,
reconnections: 0, reconnections: 0,
PrinterStatus, PrinterStatus,
Error1,
Error2,
Error3,
submitErros,
CDName, CDName,
CDStatus, CDStatus,
diskTypes, diskTypes,
@@ -335,7 +338,7 @@ const actions = {
// 提交任务报错处理 // 提交任务报错处理
} else if (data.resp_name === 'submit_task_res') { } else if (data.resp_name === 'submit_task_res') {
let error = data.resp_info let error = data.resp_info
commit('setData', { name: 'printer_error', data: {type: 'error', notify: '任务' + error.task_uuid + '提交失败:' + this.$store.state.submitErros[error.task_res], message: '' } }) commit('setData', { name: 'printer_error', data: {type: 'error', notify: '任务' + error.task_uuid + '提交失败:' + submitErros[error.task_res], message: '' } })
// 打印报错处理 // 打印报错处理
} else if (data.resp_name === 'printer_error') { } else if (data.resp_name === 'printer_error') {
let error = data.resp_info let error = data.resp_info
@@ -362,16 +365,28 @@ const actions = {
if (errors[i] == 1) info.error3 = i if (errors[i] == 1) info.error3 = i
} }
} }
if (error.printer_error) {
commit('setData', { name: 'printer_error', data: {type: 'error', notify: printer_errors[error.printer_error], message: '' } })
dispatch('websocketsend', {
req_name: 'next_task',
req_type: 1,
req_info: {}
}).then(() => {
}).catch(() => {
})
}
setTimeout(() => { setTimeout(() => {
if (info.error1 || info.error1 === 0) { if (info.error1 || info.error1 === 0) {
commit('setData', { name: 'printer_error', data: {type: 'error', notify: this.$store.state.Error1[info.error1], message: '' } }) commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error1[info.error1], message: '' } })
} }
if (info.error2 || info.error2 === 0) { if (info.error2 || info.error2 === 0) {
commit('setData', { name: 'printer_error', data: {type: 'error', notify: this.$store.state.Error2[info.error2], message: '' } }) commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error2[info.error2], message: '' } })
} }
if (info.error3 || info.error3 === 0) { if (info.error3 || info.error3 === 0) {
commit('setData', { name: 'printer_error', data: {type: 'error', notify: this.$store.state.Error3[info.error3], message: '' } }) commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error3[info.error3], message: '' } })
} }
}, 100) }, 100)