|  |  |  | 
|---|
|  |  |  | import com.zy.acs.manager.common.domain.MapDto; | 
|---|
|  |  |  | import com.zy.acs.manager.common.domain.MapRouteDto; | 
|---|
|  |  |  | import com.zy.acs.manager.common.exception.BusinessException; | 
|---|
|  |  |  | import com.zy.acs.manager.core.service.PatrolService; | 
|---|
|  |  |  | import com.zy.acs.manager.core.domain.BackpackDto; | 
|---|
|  |  |  | import com.zy.acs.manager.core.service.MapService; | 
|---|
|  |  |  | import com.zy.acs.manager.core.service.floyd.FloydNavigateService; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.acs.manager.manager.entity.NavMap; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.entity.*; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.enums.AgvStsType; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.enums.StatusType; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.enums.TaskStsType; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.mapper.NavMapMapper; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.service.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | private LocService locService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ConfigService configService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PatrolService patrolService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('manager:loc:update')") | 
|---|
|  |  |  | @PostMapping("/startupOrShutdown") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok().add(Cools | 
|---|
|  |  |  | .add("rcsStatus", configService.getVal("TaskAssignMode", Boolean.class)) | 
|---|
|  |  |  | .add("point", GsonUtils.toJson(mapCodeItems)) | 
|---|
|  |  |  | .add("common", activeNavMap.getData()) | 
|---|
|  |  |  | .add("common", null != activeNavMap ? activeNavMap.getData() : null) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | vo.setVol(String.valueOf(agvDetail.getVol())); | 
|---|
|  |  |  | vo.setSoc(String.valueOf(agvDetail.getSoc())); | 
|---|
|  |  |  | vo.setPos(agvDetail.getPos() != null && agvDetail.getPos() == 1); | 
|---|
|  |  |  | vo.setCode(codeService.getById(agvDetail.getRecentCode()).getData()); | 
|---|
|  |  |  | Code code = codeService.getCacheById(agvDetail.getRecentCode()); | 
|---|
|  |  |  | if (null != code) { | 
|---|
|  |  |  | vo.setCode(code.getData()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | vo.setDirection(agvDetail.getAgvAngle()); | 
|---|
|  |  |  | vo.setBackpack(GsonUtils.fromJsonToList(agvDetail.getBackpack(), BackpackDto.class)); | 
|---|
|  |  |  | vo.setPatrol(patrolService.isPatrolling(agvNo)); | 
|---|
|  |  |  | String error = agvDetail.realError(); | 
|---|
|  |  |  | if (!Cools.isEmpty(error)) { | 
|---|
|  |  |  | vo.setError(error); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Task> tasks = taskService.selectInSts(agv.getId(), TaskStsType.WAITING, TaskStsType.ASSIGN, TaskStsType.PROGRESS); | 
|---|
|  |  |  | if (!Cools.isEmpty(tasks)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(codeData)) { | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Code code = codeService.selectByData(codeData); | 
|---|
|  |  |  | Code code = codeService.getCacheByData(codeData); | 
|---|
|  |  |  | MapPointVo vo = new MapPointVo(); | 
|---|
|  |  |  | vo.setCodeId(code.getId()); | 
|---|
|  |  |  | vo.setCodeData(code.getData()); | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/route/list") | 
|---|
|  |  |  | public R routeList(@RequestParam(required = false) Long zoneId) { | 
|---|
|  |  |  | List<MapRouteVo> result = new ArrayList<>(); | 
|---|
|  |  |  | List<Route> routeList = routeService.list(new LambdaQueryWrapper<Route>().eq(Route::getStatus, 1)); | 
|---|
|  |  |  | List<Route> routeList = routeService.list(new LambdaQueryWrapper<Route>().eq(Route::getStatus, StatusType.ENABLE.val)); | 
|---|
|  |  |  | for (Route route : routeList) { | 
|---|
|  |  |  | MapRouteVo vo = new MapRouteVo(); | 
|---|
|  |  |  | vo.setRouteId(route.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Code> codes = codeService.list(); | 
|---|
|  |  |  | List<Code> codeArr = param.getCodeArr(); | 
|---|
|  |  |  | for (Code code : codeArr) { | 
|---|
|  |  |  | Code one = codeService.selectByData(code.getData()); | 
|---|
|  |  |  | Code one = codeService.getCacheByData(code.getData()); | 
|---|
|  |  |  | if (one == null) { | 
|---|
|  |  |  | if (!codeService.save(code)) { | 
|---|
|  |  |  | throw new BusinessException(code.getData()+" save fail![Code]"); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<MapParam.Route> routeArr = param.getRouteArr(); | 
|---|
|  |  |  | for (MapParam.Route paramRoute : routeArr) { | 
|---|
|  |  |  | Code startCode = codeService.selectByData(paramRoute.getStartCode()); | 
|---|
|  |  |  | Code endCode = codeService.selectByData(paramRoute.getEndCode()); | 
|---|
|  |  |  | Code startCode = codeService.getCacheByData(paramRoute.getStartCode()); | 
|---|
|  |  |  | Code endCode = codeService.getCacheByData(paramRoute.getEndCode()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Route route = routeService.findByCodeOfBoth(startCode.getId(), endCode.getId()); | 
|---|
|  |  |  | if (route == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(agvParam.getPos())) { | 
|---|
|  |  |  | throw new BusinessException(agvParam.getAgvNo() + " agv not in position!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Code code = codeService.selectByData(agvParam.getPos()); | 
|---|
|  |  |  | Code code = codeService.getCacheByData(agvParam.getPos()); | 
|---|
|  |  |  | Agv agv = agvService.selectByUuid(agvParam.getAgvNo()); | 
|---|
|  |  |  | if (agv == null) { | 
|---|
|  |  |  | agv = new Agv(); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Agv agv : agvList) { | 
|---|
|  |  |  | AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); | 
|---|
|  |  |  | if (null == agvDetail) { continue; } | 
|---|
|  |  |  | Code currCode = codeService.getById(agvDetail.getCode()); | 
|---|
|  |  |  | Code currCode = codeService.getCacheById(agvDetail.getCode()); | 
|---|
|  |  |  | MapAgvDto agvDto = new MapAgvDto(); | 
|---|
|  |  |  | agvDto.setUuid(agv.getUuid()); | 
|---|
|  |  |  | agvDto.setCurrCode(currCode==null?null:currCode.getData()); | 
|---|