| | |
| | | private boolean resetFlag2 = false; |
| | | |
| | | private boolean connectRgv = false; |
| | | public Long currentTimeMilliConnectRgv= 0L; |
| | | |
| | | private boolean delRgvTask = false; |
| | | private short wrkSign = 0; |
| | | |
| | |
| | | @Override |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | initRgv(); |
| | | try{ |
| | | Thread.sleep(2000); |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | connectRgv = this.connect(); |
| | | while(!connectRgv){ |
| | | try { |
| | |
| | | // OutputQueue.RGV.offer(MessageFormat.format("【{0}】RGV 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("RGV plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("rgv", slave.getId(), "RGVplc连接失败"); |
| | | } catch (Exception e2){ |
| | | if (System.currentTimeMillis()-currentTimeMilliConnectRgv>1000*60*10){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("rgv", slave.getId(), "RGVplc连接失败"); |
| | | } catch (Exception e2){ |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | | if (currentTimeMilliConnectRgv == 0){ |
| | | currentTimeMilliConnectRgv = System.currentTimeMillis()-1000*60*10-1; |
| | | } else { |
| | | currentTimeMilliConnectRgv = System.currentTimeMillis(); |
| | | } |
| | | } |
| | | } |
| | | initRgv(); |
| | |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.service.BasCrnOptService; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.CrnErrCache; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | * 堆垛机是否在回原点运动中标记 |
| | | */ |
| | | private boolean backHpFlag = false; |
| | | public Long currentTimeMilliConnectCrn= 0L; |
| | | |
| | | public SiemensCrnThread(CrnSlave slave) { |
| | | this.slave = slave; |
| | |
| | | initCrn(); |
| | | OutputQueue.CRN.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:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | if (System.currentTimeMillis()-currentTimeMilliConnectCrn>1000*60*10){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("Crn", slave.getId(), "读取堆垛机plc状态信息失败"); |
| | | } catch (Exception e2){ |
| | | Thread.sleep(1000); |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | | if (currentTimeMilliConnectCrn == 0){ |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis()-1000*60*10-1; |
| | | } else { |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | 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); |