Merge branch 'master' of http://121.40.234.130:8899/root/acs2.0
This commit is contained in:
@@ -78,6 +78,11 @@ public interface AcsConfig {
|
||||
*/
|
||||
String HASWMS = "hasWms";
|
||||
|
||||
/**
|
||||
* OPC数据源URL
|
||||
*/
|
||||
String OPCURL = "opcUrl";
|
||||
|
||||
/**
|
||||
* 是否请求wms系统
|
||||
*/
|
||||
|
||||
@@ -345,9 +345,12 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
}
|
||||
}
|
||||
|
||||
private final static String endPointUrl = "opc.tcp://127.0.0.1:49320";
|
||||
|
||||
// private final static String endPointUrl = "opc.tcp://127.0.0.1:49320";
|
||||
|
||||
private static OpcUaClient createClient() throws Exception {
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
String endPointUrl = paramService.findByCode(AcsConfig.OPCURL).getValue();
|
||||
//opc ua服务端地址
|
||||
Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security");
|
||||
Files.createDirectories(securityTempDir);
|
||||
|
||||
@@ -19,6 +19,9 @@ import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
|
||||
import org.eclipse.milo.opcua.stack.core.types.structured.MonitoredItemCreateRequest;
|
||||
import org.eclipse.milo.opcua.stack.core.types.structured.MonitoringParameters;
|
||||
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -32,13 +35,16 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class TestOpcUA {
|
||||
// private final static String endPointUrl = "opc.tcp://192.168.10.60:49320";
|
||||
|
||||
private final static String endPointUrl = "opc.tcp://127.0.0.1:49320";
|
||||
// private final static String endPointUrl = "opc.tcp://127.0.0.1:49320";
|
||||
|
||||
|
||||
/**
|
||||
* 创建OPC UA客户端
|
||||
*/
|
||||
private static OpcUaClient createClient() throws Exception {
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
String endPointUrl = paramService.findByCode(AcsConfig.OPCURL).getValue();
|
||||
|
||||
//opc ua服务端地址
|
||||
Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security");
|
||||
Files.createDirectories(securityTempDir);
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
|
||||
import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
|
||||
import org.jinterop.dcom.common.JIException;
|
||||
import org.jinterop.dcom.core.JIVariant;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemProtocol;
|
||||
import org.nl.acs.opc.OpcUtl;
|
||||
@@ -23,6 +24,7 @@ import org.nl.acs.opc.service.mapper.OpcMapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.openscada.opc.dcom.list.ClassDetails;
|
||||
import org.openscada.opc.lib.common.AlreadyConnectedException;
|
||||
import org.openscada.opc.lib.common.ConnectionInformation;
|
||||
@@ -44,6 +46,7 @@ import java.util.concurrent.Executors;
|
||||
@Slf4j
|
||||
public class ReadUtil {
|
||||
|
||||
|
||||
static OpcMapper opcMapper = SpringContextHolder.getBean("opcMapper");
|
||||
|
||||
public static Server getServer(String opc_id) {
|
||||
@@ -78,7 +81,11 @@ public class ReadUtil {
|
||||
* 创建OPC UA客户端
|
||||
*/
|
||||
private static OpcUaClient createClient() throws Exception {
|
||||
String endPointUrl = "opc.tcp://127.0.0.1:49320";
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
String endPointUrl = paramService.findByCode(AcsConfig.OPCURL).getValue();
|
||||
if (StrUtil.isEmpty(endPointUrl)){
|
||||
throw new BadRequestException("opc地址未配置!");
|
||||
}
|
||||
|
||||
//opc ua服务端地址
|
||||
Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security");
|
||||
|
||||
Reference in New Issue
Block a user