编辑 | blame | 历史 | 原始文档

物料分类统一使用 mes_md_item_type - 前端联调方案

涉及页面

  • MDM 物料管理页面(新增/编辑物料)
  • MES 物料管理页面(新增/编辑物料)

业务流程与数据带入

  1. 物料分类统一使用 mes_md_item_type 表,MDM 和 MES 模块共用同一套分类数据
  2. 物料类型字段 itemType 用于快速选择:1原料、2半成品、3成品、4辅料
  3. 当选择 categoryId 时,直接关联分类 ID;当只选择 itemType 时,系统自动匹配对应名称的分类

API

获取物料分类列表

方法 路径 说明
GET /admin-api/mes/md/item-type/list 获取物料分类列表

请求参数:

参数 类型 必填 说明
status Integer 状态筛选

响应字段:

字段 类型 说明
id Long 分类编号
code String 分类编码
name String 分类名称
parentId Long 父分类编号
itemOrProduct String 物料/产品标识
sort Integer 排序
status Integer 状态

响应示例:

{
  "code": 0,
  "data": [
    {
      "id": 1,
      "code": "RAW001",
      "name": "原料",
      "parentId": 0,
      "itemOrProduct": "1",
      "sort": 1,
      "status": 0
    }
  ]
}

获取物料分类详情

方法 路径 说明
GET /admin-api/mes/md/item-type/get 获取物料分类详情

请求参数:

参数 类型 必填 说明
id Long 分类编号

保存物料分类

方法 路径 说明
POST /admin-api/mes/md/item-type/create 创建物料分类
PUT /admin-api/mes/md/item-type/update 更新物料分类

请求参数:

参数 类型 必填 说明
id Long 分类编号(更新时必填)
code String 分类编码
name String 分类名称
parentId Long 父分类编号
itemOrProduct String 物料/产品标识
sort Integer 排序
status Integer 状态

字段展示规则

字段 展示位置 说明
categoryId 新增/编辑表单 物料分类下拉框,数据来源:mes_md_item_type
itemType 新增/编辑表单 物料类型快捷选择:1原料、2半成品、3成品、4辅料

业务规则说明

场景 规则
物料分类选择 使用 mes_md_item_type 表,MDM 和 MES 共用同一套分类数据
itemType 与 categoryId 关系 当 categoryId 为空时,可根据 itemType 自动匹配对应名称的分类
itemType 映射 1→原料,2→半成品,3→成品,4→辅料
分类校验 保存物料时,会通过 RPC API 校验分类是否存在

注意事项

  • 物料分类数据在 MES 模块管理,MDM 模块通过 RPC API 调用获取
  • itemType 是快捷选择字段,最终会转换为对应的分类编码
  • 如果同时设置了 categoryIditemType,优先使用 categoryId
  • 分类支持树形结构,可通过 parentId 构建层级关系