自动化立体仓库 - WCS系统
Junjie
2023-05-10 baed29d667be08051c36c31997117a1ba292d5bc
src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -1,7 +1,7 @@
package com.zy.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.MapNode;
import com.zy.common.model.NavigateNode;
import com.zy.core.enums.ShuttleTaskModeType;
@@ -163,11 +163,20 @@
    //获取从x点到下一点的行走距离
    public static Integer getXToNextDistance(NavigateNode xNode) {
        NavigateMapData mapData = new NavigateMapData();
        ArrayList<ArrayList<JSONObject>> lists = mapData.getJsonData(1);
        List<List<MapNode>> lists = mapData.getJsonData(1);
        if (lists != null) {
            JSONObject jsonObject = lists.get(xNode.getX()).get(xNode.getY());
            if (jsonObject != null) {
                return Integer.parseInt(jsonObject.getOrDefault(xNode.getDirection(), 0).toString());
            MapNode mapNode = lists.get(xNode.getX()).get(xNode.getY());
            if (mapNode != null) {
                switch (xNode.getDirection()) {
                    case "top":
                        return mapNode.getTop();
                    case "bottom":
                        return mapNode.getBottom();
                    case "left":
                        return mapNode.getLeft();
                    case "right":
                        return mapNode.getRight();
                }
            }
            return 0;
        }