hdy
2025-02-26 a2cd0f560c226d7830c79fa3c0a6cb3db72927b4
提交 | 用户 | 时间
1e2ff5 1 package com.billion.main.plcServer;
H 2
a2cd0f 3 import com.billion.main.bs.service.IBsBomChildInfoService;
H 4 import com.billion.main.constant.Constants;
1e2ff5 5 import com.billion.main.da.service.IDaParamCollectionService;
a2cd0f 6 import com.billion.main.da.service.IDaStationCollectionService;
H 7 import com.billion.main.om.service.IOmOrderSchedulingService;
8 import com.billion.main.om.service.IOmProductionOrderInfoService;
1e2ff5 9 import com.billion.main.plcServer.sub.OPCUaSubscription;
H 10 import com.kangaroohy.milo.service.MiloService;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.boot.ApplicationArguments;
13 import org.springframework.boot.ApplicationRunner;
a2cd0f 14 import org.springframework.stereotype.Component;
1e2ff5 15
H 16 import java.util.ArrayList;
17 import java.util.List;
a2cd0f 18 @Component
1e2ff5 19 public class CustomRunner implements ApplicationRunner {
H 20     @Autowired
21     private MiloService miloService;
22
23     @Autowired
24     public IDaParamCollectionService daParamCollectionService;
a2cd0f 25
H 26     @Autowired
27     public IDaStationCollectionService daStationCollectionService;
28
29     @Autowired
30     public IOmProductionOrderInfoService omProductionOrderInfoService;
31     @Autowired
32     public IOmOrderSchedulingService omOrderSchedulingService;
33     @Autowired
34     public IBsBomChildInfoService bomChildInfoService;
35
36
1e2ff5 37     @Override
H 38     public void run(ApplicationArguments args) throws Exception {
a2cd0f 39         //第三方设备
H 40         Constants.PLC.add(Constants.C040);
41         Constants.PLC.add(Constants.OP030);
42         Constants.PLC.add(Constants.OP050);
43         Constants.PLC.add(Constants.OP070);
44         Constants.PLC.add(Constants.OP110);
45         Constants.PLC.add(Constants.OP140);
46         //PLC1设备
47         Constants.PLC.add(Constants.C010);
48         Constants.PLC.add(Constants.C020);
49         Constants.PLC.add(Constants.C030);
50         Constants.PLC.add(Constants.C060);
51         Constants.PLC.add(Constants.C070);
52         //PLC2设备
53         Constants.PLC.add(Constants.P010);
54         Constants.PLC.add(Constants.P020);
55         Constants.PLC.add(Constants.P030);
56         Constants.PLC.add(Constants.OP005);
57         Constants.PLC.add(Constants.OP010);
58         Constants.PLC.add(Constants.OP020);
59         Constants.PLC.add(Constants.OP040);
60         Constants.PLC.add(Constants.OP045);
61         Constants.PLC.add(Constants.OP060);
62         Constants.PLC.add(Constants.OP075);
63         Constants.PLC.add(Constants.OP080);
64         Constants.PLC.add(Constants.OP090);
65         Constants.PLC.add(Constants.OP095);
66         Constants.PLC.add(Constants.OP100);
67         Constants.PLC.add(Constants.OP120);
68         //PLC3设备
69         Constants.PLC.add(Constants.OP130);
70         Constants.PLC.add(Constants.OP145);
71         Constants.PLC.add(Constants.OP150);
72         Constants.PLC.add(Constants.OP160);
73         Constants.PLC.add(Constants.OP165);
74         Constants.PLC.add(Constants.OP170);
75         Constants.PLC.add(Constants.OP180);
76         Constants.PLC.add(Constants.OP190);
77         Constants.PLC.add(Constants.OP200);
78         Constants.PLC.add(Constants.OP210);
79         Constants.PLC.add(Constants.OP220);
80         Constants.PLC.add(Constants.OP230);
81         Constants.PLC.add(Constants.OP240);
82         Constants.PLC.add(Constants.OP250);
83         Constants.PLC.add(Constants.OP260);
84         Constants.PLC.add(Constants.OP270);
85         Constants.PLC.add(Constants.OP275);
86         Constants.PLC.add(Constants.OP280);
87         Constants.PLC.add(Constants.OP290);
88         Constants.PLC.add(Constants.OP295);
89         Constants.PLC.add(Constants.OP300);
90         //
1e2ff5 91
H 92         OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
a2cd0f 93                 daParamCollectionService,
H 94                 daStationCollectionService,
95                 omProductionOrderInfoService,
96                 omOrderSchedulingService,
97                 bomChildInfoService);
1e2ff5 98
H 99         List<String> lists = getList();
100         System.out.println("订阅内容:"+lists);
101         miloService.subscriptionFromOpcUa(lists,OPCUaSubscription);
102
103     }
104
105     public List<String> getList(){
106         List<String> lists = new ArrayList<>();
a2cd0f 107         lists.add("PLC1.C005.RecordData");//请求保存
H 108         lists.add("PLC1.C005.WorkOrderRequest");//请求保存
109         lists.add("PLC1.OP010.RecordData");//请求保存
110         lists.add("PLC1.A1.RecordData");//请求保存
111
1e2ff5 112         return lists;
H 113     }
114 }