This commit is contained in:
苏尹岚
2019-12-18 15:19:22 +08:00
parent 12a1a23ac1
commit 990f3a2da2
6 changed files with 14 additions and 13 deletions

View File

@@ -267,11 +267,7 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
} else { } else {
isDuplicated = true isDuplicated = true
order.DuplicatedCount++ order.DuplicatedCount++
if order.Status == model.OrderStatusCanceled || order.Status == model.OrderStatusFinished { db.Db.Update(order, "DuplicatedCount")
db.Db.Update(order, "DuplicatedCount", "Status")
} else {
db.Db.Update(order, "DuplicatedCount")
}
baseapi.SugarLogger.Infof("saveOrder duplicated orderid:%s msg received", order.VendorOrderID) baseapi.SugarLogger.Infof("saveOrder duplicated orderid:%s msg received", order.VendorOrderID)
} }
} }

View File

@@ -23,6 +23,9 @@ import (
const ( const (
maxLastHours = 7 * 24 // 最多只能查询7天内的订单数据 maxLastHours = 7 * 24 // 最多只能查询7天内的订单数据
defLastHours = 2 * 24 // 缺省是两天内的订单 defLastHours = 2 * 24 // 缺省是两天内的订单
orderMixTimeImmediatelyArrive = 8
orderMixTimeDelayArrive = 5
) )
type tWaybillExt struct { type tWaybillExt struct {
@@ -992,11 +995,11 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
} else { } else {
if goodsOrder.Status != model.OrderStatusFinished && goodsOrder.Status != model.OrderStatusCanceled { if goodsOrder.Status != model.OrderStatusFinished && goodsOrder.Status != model.OrderStatusCanceled {
if goodsOrder.BusinessType == model.BusinessTypeImmediate { if goodsOrder.BusinessType == model.BusinessTypeImmediate {
if time.Now().Sub(goodsOrder.CreatedAt).Hours() >= 8 { if time.Now().Sub(goodsOrder.CreatedAt).Hours() >= orderMixTimeImmediatelyArrive {
missingOrderList = append(missingOrderList, pair) missingOrderList = append(missingOrderList, pair)
} }
} else { } else {
if time.Now().Sub(goodsOrder.ExpectedDeliveredTime).Hours() >= 5 { if time.Now().Sub(goodsOrder.ExpectedDeliveredTime).Hours() >= orderMixTimeDelayArrive {
missingOrderList = append(missingOrderList, pair) missingOrderList = append(missingOrderList, pair)
} }
} }
@@ -1010,6 +1013,9 @@ func (c *OrderManager) AmendMissingOrders(ctx *jxcontext.Context, vendorIDs []in
if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil { if handler := partner.GetPurchaseOrderHandlerFromVendorID(pair.VendorID); handler != nil {
order, err2 := handler.GetOrder(pair.VendorOrgCode, pair.VendorOrderID) order, err2 := handler.GetOrder(pair.VendorOrgCode, pair.VendorOrderID)
if err = err2; err == nil { if err = err2; err == nil {
if order.Status == model.OrderStatusCanceled || order.Status == model.OrderStatusFinished {
err = c.UpdateOrderFields(order, []string{"Status"})
}
isDuplicated, err2 := c.SaveOrder(order, false, dao.GetDB()) isDuplicated, err2 := c.SaveOrder(order, false, dao.GetDB())
if err2 == nil && !isDuplicated { if err2 == nil && !isDuplicated {
retVal = []int{1} retVal = []int{1}

View File

@@ -1150,9 +1150,8 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
if valid["status"] != nil { if valid["status"] != nil {
syncStatus |= model.SyncFlagStoreStatus syncStatus |= model.SyncFlagStoreStatus
} }
if valid["vendorStoreName"] != nil { if vendorStoreName, ok := valid["vendorStoreName"].(string); ok {
vendorStoreName := valid["vendorStoreName"].(string) if utf8.RuneCountInString(vendorStoreName) > jdapi.MaxStoreNameLen && vendorID == model.VendorIDJD {
if utf8.RuneCountInString(vendorStoreName) > 13 && vendorID == model.VendorIDJD {
return 0, fmt.Errorf("门店名称不允许超过13位") return 0, fmt.Errorf("门店名称不允许超过13位")
} }
syncStatus |= model.SyncFlagStoreName syncStatus |= model.SyncFlagStoreName

View File

@@ -328,7 +328,7 @@ func FloatWeight2Int(weight float32) int {
} }
func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) { func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) {
if exPrefix != "" && exPrefixBegin != utils.ZeroTimeValue && exPrefixEnd != utils.ZeroTimeValue { if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) {
if time.Now().Before(exPrefixEnd) && time.Now().After(exPrefixBegin) { if time.Now().Before(exPrefixEnd) && time.Now().After(exPrefixBegin) {
skuName = exPrefix skuName = exPrefix
} }

View File

@@ -514,7 +514,7 @@ func newGetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSync
t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status,
t1.%s_sync_status sku_sync_status, t1.store_id, t1.deleted_at bind_deleted_at, t1.%s_sync_status sku_sync_status, t1.store_id, t1.deleted_at bind_deleted_at,
t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id, t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id,
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end,
IF(t11.%s <> '', t11.%s, t3.img) img, IF(t11.%s <> '', t11.%s, t3.img) img,
IF(t12.%s <> '', t12.%s, t3.img2) img2, IF(t12.%s <> '', t12.%s, t3.img2) img2,
t13.%s desc_img, t13.%s desc_img,

View File

@@ -245,7 +245,7 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate bool
}) })
} }
params = map[string]interface{}{ params = map[string]interface{}{
"name": utils.LimitUTF8StringLen(utils.FilterEmoji(storeSku.SkuName), ebaiapi.MaxSkuNameByteCount), "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount),
"left_num": model.MaxStoreSkuStockQty, "left_num": model.MaxStoreSkuStockQty,
"category_id": utils.Str2Int64(storeSku.VendorCatID), "category_id": utils.Str2Int64(storeSku.VendorCatID),
"predict_cat": 0, // 不使用推荐类目 "predict_cat": 0, // 不使用推荐类目