ProductAutomaticRepairActivity - 不良品自动返修
概述
ProductAutomaticRepairActivity 是一个 MES 专用的不良品自动返修节点,用于自动创建产品的返修判定记录。该节点可以根据配置的判定结果类型(NG品流程、人工返修、设备返修、产品报废)自动为产品创建相应的判定记录,实 现不良品的自动化处理流程。
基本信息
| 属性 | 值 |
|---|---|
| 显示名称 | 不良品自动返修 |
| 类名 | ProductAutomaticRepairActivity |
| 命名空间 | CMS.Plugin.MesSuite.Activitys |
| 基类 | InboundDetectionActivity |
| 分类 | 工序步骤 |
| 排序 | 15 |
| 发布 | 是 |
配置说明
该节点通过工艺配置和流程上下文变量进行控制。
工艺配置
| 配置项 | 说明 |
|---|---|
| ProductAutomaticRepair | 不良品自动返修功能开关 |
输入变量
| 变量名 | 常量 | 类型 | 说明 |
|---|---|---|---|
| ProductAutomaticRepair_SerialNumber | FlowItemCollection.ProductAutomaticRepairSerialNumberKey | string | 产品序列号(必填) |
| ProductAutomaticRepair_Judgement | FlowItemCollection.ProductAutomaticRepairJudgementKey | string | 判定结果类型(必填) |
| ProductAutomaticRepair_Reason | FlowItemCollection.ProductAutomaticRepairReasonKey | string | 不合格原因(可选) |
| ProductAutomaticRepair_Section | FlowItemCollection.ProductAutomaticRepairSectionKey | string | 判定工序(可选) |
输出变量
| 变量名 | 常量 | 类型 | 说明 |
|---|---|---|---|
| ProductAutomaticRepair_Result | FlowItemCollection.ProductAutomaticRepairResultKey | int | 执行结果:0=未执行,1=成功,2=失败 |
| ProductAutomaticRepair_Description | FlowItemCollection.ProductAutomaticRepairDescriptionKey | string | 执行描述/错误信息 |
判定结果类型
| 枚举值 | 名称 | 说明 |
|---|---|---|
| 1 | NG品流程 | 产品进入 NG 品处理流程 |
| 2 | 人工返修 | 产品需要人工返修 |
| 3 | 设备返修 | 产品需要设备返修 |
| 4 | 产品报废 | 产品报废处理 |
业务逻辑
执行流程
┌─────────────────────────────────────────────────────────────┐
│ ProductAutomaticRepairActivity │
├─────────────────────────────────────────────────────────────┤
│ EnterAsync - 初始化阶段 │
│ ├─ 设置执行结果 = 0(未执行) │
│ └─ 清空执行描述 │
├─────────────────────────────────────────────────────────────┤
│ ProcessAsync - 处理阶段 │
│ ├─ 检查功能是否启用 │
│ │ └─ 未启用 → 设置结果=2,返回禁用说明 │
│ ├─ 验证产品码 │
│ │ └─ 为空 → 设置结果=2,返回错误 │
│ ├─ 验证判定结果类型 │
│ │ └─ 无效 → 设置结果=2,返回错误 │
│ ├─ 创建判定记录 │
│ │ └─ 调用 IJudgmentProvider.CreateJudgementAsync │
│ └─ 设置执行结果 │
│ ├─ 成功 → 结果=1 │
│ └─ 失败 → 结果=2,记录错误信息 │
└─ ────────────────────────────────────────────────────────────┘
执行结果说明
| 结果值 | 说明 |
|---|---|
| 0 | 未执行(初始状态) |
| 1 | 执行成功 |
| 2 | 执行失败 |
使用示例
基本流程配置
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│QualificationJudgment│──▶│ProductAutomaticRepair│──▶│ 后续处理节点 │
│ 质量判定 │ │ 不良品自动返修 │ │ │
└──────────────────┘ └──────────────────┘ └──────────────────┘
设置输入参数
{
"Activities": [
{
"Name": "设置产品码",
"Type": "VariableWriteActivity",
"VariableName": "ProductAutomaticRepair_SerialNumber",
"VariableValue": "SN123456789"
},
{
"Name": "设置判定结果",
"Type": "VariableWriteActivity",
"VariableName": "ProductAutomaticRepair_Judgement",
"VariableValue": "2"
},
{
"Name": "设置不合格原因",
"Type": "VariableWriteActivity",
"VariableName": "ProductAutomaticRepair_Reason",
"VariableValue": "外观缺陷"
},
{
"Name": "不良品自动返修",
"Type": "ProductAutomaticRepairActivity"
}
]
}
检查执行结果
{
"Activities": [
{
"Name": "不良品自动返修",
"Type": "ProductAutomaticRepairActivity"
},
{
"Name": "检查结果",
"Type": "ConditionActivity",
"Condition": "ProductAutomaticRepair_Result == 1"
}
]
}