| | |
| | | */ |
| | | @Transactional |
| | | public synchronized List<PathDto> generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) { |
| | | List<PathDto> pathTrace = new ArrayList<>(); |
| | | try { |
| | | if (Cools.isEmpty(agvId, segmentList)) { return; } |
| | | if (Cools.isEmpty(agvId, segmentList)) { return pathTrace; } |
| | | Date now = new Date(); |
| | | long actionPrepareSts = ActionStsType.PREPARE.val(); |
| | | // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); |
| | |
| | | if (!lastCode.getData().equals(pathList.get(0))) { |
| | | throw new CoolException("AGV[" + agvNo + "]定位偏移..."); |
| | | } |
| | | pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false)); |
| | | |
| | | boolean first = true; |
| | | for (Segment segment : segmentList) { |
| | |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = nextLaneDir; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | |
| | | if (nextDirection.equals(oppNextLaneDir)) { |
| | |
| | | )); |
| | | |
| | | lastDirection = nextDirection; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | } |
| | | } |
| | |
| | | )); |
| | | |
| | | lastDirection = nextDirection; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | |
| | | // run |
| | |
| | | )); |
| | | |
| | | lastCode = nextCode; |
| | | pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false)); |
| | | |
| | | } |
| | | |
| | |
| | | )); |
| | | |
| | | lastDirection = firstTurnDir; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | |
| | | } |
| | | first = false; |
| | |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = oriStaWorkDirection; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | // 计算货叉工作方向 |
| | | actuatorDirectionType = ActuatorDirectionType.fromVal(oriSta.getActDir()); |
| | |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = destStaWorkDirection; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | // 背篓取货 |
| | | if (backupAction) { |
| | |
| | | now // 工作时间 |
| | | )); |
| | | lastDirection = chargeDirection; |
| | | PathDto.markTurn(pathTrace, lastDirection); |
| | | } |
| | | |
| | | // charge |
| | |
| | | } |
| | | |
| | | log.info("{}号Agv动作组装完成,指令数量:{}", agvNo, newActionList.size()); |
| | | return pathTrace; |
| | | } catch (Exception e) { |
| | | log.error("mainService.generateAction", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | task.setUpdateTime(now); |
| | | if (!taskService.updateById(task)) { |
| | | throw new BusinessException(task.getSeqNum() + "任务更新失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | AgvAction agvAction = new AgvAction(agvNo, actionGroupId); |