POST 保存物料 MRP 计划参数
参数位置:body:productId、planningMethod、safetyStockQty、reorderPointQty、maxStockQty、lotRule、fixedLotQty、periodDays、minLotQty、lotMultiple、maxLotQty、fixedLeadDays、variableLeadDays、variableLeadBatch、inspectionDays、purchaseProcessDays、remark、version。 POST 写操作。body 为 JSON 对象,整体保存一个物料的参数(没传的按默认值)。必填:productId(物料 ID)。可选:planningMethod(MRP / ROP 再订货点 / NONE 不计划,默认 MRP)、safetyStockQty(安全库存)、reorderPointQty、maxStockQty(ROP 时最高库存必填且大于再订货点)、lotRule(LFL 按需 默认 / FIXED 固定批量,需 fixedLotQty>0 / PERIOD 期间合并,需 periodDays>0)、minLotQty、lotMultiple、maxLotQty(0=不限)、fixedLeadDays(空=自动)、variableLeadDays + variableLeadBatch(设了变动提前期须填批量)、inspectionDays、purchaseProcessDays(空=跟随生产配置)、remark(最多 200 字)、version(列表里的版本号,传了用于并发冲突检查)。
| 接口编码 | 所需范围 | 后端接口 |
|---|---|---|
production.mrp-param.save | production:write | POST /v1/production-mrp/planning-params/save(comap-srm) |
员工权限:本接口按权限码 production:mrp-params:update 对照绑定员工的主站功能权限。
必填字段
| 字段 | 依据 |
|---|---|
productId | 参数说明、接口规格 |
条件必填(如「某状态时必填」)不在此表,以上方参数说明为准。 判定规则见必填字段的判定。
请求体字段(body)
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
productId | integer(int64) | 是 | 物料 ID |
planningMethod | string | — | 计划方式:MRP / ROP / NONE |
safetyStockQty | number | — | 安全库存;空或 0 = 不补(MRP 只认这里设的,库存预警规则不算) |
reorderPointQty | number | — | 再订货点(ROP 用) |
maxStockQty | number | — | 最高库存(ROP 用,要大于订货点) |
lotRule | string | — | 批量规则:LFL 按需 / FIXED 固定批量 / PERIOD 期间合并 |
fixedLotQty | number | — | 固定批量的每批数量 |
periodDays | integer(int32) | — | 期间合并的天数 |
minLotQty | number | — | 最小批量 |
lotMultiple | number | — | 批量倍数 |
maxLotQty | number | — | 最大批量(0 = 不限) |
fixedLeadDays | integer(int32) | — | 固定提前期(天);空 = 自动 |
variableLeadDays | integer(int32) | — | 变动提前期(天,只对自制件生效) |
variableLeadBatch | number | — | 变动提前期对应的批量 |
inspectionDays | integer(int32) | — | 检验提前期(工作日) |
purchaseProcessDays | integer(int32) | — | 采购处理天数(工作日);空 = 跟随生产配置 |
remark | string | — | 备注(最多 200 个字) |
version | integer(int32) | — | 打开编辑时这个物料参数的版本(列表里的 version;没设过参数为空):别人在这期间改过就报 79015 |
「必填」仅反映接口规格声明的部分。服务内还有未体现在规格里的校验, 标「—」不等于可以不传;租户在主站配置的字段必填不约束本接口。 详见必填字段的判定与字段清单与自定义字段。
请求示例
curl -X POST https://open.risemap.cn/v1/api/invoke \
-H "Authorization: Bearer <访问令牌>" \
-H "Content-Type: application/json" \
-d '{
"apiCode": "production.mrp-param.save",
"body": {
"productId": "1961000000000000001"
}
}'
响应 data 字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
productId | integer(int64) | — | 物料 ID |
productCode | string | — | 物料编码 |
productName | string | — | 物料名称 |
productSpec | string | — | 规格型号 |
unitName | string | — | 主单位 |
supplyType | string | — | 供应方式:BUY / MAKE / OUTSOURCE;物料来源类型解析不出来为空 |
supplyTypeName | string | — | 供应方式名称 |
availableQty | number | — | 当前可用(参与抵扣的仓库合计) |
planningMethod | string | — | 计划方式:MRP / ROP / NONE |
planningMethodName | string | — | 计划方式名称 |
safetyStockQty | number | — | 生效的安全库存(没设为 0) |
safetyStockOverride | number | — | 计划参数里设的安全库存;空 = 没设,MRP 不补(库存预警规则不再当默认值) |
reorderPointQty | number | — | 再订货点 |
maxStockQty | number | — | 最高库存 |
lotRule | string | — | 批量规则:LFL / FIXED / PERIOD |
lotRuleName | string | — | 批量规则名称 |
fixedLotQty | number | — | 固定批量的每批数量 |
periodDays | integer(int32) | — | 期间合并天数 |
minLotQty | number | — | 最小批量 |
lotMultiple | number | — | 批量倍数 |
maxLotQty | number | — | 最大批量(0 = 不限) |
packQty | number | — | 包装倍数(物料最小包装量,采购件取整用) |
fixedLeadDays | integer(int32) | — | 固定提前期;空 = 自动 |
autoLeadDays | integer(int32) | — | 自动口径的提前期(天) |
autoLeadSource | string | — | 自动口径的来源:ROUTING 工艺路线 / SOURCING 价格本交期 / HISTORY 历史到货 / FALLBACK 系统兜底 |
autoLeadSourceName | string | — | 自动口径的来源名称 |
variableLeadDays | integer(int32) | — | 变动提前期(天) |
variableLeadBatch | number | — | 变动提前期对应的批量 |
inspectionDays | integer(int32) | — | 检验提前期(工作日) |
purchaseProcessDays | integer(int32) | — | 生效的采购处理天数(工作日,采购件) |
purchaseProcessDaysOverride | integer(int32) | — | 计划参数里设的采购处理天数;空 = 跟随生产配置 |
supplierName | string | — | 推荐供应商(默认供应商 → 价格本) |
customized | boolean | — | 改过参数 |
version | integer(int32) | — | 参数版本(保存时原样带回,防止覆盖别人刚做的修改);没设过参数为空 |
updatedAt | string | — | 最后修改时间 |
updatedBy | string | — | 最后修改人 |
remark | string | — | 备注 |
错误处理
响应统一信封 { code, message, data },code == 200 为成功。以下是本接口可能返回的开放平台层错误:
| 错误码 | 说明 | 可重试 |
|---|---|---|
| 92101 | 访问凭证无效 | 否 |
| 92201 | 接口未登记或已停用 | 否 |
| 92202 | 超出凭证授权范围——本接口需 production:write | 否 |
| 92204 | 绑定员工无此接口的功能权限 | 否 |
| 92203 | 上游服务调用失败 | 先查询处理结果,禁止盲目重试 |
| 92301 | 请求过于频繁 | 是 |
| 92205 | 写操作处理超时,结果未知(下游可能仍在执行) | 否,先查询确认结果 |
| 92302 | 有参数相同的写请求正在处理中 | 等待并确认前一次结果,勿重复提交 |
除此之外,comap-srm 自身的业务校验失败会原样透传其业务码与提示
(如字段校验、状态不允许、数据不存在),这类码不在开放平台的号段内,
以响应里的 message 为准。完整的平台层错误码见错误码说明。
← 返回mrp-param