POST 新建工序
参数位置:body:id、version、code、name、type、defaultWorkshopId、standardMinutes、setupMinutes、pieceRate、outsourcingDays、defaultSupplierId、defectReasonIds、inspectionTypes、inspectionPoint、inspectionPlanId、firstArticleQty、patrolEveryQty、patrolEveryMinutes、transferGate、firstArticleGate、releasePoint、sopFiles、clockRequired、reportRequired、restrictStations、enabled、remark、workstationIds。 必填:name(工序名称)。可选:code(编码,留空自动编 OP-xxx)、type(1 加工 2 装配 默认 3 检验 4 包装 5 委外)、defaultWorkshopId(默认车间)、standardMinutes(标准工时 分钟/件)、setupMinutes、pieceRate(计件单价)、outsourcingDays、defaultSupplierId(委外用)、defectReasonIds(不良品项 ID 数组)、inspectionTypes(数组,1 首检 2 巡检 3 工序检)、inspectionPlanId、firstArticleQty、patrolEveryQty、patrolEveryMinutes、transferGate / firstArticleGate / releasePoint(0 跟随生产配置 1 是 2 否)、clockRequired、reportRequired、restrictStations、enabled(默认 1)、remark、workstationIds(可做工位 ID 数组)。返回新工序 ID。
| 接口编码 | 所需范围 | 后端接口 |
|---|---|---|
production.operation.create | production:write | POST /v1/production-operation/create(comap-srm) |
员工权限:本接口按权限码 production:operations:create 对照绑定员工的主站功能权限。
必填字段
| 字段 | 依据 |
|---|---|
name | 参数说明 |
条件必填(如「某状态时必填」)不在此表,以上方参数说明为准。 判定规则见必填字段的判定。
请求体字段(body)
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer(int64) | — | ID:新建不传,编辑必传 |
version | integer(int32) | — | [L29] 编辑时打开表单那一刻的版本号(列表里的 version):别处改过就报 77821 让刷新;不传不查(定-7) |
code | string | — | 编码:新建留空自动编 OP-xxx;编辑不能清空,被工艺路线引用后不能改 |
name | string | — | 名称 |
type | integer(int32) | — | 类型:1 加工 2 装配 3 检验 4 包装 5 委外 |
defaultWorkshopId | integer(int64) | — | 默认车间 |
standardMinutes | number | — | 标准工时(分钟 / 件);不传 = 未定(C53),0 = 不占工时 |
setupMinutes | number | — | 准备时间(分钟);不传 = 0 |
pieceRate | number | — | 默认计件单价(元 / 件) |
outsourcingDays | integer(int32) | — | 委外周期(天,只对委外类型保存) |
defaultSupplierId | integer(int64) | — | 默认委外供应商 |
defectReasonIds | integer(int64)[] | — | 不良品项;空 = 全部不良原因都能选 |
inspectionTypes | integer(int32)[] | — | 检验方法:1 首检 2 巡检 3 工序检;不传时按 inspectionPoint 换算 |
inspectionPoint | integer(int32) | — | 旧检验点(遗留):0 无 1 首检 2 完工检 |
inspectionPlanId | integer(int64) | — | 检验方案(本批只存不校验) |
firstArticleQty | integer(int32) | — | 首件数,默认 1 |
patrolEveryQty | integer(int32) | — | 巡检间隔(件),默认 0 |
patrolEveryMinutes | integer(int32) | — | 巡检间隔(分钟):不传 = 跟随生产配置「巡检间隔(分钟)」,0 = 不按时间巡,最多 1440;委外类型恒为空 |
transferGate | integer(int32) | — | 检验卡转序(C34):0 跟随生产配置 1 卡 2 不卡;不传 = 0 |
firstArticleGate | integer(int32) | — | 首检限报(C34):0 跟随生产配置 1 卡 2 不卡;不传 = 0 |
releasePoint | integer(int32) | — | 放行点(需上道放行,C20、A20):0 跟随生产配置 1 是 2 否;不传 = 0 |
sopFiles10 | MesSopFileDTO[] | — | 默认作业指导 |
clockRequired | boolean | — | 计时工序(原「报工前要打卡」,C27、REP-35):开工先开始计时,终端报工按计时算;委外类型恒为否 |
reportRequired | boolean | — | 加进路线时默认必需,默认是 |
restrictStations | boolean | — | 限定工位(P10):新建不传 = 关;编辑不传 = 不动 |
enabled | integer(int32) | — | 启用:新建不传 = 1;编辑不传 = 不动 |
remark | string | — | 说明 |
workstationIds | integer(int64)[] | — | 能做这道工序的工位(整体改分工;委外类型一律清空);编辑不传 = 不动 |
「必填」仅反映接口规格声明的部分。服务内还有未体现在规格里的校验, 标「—」不等于可以不传;租户在主站配置的字段必填不约束本接口。 详见必填字段的判定与字段清单与自定义字段。
请求示例
curl -X POST https://open.risemap.cn/v1/api/invoke \
-H "Authorization: Bearer <访问令牌>" \
-H "Content-Type: application/json" \
-d '{
"apiCode": "production.operation.create",
"body": {}
}'
错误处理
响应统一信封 { code, message, data },code == 200 为成功。以下是本接口可能返回的开放平台层错误:
| 错误码 | 说明 | 可重试 |
|---|---|---|
| 92101 | 访问凭证无效 | 否 |
| 92201 | 接口未登记或已停用 | 否 |
| 92202 | 超出凭证授权范围——本接口需 production:write | 否 |
| 92204 | 绑定员工无此接口的功能权限 | 否 |
| 92203 | 上游服务调用失败 | 先查询处理结果,禁止盲目重试 |
| 92301 | 请求过于频繁 | 是 |
| 92205 | 写操作处理超时,结果未知(下游可能仍在执行) | 否,先查询确认结果 |
| 92302 | 有参数相同的写请求正在处理中 | 等待并确认前一次结果,勿重复提交 |
除此之外,comap-srm 自身的业务校验失败会原样透传其业务码与提示
(如字段校验、状态不允许、数据不存在),这类码不在开放平台的号段内,
以响应里的 message 为准。完整的平台层错误码见错误码说明。
← 返回operation