如何使用impex更新发布的促销规则

2020-09-12 00:34发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我已经使用impex创建了促销规则,并通过后台发布了该规则。

我修改了规则并多次发布了相同的规则。 只要我通过backoffice更新和发布,此方法就可以正常工作。

但是当我尝试使用impex更新相同的规则时,会引发错误。

 输入自动部署到两个模块的代码
  INSERT_UPDATE PromotionSourceRule [$ ruleImportProcessor]; code [unique = true]; priority; maxAllowedRuns; stackable [default = false]; ruleGroup(code); conditions; actions; messageFired [lang = en]; website(Identifier)[default = $ defaultPromoGrp  ]; excludeFromStorefrontDisplay [default = false]; status(code)[unique = true,default = PUBLISHED]
  ""#%afterEach:de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleEngineSystemSetup"")。registerSourceRuleForDeployment(impex.getLastImportedItem(),新的String [] {$ {promotionsModule,$ previewModule});"
  ; product_percentage_discount; 75; 1; true; productPromotionRuleGroup;" [{"" definitionId"":"" y_group"","" parameters"":{"" operator"":{"" uuid"":"" bc4e42c-  3b09-426c-a964-d5e7a296c498"","" value"":"" AND""}},"" children"":[{"" definitionId"":"" y_target_customers"","" parameters"":  {"" customer_groups"":{"" uuid"":"" bc52ebe5-e161-4945-bf1b-ecd29d3fc357"",""类型"":"" List(ItemType(UserGroup))"",""值"  ":["" 35PercentageDiscountUnit""]},"" customer_groups_operator"":{"" uuid"":"" e7637460-ef7e-4bbf-a999-e3191315c244"","" type"":"" Enum(de。  hybris.platform.ruledefinitions.CollectionOperator)"",""值"":"" CONTAINS_ANY""},""客户"":{"" uuid"":"" e5892d9a-fe02-4701-bb65-b6e1ea67ef4a""  ,"" type"":"" List(ItemType(Customer))"","" value"":[]},"" excluded_customers"":{"" uuid"":"" 6d06b559-cdb5-43af-  94ac-cff35bf1e92c"",""类型"":""列表(ItemType(Customer))"",""值"":[]},"" excluded_customer_groups"":{"" uuid"":"" 85a08e42  -744c-4a4c-93af-0359c89708d8"","" type"":"" List(ItemType(UserGroup))"","" value"":[]}},"" children"":[]},  {"" def  initionId"":"" y_qualifying_categories"","" parameters"":{"" quantity"":{"" uuid"":"" 6307770f-e851-45a3-bc73-88634f8a4443"","" type"":  "" java.lang.Integer"",""值"":1},"" categories_operator"":{"" uuid"":""" c361f681-2f88-44c4-acf5-27281568e313"","类型"  ":"" Enum(de.hybris.platform.ruledefinitions.CollectionOperator)"","" value"":"" CONTAINS_ANY""},"" excluded_categories"":{"" uuid"":"" dd0f76d2-f8be  -4dc0-a68a-b94c2259327b"",""类型"":""列表(ItemType(类别))""},""排除的产品"":{"" uuid"":"" 047bea52-4d89-4c97-8994  -442239fc456c"",""类型"":""列表(ItemType(产品))""},""类别"":{"" uuid"":"" 83e6ca48-3441-49e2-b3ff-eabb479e9966"""  ,"" type"":"" List(ItemType(Category))"","" value"":["" 1""]},"" operator"":{"" uuid"":"" 631c6ced  -468c-46c8-b4ca-97a3a3ac10b8"","" type"":"" Enum(de.hybris.platform.ruledefinitions.AmountOperator)"","" value"":""" GREATER_THAN_OR_EQUAL""}},""  children"":[]}]}]";""" [{"" definitionId"":"" y_order_entry_percentage_discount"","" parameters"":{" value"":{"" uuid"":"" a1a5d598  -c351-43a4-92bf-  eb63d877496a"","" type"":"" java.math.BigDecimal"","" value"":35}}}]"";您的折扣:这是{a1a5d598-c351-43a4-92bf-eb63d877496a};
  回覆



  

下面是我遇到的错误,

status(code)[unique = true,default = PUBLISHED]在标题1中),它正在创建新版本的促销规则并在新版本中更新给定的数据。 2)如果我第二次运行脚本,则会引发一些数据库索引异常。

标头中没有状态(代码)[unique = true,default = PUBLISHED]

1)由于存在同一规则的多个不活动版本,因此引发了模棱两可的唯一标识符异常。

以下两点我需要帮助。

1)如何更新促销规则的发布版本?

用例:需要更新messageFired属性或需要更新条件和操作2)以及如何使用Impex自动发布促销规则?。

用例:,而我不想碰到后台办公室,我想提拔促销活动并希望发布促销规则。

混合版本:6.4

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我已经使用impex创建了促销规则,并通过后台发布了该规则。

我修改了规则并多次发布了相同的规则。 只要我通过backoffice更新和发布,此方法就可以正常工作。

但是当我尝试使用impex更新相同的规则时,会引发错误。

 输入自动部署到两个模块的代码
  INSERT_UPDATE PromotionSourceRule [$ ruleImportProcessor]; code [unique = true]; priority; maxAllowedRuns; stackable [default = false]; ruleGroup(code); conditions; actions; messageFired [lang = en]; website(Identifier)[default = $ defaultPromoGrp  ]; excludeFromStorefrontDisplay [default = false]; status(code)[unique = true,default = PUBLISHED]
  ""#%afterEach:de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleEngineSystemSetup"")。registerSourceRuleForDeployment(impex.getLastImportedItem(),新的String [] {$ {promotionsModule,$ previewModule});"
  ; product_percentage_discount; 75; 1; true; productPromotionRuleGroup;" [{"" definitionId"":"" y_group"","" parameters"":{"" operator"":{"" uuid"":"" bc4e42c-  3b09-426c-a964-d5e7a296c498"","" value"":"" AND""}},"" children"":[{"" definitionId"":"" y_target_customers"","" parameters"":  {"" customer_groups"":{"" uuid"":"" bc52ebe5-e161-4945-bf1b-ecd29d3fc357"",""类型"":"" List(ItemType(UserGroup))"",""值"  ":["" 35PercentageDiscountUnit""]},"" customer_groups_operator"":{"" uuid"":"" e7637460-ef7e-4bbf-a999-e3191315c244"","" type"":"" Enum(de。  hybris.platform.ruledefinitions.CollectionOperator)"",""值"":"" CONTAINS_ANY""},""客户"":{"" uuid"":"" e5892d9a-fe02-4701-bb65-b6e1ea67ef4a""  ,"" type"":"" List(ItemType(Customer))"","" value"":[]},"" excluded_customers"":{"" uuid"":"" 6d06b559-cdb5-43af-  94ac-cff35bf1e92c"",""类型"":""列表(ItemType(Customer))"",""值"":[]},"" excluded_customer_groups"":{"" uuid"":"" 85a08e42  -744c-4a4c-93af-0359c89708d8"","" type"":"" List(ItemType(UserGroup))"","" value"":[]}},"" children"":[]},  {"" def  initionId"":"" y_qualifying_categories"","" parameters"":{"" quantity"":{"" uuid"":"" 6307770f-e851-45a3-bc73-88634f8a4443"","" type"":  "" java.lang.Integer"",""值"":1},"" categories_operator"":{"" uuid"":""" c361f681-2f88-44c4-acf5-27281568e313"","类型"  ":"" Enum(de.hybris.platform.ruledefinitions.CollectionOperator)"","" value"":"" CONTAINS_ANY""},"" excluded_categories"":{"" uuid"":"" dd0f76d2-f8be  -4dc0-a68a-b94c2259327b"",""类型"":""列表(ItemType(类别))""},""排除的产品"":{"" uuid"":"" 047bea52-4d89-4c97-8994  -442239fc456c"",""类型"":""列表(ItemType(产品))""},""类别"":{"" uuid"":"" 83e6ca48-3441-49e2-b3ff-eabb479e9966"""  ,"" type"":"" List(ItemType(Category))"","" value"":["" 1""]},"" operator"":{"" uuid"":"" 631c6ced  -468c-46c8-b4ca-97a3a3ac10b8"","" type"":"" Enum(de.hybris.platform.ruledefinitions.AmountOperator)"","" value"":""" GREATER_THAN_OR_EQUAL""}},""  children"":[]}]}]";""" [{"" definitionId"":"" y_order_entry_percentage_discount"","" parameters"":{" value"":{"" uuid"":"" a1a5d598  -c351-43a4-92bf-  eb63d877496a"","" type"":"" java.math.BigDecimal"","" value"":35}}}]"";您的折扣:这是{a1a5d598-c351-43a4-92bf-eb63d877496a};
  回覆



  

下面是我遇到的错误,

status(code)[unique = true,default = PUBLISHED]在标题1中),它正在创建新版本的促销规则并在新版本中更新给定的数据。 2)如果我第二次运行脚本,则会引发一些数据库索引异常。

标头中没有状态(代码)[unique = true,default = PUBLISHED]

1)由于存在同一规则的多个不活动版本,因此引发了模棱两可的唯一标识符异常。

以下两点我需要帮助。

1)如何更新促销规则的发布版本?

用例:需要更新messageFired属性或需要更新条件和操作2)以及如何使用Impex自动发布促销规则?。

用例:,而我不想碰到后台办公室,我想提拔促销活动并希望发布促销规则。

混合版本:6.4

付费偷看设置
发送
1条回答
hongfeng1314
1楼-- · 2020-09-12 00:49

我可以解释我们如何做到的。

我们通过impex创建规则,如下所示:

第一次IMPEX

  INSERT_UPDATE PromotionSourceRule; code [unique = true];优先级; maxAllowedRuns; stackable [default = false]; ruleGroup(code); conditions; actions; website(Identifier)[default = myPromoGrp]; uuid; name [  lang = de]; name [lang = en]; messageFired [lang = de]; messageFired [lang = en]
  ; test_coupon_code_order_threshold; 160; 1; true; couponPromotionRuleGroup;" [{"" definitionId"":"" y_qualifying_coupons"","" parameters"":{"" coupons"":{" uuid"":"" 14afa807-  d839-485d-8e28-4f02f3ed5334"",""类型"":""列表(ItemType(AbstractCoupon))"",""值"":["" my_TEST1""]}}},""孩子"":  []},{"" definitionId"":"" y_cart_total"",""参数"":{""值"":{"" uuid"":"" ced663f9-0d56-4a79-a41b-f9e678c0cfad""  ,"" type"":"" Map(ItemType(Currency),java.math.BigDecimal)"","" value"":{"" EUR"":30}},""运算符"":{"  " uuid"":"" 503e35dc-ec0c-4728-98e9-51b8dbf49c46"","" type"":"" Enum(de.hybris.platform.ruledefinitions.AmountOperator)"","" value"":""  GREATER_THAN_OR_EQUAL""}},""孩子"":[]}]";" [["" definitionId"":"" y_order_fixed_discount"",""参数"":{""值"":{"" uuid  "":"" 4264c7ba-e88d-4a85-bc31-dbd81afdce47"","" type"":"" Map(ItemType(Currency),java.math.BigDecimal)"","" value"":{""  EUR"":5}}}}]""; myPromoGrp; a0fff4d0-8f2a-470a-a3b2-b4c7743ec5d1;促销优惠券;促销优惠券;
 
  "#%impex.enableExternalSyntaxParsing(true);"
  "#%ruleService = de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleService""); ruleMaintenanceService = de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleMaintenanceService"  "]; ruleMaintenanceService.compileAndPublishRules(ruleService.getAllToBePublishedRulesForType(de.hybris.platform.promotionengineservices.model.PromotionSourceRuleModel.class)));"

  

由于上面编写的bean shell脚本(与我们的hybris 6.5一起使用),上述impex将被发布。

该规则发布后,我们将运行以下脚本,该脚本将自行以未发布状态创建该规则的新版本,并且如果您希望您可以手动发布或自动发布它,如下所示:

  INSERT_UPDATE PromotionSourceRule; code [unique = true];优先级; maxAllowedRuns; stackable [default = false]; ruleGroup(code); conditions; actions; website(Identifier)[default = myPromoGrp]; uuid; name [  lang = de]; name [lang = en]; messageFired [lang = de]; messageFired [lang = en]
  ; test_coupon_code_order_threshold; 160; 1; true; couponPromotionRuleGroup;" [{"" definitionId"":"" y_qualifying_coupons"","" parameters"":{"" coupons"":{" uuid"":"" 14afa807-  d839-485d-8e28-4f02f3ed5334"",""类型"":""列表(ItemType(AbstractCoupon))"",""值"":["" my_TEST1""]}}},""孩子"":  []},{"" definitionId"":"" y_cart_total"",""参数"":{""值"":{"" uuid"":"" ced663f9-0d56-4a79-a41b-f9e678c0cfad""  ,"" type"":"" Map(ItemType(Currency),java.math.BigDecimal)"","" value"":{"" EUR"":30}},""运算符"":{"  " uuid"":"" 503e35dc-ec0c-4728-98e9-51b8dbf49c46"","" type"":"" Enum(de.hybris.platform.ruledefinitions.AmountOperator)"","" value"":""  GREATER_THAN_OR_EQUAL""}},""孩子"":[]}]";" [["" definitionId"":"" y_order_fixed_discount"",""参数"":{""值"":{"" uuid  "":"" 4264c7ba-e88d-4a85-bc31-dbd81afdce47"","" type"":"" Map(ItemType(Currency),java.math.BigDecimal)"","" value"":{""  EUR"":5}}}}]";" myPromoGrp; a0fff4d0-8f2a-470a-a3b2-b4c7743ec5d1;促销优惠券IMPEXXXXX2;促销优惠券;;
 
  "#%impex.enableExternalSyntaxParsing(true);"
  "#%ruleService = de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleService""); ruleMaintenanceService = de.hybris.platform.core.Registry.getApplicationContext()。getBean("" ruleMaintenanceService"  "]; ruleMaintenanceService.compileAndPublishRules(ruleService.getAllToBePublishedRulesForType(de.hybris.platform.promotionengineservices.model.PromotionSourceRuleModel.class)));"

  

一周热门 更多>

点击此处---> EasySAP.com 一起学习S4 HANA ...

相关问答