hdy
5 天以前 31960ffca93463cf4f6d417576c8694aed84138e
提交 | 用户 | 时间
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;
bf5dcc 5 import com.billion.main.da.service.IDaCollectionParamConfService;
H 6 import com.billion.main.da.service.IDaMaterialCollectionService;
1e2ff5 7 import com.billion.main.da.service.IDaParamCollectionService;
a2cd0f 8 import com.billion.main.da.service.IDaStationCollectionService;
H 9 import com.billion.main.om.service.IOmOrderSchedulingService;
10 import com.billion.main.om.service.IOmProductionOrderInfoService;
1e2ff5 11 import com.billion.main.plcServer.sub.OPCUaSubscription;
b9df2f 12 import com.billion.main.sys.service.ISysCountService;
1e2ff5 13 import com.kangaroohy.milo.service.MiloService;
H 14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.boot.ApplicationArguments;
16 import org.springframework.boot.ApplicationRunner;
a2cd0f 17 import org.springframework.stereotype.Component;
1e2ff5 18
H 19 import java.util.ArrayList;
20 import java.util.List;
a2cd0f 21 @Component
1e2ff5 22 public class CustomRunner implements ApplicationRunner {
H 23     @Autowired
24     private MiloService miloService;
25
26     @Autowired
27     public IDaParamCollectionService daParamCollectionService;
a2cd0f 28
H 29     @Autowired
30     public IDaStationCollectionService daStationCollectionService;
31
32     @Autowired
33     public IOmProductionOrderInfoService omProductionOrderInfoService;
34     @Autowired
35     public IOmOrderSchedulingService omOrderSchedulingService;
36     @Autowired
bf5dcc 37     public IBsBomChildInfoService bsBomChildInfoService;
H 38     @Autowired
39     public IDaCollectionParamConfService daCollectionParamConfService;
40     @Autowired
41     public IDaMaterialCollectionService daMaterialCollectionService;
b9df2f 42     @Autowired
H 43     public ISysCountService sysCountService;
a2cd0f 44
H 45
1e2ff5 46     @Override
H 47     public void run(ApplicationArguments args) throws Exception {
b9df2f 48         //PLC1设备//排查上下线
H 49         Constants.PLC1.add(Constants.C010);
50         Constants.PLC1.add(Constants.C020);
51         Constants.PLC1.add(Constants.C030);
52         Constants.PLC1.add(Constants.C050);
53         Constants.PLC1.add(Constants.C060);
54         //PLC2设备//排查上下线
55         Constants.PLC2.add(Constants.OP005);
56         Constants.PLC2.add(Constants.OP010);
57         Constants.PLC2.add(Constants.OP020);
58         Constants.PLC2.add(Constants.OP040);
59         Constants.PLC2.add(Constants.OP045);
60         Constants.PLC2.add(Constants.OP060);
61         Constants.PLC2.add(Constants.OP070);
62         Constants.PLC2.add(Constants.OP075);
63         Constants.PLC2.add(Constants.OP080);
64         Constants.PLC2.add(Constants.OP090);
65         Constants.PLC2.add(Constants.OP095_1);
66         Constants.PLC2.add(Constants.OP095_2);
67         Constants.PLC2.add(Constants.OP100_1);
68         Constants.PLC2.add(Constants.OP100_2);
69         Constants.PLC2.add(Constants.OP120);
70         //PLC3设备//排查上下线
71         Constants.PLC3.add(Constants.OP130);
72         Constants.PLC3.add(Constants.OP145_1);
73         Constants.PLC3.add(Constants.OP145_2);
74         Constants.PLC3.add(Constants.OP150_1);
75         Constants.PLC3.add(Constants.OP150_2);
76         Constants.PLC3.add(Constants.OP160);
77         Constants.PLC3.add(Constants.OP165_1);
78         Constants.PLC3.add(Constants.OP165_2);
79         Constants.PLC3.add(Constants.OP170_1);
80         Constants.PLC3.add(Constants.OP170_2);
81         Constants.PLC3.add(Constants.OP180);
82         Constants.PLC3.add(Constants.OP190_1);
83         Constants.PLC3.add(Constants.OP190_2);
84         Constants.PLC3.add(Constants.OP200_1);
85         Constants.PLC3.add(Constants.OP200_2);
86         Constants.PLC3.add(Constants.OP210_1);
87         Constants.PLC3.add(Constants.OP210_2);
88         Constants.PLC3.add(Constants.OP220_1);
89         Constants.PLC3.add(Constants.OP220_2);
90         Constants.PLC3.add(Constants.OP230_1);
91         Constants.PLC3.add(Constants.OP230_2);
92         Constants.PLC3.add(Constants.OP240_1);
93         Constants.PLC3.add(Constants.OP240_2);
94         Constants.PLC3.add(Constants.OP250_1);
95         Constants.PLC3.add(Constants.OP250_2);
96         Constants.PLC3.add(Constants.OP260_1);
97         Constants.PLC3.add(Constants.OP260_2);
98         Constants.PLC3.add(Constants.OP270_1);
99         Constants.PLC3.add(Constants.OP270_2);
100         Constants.PLC3.add(Constants.OP275);
101         Constants.PLC3.add(Constants.OP280);
102         Constants.PLC3.add(Constants.OP290_1);
103         Constants.PLC3.add(Constants.OP290_2);
104         Constants.PLC3.add(Constants.OP295);
105         Constants.PLC3.add(Constants.OP300);
106         Constants.PLC3.add(Constants.OP310);
107         //PLC4//排查上下线
108         Constants.PLC4.add(Constants.C040);
109         Constants.PLC4.add(Constants.OP030);
110         Constants.PLC4.add(Constants.OP050);
111         Constants.PLC4.add(Constants.OP110);
112         Constants.PLC4.add(Constants.OP140);
113         //上线工位
114         Constants.ONLINE.add(Constants.C005);
115         Constants.ONLINE.add(Constants.OP005);
116         //下线工位
117         Constants.OFFLINE.add(Constants.C070);
118         Constants.OFFLINE.add(Constants.OP310);
1e2ff5 119
H 120         OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
a2cd0f 121                 daParamCollectionService,
H 122                 daStationCollectionService,
123                 omProductionOrderInfoService,
124                 omOrderSchedulingService,
bf5dcc 125                 bsBomChildInfoService,
H 126                 daCollectionParamConfService,
b9df2f 127                 daMaterialCollectionService,
H 128                 sysCountService);
1e2ff5 129
H 130         List<String> lists = getList();
131         System.out.println("订阅内容:"+lists);
132         miloService.subscriptionFromOpcUa(lists,OPCUaSubscription);
133
134     }
135
136     public List<String> getList(){
137         List<String> lists = new ArrayList<>();
b9df2f 138         //PLC1
H 139         lists.add("PLC1.C005.RecordData");
140         lists.add("PLC1.C005.WorkOrderRequest");//请求工单
141         lists.add("PLC1.C010.RecordData");
142         lists.add("PLC1.C020.RecordData");
143         lists.add("PLC1.C030.RecordData");
144         lists.add("PLC1.C050.RecordData");
145         lists.add("PLC1.C060.RecordData");
146         lists.add("PLC1.C070.RecordData");
147         //PLC2
148         lists.add("PLC2.OP005.RecordData");
149         lists.add("PLC2.OP010.WorkOrderRequest");//请求工单
150         lists.add("PLC2.OP020.RecordData");
151         lists.add("PLC2.OP040.RecordData");
152         lists.add("PLC2.OP045.RecordData");
153         lists.add("PLC2.OP060.RecordData");
154         lists.add("PLC2.OP070.RecordData");
155         lists.add("PLC2.OP075.RecordData");
156         lists.add("PLC2.OP080.RecordData");
157         lists.add("PLC2.OP090.RecordData");
158         lists.add("PLC2.OP095-1.RecordData");
159         lists.add("PLC2.OP095-2.RecordData");
160         lists.add("PLC2.OP100-1.RecordData");
161         lists.add("PLC2.OP100-2.RecordData");
162         lists.add("PLC2.OP120.RecordData");
163         lists.add("PLC2.P010.RecordData");
164         lists.add("PLC2.P010.WorkOrderRequest");//请求工单
165         //PLC3
166         lists.add("PLC3.OP130.RecordData");
167         lists.add("PLC3.OP145-1.RecordData");
168         lists.add("PLC3.OP145-2.RecordData");
169         lists.add("PLC3.OP150-1.RecordData");
170         lists.add("PLC3.OP150-2.RecordData");
171         lists.add("PLC3.OP160.RecordData");
172         lists.add("PLC3.OP165-1.RecordData");
173         lists.add("PLC3.OP165-2.RecordData");
174         lists.add("PLC3.OP170-1.RecordData");
175         lists.add("PLC3.OP170-2.RecordData");
176         lists.add("PLC3.OP180.RecordData");
177         lists.add("PLC3.OP190-1.RecordData");
178         lists.add("PLC3.OP190-2.RecordData");
179         lists.add("PLC3.OP200-1.RecordData");
180         lists.add("PLC3.OP200-2.RecordData");
181         lists.add("PLC3.OP210-1.RecordData");
182         lists.add("PLC3.OP210-2.RecordData");
183         lists.add("PLC3.OP220-1.RecordData");
184         lists.add("PLC3.OP220-2.RecordData");
185         lists.add("PLC3.OP230-1.RecordData");
186         lists.add("PLC3.OP230-2.RecordData");
187         lists.add("PLC3.OP240-1.RecordData");
188         lists.add("PLC3.OP240-2.RecordData");
189         lists.add("PLC3.OP250-1.RecordData");
190         lists.add("PLC3.OP250-2.RecordData");
191         lists.add("PLC3.OP260-1.RecordData");
192         lists.add("PLC3.OP260-2.RecordData");
193         lists.add("PLC3.OP270-1.RecordData");
194         lists.add("PLC3.OP270-2.RecordData");
195         lists.add("PLC3.OP275.RecordData");
196         lists.add("PLC3.OP280.RecordData");
197         lists.add("PLC3.OP290-1.RecordData");
198         lists.add("PLC3.OP290-2.RecordData");
199         lists.add("PLC3.OP295.RecordData");
200         lists.add("PLC3.OP300.RecordData");
201         lists.add("PLC3.OP310.RecordData");
202         //PLC4
203         lists.add("PLC4.C040.RecordData");
204         lists.add("PLC4.OP030.RecordData");
205         lists.add("PLC4.OP050.RecordData");
206         lists.add("PLC4.OP070.RecordData");
207         lists.add("PLC3.OP110.RecordData");
208         lists.add("PLC3.OP140.RecordData");
209
210
211
a2cd0f 212
1e2ff5 213         return lists;
H 214     }
215 }