| | |
| | | Task task = taskService.getById(segment.getTaskId()); |
| | | TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())); |
| | | // 目标是否为站点 |
| | | boolean isStation = posType == TaskPosDto.PosType.ORI_STA || posType == TaskPosDto.PosType.DEST_STA; |
| | | boolean isStation = posType == TaskPosDto.PosType.ORI_STA || posType == TaskPosDto.PosType.DEST_STA || posType == TaskPosDto.PosType.MOVE; |
| | | // 目标是否为库位 |
| | | boolean isLoc = posType == TaskPosDto.PosType.ORI_LOC || posType == TaskPosDto.PosType.DEST_LOC; |
| | | boolean isLoc = posType == TaskPosDto.PosType.ORI_LOC || posType == TaskPosDto.PosType.DEST_LOC || posType == TaskPosDto.PosType.MOVE ; |
| | | // 站点地码 |
| | | List<String> turnCodes = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054"); |
| | | // 库位地码 |
| | |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(180), // 动作参数 |
| | | String.valueOf(nextCode.getData().equals("00000051") ? 180 : 0 ), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | |
| | | lastDirection = nextDirection; |
| | | } |
| | | |
| | | // 如果当前地码和下一个地码都在站点地码集合内,则根据在集合中的顺序决定行进方向和是否倒退 |
| | | if (turnCodes.contains(lastCode.getData()) && turnCodes.contains(nextCode.getData())) { |
| | | int lastIndex = turnCodes.indexOf(lastCode.getData()); |
| | | int nextIndex = turnCodes.indexOf(nextCode.getData()); |
| | | if (nextIndex > lastIndex) { |
| | | nextDirection = 180D; |
| | | reverse = false; |
| | | } else if (nextIndex < lastIndex) { |
| | | nextDirection = 0D; |
| | | reverse = true; |
| | | } |
| | | } |
| | | |
| | | // run |
| | | ActionTypeType actionType = ActionTypeType.StraightAheadTurnable; |
| | | if (reverse) { |