【类 型】:refactor

【主	题】:提交任务 改异步
【描	述】:
	[原因]:先完成订单状态更改 再向飞机发送航点文件   防止飞机飞走了 订单状态还没改
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-10 23:41:18 +08:00
parent 91f024105d
commit 1fa449130e
2 changed files with 28 additions and 21 deletions

View File

@ -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匹配成 送餐订单里面的对应字段

View File

@ -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: 获取订单列表