cpT
2025-06-19 c1ef2d1fc4c0dae2bc8452924dcd77a0ff3a1ef5
src/main/java/com/zy/core/thread/RgvThread.java
@@ -65,6 +65,8 @@
    private boolean resetFlag2 = false;
    private boolean connectRgv = false;
    public Long currentTimeMilliConnectRgv= 0L;
    private boolean delRgvTask = false;
    private short wrkSign = 0;
@@ -75,6 +77,12 @@
    @Override
    @SuppressWarnings("InfiniteLoopStatement")
    public void run() {
        initRgv();
        try{
            Thread.sleep(2000);
        } catch (Exception e){
        }
        connectRgv = this.connect();
        while(!connectRgv){
            try {
@@ -1055,11 +1063,18 @@
//            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();