hdy
2025-02-12 76a2cda5327be91041903b491ee729707e2004c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.billion.main.plcServer;
 
import com.billion.main.da.service.IDaParamCollectionService;
import com.billion.main.plcServer.sub.OPCUaSubscription;
import com.kangaroohy.milo.service.MiloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
 
import java.util.ArrayList;
import java.util.List;
 
public class CustomRunner implements ApplicationRunner {
    @Autowired
    private MiloService miloService;
 
 
    @Autowired
    public IDaParamCollectionService daParamCollectionService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
 
        OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
                daParamCollectionService);
 
        List<String> lists = getList();
        System.out.println("订阅内容:"+lists);
        miloService.subscriptionFromOpcUa(lists,OPCUaSubscription);
 
    }
 
    public List<String> getList(){
        List<String> lists = new ArrayList<>();
        lists.add("CFL4CVT.BCOP010.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP040.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP060.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP100.RecordData");//请求保存
        lists.add("CFL4CVT.BP020.RecordData");//请求保存
        lists.add("CFL4CVT.OP220.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP010.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP040.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP060.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP100.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BP020.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.OP220.MesRecordDataDone");//请求保存
        return lists;
    }
}