diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 6cb37d8cc..236b343f8 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -533,9 +533,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } else { skus, err = dao.GetStoreSkus(db, vendorID, storeID, skuIDs) } - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus1 := %s", utils.Format4Output(skus, false)) - } if err != nil || len(skus) == 0 { return err @@ -582,15 +579,9 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag if sku.Status != model.SkuStatusNormal { sku.MergedStatus = model.SkuStatusDontSale } - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus2 := %s", utils.Format4Output(skus, false)) - } var bareSku *partner.StoreSkuInfo isNeedReorder := false if isStoreSkuSyncNeedDelete(sku) { - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus3 := %s", utils.Format4Output(skus, false)) - } if !dao.IsVendorThingIDEmpty(sku.VendorSkuID) { bareSku = storeSkuSyncInfo2Bare(sku) if singleStoreHandler == nil { @@ -603,9 +594,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag updateItems = append(updateItems, sku2Update(vendorID, sku, model.SyncFlagDeletedMask)) } } else if model.IsSyncStatusNew(sku.SkuSyncStatus) { - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus4 := %s", utils.Format4Output(skus, false)) - } calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)) if singleStoreHandler == nil { if dao.IsVendorThingIDEmpty(sku.VendorSkuID) { @@ -622,9 +610,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } } } else { - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(skus, false)) - } if sku.MergedStatus == model.SkuStatusNormal { if dao.IsVendorThingIDEmpty(sku.VendorCatID) && !strings.Contains(sku.StoreName, model.ExdStoreName) && vendorID != model.VendorIDYB && vendorID != model.VendorIDDD && vendorID != model.VendorIDJDShop { globals.SugarLogger.Warnf("syncStoreSkuNew 创建门店:%d商品:%d,但没有平台分类ID", storeID, sku.SkuID) @@ -637,9 +622,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } isNeedReorder = true } else { - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus6 := %s", utils.Format4Output(skus, false)) - } if dao.IsVendorThingIDEmpty(sku.VendorSkuID) && vendorID != model.VendorIDJDShop { // err = fmt.Errorf("门店:%d,修改没有创建的商品:%d", storeID, sku.SkuID) if vendorID != model.VendorIDJDShop || (vendorID == model.VendorIDJDShop && storeID == model.JdShopMainStoreID && sku.StoreSkuStatus != model.SkuStatusDontSale) { @@ -773,15 +755,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag } } - if storeID == 20002 { - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(createList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(updateList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(deleteList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(stockList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(onlineList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(offlineList, false)) - globals.SugarLogger.Debugf("----skus5 := %s", utils.Format4Output(priceList, false)) - } + task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { step := batchItemList[0].(int) @@ -893,6 +867,9 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag }, ctx, task, updateList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError2) } case 3: + if storeID == 20002 { + globals.SugarLogger.Debugf("----stockList := %s", utils.Format4Output(stockList, false)) + } // for k, list := range [][]*partner.StoreSkuInfo{stockList /*, onlineList*/} { if len(stockList) > 0 { _, err = putils.FreeBatchStoreSkuInfo("更新门店商品库存", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) { diff --git a/business/partner/purchase/jd/store_sku2.go b/business/partner/purchase/jd/store_sku2.go index 77ef46864..485e507ad 100644 --- a/business/partner/purchase/jd/store_sku2.go +++ b/business/partner/purchase/jd/store_sku2.go @@ -171,12 +171,22 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg } func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) { + if storeID == 20002 { + globals.SugarLogger.Debugf("----stockList1 := %s,%s,%d,%s", vendorOrgCode, vendorStoreID, storeID, utils.Format4Output(storeSkuList, false)) + } if len(storeSkuList) == 1 && vendorOrgCode != apimanager.FakeJdOrgCode { if globals.EnableJdStoreWrite { err = getAPI(vendorOrgCode).UpdateCurrentQty(ctx.GetTrackInfo(), vendorStoreID, utils.Str2Int64WithDefault(storeSkuList[0].VendorSkuID, 0), storeSkuList[0].Stock) + if storeID == 20002 { + globals.SugarLogger.Debugf("----stockList2 := %s", utils.Format4Output(storeSkuList, false)) + globals.SugarLogger.Debugf("----stockList3 err := %v", err) + } failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJD], "更新商品库存") } } else { + if storeID == 20002 { + globals.SugarLogger.Debugf("----stockList4 := %s,%s,%d,%s", vendorOrgCode, vendorStoreID, storeID, utils.Format4Output(storeSkuList, false)) + } var skuStockList []*jdapi.SkuStock for _, v := range storeSkuList { skuStockList = append(skuStockList, &jdapi.SkuStock{ @@ -184,6 +194,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg StockQty: v.Stock, }) } + if storeID == 20002 { + globals.SugarLogger.Debugf("----skuStockList := %s,%s,%d,%s", vendorOrgCode, vendorStoreID, storeID, utils.Format4Output(skuStockList, false)) + } if globals.EnableJdStoreWrite { var responseList []*jdapi.StoreSkuBatchUpdateResponse var err2 error