- 拣货完成及之前的订单事件TIMER不能覆盖运单TIMER(一般是消息错序引起的)
This commit is contained in:
@@ -648,7 +648,7 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa
|
||||
statusTime = bill.StatusTime
|
||||
}
|
||||
globals.SugarLogger.Debugf("resetTimer, orderID:%s statusType:%d status:%v", order.VendorOrderID, statusType, status)
|
||||
if statusType != savedOrderInfo.timerStatusType || status >= savedOrderInfo.timerStatus { // 新设置的TIMER不能覆盖状态在其后的TIMER,如果状态回绕,需要注意
|
||||
if isStatusNewer(savedOrderInfo.timerStatusType, savedOrderInfo.timerStatus, statusType, status) { // 新设置的TIMER不能覆盖状态在其后的TIMER,如果状态回绕,需要注意
|
||||
config := s.mergeOrderStatusConfig(savedOrderInfo, statusTime, statusType, status)
|
||||
if config == nil || config.TimerType != partner.TimerTypeByPass {
|
||||
s.stopTimer(savedOrderInfo)
|
||||
@@ -690,6 +690,14 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa
|
||||
}
|
||||
}
|
||||
|
||||
func isStatusNewer(curStatusType, curStatus, statusType, status int) bool {
|
||||
// 拣货完成及之前的订单事件TIMER不能覆盖运单TIMER(一般是消息错序引起的)
|
||||
if curStatusType == scheduler.TimerStatusTypeWaybill && statusType == scheduler.TimerStatusTypeOrder && status <= model.OrderStatusFinishedPickup {
|
||||
return false
|
||||
}
|
||||
return curStatusType != statusType || status >= curStatus
|
||||
}
|
||||
|
||||
func (s *DefScheduler) mergeOrderStatusConfig(savedOrderInfo *WatchOrderInfo, statusTime time.Time, statusType, status int) (retVal *StatusActionConfig) {
|
||||
s.locker.RLock()
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user