Appearance
POST /dm-store/partMain/update
Content-Type: application/json
触发按钮:partMainUpdate
入参
传递对象: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
{
"id": 2251,
"createTime": "2026-05-21 02:18:29",
"createUser": "zhongmg2",
"updateTime": "2026-05-21 02:18:29",
"updateUser": "zhongmg2",
"factoryNo": "000027",
"isDelete": 0,
"partNo": "002263",
"partCode": "ss",
"bigCategory": "ss",
"smallCategory": "sss",
"sonCategory": "sss",
"partName": "ss",
"spec": "sss",
"uom": "LUMENES",
"controlType": 1,
"currency": 1,
"price": 111,
"preferredSupplier": "FACILITIES CORP",
"supplierNo": null,
"isPeriod": 0,
"isLife": 0,
"maxLife": null,
"maxLifeUom": "",
"useModel": "ss",
"preciousType": 1,
"validFlag": 1,
"description": "2222",
"packageNumber": null,
"baseUrl": "https://10.188.132.96/lemes-api/common/oss/get/devicemate/DEVICEMATE_PART_MAIN/tst_zmg.png",
"attachmentVoList": [
{
"id": 64636,
"createTime": "2026-05-21 02:18:24",
"createUser": "zhongmg2",
"updateTime": "2026-05-21 02:18:29",
"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": 2251,
"baseUrl": "https://10.188.132.96/lemes-api/common/oss/get/",
"isDelOrUp": null
}
],
"serialRule": 1
}出参
传递对象:ResultData
json
{
"code": 200,
"msg": "success"
}前端校验规则
前端校验
├── 权限校验
│ ├── 编辑按钮权限
│ │ └── v-auth: 'information:partMain:edit:popup'
│ └── 删除按钮权限
│ └── v-auth: 'information:partMain:delete:popup'
├── 表单必填校验
│ ├── partCode(料号编码)
│ │ └── required: true, trigger: blur
│ ├── partName(物料名称)
│ │ └── required: true, trigger: blur
│ ├── spec(规格)
│ │ └── required: true, trigger: blur
│ ├── uom(单位)
│ │ └── required: true, trigger: change
│ ├── price(单价)
│ │ └── required: true, trigger: blur
│ ├── controlType(库存控制类型)
│ │ └── required: true, trigger: change
│ └── serialRule(序列号规则)
│ └── required: true, trigger: change
├── 条件必填校验
│ ├── packageNumber(包装数量)
│ │ └── required: true, controlType == 3 时生效
│ ├── maxLife(最大生命周期)
│ │ └── required: true, controlType == 2 且 isLife == 1 时生效
│ └── maxLifeUom(生命周期单位)
│ └── required: true, controlType == 2 且 isLife == 1 时生效
├── 输入格式校验
│ ├── price
│ │ └── 最多3位小数
│ ├── packageNumber
│ │ └── 仅允许整数
│ └── maxLife
│ └── 最多1位小数
├── 文件上传校验
│ └── attachmentVoList
│ ├── 文件格式
│ │ ├── image/jpeg
│ │ ├── image/png
│ │ ├── image/gif
│ │ └── image/jpg
│ └── 文件大小
│ └── < 5MB
└── 提交前校验
└── this.$refs.form.validate后端逻辑
业务流程:校验名称重复 -> 校验编码重复 -> 更新附件 -> 处理控制类型逻辑 -> 更新物料主数据
├── 校验物料名称重复 :346-355
│ ├── 条件: partName相同 & isDelete=0 & id不同
│ └── 重复则抛异常: StoreExceptionCode.EX201024
├── 校验物料编码重复 :357-364
│ ├── 条件: partCode相同 & isDelete=0 & id不同
│ └── 重复则抛异常: StoreExceptionCode.EX201025
├── 更新附件 :366-383
│ ├── businessKey: DEVICEMATE_PART_MAIN :368
│ ├── 遍历附件列表
│ │ └── targetId为空则绑定物料ID :372-381
│ │ ├── 查询已有文件: fileClient.listFileWithTarget :374
│ │ ├── 删除旧文件: fileClient.deleteFiles :377
│ │ └── 更新文件targetId: fileClient.updateFile :380
├── 处理控制类型逻辑 :384-389
│ ├── controlType为1或3: 重置maxLife=0
│ └── controlType为1或2: 重置packageNumber=0
└── 更新物料主数据 :390-393
├── 复制VO到DO: BeanUtils.copyProperties :390
├── 更新人和时间: partMainDo.updateBy() :391
└── 执行更新: this.updateById :392后端校验规则
后端校验
├── 业务唯一性校验
│ ├── 物料名称唯一性校验 :348-354
│ │ ├── 查询条件: partName + isDelete=0 + 排除当前ID
│ │ └── 冲突异常: StoreExceptionCode.EX201024
│ └── 物料编码唯一性校验 :357-364
│ ├── 查询条件: partCode + isDelete=0 + 排除当前ID
│ └── 冲突异常: StoreExceptionCode.EX201025
└── 条件业务校验 :384-389
├── controlType == 1 或 3
│ └── maxLife 强制设为 0
└── controlType == 1 或 2
└── packageNumber 强制设为 0涉及数据库表
| 库名.表名 | mapper.statement | 描述 |
|---|---|---|
| store.part_main | PartMainMapper.updateById | 按 id 更新partMain数据 |
| 附件数据 | fileClient.listFileWithTarget | 按业务目标查询附件并回填 attachmentVoList 或 baseUrl |
| 附件数据 | fileClient.deleteFiles | 删除旧附件文件 |
| 附件数据 | fileClient.updateFile | 回写附件 targetId |