| | |
| | | |
| | | @Override |
| | | public StationCommand getCommand(StationCommandType commandType, Integer taskNo, Integer stationId, Integer targetStationId, Integer palletSize) { |
| | | return getCommand(commandType, taskNo, stationId, targetStationId, palletSize, null); |
| | | } |
| | | |
| | | @Override |
| | | public StationCommand getCommand(StationCommandType commandType, |
| | | Integer taskNo, |
| | | Integer stationId, |
| | | Integer targetStationId, |
| | | Integer palletSize, |
| | | Double pathLenFactor) { |
| | | StationCommand stationCommand = new StationCommand(); |
| | | stationCommand.setTaskNo(taskNo); |
| | | stationCommand.setStationId(stationId); |
| | |
| | | |
| | | if (commandType == StationCommandType.MOVE) { |
| | | if (!stationId.equals(targetStationId)) { |
| | | List<Integer> path = calcPathStationIds(stationId, targetStationId); |
| | | List<Integer> path = calcPathStationIds(taskNo, stationId, targetStationId, pathLenFactor); |
| | | if (path == null || path.isEmpty()) { |
| | | log.warn("输送线命令生成失败,路径为空,taskNo={}, stationId={}, targetStationId={}", |
| | | taskNo, stationId, targetStationId); |
| | |
| | | return zyStationConnectDriver.readOriginCommand(address, length); |
| | | } |
| | | |
| | | private List<Integer> calcPathStationIds(Integer startStationId, Integer targetStationId) { |
| | | private List<Integer> calcPathStationIds(Integer taskNo, |
| | | Integer startStationId, |
| | | Integer targetStationId, |
| | | Double pathLenFactor) { |
| | | NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class); |
| | | if (navigateUtils == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<NavigateNode> nodes = navigateUtils.calcByStationId(startStationId, targetStationId); |
| | | List<NavigateNode> nodes = navigateUtils.calcByStationId(startStationId, targetStationId, taskNo, pathLenFactor); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (NavigateNode n : nodes) { |
| | | JSONObject v = JSONObject.parseObject(n.getNodeValue()); |