自动化立体仓库 - WMS系统
#
zzgtfwq
昨天 8ea4c0fa09a08ec40e5f453bcde0fc7397b15b0d
src/main/java/com/zy/asrs/utils/Utils.java
@@ -35,6 +35,91 @@
        return (float) Arith.multiplys(2, f, 1);
    }
    public static int armStaNo(int armNo,int staNo) {
        switch (armNo){
            case 1:
                switch (staNo){
                    case 0:
                        return 7;
                    case 1:
                        return 8;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            case 2:
                switch (staNo){
                    case 0:
                        return 5;
                    case 1:
                        return 6;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            case 3:
                switch (staNo){
                    case 0:
                        return 3;
                    case 1:
                        return 4;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            case 4:
                switch (staNo){
                    case 0:
                        return 1;
                    case 1:
                        return 2;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            case 5:
                switch (staNo){
                    case 0:
                        return 11;
                    case 1:
                        return 12;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            case 6:
                switch (staNo){
                    case 0:
                        return 13;
                    case 1:
                        return 14;
                    case 2:
                        return 101;
                    case 3:
                        return 102;
                    default:
                        return 0;
                }
            default:
                return 0;
        }
    }
    public static String zerofill(String msg, Integer count) {
        if (msg.length() == count) {
            return msg;
@@ -123,9 +208,17 @@
     */
    public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
        int row = getRow(deepLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
        return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row);
        boolean deepLocRight = isDeepLocRight(slaveProperties, row);
        int targetRow;
        if (deepLocLeft) {
            targetRow = row + 1;
        } else if (deepLocRight) {
            targetRow = row - 1;
        } else {
            throw new RuntimeException(deepLoc + "不是浅库位,系统繁忙");
        }
        return zerofill(String.valueOf(targetRow), 2) + deepLoc.substring(2);
    }
    /**
@@ -141,30 +234,45 @@
     */
    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
        int row = getRow(shallowLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row-1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, row+1);
        int targetRow;
        if (remainder == 2) {
        if (deepLocLeft) {
            targetRow = row - 1;
        } else if (remainder == 3) {
        } else if (deepLocRight) {
            targetRow = row + 1;
        } else {
            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
        }
        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
    }
//    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
//        int row = getRow(shallowLoc);
//        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
//        int targetRow;
//        if (remainder == 2) {
//            targetRow = row - 1;
//        } else if (remainder == 3) {
//            targetRow = row + 1;
//        } else {
//            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
//        }
//        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
//    }
    /**
     * 获取 浅库位排对应的深库位排
     */
    public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, shallowRow-1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, shallowRow+1);
        int targetRow;
        if (remainder == 2) {
        if (deepLocLeft) {
            targetRow = shallowRow - 1;
        } else if (remainder == 3) {
        } else if (deepLocRight) {
            targetRow = shallowRow + 1;
        } else {
            throw new RuntimeException(shallowRow + "不是浅库位排,系统繁忙");
            throw new RuntimeException(shallowRow + "不是浅库位,系统繁忙");
        }
        return targetRow;
    }
@@ -249,6 +357,13 @@
        return false;
    }
    public static boolean BooleanWhsTypeSta(Integer whsType) {
        if (whsType == 1 || whsType == 2 || whsType == 5 || whsType==3 || whsType==4 || whsType == 9) {
            return true;
        }
        return false;
    }
    public static boolean BooleanWhsTypeSta(RowLastno rowLastno, Integer staDescId) {//站点路径更新
        if (rowLastno.getPointSwitch().equals("Y") && staDescId != 11 && staDescId != 111) {
            return true;
@@ -276,7 +391,8 @@
    public static int[] LocNecessaryParameters(RowLastno rowLastno, Integer curRow, Integer crnNumber) {
        switch (rowLastno.getTypeId()) {
            case 1://经典双伸库位
                return LocNecessaryParametersDoubleExtension(rowLastno, curRow, crnNumber); //已完善
                return LocNecessaryParametersDoubleExtension9(rowLastno, curRow, crnNumber); //已完善
//                return LocNecessaryParametersDoubleExtension(rowLastno, curRow, crnNumber); //已完善
            case 2://经典单伸库位(2排货架)
                return LocNecessaryParametersDoubleExtension2(rowLastno, curRow, crnNumber); //已完善
            case 3://经典单双伸库位  左单右双(小单大双)
@@ -289,9 +405,59 @@
                return LocNecessaryParametersDoubleExtension6(rowLastno, curRow, crnNumber); //已完善
            case 7://平库  CTU库
                return LocNecessaryParametersDoubleExtension7(rowLastno, curRow, crnNumber); //已完善
            case 9://前双伸 后左单右双(小单大双)  港投定制
                return LocNecessaryParametersDoubleExtension9(rowLastno, curRow, crnNumber); //已完善
            default:
                return LocNecessaryParametersMove(rowLastno, curRow, crnNumber);//moveCrnNo
        }
    }
    public static int[] LocNecessaryParametersDoubleExtension9(RowLastno rowLastno, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
        Integer sRow = rowLastno.getsRow();
        Integer sCrnNo = rowLastno.getsCrnNo();
        necessaryParameters[0] = crnNumber; // 轮询次数
        //满板正常入库
        if (curRow.equals(14)) {
            necessaryParameters[1] = 1;    //curRow   最深库位排
            necessaryParameters[2] = 1;     //crnNo     堆垛机号
            necessaryParameters[3] = 2;    //nearRow  最浅库位排
        } else if (curRow.equals(11)) {
            necessaryParameters[1] = 4;    //curRow   最深库位排
            necessaryParameters[2] = 1;     //crnNo     堆垛机号
            necessaryParameters[3] = 3;    //nearRow  最浅库位排
        } else if (curRow.equals(10)) {
            necessaryParameters[1] = 14;    //curRow   最深库位排
            necessaryParameters[2] = 4;     //crnNo     堆垛机号
            necessaryParameters[3] = 13;    //nearRow  最浅库位排
        } else if (curRow.equals(9)) {
            necessaryParameters[1] = 11;    //curRow   最深库位排
            necessaryParameters[2] = 4;     //crnNo     堆垛机号
            necessaryParameters[3] = 12;    //nearRow  最浅库位排
        } else if (curRow.equals(8)) {
            necessaryParameters[1] = 10;    //curRow   最深库位排
            necessaryParameters[2] = 3;     //crnNo     堆垛机号
            necessaryParameters[3] = 10;    //nearRow  最浅库位排
        } else if (curRow.equals(5)) {
            necessaryParameters[1] = 9;    //curRow   最深库位排
            necessaryParameters[2] = 3;     //crnNo     堆垛机号
            necessaryParameters[3] = 9;    //nearRow  最浅库位排
        } else if (curRow.equals(4)) {
            necessaryParameters[1] = 8;    //curRow   最深库位排
            necessaryParameters[2] = 2;     //crnNo     堆垛机号
            necessaryParameters[3] = 7;    //nearRow  最浅库位排
        } else if (curRow.equals(1)) {
            necessaryParameters[1] = 5;    //curRow   最深库位排
            necessaryParameters[2] = 2;     //crnNo     堆垛机号
            necessaryParameters[3] = 6;    //nearRow  最浅库位排
        } else {
            necessaryParameters[1] = 1;    //curRow   最深库位排
            necessaryParameters[2] = 1;     //crnNo     堆垛机号
            necessaryParameters[3] = 2;    //nearRow  最浅库位排
        }
        return necessaryParameters;
    }
    //经典双伸库位
@@ -315,14 +481,14 @@
            if (curRow < sRow || curRow > (crnNumber * 4 + sRow - 1)) {
                throw new CoolException("库位排号异常:排号:" + curRow);
            }
            if ((curRow - sRow) % 4 == 0) {
            if ((curRow - (sRow-1)) % 4 == 0) {
                necessaryParameters[1] = curRow;    //curRow   最深库位排
                necessaryParameters[2] = (curRow - sRow + 2) / 4 + sCrnNo - 1;     //crnNo     堆垛机号
                necessaryParameters[3] = curRow + 1;    //nearRow  最浅库位排
            } else if ((curRow - sRow + 1) % 4 == 0) {
                necessaryParameters[1] = curRow;    //curRow   最深库位排
                necessaryParameters[2] = (curRow - sRow + 1) / 4 + sCrnNo - 1;     //crnNo     堆垛机号
                necessaryParameters[2] = (curRow - (sRow-1)) / 4 + sCrnNo - 1;     //crnNo     堆垛机号
                necessaryParameters[3] = curRow - 1;    //nearRow  最浅库位排
            } else if ((curRow - (sRow-1)-1) % 4 == 0) {
                necessaryParameters[1] = curRow;    //curRow   最深库位排
                necessaryParameters[2] = (curRow - (sRow-1)-1) / 4 + sCrnNo;     //crnNo     堆垛机号
                necessaryParameters[3] = curRow + 1;    //nearRow  最浅库位排
            } else {
                throw new CoolException("库位排号异常:排号:" + curRow);
            }