- model.WaybillStatusNeverSend
- try to set ebai sku weight
This commit is contained in:
@@ -242,6 +242,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db orm.O
|
||||
} else {
|
||||
v.JxSkuID = skuBindInfo.SkuID
|
||||
v.ShopPrice = int64(skuBindInfo.UnitPrice)
|
||||
v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准
|
||||
order.ShopPrice += v.ShopPrice * int64(v.Count)
|
||||
if skuBindInfo.UnitPrice == 0 {
|
||||
globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku门店价格为零(一般原因为没有门店价格信息),orderID:%s, StoreID:%d, SkuID:%d, sku:%v", opNum, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.JxSkuID, v)
|
||||
|
||||
@@ -447,6 +447,12 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
if !isPending {
|
||||
weixinmsg.NotifyWaybillStatus(bill, order)
|
||||
}
|
||||
case model.WaybillStatusNeverSend: // 平台不配送,直接创建三方运单
|
||||
s.resetTimer(savedOrderInfo, bill, isPending)
|
||||
s.removeWaybillFromMap(savedOrderInfo, bill.WaybillVendorID)
|
||||
if order.WaybillVendorID == model.VendorIDUnknown {
|
||||
s.createWaybillOn3rdProviders(savedOrderInfo, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
@@ -196,3 +196,12 @@ func IsMobileFake(mobile string) bool {
|
||||
func IsLegalStoreID(id int) bool {
|
||||
return id >= 100000 && id < 200000
|
||||
}
|
||||
|
||||
// 将规格转为重量
|
||||
func FormatSkuWeight(specQuality float32, specUnit string) int {
|
||||
lowerSpecUnit := strings.ToLower(specUnit)
|
||||
if lowerSpecUnit == "kg" || lowerSpecUnit == "l" {
|
||||
specQuality *= 1000
|
||||
}
|
||||
return int(specQuality)
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ const (
|
||||
WaybillStatusDelivered = 105
|
||||
WaybillStatusCanceled = 115
|
||||
WaybillStatusFailed = 120
|
||||
WaybillStatusNeverSend = 125 // 这个状态指的是平台方不愿意配送,门店自己想办法。与WaybillStatusAcceptCanceled不一样,WaybillStatusAcceptCanceled可能之后还会尝试配送
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -99,17 +99,22 @@ func (p *PurchaseHandler) GetOrder(vendorOrderID string) (order *model.GoodsOrde
|
||||
// discounts := result["discount"].(map[string]interface{})
|
||||
for _, product2 := range products {
|
||||
product := product2.(map[string]interface{})
|
||||
skuName := product["product_name"].(string)
|
||||
_, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(skuName)
|
||||
sku := &model.OrderSku{
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: model.VendorIDEBAI,
|
||||
Count: int(utils.MustInterface2Int64(product["product_amount"])),
|
||||
SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["custom_sku_id"]), 0)),
|
||||
VendorSkuID: utils.Interface2String(product["baidu_product_id"]),
|
||||
SkuName: product["product_name"].(string),
|
||||
Weight: 0, // todo
|
||||
SkuName: skuName,
|
||||
Weight: jxutils.FormatSkuWeight(specQuality, specUnit), // 订单信息里没有重量,只有名字里尝试找
|
||||
SalePrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
// PromotionType: int(utils.MustInterface2Int64(product["promotionType"])),
|
||||
}
|
||||
if sku.Weight == 0 {
|
||||
sku.Weight = 222 // 如果名字里找不到缺省给半斤左右的一个特别值
|
||||
}
|
||||
// if product["isGift"].(bool) {
|
||||
// sku.SkuType = 1
|
||||
// }
|
||||
|
||||
@@ -21,7 +21,7 @@ var (
|
||||
ebaiapi.WaybillStatusExceptional: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusSelfDelivery: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusNotInDelivering: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusDeliveryRejected: model.WaybillStatusAcceptCanceled, // ?
|
||||
ebaiapi.WaybillStatusDeliveryRejected: model.WaybillStatusNeverSend,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user