【类 型】:refactor

【主	题】:任务提交前 检查
【描	述】:
	[原因]:排除意外情况
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-10 14:11:51 +08:00
parent 479103333e
commit 3d47d2c32e

View File

@ -406,6 +406,19 @@ export default {
* @description: 执行任务前 先检测订单是否 合法 例如订单重量会不会超出飞机载重上限 * @description: 执行任务前 先检测订单是否 合法 例如订单重量会不会超出飞机载重上限
*/ */
checkQuest () { checkQuest () {
console.log(this.questForm.id)
if (this.questForm.id === '') {
this.$message.error('未选择订单任务!')
return
}
if (!this.currentOrder) {
this.$message.error('此订单已被申请退款或者订单已经被取消!')
return
}
if (this.currentOrder.bind_route === null) { //
this.$message.error('此站点,未绑定任务航点')
return
}
if (Number(this.currentOrder.total_weight) >= Number(this.plane.weight_max)) { // if (Number(this.currentOrder.total_weight) >= Number(this.plane.weight_max)) { //
this.$confirm('此订单总重超出本飞机的载重上限', '检测订单', { this.$confirm('此订单总重超出本飞机的载重上限', '检测订单', {
confirmButtonText: '仍然提交', confirmButtonText: '仍然提交',
@ -449,64 +462,52 @@ export default {
* @description: 执行订单任务 * @description: 执行订单任务
*/ */
runQuest () { runQuest () {
if (this.questForm.id === '') { /* 插入日志 */
this.$message.error('未选择订单任务!') this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` })
return /* 执行写在这里 */
} let routeData // 线
if (this.currentOrder) { let newRuning // running
/* 插入日志 */ try {
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` }) /* 站点正在执行任务runing 注册 */
/* 执行写在这里 */ const runing = this.currentOrder.runing.split(',')
if (this.currentOrder.bind_route === null) { // let foundEmpty = false
this.$message.error('此站点,未绑定任务航点') let selIndex // 使线
return runing.some((item, index, arr) => {
} if (item === '') {
let routeData arr[index] = this.planesId
let newRuning // running foundEmpty = true
try { selIndex = index
/* 站点正在执行任务runing 注册 */ return true // 退
const runing = this.currentOrder.runing.split(',')
let foundEmpty = false
let selIndex // 使线
runing.some((item, index, arr) => {
if (item === '') {
arr[index] = this.planesId
foundEmpty = true
selIndex = index
return true // 退
}
})
newRuning = runing.join(',')
if (!foundEmpty) {
this.$message({
type: 'warning',
message: '此站点执行飞机已达上线,如果想执行请为该站点绑定更多航线'
})
return // 退
} }
/* 航线选择 */ })
const bindRoute = this.currentOrder.bind_route.split(',') newRuning = runing.join(',')
routeData = this.routeList.find(element => element.id === bindRoute[selIndex]).route_data if (!foundEmpty) {
routeData = JSON.parse(routeData)// this.$message({
// $food_sn$ type: 'warning',
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// telTail tel message: '站点所有航线都已被占用!'
routeData.tasks.forEach((x, index) => {
if (x.sound) {
const str = this.voiceRouteParse(this.currentOrder, x.sound)
routeData.tasks[index].sound = str//
}
}) })
routeData = JSON.stringify(routeData)// return // 退
} catch (error) {
this.$message.error('操作失败,请重新尝试')
} }
this.publishFun(`{"questAss":${routeData}}`)// /* 航线选择 */
this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// const bindRoute = this.currentOrder.bind_route.split(',')
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: newRuning })// 线 routeData = this.routeList.find(element => element.id === bindRoute[selIndex]).route_data
this.speakText('提交任务,锁定航线。') routeData = JSON.parse(routeData)//
} else { // $food_sn$
this.$message.error('此订单已被申请退款或者订单已经被取消!') this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// telTail tel
routeData.tasks.forEach((x, index) => {
if (x.sound) {
const str = this.voiceRouteParse(this.currentOrder, x.sound)
routeData.tasks[index].sound = str//
}
})
routeData = JSON.stringify(routeData)//
} catch (error) {
this.$message.error('操作失败,请重新尝试')
} }
this.publishFun(`{"questAss":${routeData}}`)//
this.questAss(this.currentOrder.id, 'shipment_status', '已发货')//
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: newRuning })// 线
this.speakText('提交任务,锁定航线。')
}, },
/** /**
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段 * @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
@ -666,6 +667,13 @@ export default {
} }
return false return false
}) })
},
questList (val) {
/* 任务列表更新时 判断还有没有当前选择的id 没有就清空 */
const found = val.some(item => item.id === this.questForm.id)
if (!found) {
this.questForm.id = ''
}
} }
} }