#
luxiaotao1123
2024-11-04 f9f3b4c4cd6b174f776b15360b0d063a9d0b829b
#
1个文件已修改
99 ■■■■ 已修改文件
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
@@ -1,8 +1,8 @@
package com.zy.acs.manager.core.service;
import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.common.utils.Utils;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.manager.common.utils.MapDataUtils;
import com.zy.acs.manager.core.constant.MapDataConstant;
import com.zy.acs.manager.core.domain.Lane;
@@ -166,8 +166,9 @@
            openQueue.add(start);
            existNodes.add(start);
            RetreatNavigateNode firstPointOfTurn = null;
            List<String> firstPointWaveScopeOfTurn = new ArrayList<>();
            RetreatNavigateNode availablePointOfTurn = null;
            List<String> availablePointWaveScopeOfTurn = new ArrayList<>();
            int actuallyLanesOfTurn = 0;
            while (openQueue.size() > 0 && null == finialNode) {
@@ -175,35 +176,14 @@
                List<RetreatNavigateNode> enableNodes = new ArrayList<>();
                ArrayList<RetreatNavigateNode> neighborNodes = this.getNeighborNodes(currentNode, existNodes);
                int forks = neighborNodes.size();
                if (firstPointOfTurn == null && forks >= 2 && !isSame(start, currentNode)) {
                    firstPointOfTurn = currentNode;
                    firstPointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, firstPointOfTurn.getCodeData(), avoidDistance)
                            .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList());
                boolean pointOfTurn = false;
                if (neighborNodes.size() >= 2 && !isSame(start, currentNode)) {
                    pointOfTurn = true;
                }
                label: for (RetreatNavigateNode node : neighborNodes) {
                    int weight = 0;
                    // wave
                    String waveNode = waveMatrix[node.getX()][node.getY()];
                    assert !waveNode.equals(WaveNodeType.DISABLE.val);
                    if (!waveNode.equals(WaveNodeType.ENABLE.val)) {
                        List<String> waveNodeList = MapDataUtils.parseWaveNode(waveNode);
                        List<String> otherWaveList = MapDataUtils.hasOtherWave(waveNodeList, agvNo);
                        for (String otherWave : otherWaveList) {
                            if (!Cools.isEmpty(blackList) && blackList.contains(otherWave)) {
                                continue;
                            }
                            if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) {
                                continue label;
                            } else {
                                weight += WEIGHT_CALC_COEFFICIENT;
                            }
                        }
                    }
                // 计算是否为可用转弯点
                if (pointOfTurn) {
                    for (RetreatNavigateNode node : neighborNodes) {
                    // lane
                    Lane lane = laneService.search(node.getCodeData());
                    if (null != lane) {
@@ -229,9 +209,46 @@
                        }
                    }
                    // have cross turn road
                    if (null != firstPointOfTurn) {
                        if (!firstPointWaveScopeOfTurn.contains(node.getCodeData())) {
                        actuallyLanesOfTurn ++;
                    }
                    if (actuallyLanesOfTurn >= 2) {
                        availablePointOfTurn = currentNode;
                        availablePointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, availablePointOfTurn.getCodeData(), avoidDistance)
                                .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList());
                    }
                }
                label: for (RetreatNavigateNode node : neighborNodes) {
                    int weight = 0;
                    // wave
                    String waveNode = waveMatrix[node.getX()][node.getY()];
                    assert !waveNode.equals(WaveNodeType.DISABLE.val);
                    if (!waveNode.equals(WaveNodeType.ENABLE.val)) {
                        List<String> waveNodeList = MapDataUtils.parseWaveNode(waveNode);
                        List<String> otherWaveList = MapDataUtils.hasOtherWave(waveNodeList, agvNo);
                        for (String otherWave : otherWaveList) {
                            if (!Cools.isEmpty(blackList) && blackList.contains(otherWave)) {
                                continue;
                            }
                            if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) {
                                if (null != availablePointOfTurn && actuallyLanesOfTurn > 0) {
                                    actuallyLanesOfTurn --;
                                }
                                continue label;
                            } else {
                                weight += WEIGHT_CALC_COEFFICIENT;
                            }
                        }
                    }
                    if (null != availablePointOfTurn) {
                        if (!availablePointWaveScopeOfTurn.contains(node.getCodeData())) {
                            enableNodes.add(node);
                        }
                    }
@@ -243,10 +260,14 @@
                    existNodes.add(node);
                }
                if (!Cools.isEmpty(enableNodes)) {
                    if (actuallyLanesOfTurn >= 2) {
                    Collections.sort(enableNodes);
                    finialNode = enableNodes.stream().findFirst().orElse(null);
                    jam.setCycleAvo(1);
                    }
                }
            }
@@ -254,18 +275,6 @@
        }
        return finialNode;
    }
    private int calcNodeWeightVal(List<String> otherWaveList) {
        int weightVal = 0;
        if (!Cools.isEmpty(otherWaveList)) {
        }
        return weightVal;
    }
    // 获取四周节点