skyouc
15 小时以前 3b92bdcd3683ef7ce55af6e5a443732e638b1cb9
库位初始化优化
2个文件已修改
40 ■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocController.java
@@ -1,8 +1,6 @@
package com.vincent.rsf.server.manager.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
@@ -19,7 +17,6 @@
import com.vincent.rsf.server.manager.service.LocService;
import com.vincent.rsf.server.system.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,7 +26,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.stream.Collectors;
@@ -212,9 +208,6 @@
        }
        if (Objects.isNull(param.getTypeIds()) && param.getTypeIds().isEmpty()) {
            return R.error("库位类型不能为空!!");
        }
        if (Objects.isNull(param.getWarehouseId())) {
            return R.error("仓库ID不能为空!!");
        }
        if (Objects.isNull(param.getAreaId())) {
            return R.error("库区ID不能为空!!");
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocServiceImpl.java
@@ -85,21 +85,25 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R initLocs(LocMastInitParam param, Long loginUserId) {
        //清空表
//        this.baseMapper.deleteAll();
        //清空当前库区库位
        List<Loc> locs = this.list(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId()));
        if (!locs.isEmpty()) {
            if (!this.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId()))) {
                throw new CoolException("初始化失败:数据删除失败!!");
            }
        }
        WarehouseAreas warehouseAreas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>()
                .eq(WarehouseAreas::getWarehouseId, param.getWarehouseId())
                .eq(WarehouseAreas::getId, param.getAreaId()));
                .eq(!Objects.isNull(param.getWarehouseId()), WarehouseAreas::getWarehouseId, param.getWarehouseId())
                .eq(!Objects.isNull(param.getAreaId()), WarehouseAreas::getId, param.getAreaId()));
        if (Objects.isNull(warehouseAreas)) {
            throw new CoolException("库区不存在!!");
        }
        // 清空表
        // this.baseMapper.deleteAll();
        // 清空当前库区库位
        List<Loc> locs = this.list(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, warehouseAreas.getWarehouseId())
                .eq(Loc::getAreaId, warehouseAreas.getId()));
        if (!locs.isEmpty()) {
            if (!this.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, warehouseAreas.getWarehouseId())
                    .eq(Loc::getAreaId, warehouseAreas.getId()))) {
                throw new CoolException("初始化失败:数据删除失败!!");
            }
        }
        String join = StringUtils.join(param.getTypeIds(), ",");
        String[] split = warehouseAreas.getCode().split("\\.");
@@ -115,7 +119,8 @@
        Integer chanl = 0; //默认第一巷道
        for (int r = param.getStartRow(); r <= param.getEndRow(); r++) {
            try{
                Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(), param.getStartRow());
                Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(),
                        param.getStartRow());
                for (List<Integer> node : shelves.nodes){
                    if (node.contains(r)) {
                        if (!Cools.isEmpty(param.getStartChannel()) && param.getStartChannel() > 0){
@@ -206,7 +211,8 @@
        if (Objects.isNull(locs.getLocAreaId())) {
            throw new CoolException("修改库位信息不能为空!!");
        }
        List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId()));
        List<LocArea> locAreas = locAreaService
                .list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId()));
        if (locAreas.isEmpty()) {
            throw new CoolException("库位分区不存在!!");
        }
@@ -226,6 +232,7 @@
    /**
     * 获取库位使用情况
     *
     * @return
     */
    @Override