diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 7858319e0..9178cc301 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3983,11 +3983,7 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo storeSkuBindHis := &model.StoreSkuBindHistory{ SnapshotAt: snapshotAt.AddDate(0, 0, -2), } - storeSkuBindHis2 := &model.StoreSkuBindHistory{ - SnapshotAt: snapshotAt, - } dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt") - dao.DeleteEntity(db, storeSkuBindHis2, "SnapshotAt") storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "") task := tasksch.NewParallelTask("BackUpStoreSkuBind", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 12add114e..f7857ef4e 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -38,15 +38,17 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v result, err = api.YinBaoAPI.AddProductInfo(buildProductInfoParam(storeSku)) } if err != nil { - // if strings.Contains(err.Error(), addErr1) { - // queryProductByBarcodeResult, err := api.YinBaoAPI.QueryProductByBarcodes([]string{storeSku.YbBarCode}) - // if err != nil && len(queryProductByBarcodeResult) > 0 { - // if queryProductByBarcodeResult[0].Enable == model.SkuStatusDeleted { - // api.YinBaoAPI.SaveProduct(userId, keyword, saveProductParam) - // } - // } - // } - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品") + if strings.Contains(err.Error(), addErr1) { + queryProductByBarcodeResult, err := api.YinBaoAPI.QueryProductByBarcodes([]string{storeSku.YbBarCode}) + if err != nil && len(queryProductByBarcodeResult) > 0 { + if queryProductByBarcodeResult[0].Enable == model.SkuStatusDeleted { + api.YinBaoAPI.BatchUpdateProductEnable(vendorStoreID, utils.Int64ToStr(queryProductByBarcodeResult[0].UID), model.SkuStatusNormal) + storeSku.VendorSkuID = utils.Int64ToStr(queryProductByBarcodeResult[0].UID) + } + } + } else { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品") + } } else { storeSku.VendorSkuID = utils.Int64ToStr(result.UID) err = uploadYbImage(vendorStoreID, storeSku.YbBarCode, storeSku.Img)