| | |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.manager.service.impl.LocStsServiceImpl; |
| | | import com.zy.acs.manager.manager.service.impl.WebsocketServiceImpl; |
| | | import com.zy.acs.manager.manager.utils.ActionSorter; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | |
| | | } |
| | | Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, true); |
| | | Integer locStaTaskNum = configService.getVal("LOC_STA_TASK_NUM", Integer.class, 2); |
| | | |
| | | |
| | | // 保存任务 |
| | | for (Task task : taskList) { |
| | |
| | | |
| | | boolean first = true; |
| | | for (Segment segment : segmentList) { |
| | | |
| | | // 分段所属的Task |
| | | Task task = taskService.getById(segment.getTaskId()); |
| | | TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())); |
| | | boolean isStation = posType.equals(TaskPosDto.PosType.ORI_STA) || posType.equals(TaskPosDto.PosType.DEST_STA); |
| | | |
| | | // 节点条码 |
| | | Code code = codeService.getCacheById(segment.getEndNode()); |
| | |
| | | // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true |
| | | boolean reverse = false; |
| | | if (nextDirection.equals((workDirection + 180) % 360)) { |
| | | 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())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) { |
| | | List<String> list = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084"); |
| | | if (isStation && list.contains(lastCode.getData())) { |
| | | reverse = false; |
| | | lastDirection = nextDirection; |
| | | } else { |
| | |
| | | nextDirection = lastDirection; |
| | | reverse = true; |
| | | } else { |
| | | if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.ORI_STA) || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) { |
| | | if (isStation && (lastCode.getData().equals("00000050") || lastCode.getData().equals("00000080"))) { |
| | | // turn |
| | | reverse = false; |
| | | actionList.add(new Action( |
| | |
| | | now // 工作时间 |
| | | )); |
| | | log.info("1TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | posType, |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | |
| | | now // 工作时间 |
| | | )); |
| | | log.info("2TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | posType, |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | |
| | | lastDirection = nextDirection; |
| | | } |
| | | } else { |
| | | if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.ORI_STA) || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) { |
| | | if (isStation && (lastCode.getData().equals("00000050") || lastCode.getData().equals("00000080"))) { |
| | | // turn |
| | | reverse = false; |
| | | actionList.add(new Action( |
| | |
| | | now // 工作时间 |
| | | )); |
| | | log.info("3TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | posType, |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | |
| | | now // 工作时间 |
| | | )); |
| | | log.info("4TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | posType, |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | |
| | | if (first) { |
| | | if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) { |
| | | Double turnDirection = workDirection; |
| | | 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())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) { |
| | | List<String> list = Arrays.asList("00000050","00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084"); |
| | | if (isStation && list.contains(lastCode.getData())) { |
| | | turnDirection = workDirection + 180.0; |
| | | } |
| | | if (lastCode.getCornerBool()) { |
| | |
| | | now // 工作时间 |
| | | )); |
| | | log.info("5TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | posType, |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | null, |