| | |
| | | try { |
| | | // valid ----------------------------------------------- |
| | | Agv agv = agvService.getById(agvId); |
| | | if (!agvService.judgeEnable(agv.getId(), true)) { |
| | | if (!agvService.judgeEnable(agv.getId(), false)) { |
| | | return; |
| | | } |
| | | if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { |
| | |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | |
| | | startCode = codeService.getById(oriLoc.getCode()); |
| | | endCode = codeService.getById(destLoc.getCode()); |
| | | startCode = codeService.getCacheById(oriLoc.getCode()); |
| | | endCode = codeService.getCacheById(destLoc.getCode()); |
| | | |
| | | TaskPosDto.packagePosGroup(groups, task, startCode, TaskPosDto.PosType.ORI_LOC, sameGroupXy); |
| | | TaskPosDto.packagePosGroup(groups, task, endCode, TaskPosDto.PosType.DEST_LOC, sameGroupXy); |
| | |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | destSta = staService.getById(task.getDestSta()); |
| | | |
| | | startCode = codeService.getById(oriLoc.getCode()); |
| | | endCode = codeService.getById(destSta.getCode()); |
| | | startCode = codeService.getCacheById(oriLoc.getCode()); |
| | | endCode = codeService.getCacheById(destSta.getCode()); |
| | | |
| | | TaskPosDto.packagePosGroup(groups, task, startCode, TaskPosDto.PosType.ORI_LOC, sameGroupXy); |
| | | TaskPosDto.packagePosGroup(groups, task, endCode, TaskPosDto.PosType.DEST_STA, sameGroupXy); |
| | |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | |
| | | startCode = codeService.getById(oriSta.getCode()); |
| | | endCode = codeService.getById(destLoc.getCode()); |
| | | startCode = codeService.getCacheById(oriSta.getCode()); |
| | | endCode = codeService.getCacheById(destLoc.getCode()); |
| | | |
| | | TaskPosDto.packagePosGroup(groups, task, startCode, TaskPosDto.PosType.ORI_STA, sameGroupXy); |
| | | TaskPosDto.packagePosGroup(groups, task, endCode, TaskPosDto.PosType.DEST_LOC, sameGroupXy); |
| | |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | destSta = staService.getById(task.getDestSta()); |
| | | |
| | | startCode = codeService.getById(oriSta.getCode()); |
| | | endCode = codeService.getById(destSta.getCode()); |
| | | startCode = codeService.getCacheById(oriSta.getCode()); |
| | | endCode = codeService.getCacheById(destSta.getCode()); |
| | | |
| | | TaskPosDto.packagePosGroup(groups, task, startCode, TaskPosDto.PosType.ORI_STA, sameGroupXy); |
| | | TaskPosDto.packagePosGroup(groups, task, endCode, TaskPosDto.PosType.DEST_STA, sameGroupXy); |
| | |
| | | } |
| | | |
| | | // re-order by agv current position |
| | | Code currCode = codeService.getById(agvDetail.getRecentCode()); |
| | | Code currCode = codeService.getCacheById(agvDetail.getRecentCode()); |
| | | Double[] currPosition = new Double[] {currCode.getX(), currCode.getY()}; |
| | | |
| | | List<List<TaskPosDto>> pickGroups = new ArrayList<>(); |
| | |
| | | if (Cools.isEmpty(agvId, taskType)) { return false; } |
| | | try { |
| | | String agvNo = agvService.getAgvNo(agvId); |
| | | AgvDetail agvDetail = agvDetailService.selectByAgvId(agvId); |
| | | if (!agvService.judgeEnable(agvId)) { |
| | | return false; |
| | | } |
| | |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | AgvDetail agvDetail = agvDetailService.selectMajorByAgvId(agvId); |
| | | Code endCode = null; |
| | | switch (taskType) { |
| | | case TO_CHARGE: |
| | |
| | | List<FuncSta> idleFunStaList = funcStaService.findInIdleStatus(FuncStaType.query(taskType), agvId); |
| | | if (!Cools.isEmpty(idleFunStaList)) { |
| | | FuncSta funcSta = funcStaService.checkoutClosestFunSta(agvDetail.getRecentCode(), idleFunStaList); |
| | | endCode = codeService.getById(funcSta.getCode()); |
| | | endCode = codeService.getCacheById(funcSta.getCode()); |
| | | } |
| | | if (null == endCode) { |
| | | log.warn("AGV[{}] failed to search destination,there hadn't any idle funSta,TaskTypeType:{}", agvNo, taskType.toString()); |
| | |
| | | // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); |
| | | int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class); |
| | | String agvNo = agvService.getAgvNo(agvId); |
| | | if (!agvService.judgeEnable(agvId)) { |
| | | throw new CoolException("AGV[" + agvNo + "]当前不可用..."); |
| | | } |
| | | // if (!agvService.judgeEnable(agvId)) { |
| | | // throw new CoolException("AGV[" + agvNo + "]当前不可用..."); |
| | | // } |
| | | |
| | | AgvModel agvModel = agvModelService.getByAgvId(agvId); |
| | | Double workDirection = agvModel.getWorkDirection(); |
| | |
| | | |
| | | List<Action> actionList = new ArrayList<>(); |
| | | // start node |
| | | Code lastCode = codeService.getById(agvDetail.getRecentCode()); |
| | | Code lastCode = codeService.getCacheById(agvDetail.getRecentCode()); |
| | | Double lastDirection = agvDetail.getAgvAngle(); |
| | | if (!lastCode.getData().equals(pathList.get(0))) { |
| | | throw new CoolException("AGV[" + agvNo + "]定位偏移..."); |
| | |
| | | Task task = taskService.getById(segment.getTaskId()); |
| | | |
| | | // 节点条码 |
| | | Code code = codeService.getById(segment.getEndNode()); |
| | | Code code = codeService.getCacheById(segment.getEndNode()); |
| | | |
| | | // 需要走行 |
| | | if (!lastCode.getData().equals(code.getData())) { |
| | |
| | | now // 工作时间 |
| | | )); |
| | | |
| | | // List<Action> newActionList = new ArrayList<>(actionList); |
| | | |
| | | // List<Action> optimizeList = actionService.optimizeSort(actionList); |
| | | |
| | | List<Action> optimizeList = actionSorter.optimizeSort(actionList); |
| | | List<Action> newActionList = new ArrayList<>(optimizeList); |
| | | |
| | | |
| | | List<Action> newActionList = actionSorter.optimizeSort(actionList); |
| | | String groupId = String.valueOf(snowflakeIdWorker.nextId()).substring(3); |
| | | |
| | | // save action |
| | | int i = newActionList.size(); |
| | | for (Action action : newActionList) { |
| | | action.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | // action.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | action.setGroupId(groupId); |
| | | action.setPriority(i); |
| | | if (!actionService.save(action)) { |
| | | throw new BusinessException(action.getName() + "动作保存失败"); |
| | | } |
| | | i -= 1; |
| | | } |
| | | if (!actionService.saveBatch(newActionList)) { |
| | | throw new BusinessException("group[" + groupId + "] 动作保存失败"); |
| | | } |
| | | |
| | | // update segment |
| | |
| | | action.setStartTime(now); |
| | | action.setIoTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | throw new BusinessException(action.getPriority() + " - " + action.getName() + "动作更新失败"); |
| | | } |
| | | } |
| | | if (!actionService.updateBatchById(actionList)) { |
| | | throw new BusinessException("failed to update action batch !!!"); |
| | | } |
| | | |
| | | // task |
| | |
| | | } |
| | | } |
| | | |
| | | Agv agv = agvService.getById(actionList.get(0).getAgvId()); |
| | | AgvAction agvAction = new AgvAction(agv.getUuid(), actionGroupId); |
| | | String agvNo = agvService.getAgvNo(actionList.get(0).getAgvId()); |
| | | AgvAction agvAction = new AgvAction(agvNo, actionGroupId); |
| | | for (Action action : actionList) { |
| | | |
| | | switch (Objects.requireNonNull(ActionTypeType.get(action.getActionTypeEl()))) { |