From 3ef1c88e46ba88f46e70377b158062096dd286e0 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 29 一月 2024 23:46:32 +0800
Subject: [PATCH] 修改代码错误

---
 /dev/null                                                                                   |  138 ---------------
 mdc-parent/mdc-collect/pom.xml                                                              |   45 ----
 mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasClientTest.java     |    3 
 mdc-parent/mdc-show/pom.xml                                                                 |   14 -
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/MdcDataArchiveService.java        |    2 
 mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClilent.java      |  238 ++++++++++++++++++++++++++
 mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/MachineMaintainMapper.xml             |    2 
 mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasJavaClientTest.java |    3 
 mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClientTest.java   |   40 ++++
 9 files changed, 287 insertions(+), 198 deletions(-)

diff --git a/mdc-parent/mdc-collect/pom.xml b/mdc-parent/mdc-collect/pom.xml
index 3825a72..f0dbde3 100644
--- a/mdc-parent/mdc-collect/pom.xml
+++ b/mdc-parent/mdc-collect/pom.xml
@@ -20,12 +20,8 @@
         <commons-codec.version>1.10</commons-codec.version>
         <mysql-connector.version>8.0.17</mysql-connector.version>
         <jedis.version>3.1.0</jedis.version>
-        <nekohtml.version>1.9.22</nekohtml.version>
         <commons-pool2.version>2.6.2</commons-pool2.version>
         <jna.version>5.14.0</jna.version>
-        <poi.version>4.1.2</poi.version>
-        <poi-ooxml.version>4.1.2</poi-ooxml.version>
-        <poi-ooxml-schemas.version>4.1.2</poi-ooxml-schemas.version>
         <skipTests>false</skipTests>
         
         <localLibPath>D:/yangys/mdm/locallib</localLibPath>
@@ -65,24 +61,12 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-websocket</artifactId>
-        </dependency>
+       
         <!-- spring boot end -->
-
-        <!-- lombok -->
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-
         <!-- commons-io -->
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>${commons-io.version}</version>
         </dependency>
 
         <!--json-->
@@ -96,7 +80,6 @@
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
-            <version>${commons-codec.version}</version>
         </dependency>
 
         <!--mysql-->
@@ -111,13 +94,7 @@
 		    <groupId>io.github.lmlx66</groupId>
 		    <artifactId>yitter-idgenerator-spring-boot-starter</artifactId>
 		</dependency>
-        <!--nekohtml-->
-        <dependency>
-            <groupId>net.sourceforge.nekohtml</groupId>
-            <artifactId>nekohtml</artifactId>
-            <version>${nekohtml.version}</version>
-        </dependency>
-
+       
 		<!-- <dependency>
 		    <groupId>org.opcfoundation</groupId>
 		    <artifactId>opc-ua</artifactId>
@@ -135,22 +112,6 @@
             <version>${jna.version}</version>
         </dependency>
 
-        <!--poi-->
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi</artifactId>
-            <version>${poi.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi-ooxml</artifactId>
-            <version>${poi-ooxml.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi-ooxml-schemas</artifactId>
-            <version>${poi-ooxml-schemas.version}</version>
-        </dependency>
         
         <dependency>
 		    <groupId>com.github.zengfr</groupId>
@@ -225,7 +186,7 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
-					<mainClass>com.qianwen.mdc.MdcApplication</mainClass>
+					<mainClass>com.qianwen.mdc.MdcCollectApplication</mainClass>
                     <layout>ZIP</layout>
                     <includes>
                         <!-- 鎵撳寘鏃跺寘鍚牳蹇冩ā鍧椾緷璧栧寘锛岄渶鎵嬪姩鎸囧畾 -->
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasClientTest.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasClientTest.java
index 1c62481..0a0cd3a 100644
--- a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasClientTest.java
+++ b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasClientTest.java
@@ -1,11 +1,12 @@
 package com.qianwen.mdc.service.focas;
 
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import com.alibaba.fastjson.JSONObject;
 import com.sun.jna.Native;
 import com.sun.jna.ptr.ShortByReference;
-
+@Disabled
 public class FocasClientTest {
 	public static String IP = "192.168.1.8";
 	public static short port = 8193;
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasJavaClientTest.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasJavaClientTest.java
index a2358cb..de0a692 100644
--- a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasJavaClientTest.java
+++ b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/FocasJavaClientTest.java
@@ -2,12 +2,13 @@
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import com.qianwen.mdc.service.focas.types.ODBST;
 import com.sun.jna.Platform;
 import com.sun.jna.ptr.ShortByReference;
-
+@Disabled
 public class FocasJavaClientTest {
 	public static String IP = "192.168.1.8";
 	public static short port = 8193;
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocas.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocas.java
deleted file mode 100644
index cc8ee7a..0000000
--- a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocas.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.qianwen.mdc.service.focas;
-
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-import com.sun.jna.ptr.IntByReference;
-import com.sun.jna.ptr.ShortByReference;
-
-public interface MyJNAFocas  extends Library {
-	public static final String dllPath = "D:\\focas\\";
-    public static final MyJNAFocas HxFocas = (MyJNAFocas) Native.load(dllPath + "HxFocasApi", MyJNAFocas.class);
-    public static final MyJNAFocas Fwlib32 = (MyJNAFocas) Native.load(dllPath + "Fwlib32", MyJNAFocas.class);
-    public static final MyJNAFocas Fwlibe1 = (MyJNAFocas) Native.load(dllPath + "fwlibe1", MyJNAFocas.class);
-   
-	 short connectServer(String ipAddr, short port, int timeout, ShortByReference flibHndl);
-
-	 short disconnectServer(short flibHndl);
-	 
-	 short readCncType(short flibHndl, byte[] cncType);
-
-	    short readAxisName(short flibHndl, ShortByReference axisNum, byte[] axisName);
-
-	    short readNcState(short flibHndl, ShortByReference status);
-
-	    short readOpState(short flibHndl, ShortByReference status);
-
-	    short readState(short flibHndl, ShortByReference ncState, ShortByReference opState, ShortByReference alarmState, ShortByReference emergency);
-
-	    short readAlarm(short flibHndl, ShortByReference alarmCount, int[] alarmNo, short[] alarmType, short[] alarmAxis, byte[] alarmMsg);
-
-	    short readSpRate(short flibHndl, IntByReference spRate);
-
-	    short readSpLoad(short flibHndl, IntByReference spLoad);
-
-	    short readSpSpeedSet(short flibHndl, IntByReference spSpeedSet);
-
-	    short readActs(short flibHndl, IntByReference acts);
-
-	    short readServoLoad(short flibHndl, ShortByReference axisNum, int[] servoLoad);
-
-	    short readFeedRate(short flibHndl, IntByReference feedRate);
-
-	    short readFeedSet(short flibHndl, IntByReference feedSet);
-
-	    short readActf(short flibHndl, IntByReference actf);
-
-	    short readRapidRate(short flibHndl, IntByReference rapidRate);
-
-	    short readPrgNo(short flibHndl, ShortByReference mainPrgNo, ShortByReference curPrgNo);
-
-	    short readSubPrg(short flibHndl, byte[] prgName, IntByReference prgNo);
-
-	    short readSeqNo(short flibHndl, IntByReference seqNo);
-
-	    short readExecPrg(short flibHndl, ShortByReference length, byte[] execPrg);
-
-	    short readM00M01State(short flibHndl, IntByReference state);
-
-	    short readPrgReadyState(short flibHndl, IntByReference state);
-
-	    short readRealPrgName(short flibHndl, int prgNo, byte[] prgName);
-
-	    short readPosition(short flibHndl, short axisNum, float[] absolute, float[] relative, float[] machine, float[] distance);
-
-	    short readCurToolNo(short flibHndl, IntByReference toolNo);
-
-	    short readOpenTime(short flibHndl, IntByReference time);
-
-	    short readCycleTime(short flibHndl, IntByReference time);
-
-	    short readCutTime(short flibHndl, IntByReference time);
-
-	    short readOperateTime(short flibHndl, IntByReference time);
-
-	    short readPartsCount(short flibHndl, IntByReference partsCount);
-
-	    short readPartsTotal(short flibHndl, IntByReference partsTotal);
-}
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocasTest.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocasTest.java
deleted file mode 100644
index 0138619..0000000
--- a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/focas/MyJNAFocasTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.qianwen.mdc.service.focas;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-
-import org.junit.jupiter.api.Test;
-
-import com.qianwen.mdc.service.focas.types.ODBSYS;
-import com.sun.jna.Native;
-import com.sun.jna.ptr.ShortByReference;
-
-public class MyJNAFocasTest {
-	public static String IP = "192.168.1.8";
-	public static short port = 8193;
-	@Test
-	public void testConn() {
-		ShortByReference flibHndl = new ShortByReference();
-		//int r = MyJNAFocas.MathLib.add(9, 20);
-		//System.out.println(r);
-		
-		//MyJNAFocas.HxFocas.connectServer("localhost", (short)8193, 5000, flibHndl);
-		try {
-			short result = JNAJavaFocas.Fwlib.cnc_allclibhndl3(IP, port, 10, flibHndl);
-			System.out.print(result);
-			short ret = JNAJavaFocas.Fwlib.cnc_freelibhndl(flibHndl.getValue());
-			
-			System.out.print("ret="+ret);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-	}
-	
-	//@Test
-	public void testReadCncType1() {
-		FocasJavaClient c = new FocasJavaClient();
-		c.setIp(IP);
-		c.setPort(port);
-		c.setTimeout(5);
-		c.connect();
-		String ty = c.readCncType();
-		System.out.println(ty);
-		c.disconnect();
-	}
-	String byteArrToString(byte[] bytes) {
-    	if(bytes == null) {
-    		return null;
-    	}
-    
-    	char[] charArr = new char[bytes.length];
-    	
-    	int i = 0;
-    	while(bytes[0] != 0 && i<bytes.length) {
-    		charArr[i] = (char)bytes[i];
-    		i++;
-    	}
-    	
-    	return new String(charArr,0,i);
-    }
-	/**
-	 * 鑷祴鏂规硶
-	 */
-	@Test
-	public void testReadCncType() {
-		ShortByReference flibHndl = new ShortByReference();
-		
-		
-		try {
-			short result = JNAJavaFocas.Fwlib.cnc_allclibhndl3(IP, port, 10, flibHndl);
-			
-			ODBSYS sysInfo = new ODBSYS();
-			short val = JNAJavaFocas.Fwlib.cnc_sysinfo(flibHndl.getValue(), sysInfo);
-			String se = "d";//new String(getBytes(sysInfo.cnc_type)).trim();
-			//32锛� 48
-			String cncTypeNum = this.byteArrToString(sysInfo.cnc_type);//绫诲瀷缂栧彿
-			
-			String CNCType;
-			switch (cncTypeNum)
-            {
-                case "15":
-                    CNCType = "Series 15/15i";
-                    break;
-                case "16":
-                    CNCType = "Series 16/16i";
-                    break;
-                case "18":
-                    CNCType = "Series 18/18i";
-                    break;
-                case "21":
-                    CNCType = "Series 21/21i";
-                    break;
-                case "30":
-                    CNCType = "Series 30i";
-                    break;
-                case "31":
-                    CNCType = "Series 31i";
-                    break;
-                case "32":
-                    CNCType = "Series 32i";
-                    break;
-                case "35":
-                    CNCType = "Series 35i";
-                    break;
-                case " 0":
-                    CNCType = "Series 0i";
-                    break;
-                case "PD":
-                    CNCType = "Power Mate i-D";
-                    break;
-                case "PH":
-                    CNCType = "Power Mate i-H";
-                    break;
-                case "PM":
-                    CNCType = "Power Motion i";
-                    break;
-                default:
-                    CNCType = "鍏跺畠绫诲瀷";
-                    break;
-            }
-			
-			String seriesStr = this.byteArrToString(sysInfo.series);//绫诲瀷缂栧彿
-			System.out.println("val="+val+",data="+CNCType);
-			System.out.println("seriesStr="+seriesStr);
-			System.out.println("version="+this.byteArrToString(sysInfo.version));
-			System.out.println("mttype="+this.byteArrToString(sysInfo.mt_type));
-			System.out.println("axes="+this.byteArrToString(sysInfo.axes));
-			
-			
-			short ret = JNAJavaFocas.Fwlib.cnc_freelibhndl(flibHndl.getValue());
-			
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		
-	}
-}
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClientTest.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClientTest.java
new file mode 100644
index 0000000..0488a66
--- /dev/null
+++ b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClientTest.java
@@ -0,0 +1,40 @@
+package com.qianwen.mdc.service.opcua;
+
+import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
+import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem;
+import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem.ValueConsumer;
+import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
+import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
+import org.junit.jupiter.api.Test;
+
+public class MyOpcuaClientTest {
+
+	@Test
+	public void t() {
+		ValueConsumer vc = new ValueConsumer() {
+
+			@Override
+			public void onValueArrived(UaMonitoredItem item, DataValue value) {
+				//澶勭悊鏁版嵁
+				System.out.println(value);
+			}
+			
+		};
+		
+		MyOpcuaClilent mc = new MyOpcuaClilent();
+		try {
+			OpcUaClient client = mc.connect("yangys-HW", 53530, "/OPCUA/SimulationServer");
+			mc.setValueConsumer(vc);
+			//mc.subscribe("1001");
+			
+			
+			//Object val = mc.readValue(3, 1001);
+			
+			//System.out.println(val);
+			NodeId nodeId = new NodeId(3, "abcd");
+			mc.readNodeValue(client,nodeId);
+		}catch(Exception e) {
+			e.printStackTrace();
+		}
+	}
+}
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClilent.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClilent.java
new file mode 100644
index 0000000..be3c66c
--- /dev/null
+++ b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/opcua/MyOpcuaClilent.java
@@ -0,0 +1,238 @@
+package com.qianwen.mdc.service.opcua;
+
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
+import org.eclipse.milo.opcua.sdk.client.api.identity.AnonymousProvider;
+import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem.ValueConsumer;
+import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedDataItem;
+import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedDataItem.DataValueListener;
+import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedSubscription;
+import org.eclipse.milo.opcua.stack.core.AttributeId;
+import org.eclipse.milo.opcua.stack.core.security.SecurityPolicy;
+import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
+import org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText;
+import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
+import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
+import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UShort;
+import org.eclipse.milo.opcua.stack.core.types.enumerated.MonitoringMode;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MyOpcuaClilent {
+	/**
+	 * namespace
+	 */
+	private int ns = 3;
+	private static AtomicInteger atomic = new AtomicInteger(1);
+	private OpcUaClient client;
+	// 鎵归噺璁㈤槄namespaceIndex榛樿涓�2
+    private int batchNamespaceIndex = 2;
+	// 鎵归噺璁㈤槄鏃剁殑identifiers
+    private List<String> batchIdentifiers;
+	private ValueConsumer valueConsumer;
+	DataValueListener valueListener;
+	public ValueConsumer getValueConsumer() {
+		return valueConsumer;
+	}
+
+	public void setValueConsumer(ValueConsumer valueConsumer) {
+		this.valueConsumer = valueConsumer;
+	}
+
+	private static final Logger logger = LoggerFactory.getLogger(MyOpcuaClilent.class);
+	/**
+	 * 杩炴帴opcua鏈嶅姟鍣�
+	 * @param ip
+	 * @param port
+	 * @param suffix
+	 * @return
+	 * @throws Exception
+	 */
+	public OpcUaClient connect(String ip, int port, String suffix) throws Exception {
+        String endPointUrl = "opc.tcp://" + ip + ":" + port + suffix;
+        Path securityTempDir = Paths.get(System.getProperty("java.io.tmpdir"), "security");
+        Files.createDirectories(securityTempDir);
+        if (!Files.exists(securityTempDir)) {
+            throw new RuntimeException("鍒涘缓 security 澶辫触: " + securityTempDir);
+        }
+        OpcUaClient opcUaClient = OpcUaClient.create(endPointUrl,
+                endpoints ->
+                        endpoints.stream()
+                                .filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.None.getUri()))
+                                .findFirst(),
+                configBuilder ->
+                        configBuilder
+                                .setApplicationName(LocalizedText.english("eclipse milo opc-ua client"))
+                                .setApplicationUri("urn:eclipse:milo:examples:client")
+                                //璁块棶鏂瑰紡锛氬尶鍚�
+                                .setIdentityProvider(new AnonymousProvider())
+                                .setRequestTimeout(UInteger.valueOf(5000))
+                                .build()
+        );
+        opcUaClient.connect().get();
+        Thread.sleep(2000); // 绾跨▼浼戠湢涓�涓嬪啀杩斿洖瀵硅薄锛岀粰鍒涘缓杩囩▼涓�涓椂闂淬��
+        
+        this.client = opcUaClient;
+        return opcUaClient;
+    }
+	
+	/**
+	 * 璇诲彇鑺傜偣鏁版嵁
+	 * @param client
+	 * @param namespaceIndex
+	 * @param identifier
+	 * @throws Exception
+	 */
+	public Object readValue(int ns, int identifier) throws Exception {
+        //鑺傜偣
+        NodeId nodeId = new NodeId(ns, identifier);
+        try {
+	        //璇诲彇鑺傜偣鏁版嵁
+	        DataValue value = client.readValue(0.0, TimestampsToReturn.Neither, nodeId).get();
+	
+	        Object  val = value.getValue().getValue();
+	        // 鐘舵��
+	        System.out.println("Status: " + value.getStatusCode());
+	
+	        if (val instanceof UShort) {
+                val = ((UShort) val).intValue();
+            } else if (val instanceof Boolean) {
+                if (val.equals(true)) {
+                    val = 1;
+                } else {
+                    val = 0;
+                }
+            }
+            return val;
+            
+	        //鏍囪瘑绗�
+	        //String id = String.valueOf(nodeId.getIdentifier());
+	        //System.out.println(id + ": " + value.getValue().getValue());
+        }catch(Exception e) {
+        	logger.info("璇诲彇鑺傜偣鏁版嵁寮傚父 identifier: {}", identifier,e);
+        	return null;
+        }
+    }
+	
+	public void readNodeValue(OpcUaClient client, NodeId nodeId) throws Exception {
+        //璇诲彇鑺傜偣鏁版嵁
+        DataValue value = client.readValue(0.0, TimestampsToReturn.Neither, nodeId).get();
+
+        // 鐘舵��
+        System.out.println("Status: " + value.getStatusCode());
+
+        //鏍囪瘑绗�
+        String id = String.valueOf(nodeId.getIdentifier());
+        System.out.println(id + ": " + value.getValue().getValue());
+    }
+
+	
+	/**
+	 * 璁㈤槄
+	 * @param identifier
+	 */
+	public void subscribe(String identifier) {
+		try {
+			client
+	        .getSubscriptionManager()
+	        .createSubscription(1000.0)
+	        .thenAccept(t -> {
+	        	NodeId nodeId = new NodeId(this.ns, identifier);
+	            ReadValueId readValueId = new ReadValueId(nodeId, AttributeId.Value.uid(), null, null);
+	            //鍒涘缓鐩戞帶鐨勫弬鏁�
+	            MonitoringParameters parameters = new MonitoringParameters(UInteger.valueOf(atomic.getAndIncrement()), 1000.0, null, UInteger.valueOf(10), true);
+	            //鍒涘缓鐩戞帶椤硅姹�
+	            //璇ヨ姹傛渶鍚庣敤浜庡垱寤鸿闃呫��
+	            MonitoredItemCreateRequest request = new MonitoredItemCreateRequest(readValueId, MonitoringMode.Reporting, parameters);
+	            List<MonitoredItemCreateRequest> requests = new ArrayList<>();
+	            requests.add(request);
+	            //鍒涘缓鐩戞帶椤癸紝骞朵笖娉ㄥ唽鍙橀噺鍊兼敼鍙樻椂鍊欑殑鍥炶皟鍑芥暟銆�
+	            t.createMonitoredItems(
+	                    TimestampsToReturn.Both,
+	                    requests,
+	                    (item, id) -> item.setValueConsumer(valueConsumer)
+	            );
+	        }).get();
+			//鎸佺画璁㈤槄
+			Thread.sleep(Long.MAX_VALUE);
+		}catch(Exception e) {
+			
+		}
+		
+	}
+
+	/**
+     * 鎵归噺璁㈤槄
+     *
+     * @param client
+     * @throws Exception
+     */
+    public void subscribeBatch(OpcUaClient client) throws Exception {
+        final CountDownLatch eventLatch = new CountDownLatch(1);
+        //澶勭悊璁㈤槄涓氬姟
+        handlerMultipleNode();
+        //鎸佺画鐩戝惉
+        eventLatch.await();
+    }
+    
+    /**
+     * 澶勭悊璁㈤槄涓氬姟
+     *
+     * @param client OPC UA瀹㈡埛绔�
+     */
+    private void handlerMultipleNode() {
+        try {
+            //鍒涘缓璁㈤槄
+            ManagedSubscription subscription = ManagedSubscription.create(client);
+            List<NodeId> nodeIdList = new ArrayList<>();
+            for (String id : batchIdentifiers) {
+                nodeIdList.add(new NodeId(batchNamespaceIndex, id));
+            }
+            //鐩戝惉
+            List<ManagedDataItem> dataItemList = subscription.createDataItems(nodeIdList);
+            for (ManagedDataItem managedDataItem : dataItemList) {
+            	DataValueListener l;
+            	managedDataItem.addDataValueListener(valueListener);
+            	/*
+                managedDataItem.addDataValueListener((t) -> {
+                    System.out.println(managedDataItem.getNodeId().getIdentifier().toString() + ":" + t.getValue().getValue().toString());
+                });
+                */
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+	public int getBatchNamespaceIndex() {
+		return batchNamespaceIndex;
+	}
+
+	public void setBatchNamespaceIndex(int batchNamespaceIndex) {
+		this.batchNamespaceIndex = batchNamespaceIndex;
+	}
+
+	public List<String> getBatchIdentifiers() {
+		return batchIdentifiers;
+	}
+
+	public void setBatchIdentifiers(List<String> batchIdentifiers) {
+		this.batchIdentifiers = batchIdentifiers;
+	}
+
+	public void setValueListener(DataValueListener valueListener) {
+		this.valueListener = valueListener;
+	}
+    
+    
+}
diff --git a/mdc-parent/mdc-show/pom.xml b/mdc-parent/mdc-show/pom.xml
index aa8e2aa..e08605a 100644
--- a/mdc-parent/mdc-show/pom.xml
+++ b/mdc-parent/mdc-show/pom.xml
@@ -22,7 +22,6 @@
 		<commons-codec.version>1.10</commons-codec.version>
 
 		<jedis.version>3.1.0</jedis.version>
-		<nekohtml.version>1.9.22</nekohtml.version>
 		<commons-pool2.version>2.6.2</commons-pool2.version>
 		<poi.version>4.1.2</poi.version>
 		<poi-ooxml.version>4.1.2</poi-ooxml.version>
@@ -88,12 +87,6 @@
 			<groupId>org.apache.commons</groupId>
 			<artifactId>commons-lang3</artifactId>
 		</dependency>
-		<!-- lombok -->
-		<dependency>
-			<groupId>org.projectlombok</groupId>
-			<artifactId>lombok</artifactId>
-			<optional>true</optional>
-		</dependency>
 
 		<!-- commons-io -->
 		<dependency>
@@ -135,12 +128,7 @@
             <version>${pagehelper.version}</version>
         </dependency>
 		-->
-		<!--nekohtml-->
-		<dependency>
-			<groupId>net.sourceforge.nekohtml</groupId>
-			<artifactId>nekohtml</artifactId>
-			<version>${nekohtml.version}</version>
-		</dependency>
+		
 
 		<!-- <dependency>
 		    <groupId>org.opcfoundation</groupId>
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/MdcDataArchiveService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/MdcDataArchiveService.java
index 7bef802..6081f10 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/MdcDataArchiveService.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/MdcDataArchiveService.java
@@ -29,12 +29,10 @@
 import com.qianwen.mdc.mapper.WorkshopMapper;
 import com.qianwen.mdc.utils.TimestampUtil;
 
-import lombok.extern.slf4j.Slf4j;
 
 /**
  * 鏁版嵁褰掓。鏈嶅姟,灏� machine_status 鏁版嵁瀵煎叆machine_status_history琛�,骞跺姞鍏ユ渶鏂扮殑machine_status鏁版嵁
  */
-@Slf4j
 @Component
 @Async
 public class MdcDataArchiveService {
diff --git a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/MachineMaintainMapper.xml b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/MachineMaintainMapper.xml
index a8f5bc2..66b0bdb 100644
--- a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/MachineMaintainMapper.xml
+++ b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/MachineMaintainMapper.xml
@@ -46,7 +46,7 @@
   
   <select id="queryPage" resultMap="FullResultMap">
       SELECT mm.id,mm.machine_id,ma.machine_name,mm.user_id,u.name user_name,style,mm.department,ud.name department_name,ma.uuid,ma.type,
-      ma.specification
+      ma.specification,
       start_date_from,start_date_to,complete_date_from,complete_date_to,is_qualified,mm.status,mm.detail
       FROM machine_maintain mm left join machine m on mm.machine_id=m.id left join sys_account u on mm.user_id=u.id
       left join machine_account ma on m.id=ma.machine_id

--
Gitblit v1.9.3