| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("rgv连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | log.error("jar连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |
| | | // e.printStackTrace(); |
| | | } |
| | |
| | | readStatus(); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("RGV数据读取线程异常!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | log.error("JAR数据读取线程异常!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | |
| | | initSte(); |
| | | // e.printStackTrace(); |
| | |
| | | * 初始化堆垛机状态 |
| | | */ |
| | | private void initSte() { |
| | | if (null == jarProtocol) { |
| | | jarProtocol = new JarProtocol(); |
| | | try{ |
| | | if (null == jarProtocol) { |
| | | jarProtocol = new JarProtocol(); |
| | | } |
| | | jarProtocol.setJarNo(slave.getId()); |
| | | jarProtocol.setMode( 0); |
| | | jarProtocol.setStatus(JarStatusType.OFF_LINE); |
| | | jarProtocol.setJarErr(0); |
| | | } catch (Exception e){ |
| | | log.error("JAR初始化异常!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | jarProtocol.setJarNo(slave.getId()); |
| | | jarProtocol.setMode( 0); |
| | | jarProtocol.setStatus(JarStatusType.OFF_LINE); |
| | | jarProtocol.setJarErr(0); |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | | // 不能有 槽号 和 机架号 |
| | | siemensS7Net = new SiemensS7Net(SiemensPLCS.S200Smart, slave.getIp()); |
| | | |
| | | try{ |
| | | // 不能有 槽号 和 机架号 |
| | | siemensS7Net = new SiemensS7Net(SiemensPLCS.S200Smart, slave.getIp()); |
| | | // siemensS7Net.setRack(slave.getRack().byteValue()); |
| | | // siemensS7Net.setSlot(slave.getSlot().byteValue()); |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if(connect.IsSuccess){ |
| | | result = true; |
| | | OutputQueue.STE.offer(MessageFormat.format( "【{0}】硫化罐plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.info("硫化罐plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】硫化罐plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.error("硫化罐plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |
| | | OperateResult connect = siemensS7Net.ConnectServer(); |
| | | if(connect.IsSuccess){ |
| | | result = true; |
| | | OutputQueue.STE.offer(MessageFormat.format( "【{0}】硫化罐plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.info("硫化罐plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】硫化罐plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.error("硫化罐plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("硫化罐plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | // melsecMcNet.ConnectClose(); |
| | | return result; |
| | | // melsecMcNet.ConnectClose(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | log.error(e.getMessage()); |
| | | log.error("硫化罐plc状态信息失败"+e.getMessage()); |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】读取硫化罐plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | // News.error("读取穿梭车plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | initSte(); |