| | |
| | | |
| | | // 需要走行 |
| | | if (!lastCode.getData().equals(code.getData())) { |
| | | |
| | | // 走行路径节点 |
| | | // List<String> pathList = mapService.checkoutPath(agv.getUuid(), lastCode, code); |
| | | List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1); |
| | |
| | | // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true |
| | | boolean reverse = false; |
| | | if (nextDirection.equals((workDirection + 180) % 360)) { |
| | | List<String> list = Arrays.asList("00000051", "00000052", "00000053", "00000054"); |
| | | List<String> list = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054"); |
| | | if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA) |
| | | || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) { |
| | | reverse = false; |
| | | lastDirection = nextDirection; |
| | | } else { |
| | | nextDirection = workDirection; |
| | | reverse = true; |
| | |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) { |
| | | // turn |
| | | reverse = false; |
| | | |
| | | actionList.add(new Action( |
| | | null, // 编号s |
| | | task.getBusId(), // 总线 |
| | |
| | | now // 工作时间 |
| | | )); |
| | | } |
| | | |
| | | lastDirection = nextDirection; |
| | | } |
| | | } else { |
| | |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) { |
| | | // turn |
| | | reverse = false; |
| | | |
| | | actionList.add(new Action( |
| | | null, // 编号s |
| | | task.getBusId(), // 总线 |
| | |
| | | } |
| | | |
| | | // 第一个动作一定是 turn |
| | | if (actionList.isEmpty()) { |
| | | if (actionList.isEmpty() && lastCode.getCornerBool()) { |
| | | // turn |
| | | actionList.add(new Action( |
| | | null, // 编号 |
| | |
| | | lastCode = nextCode; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | // 初始方向值补丁 |
| | | if (first) { |
| | | if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) { |
| | | // turn |
| | | actionList.add(new Action( |
| | | null, // 编号 |
| | | task.getBusId(), // 总线 |
| | | task.getId(), // 任务 |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(workDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | |
| | | lastDirection = workDirection; |
| | | |
| | | Double turnDirection = workDirection; |
| | | List<String> list = Arrays.asList("00000051", "00000052", "00000053", "00000054"); |
| | | if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA) |
| | | || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) { |
| | | turnDirection = workDirection + 180.0; |
| | | } |
| | | if (lastCode.getCornerBool()) { |
| | | // turn |
| | | actionList.add(new Action( |
| | | null, // 编号 |
| | | task.getBusId(), // 总线 |
| | | task.getId(), // 任务 |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(turnDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = workDirection; |
| | | } |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | // 检验方向 |
| | | FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString()); |
| | | Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle()); |
| | | if (!lastDirection.equals(chargeDirection)&&lastCode.getCornerBool()) { |
| | | if (!lastDirection.equals(chargeDirection) && lastCode.getCornerBool()) { |
| | | actionList.add(new Action( |
| | | null, // 编号 |
| | | null, // 总线 |
| | |
| | | nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal); |
| | | |
| | | // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true |
| | | if (!nextDirection.equals((workDirection+180) % 360)) { |
| | | if (!nextDirection.equals((workDirection + 180) % 360)) { |
| | | nextDirection = workDirection; |
| | | reverse = true; |
| | | } |