- add poi_seq when creating mtps waybill.

- cancel waybill in new msg when order status already end.
This commit is contained in:
gazebo
2018-07-31 20:29:55 +08:00
parent 4fd0e8d359
commit 7afa99620a
2 changed files with 5 additions and 2 deletions

View File

@@ -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)

View File

@@ -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)