自动化立体仓库 - WCS系统
Junjie
2023-04-14 3a1b33b1ab558591cf9c8acc5aa6585d6ccd6473
src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -1,6 +1,7 @@
package com.zy.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
import com.zy.core.enums.ShuttleTaskModeType;
@@ -15,6 +16,9 @@
        //通过开始编号和结束编号获取对应的xy轴坐标
        int[] startArr = NavigatePositionConvert.positionToXY(startPoint);//开始节点
        int[] endArr = NavigatePositionConvert.positionToXY(endPoint);//结束节点
        //获取当前节点计算的层高,并赋值到每一个节点中
        int lev = Utils.getLev(startPoint);
        //初始化开始节点
        NavigateNode start = new NavigateNode(startArr[0], startArr[1]);
@@ -35,6 +39,7 @@
            while (res_node != null) {
                res_node.setDirection(null);
                res_node.setIsInflectionPoint(false);
                res_node.setZ(lev);//设置层高
                //寻找拐点
                HashMap<String, Object> result = searchInflectionPoint(res_node, fatherNode, res_node.getFather());//分别传入当前节点、父节点、下一节点
@@ -129,7 +134,9 @@
        ArrayList<ArrayList<NavigateNode>> list = new ArrayList<>();
        ArrayList<NavigateNode> data = new ArrayList<>();
        String direction = mapList.get(0).getDirection();//行走方向
        for (NavigateNode mapNode : mapList) {
        for (int i = 0; i < mapList.size(); i++) {
            NavigateNode mapNode = mapList.get(i);
            boolean isInflectionPoint = mapNode.getIsInflectionPoint();
            data.add(mapNode);
            if (isInflectionPoint) {
@@ -138,6 +145,7 @@
                list.add(data);//添加某一段数据
                direction = mapNode.getDirection();//更新行走方向
                data = new ArrayList<>();
                data.add(mapNode);//将拐点的终点,更新成下一段命令的起点坐标
            }else {
                //直行线路
                mapNode.setDirection(direction);//设置行走方向
@@ -169,7 +177,7 @@
    /**
     * 获取当前路径总行走距离
     */
    public static Integer getCurrentPathAllDistance(ArrayList<NavigateNode> path) {
    public static Integer getCurrentPathAllDistance(List<NavigateNode> path) {
        if (path.size() == 1) {
            //路径只有一条数据,则直接返回行走距离
            return path.get(0).getMoveDistance();