From 5b755f09d9ffba5f6c67a5894f3887340cccb31c Mon Sep 17 00:00:00 2001 From: cl <418351270@qq.com> Date: 星期三, 03 七月 2024 17:29:36 +0800 Subject: [PATCH] 修改参数采集 --- jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java | 83 +++++++++++------------------------------ 1 files changed, 23 insertions(+), 60 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..3e7494a 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,12 +1,15 @@ 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.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; 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; @@ -14,8 +17,8 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; -import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @Component public class CustomRunner implements ApplicationRunner { @@ -32,17 +35,26 @@ @Autowired private IDaParamCollectionService daParamCollectionService; - @Autowired - private IDaCollectionParamConfService daCollectionParamConfService; @Autowired private IOmProductionOrdeInfoService omProductionOrdeInfoService; + @Autowired - private IDaTestDeviceInterfaceService daTestDeviceInterfaceService; + private IDaOpcuaConfigService daOpcuaConfigService; + + @Autowired + private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService; @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, @@ -50,70 +62,21 @@ collectionParamConfService, daParamCollectionService, omProductionOrdeInfoService, - daTestDeviceInterfaceService); + daTestDeviceInterfaceTempService); 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