Skip to content

POST /dm-store/partMain/update

Content-Type: application/json

触发按钮:partMainUpdate

入参

传递对象:PartMainVo

字段类型必填多选校验规则说明
partCodeString-物料编码
bigCategoryString-大类
smallCategoryString-小类
sonCategoryString-子类
partNameString-物料名称
specString-物料规格
uomString-单位
controlTypeInteger-控制类型
currencyInteger-币种
priceBigDecimal-价格
preferredSupplierString-首选供应商
isPeriodInteger-是否有效期件
isLifeInteger-是否寿命件
maxLifeBigDecimal-最大寿命值
maxLifeUomString-最大寿命单位
useModelString-使用机型
preciousTypeInteger-ABC分类
validFlagInteger-是否可用
descriptionString-备注
packageNumberLong-包装数量
serialRuleInteger-序列号生成规则 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_mainPartMainMapper.updateById按 id 更新partMain数据
附件数据fileClient.listFileWithTarget按业务目标查询附件并回填 attachmentVoList 或 baseUrl
附件数据fileClient.deleteFiles删除旧附件文件
附件数据fileClient.updateFile回写附件 targetId