Appearance
POST /dm-store/partMain/add
Content-Type: application/json
触发按钮:partMainAdd
入参
传递对象:PartMainVo
| 字段 | 类型 | 必填 | 多选 | 校验规则 | 说明 |
|---|---|---|---|---|---|
| partCode | String | 否 | 否 | - | 物料编码 |
| bigCategory | String | 否 | 否 | - | 大类 |
| smallCategory | String | 否 | 否 | - | 小类 |
| sonCategory | String | 否 | 否 | - | 子类 |
| partName | String | 否 | 否 | - | 物料名称 |
| spec | String | 否 | 否 | - | 物料规格 |
| uom | String | 否 | 否 | - | 单位 |
| controlType | Integer | 否 | 否 | - | 控制类型 |
| currency | Integer | 否 | 否 | - | 币种 |
| price | BigDecimal | 否 | 否 | - | 价格 |
| preferredSupplier | String | 否 | 否 | - | 首选供应商 |
| isPeriod | Integer | 否 | 否 | - | 是否有效期件 |
| isLife | Integer | 否 | 否 | - | 是否寿命件 |
| maxLife | BigDecimal | 否 | 否 | - | 最大寿命值 |
| maxLifeUom | String | 否 | 否 | - | 最大寿命单位 |
| useModel | String | 否 | 否 | - | 使用机型 |
| preciousType | Integer | 否 | 否 | - | ABC分类 |
| validFlag | Integer | 否 | 否 | - | 是否可用 |
| description | String | 否 | 否 | - | 备注 |
| packageNumber | Long | 否 | 否 | - | 包装数量 |
| serialRule | Integer | 否 | 否 | - | 序列号生成规则 1 自动生成 2手动输入 |
实际入参
json
{
"partCode": "xxx",
"partName": "xxx",
"spec": "xx",
"bigCategory": "xx",
"smallCategory": "xx",
"sonCategory": "xx",
"currency": 1,
"preferredSupplier": "FACILITIES CORP",
"uom": "KW",
"price": "111",
"controlType": 1,
"useModel": "ss",
"validFlag": 1,
"description": "22",
"attachmentVoList": [
{
"id": 64634,
"createTime": "2026-05-21 02:11:17",
"createUser": "zhongmg2",
"updateTime": "2026-05-21 02:11:17",
"updateUser": "zhongmg2",
"factoryNo": "000027",
"isDelete": 0,
"fileId": "DEVICEMATE_PART_MAIN/tst_zmg.png",
"filePath": "DEVICEMATE_PART_MAIN/tst_zmg.png",
"fileSize": 458237,
"fileName": "tst_zmg.png",
"fileType": "image/png",
"scope": null,
"businesskey": "DEVICEMATE_PART_MAIN",
"targetId": null,
"baseUrl": "https://10.188.132.96/lemes-api/common/oss/get/",
"isDelOrUp": null
}
],
"packageNumber": null,
"preciousType": 1,
"maxLife": null,
"serialRule": 1,
"maxLifeUom": "",
"isPeriod": 0,
"isLife": 0
}出参
传递对象:ResultData
json
{
"code": 200,
"msg": "success"
}前端校验规则
前端校验
├── 权限校验
│ └── 新增按钮权限
│ └── v-auth: 'information:partMain:add:popup'
├── 表单校验
│ ├── partCode
│ │ └── required: true, trigger: blur
│ ├── partName
│ │ └── required: true, trigger: blur
│ ├── spec
│ │ └── required: true, trigger: blur
│ ├── uom
│ │ └── required: true, trigger: change
│ ├── controlType
│ │ └── required: true, trigger: change
│ ├── price
│ │ ├── required: true, trigger: blur
│ │ ├── 仅允许数字和小数点输入
│ │ ├── 首字符禁止为小数点
│ │ ├── 多个小数点时仅保留一个
│ │ ├── 最多 3 位小数
│ │ └── 失焦时值为 0 或空值触发 warning
│ ├── packageNumber
│ │ ├── required: true(form.controlType == 3 时生效), trigger: blur
│ │ ├── 仅允许整数输入
│ │ └── 失焦时值为 0 或空值触发 warning
│ ├── maxLife
│ │ ├── required: true(form.controlType == 2 && form.isLife == 1 时生效), trigger: blur
│ │ ├── 仅允许数字和小数点输入
│ │ ├── 首字符禁止为小数点
│ │ ├── 多个小数点时仅保留一个
│ │ └── 最多 1 位小数
│ ├── maxLifeUom
│ │ └── required: true(form.controlType == 2 && form.isLife == 1 时生效), trigger: blur
│ └── serialRule
│ └── required: true(form.controlType == 2 时生效), trigger: change
├── 提交拦截校验
│ └── 表单 validate 未通过时不触发 addAction
├── 文件上传校验
│ └── attachmentVoList
│ ├── 仅允许 image/jpeg、image/png、image/gif、image/jpg
│ └── 文件大小限制:小于 5MB后端逻辑
业务流程:先校验物料是否可新增,再生成物料编号并保存主数据,最后回写附件归属
├── 校验物料可新增:validData :256
│ ├── 校验库存台账占用:findAllList :284
│ ├── 校验物料名称唯一:checkPartMainNameExist :292-295
│ └── 校验物料编码唯一:checkPartMainCodeExist :298-301
├── 生成物料编号:getCommonSeqNo :258
├── 保存物料主记录:save :262
└── 回写附件归属:updateFile :271
└── 设置附件 targetId后端校验规则
后端校验
├── 占用与冲突校验
│ └── 校验传入物料代号是否已被库存台账使用:validData :283-289
│ ├── 从库存台账按 partNo 命中即拦截
│ └── StoreExceptionCode.EX201059
└── 业务唯一性校验
├── 校验物料名称是否重复:validData :292-295
│ ├── 按 partName 且 isDelete=0 判重
│ └── StoreExceptionCode.EX201024
└── 校验物料编码是否重复:validData :298-301
├── 按 partCode 且 isDelete=0 判重
└── StoreExceptionCode.EX201025涉及数据库表
| 库名.表名 | mapper.statement | 描述 |
|---|---|---|
| tools.GLOBAL_SERIAL | GlobalSerialMapper.updateCurrentValue | 更新序列号 |
| tools.attachment | AttachmentMapper.update | 更新附件 |
| store.part_main | PartMainMapper.insert | 新增物料 |