Matching Formula
Introduction
MatchingFormulaActivity is a recipe matching node used to match the corresponding product model and recipe based on the product identification code. This node is usually used in conjunction with DistributeFormulaActivity to match the recipe first and then apply it.
Configuration Items
This node has no additional configuration properties.
Business Logic
Execution Flow
Start
│
▼
Initialize flow data items
│
▼
Check if recipe distribution is enabled
│
├─► Not Enabled → Set result=3, return
│
▼
Get Product Identification Code
│
├─► Empty → Set result=0, return
│
▼
Check recipe distribution mode config
│
├─► Not "Distribute when process identifies product" → Set result=3, return
│
▼
Find Product Model by Identification Code
│
├─► Not Found → Set result=3, return
│
▼
Match Recipe by Product Model
│
├─► Not Found → Set result=3, return
│
▼
Set Product Model and Recipe to Flow Data Items
│
▼
End
Result Values
| Result Value | Description |
|---|---|
| 0 | Product Identification Code is empty |
| 3 | Function not enabled/Product Model not found/Recipe not found |
Flow Data Items
Input Data Items
| Data Item | Type | Description |
|---|---|---|
| ApplicationData | ProcessModel | Process Model |
| FormulaDistributionProductKey | string | Product Identification Code |
Output Data Items
| Data Item | Type | Description |
|---|---|---|
| FormulaDistributionResultKey | int | Recipe Matching Result |
| FormulaDistributionDescriptionKey | string | Recipe Matching Description |
| FormulaDistributionProductModelKey | ProductModel | Matched Product Model |
| FormulaDistributionFormulaModelKey | FormulaModel | Matched Recipe |
Usage Example
Basic Configuration
<MatchingFormulaActivity Name="Match Recipe" />
Set Product Identification Code
<VariableWriteActivity Name="Set Product ID Code">
<Variable>FormulaDistributionProductKey</Variable>
<Value>{Product ID Code}</Value>
</VariableWriteActivity>
<MatchingFormulaActivity Name="Match Recipe" />
Typical Flow Configuration
Set ID Code → Match Recipe → Apply Recipe
<!-- Read Product ID Code from PLC -->
<VariableReadActivity Name="Read Product ID Code">
<Variable>ProductIdentificationCode</Variable>
<Target>FormulaDistributionProductKey</Target>
</VariableReadActivity>
<MatchingFormulaActivity Name="Match Recipe" />
<ConditionActivity Name="Match Result Judgment">
<Condition>Flow.DataItems["FormulaDistributionProductModelKey"] != null</Condition>
<TrueBranch>
<DistributeFormulaActivity Name="Apply Recipe" />
</TrueBranch>
<FalseBranch>
<LogActivity Name="Log Match Failure" />
</FalseBranch>
</ConditionActivity>
System Configuration Requirements
Recipe Distribution Mode
Need to set recipe distribution mode to "Distribute when process identifies product" (Value 2) in system settings:
- Setting Item:
CMSPluginFormulaManagementSettings.FormulaDistributionMode - Value:
2
Notes
- Product Identification Code must be set in flow data items.
- "Distribute when process identifies product" must be enabled in system settings.
- Product model must exist in the system.
- Product must be associated with a valid recipe.