cl
2024-01-16 cf6bff3922bbd0624b98834f6ea85c8e619e564f
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/EOP090B/impl/EOP090BServerInterfaceImpl.java
@@ -44,10 +44,33 @@
    private static String GROUP_NAME  = "EOP090B_P";//组名
    private static List list = null;
    private static Group group = null;
    private int count = 0;
    /**
     * 设置心跳标志位,保存到全局变量
     */
    public void setHeartbeat(String value) {
        if ("false".equals(value)) {
            OPCUnit.write(opc.getEOP090B_F_HEART_BEAT(), "true");
            GlobalVariable.EOP090B_F_HEART_BEAT = true;
            count = 0;
        } else {
            count++;
        }
        // 循环读取频率是:500ms一次,如果超过6次,也就是3s认定超时
        if (count > GlobalVariable.HEART_MAX_COUNT) {
            GlobalVariable.EOP090B_F_HEART_BEAT = false;
        }
    }
    @Override
    public synchronized void monitor() {
        String ecpStr = "";//异常记录标记
        try{
            String isHeartBeat = OPCUnit.read(opc.getEOP090B_F_HEART_BEAT());
            setHeartbeat(isHeartBeat);
            if(GlobalVariable.EOP090B_F_HEART_BEAT) {
                //PC读工单
                String isPLCStart = OPCUnit.read(opc.getEOP090B_J_PLC_START());//PLC开始