rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java
@@ -17,7 +17,9 @@
import com.vincent.rsf.server.manager.entity.Matnr;
import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate;
import com.vincent.rsf.server.manager.service.MatnrService;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.controller.BaseController;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -77,15 +79,17 @@
        if (Objects.isNull(matnr.get("matnr"))) {
            throw new CoolException("名称不能为空!!");
        }
        if (Objects.isNull(matnr.get("code"))) {
            throw new CoolException("编码不能为空!!");
        }
        if (Objects.isNull(matnr.get("groupId"))) {
            throw new CoolException("物料分组不能为空!!");
        }
        Matnr matnr1 = JSONObject.parseObject(JSONObject.toJSONString(matnr), Matnr.class);
        if (Objects.isNull(matnr1.getCode())) {
            String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_MATNR_CODE, null);
            System.out.println("=========>");
            System.out.println(ruleCode);
            matnr1.setCode(ruleCode);
        }
        /**
         * 扩展字段存入库
         */
@@ -109,8 +113,13 @@
    @PostMapping("/matnr/update")
    @Transactional(rollbackFor = Exception.class)
    public R update(@RequestBody Map<String, Object> params) {
        Matnr matnr = JSONObject.parseObject(JSONObject.toJSONString(params), Matnr.class);
        if (Objects.isNull(matnr.getCode())) {
            throw new CoolException("编码不能为空!!");
        }
        if (Objects.isNull(matnr.getName())) {
            throw new CoolException("名称不能为空!!");
        }
        matnr.setUpdateBy(getLoginUserId());
        if (!matnrService.updateById(matnr)) {
            return R.error("Update Fail");