From a36b834b2957440a755652ff17d067b18f4e9250 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期一, 29 一月 2024 16:55:05 +0800
Subject: [PATCH] 工位终端

---
 jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java
index 2f5a299..2fe1773 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java
@@ -2,6 +2,8 @@
 
 import com.jcdm.framework.websocket.WebSocketServer;
 import com.jcdm.framework.websocket.WebSocketUsers;
+import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
+import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
 import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
 import com.jcdm.main.da.opcuaconfig.client.ClientHandler;
@@ -29,6 +31,7 @@
     private IDaCollectionParamConfService collectionParamConfService = BeanUtils.getBean(IDaCollectionParamConfService.class);
     private IDaParamCollectionService daParamCollectionService = BeanUtils.getBean(IDaParamCollectionService.class);
     private IDaPassingStationCollectionService daPassingStationCollectionService = BeanUtils.getBean(IDaPassingStationCollectionService.class);
+    private IBsFormulaChildInfoService bsFormulaChildInfoService = BeanUtils.getBean(IBsFormulaChildInfoService.class);
     private List<DataValue> s=null;
     public void Transit(String Node, String value) throws Exception {
         log.info(Node+":"+value);
@@ -96,4 +99,71 @@
                 break;
         }
     }
+
+    public void tighten(String Node, String value) throws Exception {
+        String[] parts = Node.split("[.]");
+        ClientHandler clientHandler=new ClientHandler();
+        System.out.println("Node:"+Node+"value:"+value);
+        switch (value){
+            case "1":
+                //璇绘壄鐭�
+                NodeEntity SN_node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSN").value("").type("").build();
+                String SNCode=clientHandler.read(SN_node);
+
+                //璇昏搴�
+                NodeEntity SNDone= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSNDone").value("").type("").build();
+                String RecordSNDone = clientHandler.read(SNDone);
+
+                //璇荤粨鏋�
+                NodeEntity SNDone1= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".WorkID").value("").type("").build();
+                String WorkID = clientHandler.read(SNDone1);
+
+                //淇濆瓨鍙傛暟閲囬泦琛�
+                DaParamCollection paramCollection = new DaParamCollection();
+                paramCollection.setLocationCode(parts[1]);
+                paramCollection.setParamCode("RecordSN");
+                paramCollection.setParamValue(SNCode);
+                paramCollection.setParamName(parts[0]+"."+parts[1]+".RecordSN");
+                daParamCollectionService.insertDaParamCollection(paramCollection);
+
+
+                DaParamCollection paramCollection1 = new DaParamCollection();
+                paramCollection1.setLocationCode(parts[1]);
+                paramCollection1.setParamCode("RecordSNDone");
+                paramCollection1.setParamValue(RecordSNDone);
+                paramCollection1.setParamName(parts[0]+"."+parts[1]+".RecordSNDone");
+                daParamCollectionService.insertDaParamCollection(paramCollection1);
+
+
+
+                DaParamCollection paramCollection2 = new DaParamCollection();
+                paramCollection2.setLocationCode(parts[1]);
+                paramCollection2.setParamCode("WorkID");
+                paramCollection2.setParamValue(WorkID);
+                paramCollection2.setParamName(parts[0]+"."+parts[1]+".WorkID");
+                daParamCollectionService.insertDaParamCollection(paramCollection2);
+
+                //淇濆瓨鐘舵�佹洿鏂板墠绔〃鍗�
+                BsFormulaChildInfo test = bsFormulaChildInfoService.selectBsFormulaChildInfoByTypeTopOne("1", "test", parts[1]);
+                test.setResults(WorkID);
+                bsFormulaChildInfoService.updateBsFormulaChildInfo(test);
+                WebSocketUsers.sendMessageToUserByText(map.get(parts[1]), "TIGHTEN");
+
+
+
+                System.out.println("SNCode:"+SNCode);
+                System.out.println("Node:"+Node+"value:"+value);
+                NodeEntity node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".StationStatus").value("0").type("short").build();
+                Boolean out=clientHandler.write(node);
+                NodeEntity RecordSN= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSN").value("0").type("short").build();
+                Boolean out1=clientHandler.write(RecordSN);
+                NodeEntity riteRecordSNDone= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSNDone").value("0").type("short").build();
+                Boolean out2=clientHandler.write(riteRecordSNDone);
+                log.info("鑺傜偣:{},鍝嶅簲缁撴灉:{}", node.getIdentifier(),out);
+            default:
+                break;
+        }
+    }
+
+
 }

--
Gitblit v1.9.3