【类 型】:refactor
【主 题】:提交任务 改异步 【描 述】: [原因]:先完成订单状态更改 再向飞机发送航点文件 防止飞机飞走了 订单状态还没改 [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
91f024105d
commit
1fa449130e
@ -456,7 +456,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* @description: 执行订单任务
|
* @description: 执行订单任务
|
||||||
*/
|
*/
|
||||||
runQuest () {
|
async runQuest () {
|
||||||
/* 插入日志 */
|
/* 插入日志 */
|
||||||
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` })
|
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` })
|
||||||
/* 执行写在这里 */
|
/* 执行写在这里 */
|
||||||
@ -479,7 +479,7 @@ export default {
|
|||||||
if (!foundEmpty) {
|
if (!foundEmpty) {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: '站点所有航线都已被占用!'
|
message: '此站点所有航线均被占用,等航线空闲再试!'
|
||||||
})
|
})
|
||||||
return // 退出外层函数
|
return // 退出外层函数
|
||||||
}
|
}
|
||||||
@ -489,20 +489,27 @@ export default {
|
|||||||
routeData = JSON.parse(routeData)// 反序列化
|
routeData = JSON.parse(routeData)// 反序列化
|
||||||
// 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段
|
// 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段
|
||||||
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
||||||
routeData.tasks.forEach((x, index) => {
|
routeData.questAss.tasks.forEach((x, index) => {
|
||||||
if (x.sound) {
|
if (x.sound) {
|
||||||
const str = this.voiceRouteParse(this.currentOrder, x.sound)
|
const str = this.voiceRouteParse(this.currentOrder, x.sound)
|
||||||
routeData.tasks[index].sound = str// 重新写入声音航点
|
routeData.questAss.tasks[index].sound = str// 重新写入声音航点
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
routeData = JSON.stringify(routeData)// 重新序列化
|
routeData = JSON.stringify(routeData)// 重新序列化
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error('操作失败,请重新尝试')
|
this.$message.error('操作失败,航线异常')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
this.publishFun(`{"questAss":${routeData}}`)// 发送航点信息主题
|
let res = await this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// 订单改为发货状态 并更新订单列表
|
||||||
this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// 订单改为发货状态 并更新订单列表
|
if (res.data.status === 1) {
|
||||||
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: newRuning })// 航线注册飞机 锁定送餐点
|
res = await this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: newRuning })// 航线注册飞机 锁定送餐点
|
||||||
this.speakText('提交任务,锁定航线。')
|
if (res.data.status === 1) {
|
||||||
|
this.publishFun(`{"questAss":${routeData}}`)// 发送航点信息主题
|
||||||
|
this.speakText('提交任务,注册航线。')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 主动获取飞机状态
|
||||||
|
this.publishFun('{getPlaneState:1}')
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
|
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
|
||||||
|
@ -22,23 +22,23 @@ export async function apiCrosFrequency (params) {
|
|||||||
/**
|
/**
|
||||||
* @description: 向改变订单承接任务api 提交数据 () ,并更新订单列表
|
* @description: 向改变订单承接任务api 提交数据 () ,并更新订单列表
|
||||||
* @param {*} id 订单id
|
* @param {*} id 订单id
|
||||||
* @param {*} state 主状态"main_status" 货物状态"shipment_status" 退款状态"refund_status"
|
* @param {*} statusType 主状态"main_status" 货物状态"shipment_status" 退款状态"refund_status"
|
||||||
* @param {*} val 修改字段的值
|
* @param {*} val 修改字段的值
|
||||||
*/
|
*/
|
||||||
export function questAss (id, state, val) {
|
export async function questAss (id, statusType, val) {
|
||||||
const params = new URLSearchParams()// post对象参数 转成 字符串连接
|
const params = new URLSearchParams()// post对象参数 转成 字符串连接
|
||||||
params.append('id', id)
|
params.append('id', id)
|
||||||
params.append('state', state)
|
params.append('state', statusType)
|
||||||
params.append('val', val)
|
params.append('val', val)
|
||||||
api.post('questAss', params).then(res => {
|
const res = await api.post('questAss', params)
|
||||||
if (res.data.status === 1) {
|
if (res.data.status === 1) {
|
||||||
Message.success(res.data.msg)
|
Message.success(res.data.msg)
|
||||||
store.dispatch('fetchPaidOrderList')// 更新订单列表
|
store.dispatch('fetchPaidOrderList')// 更新订单列表
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.data.msg)
|
Message.error(res.data.msg)
|
||||||
store.dispatch('fetchPaidOrderList')// 更新订单列表
|
store.dispatch('fetchPaidOrderList')// 更新订单列表
|
||||||
}
|
}
|
||||||
})
|
return res
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description: 获取订单列表
|
* @description: 获取订单列表
|
||||||
|
Loading…
Reference in New Issue
Block a user