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"
}
]
}
与质量判定配合使用
┌──────────────────┐
│QualificationJudgment│
│ 质量判定 │
│ 结果: NG │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ 条件判断 │
│ 结果 == NG ? │
└────────┬─────────┘
│ 是
▼
┌──────────────────┐
│ProductAutomaticRepair│
│ 不良品自动返修 │
│ 判定: 人工返修 │
└──────────────────┘
错误处理
| 错误场景 | 结果值 | 错误信息 |
|---|---|---|
| 功能未启用 | 2 | 配方下发禁用 |
| 产品码为空 | 2 | 产品码不能为空 |
| 判定结果格式错误 | 2 | 判定结果格式不正确:1=NG品流程、2=人工返修、3=设备返修、4=产品报废 |
| 创建判定失败 | 2 | 具体错误信息 |
| 系统异常 | 2 | 异常信息 |
依赖服务
| 服务接口 | 说明 |
|---|---|
| IJudgmentProvider | 判定服务,用于创建判定记录 |
注意事项
- 功能启用:需要在工艺配置中启用不良品自动返修功能
- 产品码必填:产品序列号是必填参数
- 判定类型验证:判定结果必须是有效的枚举值(1-4)
- 操作员记录:系统会自动记录当前操作员信息
- 异常处理:创建判定过程中的异常会被捕获并记录
- 结果检查:建议在后续节点检查执行结果
相关节点
- InboundDetectionActivity - 进站检测基类
- ProductStateDetectionActivity - 产品状态检测节点
- QualificationJudgmentActivity - 质量判定节点
- LocalQualificationJudgmentActivity - 本地质量判定节点
最后更新时间: 2025-11-28