| | |
| | | throw new BusinessException("Internal Server Error!"); |
| | | } |
| | | Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, true); |
| | | Integer locStaTaskNum = configService.getVal("LOC_STA_TASK_NUM", Integer.class, 2); |
| | | |
| | | |
| | | // 保存任务 |
| | |
| | | if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | } else { |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getDestSta, destSta.getId()).in(Task::getTaskSts, TaskStsType.INIT.val(), TaskStsType.WAITING.val(), TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val())); |
| | | if (!Cools.isEmpty(list) && list.size() >= locStaTaskNum) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " task more"); |
| | | } |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | | destSta.setUpdateTime(now); |
| | |
| | | if (destSta.getStaTypeIsCheck() != 1) { |
| | | if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | } else { |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getDestSta, destSta.getId()).in(Task::getTaskSts, TaskStsType.INIT.val(), TaskStsType.WAITING.val(), TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val())); |
| | | if (!Cools.isEmpty(list) && list.size() >= locStaTaskNum) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " task more"); |
| | | } |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | |
| | | ActionTypeType.ReadyTakeFromAgvSite.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | | now, // 工作时间 |
| | | destSta.getStaTypeIsCheck() == 1 ? 2 : 0, |
| | | destSta.getStaNo() |
| | | now // 工作时间 |
| | | |
| | | )); |
| | | // 计算货叉工作方向 |
| | | staWorkDirection = mapService.calculateAgvWorkDirectionByStation(destStaWorkDirection, lastDirection); |
| | |
| | | ActionTypeType.ReadyReleaseToConveyorSta.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | now, // 工作时间 |
| | | destSta.getStaTypeIsCheck() == 1 ? 2 : 0, |
| | | destSta.getStaNo() |
| | | )); |
| | | break; |
| | | case TO_CHARGE: |
| | |
| | | // } |
| | | // } |
| | | |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | for (Long taskId : taskIds) { |
| | | Task task = taskService.getById(taskId); |
| | | report(task, agv_11_up.getQrCode(), TaskReportStsType.END); |
| | | } |
| | | // List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | // for (Long taskId : taskIds) { |
| | | // Task task = taskService.getById(taskId); |
| | | // report(task, agv_11_up.getQrCode(), TaskReportStsType.END); |
| | | // } |
| | | } |
| | | |
| | | // 出库取货 |
| | |
| | | // } |
| | | // } |
| | | // } |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | for (Long taskId : taskIds) { |
| | | Task task = taskService.getById(taskId); |
| | | report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN); |
| | | } |
| | | // List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | // for (Long taskId : taskIds) { |
| | | // Task task = taskService.getById(taskId); |
| | | // report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN); |
| | | // } |
| | | |
| | | } |
| | | //从输送线取货完成 |
| | | if (agv_11_up.getCompleteType().equals(AgvCompleteType.TAKE_FROM_STA_COMPLETE)) { |
| | | WebsocketServiceImpl.taskShelfBarcode = agv_11_up.getLocCode(); |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | for (Long taskId : taskIds) { |
| | | Task task = taskService.getById(taskId); |
| | | report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN); |
| | | } |
| | | } |
| | | // if (agv_11_up.getCompleteType().equals(AgvCompleteType.TAKE_FROM_STA_COMPLETE)) { |
| | | // WebsocketServiceImpl.taskShelfBarcode = agv_11_up.getLocCode(); |
| | | // List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | // for (Long taskId : taskIds) { |
| | | // Task task = taskService.getById(taskId); |
| | | // report(task, agv_11_up.getQrCode(), TaskReportStsType.OTBIN); |
| | | // } |
| | | // } |
| | | //往输送线放货完成 |
| | | if (agv_11_up.getCompleteType().equals(AgvCompleteType.RELEASE_FROM_STA_COMPLETE)) { |
| | | WebsocketServiceImpl.taskShelfBarcode = agv_11_up.getLocCode(); |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | for (Long taskId : taskIds) { |
| | | Task task = taskService.getById(taskId); |
| | | report(task, agv_11_up.getQrCode(), TaskReportStsType.END); |
| | | } |
| | | } |
| | | // if (agv_11_up.getCompleteType().equals(AgvCompleteType.RELEASE_FROM_STA_COMPLETE)) { |
| | | // WebsocketServiceImpl.taskShelfBarcode = agv_11_up.getLocCode(); |
| | | // List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | // for (Long taskId : taskIds) { |
| | | // Task task = taskService.getById(taskId); |
| | | // report(task, agv_11_up.getQrCode(), TaskReportStsType.END); |
| | | // } |
| | | // } |
| | | |
| | | // 路径完成 || 充电完成 |
| | | if (agv_11_up.getCompleteType().equals(AgvCompleteType.ENTIRE_PATH_COMPLETE) |
| | |
| | | // task |
| | | for (Segment segment : segmentList) { |
| | | boolean taskComplete = false; |
| | | boolean otbin = false; |
| | | |
| | | |
| | | Task task = taskService.getById(segment.getTaskId()); |
| | | assert null != task; |
| | |
| | | switch (Objects.requireNonNull(posType)) { |
| | | case ORI_STA: |
| | | case ORI_LOC: |
| | | otbin = true; |
| | | break; |
| | | case DEST_STA: |
| | | case DEST_LOC: |
| | |
| | | break; |
| | | } |
| | | |
| | | if (otbin) { |
| | | locService.taskCallBackOtbin(task); |
| | | report(task, null, TaskReportStsType.OTBIN); |
| | | } |
| | | |
| | | |
| | | if (taskComplete) { |
| | | locService.taskCallBack(task); |
| | | locService.taskCallBackEnd(task); |
| | | |
| | | task.setTaskSts(TaskStsType.COMPLETE.val()); |
| | | task.setEndTime(now); |
| | | task.setUpdateTime(now); |
| | | if (!taskService.updateById(task)) { |
| | | log.error("Task [{}] 更新失败 !!!", task.getSeqNum()); |
| | | } else { |
| | | report(task, null, TaskReportStsType.END); |
| | | } |
| | | report(task, null, TaskReportStsType.END); |
| | | if (task.getSeqNum() != null && task.getSeqNum().contains("SSX-CK")) { |
| | | report(task, "1001", TaskReportStsType.COMPLETED); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getSeqNum, task.getSeqNum()).eq(TaskReport::getBusNo, task.getBusId$()).eq(TaskReport::getTaskSts, taskReportStsType.status)); |
| | | if (!Cools.isEmpty(list)) { |
| | | log.info("TaskReport [{}] 已重复,不再插入 ==========>> ", JSON.toJSONString(task)); |
| | | log.info("TaskReport [{},{}] 已重复,不再插入 ==========>> ", taskReportStsType, JSON.toJSONString(task)); |
| | | return; |
| | | } |
| | | TaskReport taskReport = new TaskReport(); |
| | |
| | | taskReport.setEventType(taskReportStsType.name); |
| | | taskReport.setSeqNum(task.getSeqNum()); |
| | | taskReport.setZpallet(task.getZpallet()); |
| | | |
| | | if (!taskReportService.save(taskReport)) { |
| | | log.info("TaskReport [{}] 插入失败 ==========>> ", JSON.toJSONString(taskReport)); |
| | | } else { |
| | |
| | | |
| | | private boolean askSta(Integer askType, String askSta) { |
| | | log.info("来询问输送线了,{},{}", askType, askSta); |
| | | String wmsUrl = configService.getVal("WMS_URL", String.class); |
| | | String wmsUrl = configService.getVal("WCS_URL", String.class); |
| | | String wmsPath = configService.getVal("WMS_STA", String.class); |
| | | if (Cools.isEmpty(wmsPath) || Cools.isEmpty(wmsUrl)) { |
| | | return true; |
| | | return false; |
| | | } |
| | | Integer time = configService.getVal("TIMEOUT", Integer.class, 5); |
| | | //Integer times = configService.getVal("REPORT_TIMES", Integer.class, 2); |