| File was renamed from zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java |
| | |
| | | package com.zy.acs.manager.core.scheduler; |
| | | package com.zy.acs.manager.core.scheduler.test; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.manager.common.domain.TaskDto; |
| | | import com.zy.acs.manager.core.service.*; |
| | | import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.core.integrate.dto.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.service.*; |
| | |
| | | // @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void execute() { |
| | | if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } |
| | | Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); |
| | | if (!maintainLocSts) { |
| | | log.error("failed to run auto agv task, the maintainLocSts is false"); |
| | | return; |
| | | } |
| | | AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString())); |
| | | if (null == agvModel) { return; } |
| | | |
| | |
| | | Collections.shuffle(stockList); |
| | | |
| | | OpenBusSubmitParam param = new OpenBusSubmitParam(); |
| | | param.setBatch(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | param.setBatchNo(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | for (int i = 0; i < Math.min(agvModel.getBackpack(), stockList.size()) ; i++) { |
| | | Sta stockSta = stockList.get(i); |
| | | String staCode = codeService.getCacheById(stockSta.getCode()).getData(); |
| | |
| | | taskDto.setOriSta(stockSta.getStaNo()); |
| | | taskDto.setDestLoc(idleLoc.getLocNo()); |
| | | taskDto.setPriority(100); |
| | | taskDto.setSeqNum(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | taskDto.setTaskNo(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | |
| | | param.getTaskList().add(taskDto); |
| | | param.getTasks().add(taskDto); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskList())) { return; } |
| | | if (Cools.isEmpty(param.getTasks())) { return; } |
| | | |
| | | mainService.generateBusAndTask(param, memo); |
| | | } |
| | |
| | | Collections.shuffle(idleList); |
| | | |
| | | OpenBusSubmitParam param = new OpenBusSubmitParam(); |
| | | param.setBatch(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | param.setBatchNo(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | for (int i = 0; i < Math.min(agvModel.getBackpack(), idleList.size()) ; i++) { |
| | | Sta idleSta = idleList.get(i); |
| | | String staCode = codeService.getCacheById(idleSta.getCode()).getData(); |
| | |
| | | taskDto.setOriLoc(stockLoc.getLocNo()); |
| | | taskDto.setDestSta(idleSta.getStaNo()); |
| | | taskDto.setPriority(100); |
| | | taskDto.setSeqNum(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | taskDto.setTaskNo(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | |
| | | param.getTaskList().add(taskDto); |
| | | param.getTasks().add(taskDto); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskList())) { return; } |
| | | if (Cools.isEmpty(param.getTasks())) { return; } |
| | | |
| | | mainService.generateBusAndTask(param, memo); |
| | | } |
| | |
| | | Collections.shuffle(idleLocList); |
| | | |
| | | OpenBusSubmitParam param = new OpenBusSubmitParam(); |
| | | param.setBatch(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | param.setBatchNo(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | for (int i = 0; i < Math.min(maxCapacity, Math.min(stockLocList.size(), idleLocList.size())); i++) { |
| | | Loc stockLoc = stockLocList.get(i); |
| | | Loc idleLoc = idleLocList.get(i); |
| | |
| | | TaskDto taskDto = new TaskDto(); |
| | | taskDto.setOriLoc(stockLoc.getLocNo()); |
| | | taskDto.setDestLoc(idleLoc.getLocNo()); |
| | | taskDto.setSeqNum(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | taskDto.setTaskNo(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | |
| | | param.getTaskList().add(taskDto); |
| | | param.getTasks().add(taskDto); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskList())) { return; } |
| | | if (Cools.isEmpty(param.getTasks())) { return; } |
| | | |
| | | mainService.generateBusAndTask(param, memo); |
| | | } |