| | |
| | | |
| | | // 巷道逻辑 |
| | | if (!laneBuilder.isInitialized()) { |
| | | throw new BusinessException("lanes are not initialized"); |
| | | throw new CoolException("lanes are not initialized"); |
| | | } |
| | | LaneDto lastLaneDto = laneBuilder.search(lastCode.getData()); |
| | | LaneDto nextLaneDto = laneBuilder.search(nextCode.getData()); |
| | |
| | | || !Objects.equals(lastLaneDto.getHashCode(), nextLaneDto.getHashCode()) |
| | | ); |
| | | |
| | | boolean reverse = false; |
| | | |
| | | // 巷道强制转弯,优先级 > workDirection |
| | | if (firstEnteringLane) { |
| | | // final double oppLaneDir = (laneDir + 180) % 360; |
| | | if (!lastDirection.equals(laneDir)) { |
| | | if (!lastCode.getCornerBool()) { |
| | | throw new CoolException(agvNo + "号小车进入巷道需调整方向为 " + laneDir + "°,请推至转弯点手动调整"); |
| | | } |
| | | // turn |
| | | actionList.add(new Action( |
| | | null, // 编号s |
| | | task.getBusId(), // 总线 |
| | | task.getId(), // 任务 |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(laneDir), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = laneDir; |
| | | } |
| | | } else { |
| | | |
| | | // 如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true |
| | | boolean reverse = false; |
| | | if (nextDirection.equals(oppWorkDir)) { |
| | | nextDirection = workDirection; |
| | | reverse = true; |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 第一个动作一定是 turn |
| | | if (actionList.isEmpty()) { |