| | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 11/15/2024 |
| | |
| | | return R.ok("RCS-FLOW-1.0.0"); |
| | | } |
| | | |
| | | // {"msg":"Success","code":200,"data":[[38,2],[38,3],[38,4],[38,5],[38,6],[37,6],[36,6],[35,6],[34,6],[33,6],[32,6],[31,6],[30,6],[29,6],[28,6],[27,6],[26,6],[25,6]]} |
| | | // {"msg":"Success","code":200,"data":[[38,2],[38,3],[38,4],[38,5],[38,6],[37,6],[36,6],[35,6],[34,6],[33,6],[32,6],[31,6],[30,6],[29,6],[28,6],[27,6],[26,6],[25,6]]} |
| | | @RequestMapping(value = "/system/demo", method = {RequestMethod.GET, RequestMethod.POST}) |
| | | public R demo() { |
| | | long startTime = System.currentTimeMillis(); |
| | | for (int i = 0; i < 1000; i++) { |
| | | this.demo1(); |
| | | } |
| | | System.out.println(System.currentTimeMillis() - startTime); |
| | | return R.ok(); |
| | | } |
| | | |
| | | private R demo1() { |
| | | List<String> path = new ArrayList<>(); |
| | | path.add("00000035"); |
| | | path.add("00000085"); |
| | | path.add("00000135"); |
| | | path.add("00000185"); |
| | | path.add("00000235"); |
| | | path.add("00000234"); |
| | | path.add("00000233"); |
| | | path.add("00000232"); |
| | | path.add("00000231"); |
| | | path.add("00000230"); |
| | | path.add("00000229"); |
| | | path.add("00000228"); |
| | | path.add("00000227"); |
| | | path.add("00000226"); |
| | | path.add("00000225"); |
| | | path.add("00000224"); |
| | | path.add("00000223"); |
| | | path.add("00000222"); |
| | | |
| | | // List<int[]> codeMatrixIdxList = new ArrayList<>(); |
| | | // for (String pathStr : path) { |
| | | // int[] codeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(null, pathStr); |
| | | // codeMatrixIdxList.add(codeMatrixIdx); |
| | | // } |
| | | |
| | | List<int[]> codeMatrixIdxList = mapDataDispatcher.getCodeMatrixIdxList(null, path); |
| | | |
| | | // System.out.println(codeMatrixIdxList.toString()); |
| | | |
| | | return R.ok().add(codeMatrixIdxList); |
| | | } |
| | | |
| | | // @RequestMapping(value = "/system/route/generate", method = {RequestMethod.GET, RequestMethod.POST}) |
| | | // public R generate() { |
| | | // String[][] codeMatrix = mapDataDispatcher.getCodeMatrix(null); |
| | |
| | | avoidWaveCalculator.calcDynamicNodeWhenBoot(); |
| | | |
| | | // AgvDetail agvDetail11 = agvDetailService.selectByAgvNo("11"); |
| | | // agvDetail11.setCode(codeService.selectByData("00000251").getId()); |
| | | // agvDetail11.setCode(codeService.getCacheByData("00000251").getId()); |
| | | // agvDetailService.updateById(agvDetail11); |
| | | // |
| | | // AgvDetail agvDetail12 = agvDetailService.selectByAgvNo("12"); |
| | | // agvDetail12.setCode(codeService.selectByData("00000204").getId()); |
| | | // agvDetail12.setCode(codeService.getCacheByData("00000204").getId()); |
| | | // agvDetailService.updateById(agvDetail12); |
| | | // |
| | | // AgvDetail agvDetail14 = agvDetailService.selectByAgvNo("14"); |
| | | // agvDetail14.setCode(codeService.selectByData("00000101").getId()); |
| | | // agvDetail14.setCode(codeService.getCacheByData("00000101").getId()); |
| | | // agvDetailService.updateById(agvDetail14); |
| | | // |
| | | // avoidWaveCalculator.calcDynamicNodeWhenBoot(); |
| | | // |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail14.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000303").getData(), null); |
| | | // codeService.getCacheByData("00000303").getData(), null); |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail11.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000411").getData(), null); |
| | | // codeService.getCacheByData("00000411").getData(), null); |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail12.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000403").getData(), null); |
| | | // codeService.getCacheByData("00000403").getData(), null); |
| | | |
| | | return R.ok(); |
| | | } |
| | |
| | | @GetMapping("/auto/go/patrol") |
| | | public R autoGoPatrol(@RequestParam(required = false, defaultValue = "5") Integer count) { |
| | | List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | |
| | | // stop |
| | | if (count == 0) { |
| | | for (String agvNo : list.stream().map(Agv::getUuid).collect(Collectors.toList())) { |
| | | if (patrolService.isPatrolling(agvNo)) { |
| | | patrolService.shutdownPatrol(agvNo); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | // start |
| | | Collections.shuffle(list); |
| | | List<Agv> agvs = list.subList(0, count); |
| | | int result = 0; |
| | |
| | | public R astarDemo() { |
| | | long startTime = System.currentTimeMillis(); |
| | | List<String> path = mapService.checkoutPath("18" |
| | | , codeService.selectByData("00001318") |
| | | , codeService.selectByData("00003447") |
| | | , codeService.getCacheByData("00001318") |
| | | , codeService.getCacheByData("00003447") |
| | | , true |
| | | , new ArrayList<>() |
| | | , segmentService.getById(1390)); |