This commit is contained in:
邹宗楠
2025-02-07 11:11:02 +08:00
parent 43f2974e25
commit af03a000e6
4 changed files with 40 additions and 8 deletions

View File

@@ -533,6 +533,9 @@ 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
@@ -579,9 +582,15 @@ 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 {
@@ -594,6 +603,9 @@ 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) {
@@ -610,6 +622,9 @@ 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)
@@ -622,6 +637,9 @@ 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) {
@@ -634,6 +652,9 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
parentTask.AddFailedList(failedList)
}
} else {
if storeID == 20002 {
globals.SugarLogger.Debugf("----skus7 := %s", utils.Format4Output(skus, false))
}
isAdded2Update := false
// 修改商品信息时不改价(以免活动引起的失败),而用单独的改价来改
if (model.IsSyncStatusUpdate(sku.SkuSyncStatus) || (model.IsSyncStatusSeq(sku.SkuSyncStatus) && reorderHandler == nil)) && singleStoreHandler != nil {
@@ -752,7 +773,15 @@ 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)