|
@ -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.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; |
|
|
import org.jinterop.dcom.common.JIException; |
|
|
import org.jinterop.dcom.common.JIException; |
|
|
import org.jinterop.dcom.core.JIVariant; |
|
|
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.ItemDto; |
|
|
import org.nl.acs.device.device_driver.standard_inspect.ItemProtocol; |
|
|
import org.nl.acs.device.device_driver.standard_inspect.ItemProtocol; |
|
|
import org.nl.acs.opc.OpcUtl; |
|
|
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.common.exception.BadRequestException; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.config.language.LangProcess; |
|
|
import org.nl.config.language.LangProcess; |
|
|
|
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
import org.openscada.opc.dcom.list.ClassDetails; |
|
|
import org.openscada.opc.dcom.list.ClassDetails; |
|
|
import org.openscada.opc.lib.common.AlreadyConnectedException; |
|
|
import org.openscada.opc.lib.common.AlreadyConnectedException; |
|
|
import org.openscada.opc.lib.common.ConnectionInformation; |
|
|
import org.openscada.opc.lib.common.ConnectionInformation; |
|
@ -44,6 +46,7 @@ import java.util.concurrent.Executors; |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
public class ReadUtil { |
|
|
public class ReadUtil { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static OpcMapper opcMapper = SpringContextHolder.getBean("opcMapper"); |
|
|
static OpcMapper opcMapper = SpringContextHolder.getBean("opcMapper"); |
|
|
|
|
|
|
|
|
public static Server getServer(String opc_id) { |
|
|
public static Server getServer(String opc_id) { |
|
@ -78,7 +81,11 @@ public class ReadUtil { |
|
|
* 创建OPC UA客户端 |
|
|
* 创建OPC UA客户端 |
|
|
*/ |
|
|
*/ |
|
|
private static OpcUaClient createClient() throws Exception { |
|
|
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服务端地址
|
|
|
//opc ua服务端地址
|
|
|
Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security"); |
|
|
Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security"); |
|
|