提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.main.plcserver; |
A |
2 |
|
|
3 |
|
109e2f
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
C |
5 |
import com.jcdm.main.constant.Constants; |
0ca254
|
6 |
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
109e2f
|
7 |
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig; |
C |
8 |
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService; |
0ca254
|
9 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
A |
10 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
5b755f
|
11 |
import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; |
0ca254
|
12 |
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService; |
A |
13 |
import com.jcdm.main.plcserver.sub.OPCUaSubscription; |
|
14 |
import com.kangaroohy.milo.service.MiloService; |
|
15 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 |
import org.springframework.boot.ApplicationArguments; |
|
17 |
import org.springframework.boot.ApplicationRunner; |
|
18 |
import org.springframework.stereotype.Component; |
|
19 |
|
|
20 |
import java.util.List; |
109e2f
|
21 |
import java.util.stream.Collectors; |
0ca254
|
22 |
|
A |
23 |
@Component |
|
24 |
public class CustomRunner implements ApplicationRunner { |
|
25 |
|
|
26 |
@Autowired |
|
27 |
private MiloService miloService; |
|
28 |
|
|
29 |
@Autowired |
|
30 |
private IDaPassingStationCollectionService daPassingStationCollectionService; |
|
31 |
|
|
32 |
@Autowired |
|
33 |
private IDaCollectionParamConfService collectionParamConfService; |
|
34 |
|
|
35 |
@Autowired |
|
36 |
private IDaParamCollectionService daParamCollectionService; |
|
37 |
|
|
38 |
|
|
39 |
@Autowired |
|
40 |
private IOmProductionOrdeInfoService omProductionOrdeInfoService; |
|
41 |
|
109e2f
|
42 |
|
2de856
|
43 |
@Autowired |
109e2f
|
44 |
private IDaOpcuaConfigService daOpcuaConfigService; |
C |
45 |
|
5b755f
|
46 |
@Autowired |
C |
47 |
private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService; |
0ca254
|
48 |
|
A |
49 |
@Override |
|
50 |
public void run(ApplicationArguments args) throws Exception { |
e0c9c6
|
51 |
//分段010-090段 电芯工位 |
aa8ab9
|
52 |
Constants.OP020_OP090.add(Constants.OP020); |
C |
53 |
Constants.OP020_OP090.add(Constants.OP030); |
|
54 |
Constants.OP020_OP090.add(Constants.OP040); |
|
55 |
Constants.OP020_OP090.add(Constants.OP050); |
|
56 |
Constants.OP020_OP090.add(Constants.OP060); |
|
57 |
Constants.OP020_OP090.add(Constants.OP090); |
0ca254
|
58 |
|
e0c9c6
|
59 |
//人工工位 |
C |
60 |
Constants.OP100_OP150.add(Constants.OP100_1); |
|
61 |
Constants.OP100_OP150.add(Constants.OP100_2); |
|
62 |
//Constants.OP100_OP150.add(Constants.OP150); |
|
63 |
|
0ca254
|
64 |
OPCUaSubscription opcUaSubscription = new OPCUaSubscription( |
A |
65 |
miloService, |
|
66 |
daPassingStationCollectionService, |
|
67 |
collectionParamConfService, |
|
68 |
daParamCollectionService, |
5b755f
|
69 |
omProductionOrdeInfoService, |
C |
70 |
daTestDeviceInterfaceTempService); |
0ca254
|
71 |
|
A |
72 |
List<String> lists = getSubList(); |
|
73 |
System.out.println("订阅内容:"+lists); |
|
74 |
miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription); |
109e2f
|
75 |
|
0ca254
|
76 |
} |
A |
77 |
|
|
78 |
/** |
|
79 |
* 订阅内容 |
|
80 |
*/ |
|
81 |
public List<String> getSubList(){ |
109e2f
|
82 |
List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>() |
C |
83 |
.eq(DaOpcuaConfig::getState, Constants.USE_ING)) |
|
84 |
.stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
0ca254
|
85 |
return lists; |
A |
86 |
} |
|
87 |
} |
|
88 |
|