This commit is contained in:
邹宗楠
2023-09-22 17:40:08 +08:00
parent 8874f336e8
commit abcc7f52cf

View File

@@ -43,37 +43,37 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
switch step {
case 1:
// 1.加载门店商品,删除商品.当分类下没有商品时.删除分类
//errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
//if errs != nil && len(errs) > 0 {
// return nil, errs[0]
//}
errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
if errs != nil && len(errs) > 0 {
return nil, errs[0]
}
case 2:
// 同步分类
//fromCategoryList, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
//
//for _, v := range fromCategoryList {
// //err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
// // CategoryCode: v.Code,
// // Sequence: v.Sequence,
// //})
// //if err != nil {
// // globals.SugarLogger.Debugf("err := RetailCatUpdate : %s", utils.Format4Output(err, false))
// //}
// if v.Children != nil && len(v.Children) != 0 {
// for _, c := range v.Children {
// if err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
// CategoryNameOrigin: v.Name,
// //CategoryCodeOrigin: v.Code,
// //CategoryCode: v.Code,
// SecondaryCategoryCode: c.Code,
// SecondaryCategoryName: c.Name,
// Sequence: c.Sequence,
// }); err != nil {
// globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %s", utils.Format4Output(c, false))
// }
// }
// }
//}
fromCategoryList, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
for _, v := range fromCategoryList {
err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
CategoryCode: v.Code,
Sequence: v.Sequence,
})
if err != nil {
globals.SugarLogger.Debugf("err := RetailCatUpdate : %s", utils.Format4Output(err, false))
}
if v.Children != nil && len(v.Children) != 0 {
for _, c := range v.Children {
if err := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
CategoryNameOrigin: v.Name,
//CategoryCodeOrigin: v.Code,
//CategoryCode: v.Code,
SecondaryCategoryCode: c.Code,
SecondaryCategoryName: c.Name,
Sequence: c.Sequence,
}); err != nil {
globals.SugarLogger.Debugf("err := RetailCatUpdate Children : %s", utils.Format4Output(c, false))
}
}
}
}
case 3:
i := offSet