修复订单调度定时器的BUG
PickupGoods失败后判断订单状态如果是已经大于拣货完成,则忽略错误
This commit is contained in:
@@ -37,8 +37,14 @@ func (c *BaseScheduler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bool
|
||||
globals.SugarLogger.Infof("PickupGoods orderID:%s", order.VendorOrderID)
|
||||
if /*order.LockStatus == model.OrderStatusUnknown && */ order.Status == model.OrderStatusAccepted {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogErrorWithInfo(func() error {
|
||||
return partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).PickupGoods(order, isSelfDelivery, userName)
|
||||
handler := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID)
|
||||
err = utils.CallFuncLogErrorWithInfo(func() (err error) {
|
||||
if err = handler.PickupGoods(order, isSelfDelivery, userName); err != nil {
|
||||
if status, err2 := handler.GetOrderStatus(order.VendorOrgCode, order.VendorOrderID); err2 == nil && status >= model.OrderStatusFinished {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
return err
|
||||
}, "PickupGoods orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -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