| | |
| | | import com.mes.s7.entity.S7DataZKDLPTwo; |
| | | import com.mes.s7.entity.S7DataZKExtra; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.tools.WebSocketUtils; |
| | | import com.mes.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | ModbusTcp CMJ2ModbusTcp; |
| | | |
| | | private Integer offset = 40001; |
| | | @Resource |
| | | private WebSocketUtils webSocketUtils; |
| | | |
| | | @Resource |
| | | RedisUtil redisUtil; |
| | |
| | | } catch (Exception e) { |
| | | log.error("opc存在异常", e); |
| | | } |
| | | |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get(websocketName); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | for (WebSocketServer socketServer : sendwServer) { |
| | | if (socketServer != null && socketServer.session.isOpen()) { |
| | | socketServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | } |
| | | webSocketUtils.sendToWeb(websocketName,jsonObject); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | |
| | | try { |
| | | //查询使用数据源1查询数据 |
| | | queryDataSource1(jsonObject); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("hollowGlassMessage"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | webSocketUtils.sendToWeb("hollowGlassMessage",jsonObject); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | if (redisUtil.getCacheObject("priorityHollowSwitch") == null) { |
| | | redisUtil.setCacheObject("priorityHollowSwitch", false); |
| | | } else { |
| | | dispatchHollowSwitch = redisUtil.getCacheObject("priorityHollowSwitch"); |
| | | priorityHollowSwitch = redisUtil.getCacheObject("priorityHollowSwitch"); |
| | | } |
| | | jsonObject.append("dispatchHollowSwitch", dispatchHollowSwitch); |
| | | jsonObject.append("priorityHollowSwitch", priorityHollowSwitch); |
| | | |
| | | //理片笼使用情况 |
| | | List<Map<String, Object>> bigStorageCageUsage = hollowBigStorageCageService.selectBigStorageCageUsage(); |
| | |
| | | jsonObject.append("pieChartVOS", pieChartVOS); |
| | | List<RunTime> hollowRunTimes = hollowBigStorageCageHistoryTaskService.queryRunTimes(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | jsonObject.append("hollowRunTimes", hollowRunTimes); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreen"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("largenScreen is closed"); |
| | | } |
| | | } |
| | | } |
| | | webSocketUtils.sendToWeb("largenScreen",jsonObject); |
| | | } |
| | | } |