Skip to main content
Version: Next

Material Usage Record

Introduction​

MaterialUsageRecordActivity is a MES-specific material usage record node used to record material usage and execute material deduction when a product leaves the station. This node automatically deducts corresponding material inventory based on material parameters in trace data.

Configuration Items​

Configuration Properties​

Property NameDisplay NameTypeDefault ValueDescription
ExecuteImmediatelyExecute ImmediatelyboolfalseWhether to execute deduction synchronously. Asynchronously if false.

Input Variables​

Variable NameConstantTypeDescription
ApplicationDataFlowItemCollection.ApplicationDataProcessModelProcess Model
ProductModelFlowItemCollection.ProductModelAssociationProductModelProduct Model
TraceModelFlowItemCollection.TraceModelTraceModelTrace Model
ParameterCollectDataFlowItemCollection.ParameterCollectDataIReadOnlyDictionaryParameter Collection Data

Business Logic​

Execution Flow​

┌─────────────────────────────────────────────────────────────┐
│ MaterialUsageRecordActivity │
├─────────────────────────────────────────────────────────────┤
│ ExecuteActionAsync - Execution Phase │
│ ├─ Get process model, product model, trace model │
│ ├─ Verify existence of necessary data │
│ └─ Execute Material Deduction │
│ ├─ ExecuteImmediately = true → Synchronous execution │
│ └─ ExecuteImmediately = false → Asynchronous execution │
├─────────────────────────────────────────────────────────────┤
│ DecreaseMaterialAsync - Deduction Processing │
│ ├─ Traverse material parameters in process config │
│ ├─ Get material barcode from trace data │
│ ├─ Check if there is independent deduction flow │
│ │ └─ Has trigger signal config → Skip (Handled by Ded. Flow)│
│ ├─ Get Usage Quantity (Read from param in Equipment Mode) │
│ └─ Call Material Service to Execute Deduction │
└─────────────────────────────────────────────────────────────┘

Deduction Logic​

  1. Traverse Material Parameters

    • Get material list from MaterialParameters of process configuration.
    • Skip materials with empty names.
  2. Get Material Barcode

    • Get corresponding material barcode from MaterialParams of trace model.
  3. Check Deduction Flow

    • If process is configured with independent material deduction flow (Type = 10008).
    • And material is configured with trigger signal, then skip (Handled by MaterialDeductionActivity).
  4. Get Usage Quantity

    • Equipment Mode: Read usage variable from parameter collection data.
    • Other Modes: Use system default usage.
  5. Execute Deduction

    • Call IMaterialProvider.DeductionAsync to execute deduction.

Usage Example​

Basic Configuration​

{
"Name": "Material Usage Record",
"Type": "MaterialUsageRecordActivity",
"ExecuteImmediately": false
}

Typical Outbound Flow​

┌──────────────────┐
│OutboundInitialize│
│ Outbound Init │
└────────┬─────────┘
│
▼
┌──────────────────┐
│QualificationJudgment│
│ Qualification │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ParameterCollect │
│ Param Collect │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Trace Save │
└────────┬─────────┘
│
▼
┌──────────────────┐
│MaterialUsageRecordActivity│ ← Material Usage Record
│ Material Usage │
└──────────────────┘

Error Handling​

Error ScenarioHandling Method
Process Model EmptyDo not execute deduction
Product Model EmptyDo not execute deduction
Trace Model EmptyDo not execute deduction
Deduction ExceptionRecord error log, do not interrupt flow

Notes​

  1. Data Dependency: Requires Process Model, Product Model, and Trace Model to exist.
  2. Execution Timing: Usually executed after trace record saving.
  3. Deduction Conflict: Skips if material is configured with trigger signal (avoids double deduction).
  4. Async Execution: Defaults to asynchronous execution, does not block outbound flow.
  5. Error Handling: Deduction exception does not interrupt flow, only logs.
  6. Trace Data: Material barcode is obtained from trace data.