业务规则示例 (Master Data Services)Business Rule Examples (Master Data Services)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - 仅限 Windows 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - Windows only 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance

本文演示 Master Data ServicesMaster Data Services的业务规则示例。This article shows examples of business rules for Master Data ServicesMaster Data Services. 你会在 Master Data ServicesMaster Data Services安装附带的示例模型中找到这些示例。You'll find these examples in the sample models that are included with your installation of Master Data ServicesMaster Data Services.

有关如何部署示例模型的说明,请参阅 Master Data Services 的安装和配置For instructions on how to deploy the sample models, see Master Data Services Installation and Configuration.

业务规则示例Business Rule Examples

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
客户Customer 客户Customer Person pmt termsPerson pmt terms 为客户指定默认付款条款。Specifies default payment terms for customers.

在下面的业务规则中,如果 CustomerType 属性值满足 is equal 规则条件,则 defaults to 规则操作 会应用于 PaymentTerms 属性。In the following business rule, if the CustomerType attribute value meets the is equal rule condition, then the defaults to rule action is applied to the PaymentTerms attribute. 否则不执行任何操作。Otherwise no action is taken.

If  
    CustomerType is equal to 2  
Then  
    PaymentTerms defaults to CASH  
Else  
    None      

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
客户Customer 客户Customer Org pmt termsOrg pmt terms 为组织指定默认付款条款。Specifies default payment terms for organizations.

在下面的业务规则中,如果 CustomerType 属性值满足 is equal 规则条件,则 defaults to 规则操作 会应用于 PaymentTerms 属性。In the following business rule, if the CustomerType attribute value meets the is equal rule condition, then the defaults to rule action is applied to the PaymentTerms attribute. 否则不执行任何操作。Otherwise no action is taken.

If  
    CustomerType is equal to 1  
Then  
    PaymentTerms defaults to 210Net30  
Else  
    None  

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
产品Product 产品Product DaysToManufactureDaysToManufacture 为内部制造指定制造天数范围。Specifies the range of days-to-manufacturing for in house manufacturing.

在下面的业务规则中,如果 InHouseManufacture 属性值满足 is equal 规则条件,则 must be between 规则操作 会应用于 DaysToManufacture 属性。In the following business rule, if the InHouseManufacture attribute value meets the is equal rule condition, then the must be between rule action is applied to the DaysToManufacture attribute. 否则不执行任何操作。Otherwise no action is taken.

If  
    InHouseManufacture is equal to Y  
Then  
    DaysToManufacture must be between 1 and 10  
Else  
    None  

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
产品Product 产品Product Required fieldsRequired fields 为产品实体成员指定必需属性。Specifies the required attributes for the product entity members.

在下面的业务规则中,在所有情况下都会为指定属性执行 is required 验证操作In the following business rule, under all conditions the is required validation action is taken for the specified attributes. 属性值不能为 Null 或空白。The attribute values cannot be Null or blank.

If  
    None  
Then  
    Name is required  
    ProductSubCategory is required  
    Color is required  
    StandardCost is required  
    SafetyStockLevel is required  
    ReorderPoint is required  
    InHouseManufacture is required  
    SellStartDate is required  
    FinishedGoodIndicator is required  
    ProductLine is required  
Else  
    None  

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
产品Product 产品Product Std CostStd Cost 要求标准成本大于 0。Requires that the standard cost is greater than 0.

在下面的业务规则中,在所有情况下都会将 must be greater than 规则操作 应用于产品的 StandardCost 属性。In the following business rule, under all conditions the must be greater than rule action is applied to the StandardCost attribute of products.

If  
    None  
Then  
    StandardCost must be greater than 0  
Else  
    None  

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
产品Product 产品Product FG MSRP CostFG MSRP Cost 指定产品是否为产成品,并且 MSRP(制造商建议零售价)和经销商成本必须大于 0。Specifies that if the product is a finished good, the MSRP (manufacturer suggested retail price) and dealer costs must be greater than 0.

在下面的业务规则中,如果 FinishedGoodIndicator 属性值满足 is equal 规则条件,则 must be greater than 规则操作 会应用于 MSRP 和 DealerCost 属性。In the following business rule, if the FinishedGoodIndicator attribute value meets the is equal rule condition, the must be greater than rule action is applied to the MSRP and DealerCost attributes.

If  
    FinishedGoodIndicator is equal to Y  
Then  
    MSRP must be greater than 0  
    DealerCost must be greater than 0  
Else  
    None  

--------------------------------------------------

示例模型Sample Model 实体Entity 业务规则名称Business Rule Name 描述Description
产品Product 产品Product Default NameDefault Name 基于 Color 和 Class 属性的值指定默认产品名称。Specifies the default product name based on the values of the Color and Class attributes. 当 Color 属性值不是 YLO 并且 Class 属性不是 NA 时,默认名称是 Yellow NA。When the Color attribute value is not YLO and the Class attribute is not NA, the default name is Yellow NA.

在下面的业务规则中,如果 Color 和 Class 属性不满足 is equal 规则条件,则 defaults to 规则操作 会应用于 Name 属性。In the following business rule, if the Color and Class attributes do not meet the is equal rule condition, the defaults to rule action is applied to the Name attribute.

If  
    (Color is equal to YLO AND Class is equal to NA) is not true  
Then  
    Name defaults to Yellow NA  
Else  
    Name defaults to Other  

--------------------------------------------------

在示例模型中查看业务规则示例To view the business rule examples in the sample models

  1. 导航在安装 MDS 之后设置的 Master Data ServicesMaster Data Services 网站,然后单击“系统管理”**** 框。Navigate to the Master Data ServicesMaster Data Services Web site that you set up after installing MDS, and click the System Administration box.
    有关设置 Web 站点的说明,请参阅 Master Data Services 的安装和配置For instructions on setting up the Web site, see Master Data Services Installation and Configuration.
  2. 单击包含业务规则的示例模型(如以上表所列),然后单击“实体”****。Click the sample model that contains the business rule, as listed in the tables above, and then click Entities.
  3. 单击应用规则的实体(如以下表所列),然后单击“业务规则”****。Click the entity to which the rule applies, as listed in the tables above, and then click Business Rules.
  4. 单击要查看的业务规则的名称。Click the name of the business rule that you want to view. UI 将展开,以显示 IfThenElse 语句。The UI expands to show the If, Then and Else statements.