diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 3dbbd741d..2cdd38056 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -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) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 72dec919c..bab5f2589 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -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) + } } } // } diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index 84364369a..704b8536e 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -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) +} diff --git a/business/model/const.go b/business/model/const.go index 3a2cf1211..fa2f733dc 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -134,6 +134,7 @@ const ( WaybillStatusDelivered = 105 WaybillStatusCanceled = 115 WaybillStatusFailed = 120 + WaybillStatusNeverSend = 125 // 这个状态指的是平台方不愿意配送,门店自己想办法。与WaybillStatusAcceptCanceled不一样,WaybillStatusAcceptCanceled可能之后还会尝试配送 ) const ( diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 9cc795436..93158117c 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -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 // } diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index 739799838..f4339f13b 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -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, } )