hdy
2025-02-27 bf5dcc46de28c2ca664be4c6c3566e0a82c1ecd6
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.billion.main.plcServer;
 
import com.billion.main.bs.service.IBsBomChildInfoService;
import com.billion.main.constant.Constants;
import com.billion.main.da.service.IDaCollectionParamConfService;
import com.billion.main.da.service.IDaMaterialCollectionService;
import com.billion.main.da.service.IDaParamCollectionService;
import com.billion.main.da.service.IDaStationCollectionService;
import com.billion.main.om.service.IOmOrderSchedulingService;
import com.billion.main.om.service.IOmProductionOrderInfoService;
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 org.springframework.stereotype.Component;
 
import java.util.ArrayList;
import java.util.List;
@Component
public class CustomRunner implements ApplicationRunner {
    @Autowired
    private MiloService miloService;
 
    @Autowired
    public IDaParamCollectionService daParamCollectionService;
 
    @Autowired
    public IDaStationCollectionService daStationCollectionService;
 
    @Autowired
    public IOmProductionOrderInfoService omProductionOrderInfoService;
    @Autowired
    public IOmOrderSchedulingService omOrderSchedulingService;
    @Autowired
    public IBsBomChildInfoService bsBomChildInfoService;
    @Autowired
    public IDaCollectionParamConfService daCollectionParamConfService;
    @Autowired
    public IDaMaterialCollectionService daMaterialCollectionService;
 
 
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //第三方设备
        Constants.PLC.add(Constants.C040);
        Constants.PLC.add(Constants.OP030);
        Constants.PLC.add(Constants.OP050);
        Constants.PLC.add(Constants.OP070);
        Constants.PLC.add(Constants.OP110);
        Constants.PLC.add(Constants.OP140);
        //PLC1设备
        Constants.PLC.add(Constants.C010);
        Constants.PLC.add(Constants.C020);
        Constants.PLC.add(Constants.C030);
        Constants.PLC.add(Constants.C060);
        Constants.PLC.add(Constants.C070);
        //PLC2设备
        Constants.PLC.add(Constants.P010);
        Constants.PLC.add(Constants.P020);
        Constants.PLC.add(Constants.P030);
        Constants.PLC.add(Constants.OP005);
        Constants.PLC.add(Constants.OP010);
        Constants.PLC.add(Constants.OP020);
        Constants.PLC.add(Constants.OP040);
        Constants.PLC.add(Constants.OP045);
        Constants.PLC.add(Constants.OP060);
        Constants.PLC.add(Constants.OP075);
        Constants.PLC.add(Constants.OP080);
        Constants.PLC.add(Constants.OP090);
        Constants.PLC.add(Constants.OP095);
        Constants.PLC.add(Constants.OP100);
        Constants.PLC.add(Constants.OP120);
        //PLC3设备
        Constants.PLC.add(Constants.OP130);
        Constants.PLC.add(Constants.OP145);
        Constants.PLC.add(Constants.OP150);
        Constants.PLC.add(Constants.OP160);
        Constants.PLC.add(Constants.OP165);
        Constants.PLC.add(Constants.OP170);
        Constants.PLC.add(Constants.OP180);
        Constants.PLC.add(Constants.OP190);
        Constants.PLC.add(Constants.OP200);
        Constants.PLC.add(Constants.OP210);
        Constants.PLC.add(Constants.OP220);
        Constants.PLC.add(Constants.OP230);
        Constants.PLC.add(Constants.OP240);
        Constants.PLC.add(Constants.OP250);
        Constants.PLC.add(Constants.OP260);
        Constants.PLC.add(Constants.OP270);
        Constants.PLC.add(Constants.OP275);
        Constants.PLC.add(Constants.OP280);
        Constants.PLC.add(Constants.OP290);
        Constants.PLC.add(Constants.OP295);
        Constants.PLC.add(Constants.OP300);
        //
 
        OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
                daParamCollectionService,
                daStationCollectionService,
                omProductionOrderInfoService,
                omOrderSchedulingService,
                bsBomChildInfoService,
                daCollectionParamConfService,
                daMaterialCollectionService);
 
        List<String> lists = getList();
        System.out.println("订阅内容:"+lists);
        miloService.subscriptionFromOpcUa(lists,OPCUaSubscription);
 
    }
 
    public List<String> getList(){
        List<String> lists = new ArrayList<>();
        lists.add("PLC1.C005.RecordData");//请求保存
        lists.add("PLC1.C005.WorkOrderRequest");//请求保存
        lists.add("PLC1.OP010.RecordData");//请求保存
        lists.add("PLC1.A1.RecordData");//请求保存
 
        return lists;
    }
}