自动化立体仓库 - WMS系统
cl
22 小时以前 f36b01fcf99f5ef0a1500d155c309ccbc7a20250
src/main/java/com/zy/asrs/utils/Utils.java
@@ -45,10 +45,10 @@
        return (float) Arith.multiplys(2, f, 1);
    }
    public static int armStaNo(int armNo,int staNo) {
        switch (armNo){
    public static int armStaNo(int armNo, int staNo) {
        switch (armNo) {
            case 1:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 7;
                    case 1:
@@ -61,7 +61,7 @@
                        return 0;
                }
            case 2:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 5;
                    case 1:
@@ -74,7 +74,7 @@
                        return 0;
                }
            case 3:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 3;
                    case 1:
@@ -87,7 +87,7 @@
                        return 0;
                }
            case 4:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 1;
                    case 1:
@@ -100,7 +100,7 @@
                        return 0;
                }
            case 5:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 11;
                    case 1:
@@ -113,7 +113,7 @@
                        return 0;
                }
            case 6:
                switch (staNo){
                switch (staNo) {
                    case 0:
                        return 13;
                    case 1:
@@ -159,8 +159,8 @@
     * {@code {crnNo: 堆垛机号, locType1: 库位高低类型}}
     *
     * @param stationId 入库站点
     * @param locType1 目标库位高低类型,1=低库位,2=高库位
     * @param matnr 物料编码,传入 {@code emptyPallet} 时使用空板排序规则
     * @param locType1  目标库位高低类型,1=低库位,2=高库位
     * @param matnr     物料编码,传入 {@code emptyPallet} 时使用空板排序规则
     * @return 按优先级排好序的堆垛机列表
     */
    public static List<Map<String, Integer>> getStationStorageAreaName(Integer stationId, Integer locType1, String matnr) {
@@ -188,6 +188,7 @@
        return result;
    }
    private static void appendCrnLocTypeEntries(List<Map<String, Integer>> result, List<Integer> crnNos, Integer locType1, boolean emptyPallet, LocMastService locMastService) {
        Short normalizedLocType1 = normalizeLocType1(locType1);
        if (normalizedLocType1 == null) {
@@ -233,7 +234,7 @@
    }
    private static List<Integer> getAvailableCrnNos(List<Integer> candidateCrnNos, Integer locType1, boolean emptyPallet,
                                                     BasCrnpService basCrnpService, LocMastService locMastService) {
                                                    BasCrnpService basCrnpService, LocMastService locMastService) {
        LinkedHashSet<Integer> availableCrnNos = new LinkedHashSet<>();
        if (Cools.isEmpty(candidateCrnNos)) {
            return new ArrayList<>();
@@ -296,6 +297,8 @@
    private static Short normalizeLocType1(Integer locType1) {
        if (locType1 == null || (locType1 != 1 && locType1 != 2)) {
            return null;
        } else {
            locType1 = 2;
        }
        return locType1.shortValue();
    }
@@ -542,6 +545,7 @@
            return null;
        }
    }
    private static Integer parseStorageArea(String area) {
        if (Cools.isEmpty(area)) {
            return null;
@@ -567,6 +571,7 @@
        }
        return null;
    }
    public static String zerofill(String msg, Integer count) {
        if (msg.length() == count) {
            return msg;
@@ -681,8 +686,8 @@
     */
    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
        int row = getRow(shallowLoc);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row-1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, row+1);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, row - 1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, row + 1);
        int targetRow;
        if (deepLocLeft) {
            targetRow = row - 1;
@@ -711,8 +716,8 @@
     * 获取 浅库位排对应的深库位排
     */
    public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, shallowRow-1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, shallowRow+1);
        boolean deepLocLeft = isDeepLocLeft(slaveProperties, shallowRow - 1);
        boolean deepLocRight = isDeepLocRight(slaveProperties, shallowRow + 1);
        int targetRow;
        if (deepLocLeft) {
            targetRow = shallowRow - 1;
@@ -870,13 +875,13 @@
            if (curRow < sRow || curRow > (crnNumber * 4 + sRow - 1)) {
                throw new CoolException("库位排号异常:排号:" + curRow);
            }
            if ((curRow - (sRow-1)) % 4 == 0) {
            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) {
            } else if ((curRow - (sRow - 1) - 1) % 4 == 0) {
                necessaryParameters[1] = curRow;    //curRow   最深库位排
                necessaryParameters[2] = (curRow - (sRow-1)-1) / 4 + sCrnNo;     //crnNo     堆垛机号
                necessaryParameters[2] = (curRow - (sRow - 1) - 1) / 4 + sCrnNo;     //crnNo     堆垛机号
                necessaryParameters[3] = curRow + 1;    //nearRow  最浅库位排
            } else {
                throw new CoolException("库位排号异常:排号:" + curRow);
@@ -1044,6 +1049,7 @@
        return necessaryParameters;
    }
    //四向库(牛眼\光泰)
    public static int[] LocNecessaryParametersDoubleExtension6(RowLastno rowLastno, Integer curRow, Integer crnNumber) {
        int[] necessaryParameters = new int[]{0, 0, 0, 0};
@@ -1053,7 +1059,7 @@
        necessaryParameters[0] = crnNumber; // 轮询次数
        curRow = curRow - offset;
        //满板正常入库
        switch (curRow){
        switch (curRow) {
            case 1:
                necessaryParameters[1] = 4;    //curRow   最深库位排
                necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
@@ -1099,7 +1105,7 @@
        Integer sCrnNo = rowLastno.getsCrnNo();//起始堆垛机号
        necessaryParameters[0] = crnNumber; // 轮询次数
        //满板正常入库
        if (curRow.equals(rowLastno.geteRow())){
        if (curRow.equals(rowLastno.geteRow())) {
            necessaryParameters[1] = sRow;    //curRow   最深库位排
            necessaryParameters[2] = sCrnNo;     //crnNo     堆垛机号
            necessaryParameters[3] = sRow;    //nearRow  最浅库位排
@@ -1174,22 +1180,23 @@
    // 外侧方向的货位  优先入库方向 ===>> 反之
    public static List<String> getGroupOutLocCrn(Integer curRow, Integer nearRow, String locNo, boolean pakin) {
        List<String> result = new ArrayList<>();
        if (pakin){
            for (int row = curRow;row>=nearRow;row--){
        if (pakin) {
            for (int row = curRow; row >= nearRow; row--) {
                result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
            }
        }else {
            for (int row = curRow;row<=nearRow;row++){
        } else {
            for (int row = curRow; row <= nearRow; row++) {
                result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
            }
        }
        return result;
    }
    //erp庫位轉換
    public static String ERPLocToWMSLoc(String locNo) {
        String WmsLoc = locNo.substring(1);
        String[] split = locNo.split("-");
        WmsLoc = split[0].substring(1)+split[1]+split[2];
        WmsLoc = split[0].substring(1) + split[1] + split[2];
        return WmsLoc;
    }
@@ -1201,7 +1208,7 @@
        for (char c : row.toCharArray()) {
            if (c == '0') {
                i++;
            }else {
            } else {
                break;
            }
        }
@@ -1211,7 +1218,7 @@
        for (char c : boy.toCharArray()) {
            if (c == '0') {
                j++;
            }else {
            } else {
                break;
            }
        }
@@ -1221,14 +1228,14 @@
        for (char c : lev.toCharArray()) {
            if (c == '0') {
                k++;
            }else {
            } else {
                break;
            }
        }
        lev = lev.substring(k);
        return row + "-" + boy + "-" + lev;
    }
}