自动化立体仓库 - WMS系统
lty
4 天以前 6d077ee150e66d50f56c61670f97d2baaa1b61a2
#许可证2.0
2个文件已修改
1个文件已添加
107 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/BasRgvMapController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/CrnRowInfo.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/BasRgvMapController.java
@@ -80,8 +80,8 @@
    @RequestMapping(value = "/basRgvMap/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
         for (Long id : ids){
    public R delete(@RequestParam(value="ids[]") Integer[] ids){
         for (Integer id : ids){
            basRgvMapService.deleteById(id);
        }
        return R.ok();
src/main/java/com/zy/asrs/entity/CrnRowInfo.java
New file
@@ -0,0 +1,38 @@
package com.zy.asrs.entity;
public class CrnRowInfo {
    private final int crnNo;
    private final int nearRow;
    private final int curRow;
    private final int rowCount;
    private final int times;
    public CrnRowInfo(int crnNo, int nearRow, int curRow, int rowCount, int times) {
        this.crnNo = crnNo;
        this.nearRow = nearRow;
        this.curRow = curRow;
        this.rowCount = rowCount;
        this.times = times;
    }
    public int getCrnNo() {
        return crnNo;
    }
    public int getNearRow() {
        return nearRow;
    }
    public int getCurRow() {
        return curRow;
    }
    public int getRowCount() {
        return rowCount;
    }
    public int getTimes() {
        return times;
    }
}
src/main/java/com/zy/common/service/CommonService.java
@@ -26,6 +26,7 @@
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
 * 货架核心功能
@@ -157,6 +158,39 @@
    }
    private Optional<CrnRowInfo> findAvailableCrnAndNearRow(RowLastno rowLastno, int curRow, int crnNumber, int times,
                                                            FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto,
                                                            RowLastnoType rowLastnoType) {
        int attempt = times;
        while (attempt < crnNumber * 2) {
            int[] params = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
            curRow = params[1];
            int crnNo = params[2];
            if (!basCrnpService.checkSiteError(crnNo, true)) {
                attempt++;
                continue;
            }
            int rowCount = params[0];
            int nearRow = params[3];
            // 只取数量判断,避免拉整 list
            int availableLocCount = locMastService.selectCount(new EntityWrapper<LocMast>()
                    .eq("row1", nearRow)
                    .eq("loc_sts", "O")
                    .eq("whs_type", rowLastnoType.getType().longValue()));
            int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>()
                    .eq("crn_no", crnNo).le("io_type", 100));
            if (availableLocCount - crnCountO <= 2) { // 可以提成常量,比如 MIN_SPARE_SLOTS = 2
                log.error("{}号堆垛机没有空库位!!! 尺寸规格: {}, 轮询次数:{}", crnNo, JSON.toJSONString(locTypeDto), attempt);
                attempt++;
                continue;
            }
            return Optional.of(new CrnRowInfo(crnNo, nearRow, curRow, rowCount, attempt));
        }
        return Optional.empty();
    }
    /**
     * 检索库位号
@@ -207,30 +241,17 @@
        }
        //此程序用于优化堆垛机异常时的运行时间
        for (int i = times; i < crnNumber * 2; i++) {
            int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
            curRow = locNecessaryParameters[1];
            crnNo = locNecessaryParameters[2];
            if (basCrnpService.checkSiteError(crnNo, true)) {
                rowCount = locNecessaryParameters[0];
                nearRow = locNecessaryParameters[3];
                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
                        .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()));
                int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100));
                if (locMasts.size() - crnCountO <= 2) {
                    log.error(crnNo + "号堆垛机没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times);
                    nearRow = 0;
                    times++;
                    continue;
                }
                break;
            } else {
                times++;
            }
        }
        if (nearRow == 0) {
        Optional<CrnRowInfo> infoOpt = findAvailableCrnAndNearRow(rowLastno, curRow, crnNumber, times, findLocNoAttributeVo, locTypeDto, rowLastnoType);
        if (!infoOpt.isPresent()) {
            throw new CoolException("无可用堆垛机");
        }
        CrnRowInfo info = infoOpt.get();
        crnNo = info.getCrnNo();
        nearRow = info.getNearRow();
        curRow = info.getCurRow();
        rowCount = info.getRowCount();
        times = info.getTimes();
        boolean signRule1 = false;
        boolean signRule2 = false;