|
@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import com.alicp.jetcache.anno.method.SpringCacheContext; |
|
|
import com.alicp.jetcache.anno.method.SpringCacheContext; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.collections4.bag.SynchronizedSortedBag; |
|
|
import org.nl.acs.opc.service.dto.OpcServerManageDto; |
|
|
import org.nl.acs.opc.service.dto.OpcServerManageDto; |
|
|
import org.nl.acs.udw.UnifiedDataAccessor; |
|
|
import org.nl.acs.udw.UnifiedDataAccessor; |
|
|
import org.nl.acs.udw.UnifiedDataAccessorFactory; |
|
|
import org.nl.acs.udw.UnifiedDataAccessorFactory; |
|
@ -16,7 +17,9 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @author 20220102CG\noblelift |
|
|
|
|
|
*/ |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerConnectionStateListener { |
|
|
public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerConnectionStateListener { |
|
@ -358,6 +361,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
public void connectionStateChanged(boolean connected) { |
|
|
public void connectionStateChanged(boolean connected) { |
|
|
if (!connected) { |
|
|
if (!connected) { |
|
|
this.server = null; |
|
|
this.server = null; |
|
@ -380,6 +384,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
public void changed(Item item, ItemState itemState) { |
|
|
public void changed(Item item, ItemState itemState) { |
|
|
String itemId = item.getId(); |
|
|
String itemId = item.getId(); |
|
|
|
|
|
|
|
@ -424,7 +429,17 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC |
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb}); |
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb}); |
|
|
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb});
|
|
|
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb});
|
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if(his instanceof int[]){ |
|
|
|
|
|
if(!Arrays.equals((long[]) his, (long[]) value)){ |
|
|
|
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); |
|
|
|
|
|
} |
|
|
|
|
|
} else if(his instanceof String){ |
|
|
|
|
|
if(!StrUtil.equals((CharSequence) his, (CharSequence) value)){ |
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); |
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); |
|
|
|
|
|
} |
|
|
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value});
|
|
|
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value});
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|