- add poi_seq when creating mtps waybill.
- cancel waybill in new msg when order status already end.
This commit is contained in:
@@ -2,6 +2,7 @@ package mtps
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
@@ -194,7 +195,7 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
|
||||
item.GoodCount += goodItem.GoodCount
|
||||
}
|
||||
}
|
||||
addParams := utils.Params2Map("note", order.BuyerComment, "goods_detail", string(utils.MustMarshal(goods)))
|
||||
addParams := utils.Params2Map("note", order.BuyerComment, "goods_detail", string(utils.MustMarshal(goods)), "poi_seq", fmt.Sprintf("%s#%d", model.VendorChineseNames[order.VendorID], order.OrderSeq))
|
||||
_, err = api.MtpsAPI.CreateOrderByShop(billParams, addParams)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("CreateWaybill, orderID:%s, billParams:%v, addParams:%v", order.VendorOrderID, billParams, addParams)
|
||||
|
||||
@@ -222,7 +222,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
if bill.Status == model.WaybillStatusNew {
|
||||
s.addWaybill2Map(savedOrderInfo, bill)
|
||||
if !isPending {
|
||||
if order.WaybillVendorID != model.VendorIDUnknown {
|
||||
if order.Status > model.OrderStatusEndBegin {
|
||||
s.CancelWaybill(bill)
|
||||
} else if order.WaybillVendorID != model.VendorIDUnknown {
|
||||
globals.SugarLogger.Debugf("OnWaybillStatusChanged multiple waybill created, bill:%v", bill)
|
||||
if !s.isBillCandidate(order, bill) && bill.WaybillVendorID != order.VendorID {
|
||||
s.CancelWaybill(bill)
|
||||
|
||||
Reference in New Issue
Block a user