From 109e2fdc5607792ddf74654cd864142963213bad Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期一, 01 七月 2024 15:26:20 +0800
Subject: [PATCH] 修改参数采集

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java |   86 ++++++++++++------------------------------
 1 files changed, 25 insertions(+), 61 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
index 9a9c710..8843f0d 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -1,21 +1,27 @@
 package com.jcdm.main.plcserver;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.jcdm.main.constant.Constants;
 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
+import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
+import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
-import com.jcdm.main.da.testDeviceInterface.service.IDaTestDeviceInterfaceService;
 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
-import com.jcdm.main.plcserver.conf.OPCElement;
 import com.jcdm.main.plcserver.sub.OPCUaSubscription;
+
 import com.kangaroohy.milo.service.MiloService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Component
 public class CustomRunner implements ApplicationRunner {
@@ -32,88 +38,46 @@
     @Autowired
     private IDaParamCollectionService daParamCollectionService;
 
-    @Autowired
-    private IDaCollectionParamConfService daCollectionParamConfService;
 
     @Autowired
     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
 
-    @Autowired
-    private IDaTestDeviceInterfaceService daTestDeviceInterfaceService;
+
+    @Resource
+    private IDaOpcuaConfigService daOpcuaConfigService;
+
+
 
     @Override
     public void run(ApplicationArguments args) throws Exception {
+        //鍒嗘010-065娈�
+        Constants.OP020_OP065.add(Constants.OP020);
+        Constants.OP020_OP065.add(Constants.OP030);
+        Constants.OP020_OP065.add(Constants.OP040);
+        Constants.OP020_OP065.add(Constants.OP050);
+        Constants.OP020_OP065.add(Constants.OP060);
+        Constants.OP020_OP065.add(Constants.OP065);
 
         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
                 miloService,
                 daPassingStationCollectionService,
                 collectionParamConfService,
                 daParamCollectionService,
-                omProductionOrdeInfoService,
-                daTestDeviceInterfaceService);
+                omProductionOrdeInfoService);
 
         List<String> lists = getSubList();
         System.out.println("璁㈤槄鍐呭锛�"+lists);
         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
+
     }
 
     /**
      * 璁㈤槄鍐呭
      */
     public List<String> getSubList(){
-        List<String> lists = new ArrayList<>();
-        lists.add(OPCElement.PACK_OP230_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP240_RecordData);//璇锋眰璁板綍鏁版嵁.
-//        lists.add(OPCElement.PACK_OP240_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP2501_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP2502_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP2503_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP260_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP260_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP270_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP270_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP290_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP290_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP300A_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP300B_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP310A_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP310B_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP330_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP380_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP380_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP400_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP400_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP410_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP410_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4301_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4302_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4303_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4304_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP440_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP450_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP450_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP460_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP460_AngleResult);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4801_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4802_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP4803_RecordData);//璇锋眰璁板綍鏁版嵁
-//
-//        lists.add(OPCElement.PACK_OP500_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP500_AngleResult);//璇锋眰璁板綍鏁版嵁
-////
-//        lists.add(OPCElement.PACK_OP280_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP320A_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP320B_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP340A_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP340B_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP350A_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP350B_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP360_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP365_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP370_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP390_RecordData);//璇锋眰璁板綍鏁版嵁
-//        lists.add(OPCElement.PACK_OP470_RecordData);//璇锋眰璁板綍鏁版嵁
-
+        List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
+                        .eq(DaOpcuaConfig::getState, Constants.USE_ING))
+                .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
         return lists;
     }
 }

--
Gitblit v1.9.3