更新 ele/auto-meal-complete.user.js

This commit is contained in:
502647092 2023-12-05 03:30:07 +00:00
parent 46a0696944
commit 0829118cc7

View File

@ -81,7 +81,7 @@
// "queryType": "COOKING" // "queryType": "COOKING"
}) })
} }
async function mealComplete(order, cookTime) { async function mealComplete(cook, cookTime) {
let orderId = cook.id let orderId = cook.id
let daySn = cook.header.daySn let daySn = cook.header.daySn
let result = await request('ShipmentService', 'mealComplete', { let result = await request('ShipmentService', 'mealComplete', {
@ -100,7 +100,7 @@
async function checkCooking() { async function checkCooking() {
if (!ele.processOrders) return if (!ele.processOrders) return
for (const cook of ele.processOrders) { for (const cook of ele.processOrders) {
let orderId = cook.id let daySn = cook.header.daySn
if (!cook.mealPreparationInfo || cook.mealPreparationInfo.mealComplete) continue if (!cook.mealPreparationInfo || cook.mealPreparationInfo.mealComplete) continue
// 骑手到店 并且大于最小上报时长 直接上报出餐 // 骑手到店 并且大于最小上报时长 直接上报出餐
let cookTime = (Date.now() - new Date(cook.activeTime).getTime()) / 1000 let cookTime = (Date.now() - new Date(cook.activeTime).getTime()) / 1000
@ -108,17 +108,15 @@
if (cook.deliveryInfo.distTraceView.traceView.status == '骑士已到店' if (cook.deliveryInfo.distTraceView.traceView.status == '骑士已到店'
&& cook.mealPreparationInfo.minMealCompleteTimeCount < 0 && cook.mealPreparationInfo.minMealCompleteTimeCount < 0
&& leftTime < ele.autoSubmitLeftTimeWhenOnShop) { && leftTime < ele.autoSubmitLeftTimeWhenOnShop) {
debug('订单 ' + orderId + ' 骑手到店.') debug('订单 #' + daySn + ' 骑手到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.')
debug('订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.')
return mealComplete(cook, cookTime) return mealComplete(cook, cookTime)
} }
if (leftTime < ele.autoSubmitLeftTime) { if (leftTime < ele.autoSubmitLeftTime) {
// 大于最小上报时长 并且距离上报超时不足120秒 直接上报出餐 // 大于最小上报时长 并且距离上报超时不足120秒 直接上报出餐
debug('订单 ' + orderId + ' 骑手未到店.') debug('订单 #' + daySn + ' 骑手未到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.')
debug('订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.')
return mealComplete(cook, cookTime) return mealComplete(cook, cookTime)
} }
debug('订单 ' + orderId + ' 还剩 ' + cook.mealPreparationInfo.commonShowTime + 's 上报超时.') debug('订单 #' + daySn + ' 还剩 ' + cook.mealPreparationInfo.commonShowTime + 's 上报超时.')
cook.mealPreparationInfo.minMealCompleteTimeCount -= 5 cook.mealPreparationInfo.minMealCompleteTimeCount -= 5
cook.mealPreparationInfo.commonShowTime -= 5 cook.mealPreparationInfo.commonShowTime -= 5
} }
@ -147,7 +145,10 @@
+ '</div>' + '</div>'
let orderInfo = '进行中的订单信息: </br><div class="ant-alert-content">' let orderInfo = '进行中的订单信息: </br><div class="ant-alert-content">'
+ (ele.processOrders.length + (ele.processOrders.length
? ele.processOrders.map(o => ' 订单: #' + o.header.daySn + ' 出餐状态 ' + (o.mealPreparationInfo.mealComplete ? '已出餐' : '未出餐') + ' 配送状态 ' + o.deliveryInfo.distTraceView.traceView.status).join('</br>') ? ele.processOrders.map(o => ' 订单: #' + o.header.daySn
+ ' 出餐状态 ' + (o.mealPreparationInfo.mealComplete ? '已出餐' : '未出餐')
+ ' 配送状态 ' + o.deliveryInfo.distTraceView.traceView.status + ''
+ (o.deliveryInfo.deliveryDistance ? ' ' + o.deliveryInfo.deliveryDistance : '')).join('</br>')
: '当前没有进行中的订单.') : '当前没有进行中的订单.')
+ '</div>' + '</div>'
let logs = '运行日志: </br><div class="ant-alert-content">' let logs = '运行日志: </br><div class="ant-alert-content">'