修复订单调度定时器的BUG
PickupGoods失败后判断订单状态如果是已经大于拣货完成,则忽略错误
This commit is contained in:
@@ -175,7 +175,7 @@ func (w *WatchOrderInfo) StopTimer(statusType, vendorID, status int) {
|
||||
for _, timerInfo := range w.timerList {
|
||||
if (statusType == -1 || statusType == timerInfo.statusType) &&
|
||||
(vendorID == -1 || vendorID == timerInfo.vendorID) &&
|
||||
(status == -1 || status <= timerInfo.status) {
|
||||
(status == -1 || status >= timerInfo.status) {
|
||||
if timerInfo.timer != nil {
|
||||
timerInfo.timer.Stop()
|
||||
timerInfo.timer = nil
|
||||
@@ -187,6 +187,10 @@ func (w *WatchOrderInfo) StopTimer(statusType, vendorID, status int) {
|
||||
w.timerList = newTimerList
|
||||
}
|
||||
|
||||
func (w *WatchOrderInfo) AddTimer(timerInfo *tTimerInfo) {
|
||||
w.timerList = append(w.timerList, timerInfo)
|
||||
}
|
||||
|
||||
func (w *WatchOrderInfo) GetCreateWaybillTimeout() (timeoutSecond int) {
|
||||
// if w.timerStatusType == scheduler.TimerStatusTypeWaybill && w.timerStatus == model.WaybillStatusNew {
|
||||
// timeoutSecond = int(w.timerTime.Sub(time.Now()) / time.Second)
|
||||
@@ -267,7 +271,7 @@ func init() {
|
||||
return nil
|
||||
},
|
||||
ShouldSetTimer: func(savedOrderInfo *WatchOrderInfo, bill *model.Waybill) bool {
|
||||
return savedOrderInfo.autoPickupTimeoutMinute > 0
|
||||
return savedOrderInfo.autoPickupTimeoutMinute > 0 && savedOrderInfo.order.Status < model.OrderStatusFinishedPickup
|
||||
},
|
||||
},
|
||||
model.OrderStatusFinishedPickup: &StatusActionConfig{
|
||||
@@ -840,6 +844,7 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa
|
||||
ts.StopTimer(statusType, vendorID, status)
|
||||
}, jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID))
|
||||
})
|
||||
savedOrderInfo.AddTimer(timerInfo)
|
||||
}
|
||||
globals.SugarLogger.Debugf("resetTimer, orderID:%s, statusType:%d, status:%d, timeout:%v", order.VendorOrderID, statusType, status, timeout)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user