Skip to main content
Version: Next

Material Detection

Introduction​

MaterialDetectionActivity is a MES-specific material detection node used to verify the validity of material barcodes during the production process. This node supports material barcode rule detection, material state detection, material missing process detection, and can automatically write the material barcode to a specified variable.

Configuration Items​

Configuration Properties​

Property NameDisplay NameTypeDefault ValueDescription
WriteBrcodeVariableWrite Material ParameterbooltrueWhether to write material barcode to configured variable
WriteRetryCountWrite Retry Countint3Write retry count
WriteRetryDelayWrite Retry Delayint500Write retry delay (ms)

Process Configuration​

Configuration ItemDescription
MaterialDetection2Material Detection Function Switch
MaterielStateDetectionMaterial State Detection Trigger Timing
MaterielMissingProcessDetectionMaterial Missing Process Detection Trigger Timing
MaterialParametersMaterial Parameter Configuration List

Input Variables​

Variable NameConstantTypeDescription
MaterialDetection_MaterialVariableFlowItemCollection.MaterialDetectionMaterialVariableKeystringMaterial Barcode to Detect

Output Variables​

Variable NameConstantTypeDescription
MaterialDetection_ResultFlowItemCollection.MaterialDetectionResultKeyintResult: 0=Not Executed, 1=Success, 2=Failure, 3=Disabled
MaterialDetection_DescriptionFlowItemCollection.MaterialDetectionDescriptionKeystringResult Description
MaterialDetection_MaterialDetailIdFlowItemCollection.MaterialDetectionMaterialDetailIdKeystringMaterial Detail ID
MaterialDetection_MaterialNameFlowItemCollection.MaterialDetectionMaterialNameKeystringMaterial Name
MaterialDetection_MaterialParameterFlowItemCollection.MaterialDetectionMaterialParameterKeystringMaterial Parameter Key
MaterialDetection_ProductModelFlowItemCollection.MaterialDetectionProductModelKeyAssociationProductModelProduct Model

Business Logic​

Execution Flow​

┌─────────────────────────────────────────────────────────────┐
│ MaterialDetectionActivity │
├─────────────────────────────────────────────────────────────┤
│ EnterAsync - Initialization Phase │
│ ├─ Set Detection Result = 0 │
│ └─ Clear descriptions and material info │
├─────────────────────────────────────────────────────────────┤
│ ProcessAsync - Processing Phase │
│ ├─ Check if function is enabled │
│ │ └─ Not Enabled → Result=3, return disabled desc │
│ ├─ Verify Material Barcode │
│ │ └─ Empty → Result=2, return error │
│ ├─ Get Product Model │
│ │ └─ Not Found → Result=2, return error │
│ ├─ Material Barcode Rule Detection │
│ │ └─ Traverse MaterialParameters for verification │
│ ├─ Material State Detection (If Enabled) │
│ ├─ Material Missing Process Detection (If Enabled) │
│ ├─ Write Material Variable (If Configured) │
│ └─ Set Detection Result │
└─────────────────────────────────────────────────────────────┘

Material Detection Flow​

  1. Barcode Rule Detection

    • Traverse material parameters in process configuration.
    • Call IMaterialProvider.VerificationAsync to verify barcode.
    • Record material info if matched.
  2. Material State Detection (Optional)

    • Executed when MaterielStateDetection = OnMaterialVerification.
    • Detects material state in current process.
  3. Material Missing Process Detection (Optional)

    • Executed when MaterielMissingProcessDetection = OnMaterialVerification.
    • Detects if material has completed prerequisite processes.

Usage Example​

Basic Flow Configuration​

┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Scan Material Code│────▶│MaterialDetection │────▶│ Subsequent Node │
│ │ │ Mat. Detection │ │ │
└──────────────────┘ └──────────────────┘ └──────────────────┘

Set Material Barcode​

{
"Activities": [
{
"Name": "Read Material Barcode",
"Type": "VariableReadActivity",
"VariableName": "MaterialDetection_MaterialVariable"
},
{
"Name": "Material Detection",
"Type": "MaterialDetectionActivity",
"WriteBrcodeVariable": true,
"WriteRetryCount": 3,
"WriteRetryDelay": 500
}
]
}

Error Handling​

Error ScenarioResult ValueError Message
Function Not Enabled3Material Detection Disabled
Material Barcode Empty2Material Barcode: {code} is empty
Product Model Not Found2Product Model Not Found
Rule Mismatch2Specific verification error info
State Detection Failed2Specific detection error info
Missing Process Failed2Specific detection error info

Notes​

  1. Function Enable: Needs to enable material detection function in process configuration.
  2. Material Param Config: Needs to configure material parameter list in process.
  3. Product Model Required: Material detection requires product model information.
  4. Variable Write: Automatically writes material barcode when WriteBrcodeVariable is enabled.
  5. Retry Mechanism: Variable write supports retry configuration.
  6. Detection Order: Barcode rule detection first, then state and missing process detection.