| | |
| | | import com.zy.acs.manager.common.exception.BusinessException; |
| | | import com.zy.acs.manager.core.service.*; |
| | | import com.zy.acs.manager.core.service.astart.MapDataDispatcher; |
| | | import com.zy.acs.manager.core.service.astart.domain.DynamicNode; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.service.*; |
| | |
| | | private AvoidWaveCalculator avoidWaveCalculator; |
| | | @Autowired |
| | | private PatrolService patrolService; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @OperationLog("Locate All Agv") |
| | |
| | | @PostMapping("/patrol/batch/startup") |
| | | public synchronized R patrolBatchStartup() { |
| | | List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(MapDataDispatcher.MAP_DEFAULT_LEV); |
| | | int result = 0; |
| | | for (Agv agv : list) { |
| | | patrolService.startupPatrol(agv.getUuid()); |
| | | result++; |
| | | String agvNo = agv.getUuid(); |
| | | |
| | | boolean inMap = false; |
| | | label: for (int i = 0; i < dynamicMatrix.length; i++) { |
| | | for (int j = 0; j < dynamicMatrix[i].length; j++) { |
| | | DynamicNode dynamicNode = dynamicMatrix[i][j]; |
| | | String vehicle = dynamicNode.getVehicle(); |
| | | if (agvNo.equals(vehicle)) { |
| | | inMap = true; |
| | | break label; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (inMap) { |
| | | patrolService.startupPatrol(agvNo); |
| | | result++; |
| | | } |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | |
| | | oriLoc = locService.getById(param.getStartLocNo()); |
| | | } |
| | | if (!Cools.isEmpty(param.getStartLocNoStr())) { |
| | | oriLoc = locService.selecatByLocNo(param.getStartLocNoStr()); |
| | | oriLoc = locService.selectByLocNo(param.getStartLocNoStr()); |
| | | } |
| | | if (null == oriLoc) { |
| | | return R.error(); |
| | |
| | | destLoc = locService.getById(param.getEndLocNo()); |
| | | } |
| | | if (!Cools.isEmpty(param.getEndLocNoStr())) { |
| | | destLoc = locService.selecatByLocNo(param.getEndLocNoStr()); |
| | | destLoc = locService.selectByLocNo(param.getEndLocNoStr()); |
| | | } |
| | | if (null == destLoc) { |
| | | return R.error(); |
| | |
| | | oriLoc = locService.getById(param.getStartLocNo()); |
| | | } |
| | | if (!Cools.isEmpty(param.getStartLocNoStr())) { |
| | | oriLoc = locService.selecatByLocNo(param.getStartLocNoStr()); |
| | | oriLoc = locService.selectByLocNo(param.getStartLocNoStr()); |
| | | } |
| | | if (null == oriLoc) { |
| | | return R.error(); |
| | |
| | | if (null == destSta) { |
| | | return R.error(); |
| | | } |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 不是无货状态"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 修改站点状态失败"); |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败"); |
| | | } |
| | | |
| | | // task |
| | |
| | | if (null == oriSta) { |
| | | return R.error(); |
| | | } |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 不是有货状态"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 修改站点状态失败"); |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败"); |
| | | } |
| | | |
| | | // destLoc |
| | |
| | | destLoc = locService.getById(param.getEndLocNo()); |
| | | } |
| | | if (!Cools.isEmpty(param.getEndLocNoStr())) { |
| | | destLoc = locService.selecatByLocNo(param.getEndLocNoStr()); |
| | | destLoc = locService.selectByLocNo(param.getEndLocNoStr()); |
| | | } |
| | | if (null == destLoc) { |
| | | return R.error(); |
| | |
| | | if (null == oriSta) { |
| | | return R.error(); |
| | | } |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 不是有货状态"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 修改站点状态失败"); |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败"); |
| | | } |
| | | |
| | | // destSta |
| | |
| | | if (null == destSta) { |
| | | return R.error(); |
| | | } |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 不是无货状态"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 修改站点状态失败"); |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败"); |
| | | } |
| | | |
| | | // task |