| | |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.core.constant.AgvAreaDispatcher; |
| | | import com.zy.acs.manager.core.cache.CoreCache; |
| | | import com.zy.acs.manager.core.domain.CodeStepDto; |
| | | import com.zy.acs.manager.core.domain.type.JobType; |
| | |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private AgvAreaDispatcher agvAreaDispatcher; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | int count = agvService.count(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | if (count > 0) { |
| | | this.scheduler = Executors.newScheduledThreadPool(count); |
| | | } |
| | | // init all code data |
| | | List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>().eq(Code::getStatus, StatusType.ENABLE.val)); |
| | | this.CODE_DATA_CACHE = codeList.stream().map(Code::getData).distinct().collect(Collectors.toList()); |
| | | |
| | | // int all loc code data |
| | | List<Code> locCodeList = codeService.getAllLocCode(); |
| | | this.LOC_CODE_DATA_CACHE = locCodeList.stream().map(Code::getData).distinct().collect(Collectors.toList()); |
| | | |
| | | } |
| | | |
| | | // pick & drop logic -------------------------------------------------- |
| | | |
| | |
| | | |
| | | Code startCode = codeService.getCacheById(agvDetail.getRecentCode()); |
| | | |
| | | List<String> codeList = AgvAreaDispatcher.AGV_AREA.get(agvNo); |
| | | List<String> disableCodeList = AgvAreaDispatcher.AGV_DISABLE_AREA.get(agvNo); |
| | | Set<String> notInCodeSet = new HashSet<>(); |
| | | |
| | | // Collections.shuffle(CODE_DATA_CACHE); |
| | | List<String> codeList = agvAreaDispatcher.getCodesByAgvId(agvDetail.getAgvId()); |
| | | Collections.shuffle(codeList); |
| | | |
| | | for (String endCodeData : codeList) { |
| | | if (disableCodeList.contains(endCodeData)) { continue; } |
| | | if (notInCodeSet.contains(endCodeData)) { continue; } |
| | | Code endCode = codeService.getCacheByData(endCodeData); |
| | | |
| | | // valid lane |
| | |
| | | log.error("未能成功停止AGV " + agvNo + " 的跑库任务。"); |
| | | return R.error("未能成功停止AGV " + agvNo + " 的跑库任务。"); |
| | | } |
| | | } |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | int count = agvService.count(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | if (count > 0) { |
| | | this.scheduler = Executors.newScheduledThreadPool(count); |
| | | } |
| | | // init all code data |
| | | List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>().eq(Code::getStatus, StatusType.ENABLE.val)); |
| | | this.CODE_DATA_CACHE = codeList.stream().map(Code::getData).distinct().collect(Collectors.toList()); |
| | | |
| | | // int all loc code data |
| | | List<Code> locCodeList = codeService.getAllLocCode(); |
| | | this.LOC_CODE_DATA_CACHE = locCodeList.stream().map(Code::getData).distinct().collect(Collectors.toList()); |
| | | |
| | | } |
| | | |
| | | @PreDestroy |