rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocController.java
@@ -177,33 +177,35 @@ @PostMapping("/loc/init") public R initLocInfo(@Valid @RequestBody LocMastInitParam param) { if (Objects.isNull(param)) { throw new CoolException("初始化信息不能为空!!"); return R.error("初始化信息不能为空!!"); } if (Objects.isNull(param.getTypeIds()) && param.getTypeIds().isEmpty()) { return R.error("库位类型不能为空!!"); } if (Objects.isNull(param.getWarehouseId())) { throw new CoolException("仓库ID不能为空!!"); return R.error("仓库ID不能为空!!"); } if (Objects.isNull(param.getAreaId())) { throw new CoolException("库区ID不能为空!!"); return R.error("库区ID不能为空!!"); } if (Objects.isNull(param.getStartRow())) { throw new CoolException("起始排不能为空!!"); return R.error("起始排不能为空!!"); } if (Objects.isNull(param.getEndRow())) { throw new CoolException("终止排不能为空!!"); return R.error("终止排不能为空!!"); } if (Objects.isNull(param.getStartBay())) { throw new CoolException("起始列不能为空!!"); return R.error("起始列不能为空!!"); } if (Objects.isNull(param.getEndBay())) { throw new CoolException("终止列不能为空!!"); return R.error("终止列不能为空!!"); } if (Objects.isNull(param.getStartLev())) { throw new CoolException("起始层不能为空!!"); return R.error("起始层不能为空!!"); } if (Objects.isNull(param.getEndLev())) { throw new CoolException("终止层不能为空!!"); return R.error("终止层不能为空!!"); } return locService.initLocs(param); } rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java
@@ -7,7 +7,6 @@ import com.vincent.rsf.framework.common.R; import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.domain.PageResult; import com.vincent.rsf.server.common.utils.CommonUtil; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.domain.BaseParam; @@ -18,22 +17,16 @@ 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.*; @RestController rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrGroupController.java
@@ -17,6 +17,7 @@ import com.vincent.rsf.server.manager.service.MatnrGroupService; import com.vincent.rsf.server.system.controller.BaseController; import io.swagger.annotations.Api; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -72,8 +73,12 @@ if (Objects.isNull(matnrGroup.getCode())) { throw new CoolException("分组编码不能为空!!"); } if (Objects.isNull(matnrGroup.getParCode())) { throw new CoolException("上级编码不能为空!!"); } matnrGroup.setCreateBy(getLoginUserId()); matnrGroup.setUpdateBy(getLoginUserId()); List<MatnrGroup> list = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>() .eq(MatnrGroup::getCode, matnrGroup.getCode())); if (!list.isEmpty()) { @@ -83,6 +88,10 @@ .eq(MatnrGroup::getName, matnrGroup.getName())); if (!groups.isEmpty()) { throw new CoolException("分组已存在,请勿重复添加!!"); } //判断上级编码是否为空 if (!Objects.isNull(matnrGroup.getParCode()) && !StringUtils.isBlank(matnrGroup.getParCode())) { matnrGroup.setParCode(matnrGroup.getParCode() + matnrGroup.getCode()); } if (!matnrGroupService.save(matnrGroup)) { return R.error("Save Fail"); @@ -109,6 +118,11 @@ } } //判断上级编码是否为空 if (!Objects.isNull(matnrGroup.getParCode()) && !StringUtils.isBlank(matnrGroup.getParCode())) { matnrGroup.setCode(matnrGroup.getParCode() + matnrGroup.getCode()); } if (!matnrGroupService.updateById(matnrGroup)) { return R.error("Update Fail"); } rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/LocMastInitParam.java
@@ -7,6 +7,7 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.List; /** * Created by vincent on 2020/6/13 @@ -47,7 +48,7 @@ @ApiModelProperty("库位类型") @NotBlank(message = "库位类型") private String type; private List<Long> typeIds; } rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/MatnrGroup.java
@@ -41,9 +41,15 @@ private String name; /** * 分组编码 */ @ApiModelProperty("上级分组编码") private String parCode; /** * 物料编码 */ @ApiModelProperty(value= "物料编码") @ApiModelProperty(value= "分组编码") private String code; /** rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocServiceImpl.java
@@ -12,6 +12,7 @@ import com.vincent.rsf.server.manager.mapper.LocTypeRelaMapper; import com.vincent.rsf.server.manager.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -84,6 +85,8 @@ if (Objects.isNull(warehouseAreas)) { throw new CoolException("库区不存在!!"); } String join = StringUtils.join(param.getTypeIds(), ","); List<Loc> list = new ArrayList<>(); for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { @@ -96,9 +99,9 @@ .setRow(r) .setCol(b) .setLev(l) .setType(join) .setAreaId(param.getAreaId()) .setWarehouseId(warehouseAreas.getWarehouseId()) .setType(param.getType()); .setWarehouseId(warehouseAreas.getWarehouseId()); list.add(loc); } } rsf-server/src/main/resources/application-dev.yml
@@ -12,10 +12,10 @@ matching-strategy: ANT_PATH_MATCHER datasource: driver-class-name: com.mysql.jdbc.Driver # url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai # username: root url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: rsf url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: root # url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai # username: rsf password: 34821015 type: com.alibaba.druid.pool.DruidDataSource druid: