| | |
| | | @Resource |
| | | RedisUtil redisUtil; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void hollowGlassTask() { |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskOne() { |
| | | hollowGlassTaskChild(930, "CMJ1.CMJ1.isFree", "HollowGlassOne"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskTwo() { |
| | | hollowGlassTaskChild(931, "ZKQ2.ZKQ2.isFree", "HollowGlassTwo"); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void hollowGlassTaskThree() { |
| | | //todo:暂无三线的空闲状态信号,临时标签空闲状态 |
| | | hollowGlassTaskChild(932, "ZKQ3.ZKQ3.isFree", "HollowGlassThree"); |
| | | } |
| | | |
| | | public void hollowGlassTaskChild(int cell, String isFreeTag, String websocketName) { |
| | | List<HollowGlassOutRelationInfo> taskList = hollowGlassOutRelationInfoService.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)); |
| | | .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START).eq(HollowGlassOutRelationInfo::getCell, cell)); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | if (CollectionUtil.isNotEmpty(taskList)) { |
| | | List<Long> taskIdList = taskList.stream().map(HollowGlassOutRelationInfo::getId).collect(Collectors.toList()); |
| | | List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>().in(HollowGlassQueueInfo::getRelationId, taskIdList)); |
| | | Map<Integer, List<HollowGlassQueueInfo>> listMap = list.stream().collect(Collectors.groupingBy(HollowGlassQueueInfo::getCell)); |
| | | jsonObject.append("930", listMap.get(930)); |
| | | jsonObject.append("931", listMap.get(931)); |
| | | jsonObject.append("932", listMap.get(932)); |
| | | jsonObject.append("queueInfo", list); |
| | | } |
| | | try { |
| | | //930空闲信号 |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | jsonObject.append("freeOneRequestEntity", freeOneRequestEntity.getValue()); |
| | | //931空闲信号 |
| | | ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | ReadWriteEntity freeOneRequestEntity = miloService.readFromOpcUa(isFreeTag); |
| | | jsonObject.append("freeRequest", freeOneRequestEntity.getValue()); |
| | | } catch (Exception e) { |
| | | log.error("opc存在异常", e); |
| | | } |
| | | |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("HollowGlass"); |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(websocketName); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | for (WebSocketServer socketServer : sendwServer) { |
| | | if (socketServer != null && socketServer.session.isOpen()) { |
| | |
| | | //931空闲信号 |
| | | ReadWriteEntity freeTwoRequestEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | jsonObject.append("freeTwoRequestEntity", freeTwoRequestEntity.getValue()); |
| | | //932空闲信号 |
| | | ReadWriteEntity freeThreeRequestEntity = miloService.readFromOpcUa("ZKQ3.ZKQ3.isFree"); |
| | | jsonObject.append("freeThreeRequestEntity", freeThreeRequestEntity.getValue()); |
| | | } catch (Exception e) { |
| | | //todo:不做任务处理 |
| | | } |