Merge remote-tracking branch 'origin/mark' into yonghui
This commit is contained in:
@@ -74,6 +74,7 @@ func (c *OrderManager) OnOrderNew(order *model.GoodsOrder, orderStatus *model.Or
|
||||
|
||||
// todo 调整单的处理可能还需要再细化一点,当前只是简单的删除重建
|
||||
func (c *OrderManager) OnOrderAdjust(order *model.GoodsOrder, orderStatus *model.OrderStatus) (err error) {
|
||||
globals.SugarLogger.Debugf("OnOrderAdjust orderID:%s, status:%d", order.VendorOrderID, order.Status)
|
||||
if order.ConsigneeMobile2 == "" && jxutils.IsStringLikeMobile(order.ConsigneeMobile) {
|
||||
order.ConsigneeMobile2 = order.ConsigneeMobile
|
||||
}
|
||||
@@ -211,7 +212,7 @@ func setFakeOrderFlag(db *dao.DaoDB, order *model.GoodsOrder) {
|
||||
}
|
||||
|
||||
func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao.DaoDB) (isDuplicated bool, err error) {
|
||||
globals.SugarLogger.Debugf("SaveOrder orderID:%s, VendorStoreID:%s", order.VendorOrderID, order.VendorStoreID)
|
||||
globals.SugarLogger.Debugf("SaveOrder orderID:%s, VendorStoreID:%s, status:%d", order.VendorOrderID, order.VendorStoreID, order.Status)
|
||||
// 忽略查找JX信息错误
|
||||
c.updateOrderOtherInfo(order, db)
|
||||
order.ID = 0
|
||||
@@ -236,7 +237,7 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
|
||||
if dao.GetRow(db, orderStatus, `
|
||||
SELECT *
|
||||
FROM order_status
|
||||
WHERE order_type = ? AND vendor_order_id = ? AND vendor_id = ?
|
||||
WHERE order_type = ? AND vendor_order_id = ? AND vendor_id = ? AND status > 0
|
||||
ORDER BY status_time DESC
|
||||
LIMIT 1
|
||||
`, model.OrderTypeOrder, order.VendorOrderID, order.VendorID) == nil {
|
||||
|
||||
@@ -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