MaterialAssociationActivity - 物料码关联查询
概述
MaterialAssociationActivity 是一个 MES 专用的物料码关联查询节点,用于根据物料条码查询关联的产品序列号。该节点通过配置的物料关联规则,在追溯数据中查找物料条码对应的产品码,实现物料与产品的关联追溯。
基本信息
| 属性 | 值 |
|---|---|
| 显示名称 | 物料码关联查询 |
| 类名 | MaterialAssociationActivity |
| 命名空间 | CMS.Plugin.MesSuite.Activitys |
| 基类 | ProcessBusinessActivity |
| 分类 | 工序步骤 |
| 排序 | 13 |
| 发布 | 是 |
配置说明
该节点通过系统配置和流程上下文变量进行控制。
系统配置
| 配置项 | 说明 |
|---|---|
| MaterialAssociationConfig | 物料关联配置列表 |
物料关联配置(MaterialAssociationConfig)
| 字段 | 说明 |
|---|---|
| WorkSectionCode | 工序编号 |
| WorkSectionId | 工序标识 |
| MaterialName | 物料名称 |
| MaterialKey | 物料参数键 |
输入变量
| 变量名 | 常量 | 类型 | 说明 |
|---|---|---|---|
| MaterialCode | FlowItemCollection.MaterialCode | string | 待查询的物料条码 |
| OrderModel | FlowItemCollection.OrderModel | OrderModel | 工单模型(可选) |
| ProductModel | FlowItemCollection.ProductModel | AssociationProductModel | 产品型号(可选) |
输出变量
| 变量名 | 常量 | 类型 | 说明 |
|---|---|---|---|
| SerialNumber | FlowItemCollection.SerialNumber | string | 关联的产品序列号 |
| MaterialCodeAssociationDescriptionValue | FlowItemCollection.MaterialCodeAssociationDescriptionValue | string | 查询结果说明 |
业务逻辑
执行流程
┌─────────────────────────────────────────────────────────────┐
│ MaterialAssociationActivity │
├─────────────────────────────────────────────────────────────┤
│ EnterAsync - 初始化阶段 │
│ └─ 设置关联描述 = "未初始化" │
├─────────────────────────────────────────────────────────────┤
│ ProcessAsync - 处理阶段 │
│ ├─ 获取物料码 │
│ │ └─ 为空 → 返回"物料码获取失败" │
│ ├─ 获取物料关联配置 │
│ │ └─ 未配置 → 返回"物料产品关联工序未配置" │
│ ├─ 获取工艺路线 │
│ ├─ 遍历关联配置查询产品码 │
│ │ ├─ 检查工序是否在工艺路线中 │
│ │ └─ 调用追溯服务查询关联产品码 │
│ └─ 设置查询结果 │