Junjie
2024-06-12 8a8faba0f55512a2c18c4fe719a1bb0c4f6a86c9
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
@@ -453,12 +454,22 @@
        NavigateMapData mapData = new NavigateMapData(z);//获取地图数据
        int[][] data = mapData.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 +489,10 @@
                LocMast distLocMast = locMastService.queryByLoc(locNo);
                if (distLocMast == null) {
                    continue;
                }
                if (distLocMast.getLocSts().equals("X")) {
                    continue;//调过禁用库位
                }
                //判断该库位是否存在工作档
@@ -684,5 +699,13 @@
        }
        return null;
    }
    /**
     * 判断字符串是否为JSON格式
     */
    public static boolean isJson(String jsonString) {
        // JSON格式的正则表达式
        String pattern = "^\\{.*\\}$";
        // 使用Pattern类进行正则匹配
        return Pattern.matches(pattern, jsonString);
    }
}