自动化立体仓库 - WCS系统
#
taisheng
6 天以前 4453cdecbc6e7a925ae76e3223418654f1cf0b18
#
3个文件已修改
126 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/NavigateMapData.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -542,6 +542,15 @@
                return false;
            }
            //检测障碍物车
            boolean checkObstacle = shuttleOperaUtils.checkObstacle(wrkMast.getLocNo(), new ArrayList<Integer>() {{
                add(shuttleProtocol.getShuttleNo());
            }});
            if (checkObstacle) {
                News.info("{}任务,避障范围有小车,等待障碍小车调离中", wrkMast.getWrkNo());
                return false;
            }
            ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
            assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 四向穿梭车编号
            assignCommand.setTaskMode(ShuttleTaskModeType.TRANSPORT.id);//小车移库任务
@@ -567,8 +576,8 @@
                return false;
            }
            commands.add(0, liftCommand.get(0));
            commands.add(liftCommand2.get(0));
//            commands.add(0, liftCommand.get(0));
//            commands.add(liftCommand2.get(0));
            assignCommand.setCommands(commands);
            wrkMast.setWrkSts(WrkStsType.LOC_MOVE_SHUTTLE_RUN.sts);//小车搬运中  501.生成移库任务 ==> 502.小车搬运中
@@ -1766,15 +1775,6 @@
                News.taskInfo(wrkMast.getWrkNo(), "{}任务,{}小车,路径计算失败", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                return false;//路径计算失败
            }
//            //检测障碍物车
//            boolean checkObstacle = shuttleOperaUtils.checkObstacle(wrkMast.getLocNo(), new ArrayList<Integer>() {{
//                add(shuttleProtocol.getShuttleNo());
//            }});
//            if (checkObstacle) {
//                News.info("{}任务,避障范围有小车,等待障碍小车调离中", wrkMast.getWrkNo());
//                return false;
//            }
            assignCommand.setCommands(commands);
src/main/java/com/zy/common/utils/NavigateMapData.java
@@ -115,6 +115,23 @@
        return null;
    }
    public int[][] parseJsonDataArr(List<List<MapNode>> lists) {
        int[][] map = new int[lists.size()][];
        int j = 0;
        for (List<MapNode> list : lists) {
            int[] tmp = new int[list.size()];
            int i = 0;
            for (MapNode mapNode : list) {
                //将数据添加进二维数组
                tmp[i++] = mapNode.getValue();
            }
            //数据添加进一维数组
            map[j++] = tmp;
        }
        return map;
    }
    /**
     * 过滤地图数据
     * mapType -1=>无过滤,1=》过滤库位状态DFX,2=》过滤库位状态X
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -6,8 +6,8 @@
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.MapNode;
import com.zy.common.model.NavigateNode;
import com.zy.common.model.enums.NavigationMapType;
import com.zy.core.News;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.dispatcher.ShuttleDispatchUtils;
@@ -260,19 +260,28 @@
                continue;
            }
            int nextInt = new Random().nextInt(outerNodes.size());
            NavigateNode randomNode = outerNodes.get(nextInt);
            String randomLocNo = NavigatePositionConvert.nodeToLocNo(randomNode);
            shuttleDispatchUtils.dispatchShuttle(null, randomLocNo, shuttleNo);
            HashMap<String, Integer> carMap = findCarMap();
            String targetLocNo = null;
            for (NavigateNode node : outerNodes) {
                String dispatchLocNo = NavigatePositionConvert.nodeToLocNo(node);
                if (carMap.containsKey(dispatchLocNo)) {
                    continue;
                }
                targetLocNo = dispatchLocNo;
                break;
            }
            if(targetLocNo == null) {
                continue;
            }
            shuttleDispatchUtils.dispatchShuttle(null, targetLocNo, shuttleNo);
        }
        return true;//内圈中有车
    }
    //搜索节点内的小车编号
    private List<Integer> findNodesCar(List<NavigateNode> nodes) {
        List<Integer> list = new ArrayList<>();
    private HashMap<String, Integer> findCarMap() {
        HashMap<String, Integer> carMap = new HashMap<>();
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
@@ -290,7 +299,13 @@
            carMap.put(currentLocNo, slave.getId());
        }
        return carMap;
    }
    //搜索节点内的小车编号
    private List<Integer> findNodesCar(List<NavigateNode> nodes) {
        List<Integer> list = new ArrayList<>();
        HashMap<String, Integer> carMap = findCarMap();
        for (NavigateNode node : nodes) {
            String locNo = NavigatePositionConvert.nodeToLocNo(node);
            if (carMap.containsKey(locNo)) {
@@ -307,8 +322,10 @@
        int lev = Utils.getLev(locNo);
        int[] pointArr = NavigatePositionConvert.positionToXY(locNo);
        NavigateNode currentNode = new NavigateNode(pointArr[0], pointArr[1]);
        currentNode.setZ(lev);
        int[][] map = navigateMapData.getDataFromRedis(lev, NavigationMapType.NORMAL.id, null, whiteShuttlePointList);
        List<List<MapNode>> lists = navigateMapData.getJsonData(lev, -1, null, null);//获取完整地图
        int[][] map = navigateMapData.parseJsonDataArr(lists);
        int nodeValue = map[pointArr[0]][pointArr[1]];
        currentNode.setNodeValue(nodeValue);
@@ -348,7 +365,8 @@
        currentNode.setZ(lev);
        innerNodes.add(currentNode);
        int[][] map = navigateMapData.getDataFromRedis(lev, NavigationMapType.NORMAL.id, null, whiteShuttlePointList);
        List<List<MapNode>> lists = navigateMapData.getJsonData(lev, -1, null, null);//获取完整地图
        int[][] map = navigateMapData.parseJsonDataArr(lists);
        int nodeValue = map[pointArr[0]][pointArr[1]];
        currentNode.setNodeValue(nodeValue);
@@ -358,7 +376,20 @@
            if (list.isEmpty()) {
                continue;
            }
            innerNodes.addAll(list);
            for (NavigateNode node : list) {
                boolean flag = false;
                for (int[] shuttlePoint : whiteShuttlePointList) {
                    if(node.getX() == shuttlePoint[0] && node.getY() == shuttlePoint[1]) {
                        flag = true;
                        break;
                    }
                }
                if(flag) {
                    continue;
                }
                innerNodes.add(node);
            }
        }
        return innerNodes;
@@ -389,13 +420,17 @@
                    NavigateNode node = new NavigateNode(x + innerCircleIdx, y);
                    node.setNodeValue(map[x + innerCircleIdx][y]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
                if (is_valid(map, x - innerCircleIdx, y)) {
                    NavigateNode node = new NavigateNode(x - innerCircleIdx, y);
                    node.setNodeValue(map[x - innerCircleIdx][y]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
            }
@@ -405,14 +440,18 @@
                    NavigateNode node = new NavigateNode(x, y + innerCircleIdx);
                    node.setNodeValue(map[x][y + innerCircleIdx]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
                if (is_valid(map, x, y - innerCircleIdx)) {
                    NavigateNode node = new NavigateNode(x, y - innerCircleIdx);
                    node.setNodeValue(map[x][y - innerCircleIdx]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
            }
        }else if (mapDirection.equals("y")) {//母轨y方向
@@ -422,14 +461,18 @@
                    NavigateNode node = new NavigateNode(x, y + innerCircleIdx);
                    node.setNodeValue(map[x][y + innerCircleIdx]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
                if (is_valid(map, x, y - innerCircleIdx)) {
                    NavigateNode node = new NavigateNode(x, y - innerCircleIdx);
                    node.setNodeValue(map[x][y - innerCircleIdx]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
            }
@@ -439,13 +482,17 @@
                    NavigateNode node = new NavigateNode(x + innerCircleIdx, y);
                    node.setNodeValue(map[x + innerCircleIdx][y]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
                if (is_valid(map, x - innerCircleIdx, y)) {
                    NavigateNode node = new NavigateNode(x - innerCircleIdx, y);
                    node.setNodeValue(map[x - innerCircleIdx][y]);
                    node.setZ(z);
                    nodes.add(node);
                    if (node.getNodeValue().equals(startNode.getNodeValue())) {
                        nodes.add(node);
                    }
                }
            }
        }else {