-
懒羊羊
2024-03-23 e20d7373595960ad6be9bd6373a3c6f186e76e5c
提交 | 用户 | 时间
a5b351 1 package com.jcdm.main.plcserver;
C 2
3
4 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
5 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
6 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
7 import com.jcdm.main.plcserver.conf.OPCElement;
8 import com.jcdm.main.plcserver.sub.OPCUaSubscription;
9 import com.kangaroohy.milo.service.MiloService;
10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.boot.ApplicationArguments;
12 import org.springframework.boot.ApplicationRunner;
13 import org.springframework.stereotype.Component;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 @Component
19 public class CustomRunner implements ApplicationRunner {
20
21     @Autowired
22     private MiloService miloService;
23
24     @Autowired
25     private IDaPassingStationCollectionService daPassingStationCollectionService;
26
27     @Autowired
28     private IDaCollectionParamConfService collectionParamConfService;
29
30     @Autowired
31     private IDaParamCollectionService daParamCollectionService;
32
33     @Override
34     public void run(ApplicationArguments args) throws Exception {
35
36         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
37                 miloService,
38                 daPassingStationCollectionService,
39                 collectionParamConfService,
40                 daParamCollectionService);
41
42         List<String> lists = getSubList();
43         miloService.subscriptionFromOpcUa(lists,opcUaSubscription);
44
45     }
46
47     /**
48      * 订阅内容
49      */
50     public List<String> getSubList(){
51         List<String> lists = new ArrayList<>();
52         lists.add(OPCElement.OP_OP010_RecordSN);//请求下发SN号
7bff29 53         lists.add(OPCElement.OP_OP230_RecordData);//请求记录数据
54         lists.add(OPCElement.OP_OP240_RecordData);//请求记录数据
3c2299 55         lists.add(OPCElement.OP_OP240_AngleResult);//请求记录数据
56         lists.add(OPCElement.OP_OP250_RecordData);//请求记录数据
57         lists.add(OPCElement.OP_OP250_AngleResult);//请求记录数据
a5b351 58         return lists;
C 59     }
60 }
61