没有显示处理model.WaybillStatusCourierArrived事件,导致TIMER没有停掉,又执行了在第3方门店创建运单操作。(改为只要收到了大于NEW的运单事件,都将TIMER停掉,状态需要添加TIMER的,再自行添加)
然后createWaybillOn3rdProviders又没有判断状态,导致又重新创建运单(添加状态判断,另外将所有TIMER事件中的逻辑都添加状态判断,合适后才真正执行)
This commit is contained in:
@@ -110,49 +110,69 @@ func (c *BaseScheduler) GetDeliveryPlatformFromVendorID(vendorID int) DeliveryPl
|
||||
|
||||
func (c *BaseScheduler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool) (err error) {
|
||||
globals.SugarLogger.Infof("AcceptOrRefuseOrder orderID:%s, isAcceptIt:%t", order.VendorOrderID, isAcceptIt)
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).AcceptOrRefuseOrder(order, isAcceptIt)
|
||||
}, "AcceptOrRefuseOrder orderID:%s, isAcceptIt:%t", order.VendorOrderID, isAcceptIt)
|
||||
if order.Status == model.OrderStatusNew {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).AcceptOrRefuseOrder(order, isAcceptIt)
|
||||
}, "AcceptOrRefuseOrder orderID:%s, isAcceptIt:%t", order.VendorOrderID, isAcceptIt)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("AcceptOrRefuseOrder orderID:%s, status:%d is not suitable, isAcceptIt:%t", order.VendorOrderID, order.Status, isAcceptIt)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (c *BaseScheduler) PickedUpGoods(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Infof("PickedUpGoods orderID:%s", order.VendorOrderID)
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).PickedUpGoods(order)
|
||||
}, "PickedUpGoods orderID:%s", order.VendorOrderID)
|
||||
if order.Status == model.OrderStatusAccepted {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).PickedUpGoods(order)
|
||||
}, "PickedUpGoods orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("PickedUpGoods orderID:%s, status:%d is not suitable", order.VendorOrderID, order.Status)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) Swtich2SelfDeliver(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Infof("Swtich2SelfDeliver orderID:%s", order.VendorOrderID)
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).Swtich2SelfDeliver(order)
|
||||
}, "Swtich2SelfDeliver orderID:%s", order.VendorOrderID)
|
||||
if order.Status == model.OrderStatusFinishedPickup {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).Swtich2SelfDeliver(order)
|
||||
}, "Swtich2SelfDeliver orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("Swtich2SelfDeliver orderID:%s, status:% is not suitable", order.VendorOrderID, order.Status)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) SelfDeliverDelievering(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Infof("SelfDeliverDelievering orderID:%s", order.VendorOrderID)
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelievering(order)
|
||||
}, "SelfDeliverDelievering orderID:%s", order.VendorOrderID)
|
||||
if order.Status == model.OrderStatusFinishedPickup {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelievering(order)
|
||||
}, "SelfDeliverDelievering orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("SelfDeliverDelievering orderID:%s, status:%d is not suitable", order.VendorOrderID, order.Status)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *BaseScheduler) SelfDeliverDelievered(order *model.GoodsOrder) (err error) {
|
||||
globals.SugarLogger.Infof("SelfDeliverDelievered orderID:%s", order.VendorOrderID)
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelievered(order)
|
||||
}, "SelfDeliverDelievered orderID:%s", order.VendorOrderID)
|
||||
if order.Status == model.OrderStatusDelivering {
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
return c.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelievered(order)
|
||||
}, "SelfDeliverDelievered orderID:%s", order.VendorOrderID)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("SelfDeliverDelievered orderID:%s, status:%d is not suitable", order.VendorOrderID, order.Status)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user