| | |
| | | add(1016);add(1017);add(1018);add(1019);add(1020);add(1021);add(1022);add(1023); |
| | | }}; |
| | | private boolean connectDev = false; |
| | | public Long currentTimeMilliConnectDev= 0L; |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | initSite(); |
| | | try{ |
| | | Thread.sleep(2000); |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | connectDev = connect(); |
| | | while(!connectDev){ |
| | | try { |
| | |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format( "【{0}】输送线plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | // deviceErrorService.addDeviceError("devp", slave.getId(), "输送线plc连接失败"); |
| | | |
| | | |
| | | if (System.currentTimeMillis()-currentTimeMilliConnectDev>1000*60*10){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("devp", slave.getId(), "输送线plc连接失败"); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | | if (currentTimeMilliConnectDev == 0){ |
| | | currentTimeMilliConnectDev = System.currentTimeMillis()-1000*60*10-1; |
| | | } else { |
| | | currentTimeMilliConnectDev = System.currentTimeMillis(); |
| | | |
| | | } |
| | | } |
| | | initSite(); |
| | | } |
| | | siemensS7Net.ConnectClose(); |
| | |
| | | read(); |
| | | |
| | | } catch (Exception e) { |
| | | connectDev = false; |
| | | log.error("RGV数据读取线程异常!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |