Junjie
2024-11-28 c3a428f2ef9dec82c49e1c9d4f425d3950d79804
src/main/java/com/zy/asrs/utils/Utils.java
@@ -28,6 +28,7 @@
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Pattern;
/**
 * Created by vincent on 2020/8/27
@@ -441,6 +442,7 @@
        WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
        CommonService commonService = SpringUtils.getBean(CommonService.class);
        ShuttleDispatchUtils shuttleDispatchUtils = SpringUtils.getBean(ShuttleDispatchUtils.class);
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        if (shuttleThread == null) {
            return false;
@@ -450,15 +452,25 @@
            return false;
        }
        NavigateMapData mapData = new NavigateMapData(z);//获取地图数据
        int[][] data = mapData.getData(-1, null, currentShuttleId == null ? null : Utils.getShuttlePoints(0, z));//载入全部车辆
        navigateMapData.setLev(z);//获取地图数据
        int[][] data = navigateMapData.getData(-1, null, currentShuttleId == null ? null : Utils.getShuttlePoints(0, z));//载入全部车辆
        int moveBay = 23;//避让起始列
        int bay = Utils.getBay(shuttleProtocol.getCurrentLocNo());//小车当前列
        if (bay > 1 && bay <= 30) {
            moveBay = 23;
        } else if (bay > 30 && bay <= 45) {
            moveBay = 39;
        } else if (bay > 45) {
            moveBay = 50;
        }
        int distY = -1;
        int distX = -1;
        int distZ = -1;
        //获取避让库位
        String distLocNo = null;
        for (int y = 20; y <= 56; y++) {
        for (int y = moveBay; y <= 56; y++) {
            boolean searchFlag = true;
            for (int x = 10; x <= 11; x++) {
                if (data[x][y] < 0 || data[x][y] == 66) {
@@ -478,6 +490,10 @@
                LocMast distLocMast = locMastService.queryByLoc(locNo);
                if (distLocMast == null) {
                    continue;
                }
                if (distLocMast.getLocSts().equals("X")) {
                    continue;//调过禁用库位
                }
                //判断该库位是否存在工作档
@@ -684,5 +700,13 @@
        }
        return null;
    }
    /**
     * 判断字符串是否为JSON格式
     */
    public static boolean isJson(String jsonString) {
        // JSON格式的正则表达式
        String pattern = "^\\{.*\\}$";
        // 使用Pattern类进行正则匹配
        return Pattern.matches(pattern, jsonString);
    }
}