订单配送,打印机

This commit is contained in:
邹宗楠
2022-06-01 15:36:08 +08:00
parent 1eae9e6ba4
commit b5a0ab5757
6 changed files with 100 additions and 30 deletions

View File

@@ -525,14 +525,14 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
if !isPending {
if order.Status >= model.OrderStatusDelivering && order.Status < model.OrderStatusEndBegin {
if order.DeliveryType == model.OrderDeliveryTypeStoreSelf {
s.SelfDeliverDelivering(order, bill.CourierMobile)
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap)
} else {
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
}
} else if order.Status > model.OrderStatusEndBegin {
// 订单处于完成状态,来的新运单,取消三方配送,转自送!
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
s.SelfDeliverDelivered(order, "自送或三方")
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) // 取消三方配送调度
s.SelfDeliverDelivered(order, "自送或三方") // 取消当前运单调度
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送
partner.CurOrderManager.OnOrderMsg(order, "订单处于结束状态来的运单", "取消三方运单转自送1")
} else {
needAddTip := order.WaybillTipMoney > 0 && !model.IsWaybillPlatformOwn(bill)
@@ -629,9 +629,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
smsmsg.NotifyPickOrder(order)
}
// 订单处于配送状态来的新分配骑手运单
if order.Status >= model.OrderStatusDelivering && order.Status < model.OrderStatusEndBegin && bill.Status < model.OrderStatusDelivering{
if order.Status >= model.OrderStatusDelivering && order.Status < model.OrderStatusEndBegin && bill.Status < model.OrderStatusDelivering {
if order.DeliveryType == model.OrderDeliveryTypeStoreSelf {
s.SelfDeliverDelivering(order, bill.CourierMobile)
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送
} else {
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
}
@@ -639,7 +639,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
//订单已经是结束状态之后来的运单143945553920000001
if order.Status > model.OrderStatusEndBegin {
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
s.SelfDeliverDelivered(order, "自送或三方")
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送
partner.CurOrderManager.OnOrderMsg(order, "订单处于结束状态来的运单", "取消三方运单,转自送")
}
// 判断订单来源与运单是否为同一来源
@@ -656,7 +656,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
if err := s.SelfDeliverDelivering(order, bill.CourierMobile); err != nil {
if err := s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrSwitch2SelfFailed); err != nil {
// 如果转自送失败,且取消三方失败,循环多次转自送
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap)
partner.CurOrderManager.OnOrderMsg(order, "自送出设置失败", err.Error())
}
partner.CurOrderManager.OnOrderMsg(order, "转自送失败,并多次转自送", err.Error())
}
@@ -737,7 +737,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
s.resetTimer(savedOrderInfo, bill, isPending)
s.removeWaybillFromMap(savedOrderInfo, bill.WaybillVendorID)
if order.DeliveryType == model.OrderDeliveryTypeStoreSelf { // 只要门店自送,订单结束都推一下送达!(bug完成的订单还会继续美团外卖送)
s.SelfDeliverDelivered(order, "")
s.SelfDeliverDelivered(order, "")
}
if !isPending {
var err2 error