自动化立体仓库 - WCS系统
#
luxiaotao1123
2022-03-16 c03523f8a00512b7423fede798ae72988c3af4d6
src/main/java/com/zy/asrs/utils/Utils.java
@@ -2,6 +2,7 @@
import com.core.common.Arith;
import com.core.common.Cools;
import com.zy.core.enums.SteABType;
import com.zy.core.properties.SlaveProperties;
import java.text.DecimalFormat;
@@ -35,6 +36,103 @@
            return msgBuilder.toString();
        }
    }
    public static Integer getGroupRow(Integer row) {
        switch (row) {
            case 1:
            case 2:
            case 3:
                return 3;
            case 4:
            case 5:
            case 6:
            case 7:
                return 4;
            case 8:
            case 9:
            case 10:
            case 11:
                return 11;
            case 12:
            case 13:
            case 14:
                return 12;
            case 15:
            case 16:
            case 17:
            case 18:
                return 18;
            case 19:
            case 20:
            case 21:
                return 19;
            default:
                throw new RuntimeException("库位解析异常");
        }
    }
    public static Integer getGroupRow(String locNo){
        int row = getRow(locNo);
        return getGroupRow(row);
    }
    public static SteABType selectAB(Integer row) {
        switch (row) {
            case 1:
            case 2:
            case 3:
                return SteABType.B;
            case 4:
            case 5:
            case 6:
            case 7:
                return SteABType.A;
            case 8:
            case 9:
            case 10:
            case 11:
                return SteABType.B;
            case 12:
            case 13:
            case 14:
                return SteABType.A;
            case 15:
            case 16:
            case 17:
            case 18:
                return SteABType.B;
            case 19:
            case 20:
            case 21:
                return SteABType.A;
            default:
                throw new RuntimeException("库位解析异常");
        }
    }
    // -------------------------------------------------------------------------------------------------------------------
    /**
     * 判断是否为深库位
@@ -144,6 +242,34 @@
    }
    /**
     * 通过库位号获取 列
     */
    public static int getBay(String locNo) {
        if (!Cools.isEmpty(locNo)) {
            return Integer.parseInt(locNo.substring(2, 5));
        }
        throw new RuntimeException("库位解析异常");
    }
    /**
     * 通过库位号获取 层
     */
    public static int getLev(String locNo) {
        if (!Cools.isEmpty(locNo)) {
            return Integer.parseInt(locNo.substring(5, 7));
        }
        throw new RuntimeException("库位解析异常");
    }
    /**
     * 通过排列层拼接出库位号
     */
    public static String append(int row, int bay, int lev) {
        return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2);
    }
    /**
     * 当检索到双深库位的浅库位时,如果深库位无货,则放入对应的深库位
     */
    public static void toDeepIfEmptyByShallow(String shallowLoc) {