提交 | 用户 | 时间
|
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 { |
884731
|
51 |
|
C |
52 |
//PLC到MES物料转换 |
|
53 |
Constants.materialMap.put("1","9900199052A"); |
|
54 |
Constants.materialMap.put("2","9900199053B"); |
|
55 |
|
e0c9c6
|
56 |
//分段010-090段 电芯工位 |
aa8ab9
|
57 |
Constants.OP020_OP090.add(Constants.OP020); |
C |
58 |
Constants.OP020_OP090.add(Constants.OP030); |
|
59 |
Constants.OP020_OP090.add(Constants.OP040); |
|
60 |
Constants.OP020_OP090.add(Constants.OP050); |
|
61 |
Constants.OP020_OP090.add(Constants.OP060); |
|
62 |
Constants.OP020_OP090.add(Constants.OP090); |
0ca254
|
63 |
|
e0c9c6
|
64 |
//人工工位 |
C |
65 |
Constants.OP100_OP150.add(Constants.OP100_1); |
|
66 |
Constants.OP100_OP150.add(Constants.OP100_2); |
884731
|
67 |
Constants.OP100_OP150.add(Constants.OP150); |
e0c9c6
|
68 |
|
eda15e
|
69 |
//模组工位List |
C |
70 |
Constants.ModuleList.add(Constants.OP110); |
|
71 |
Constants.ModuleList.add(Constants.OP120); |
|
72 |
Constants.ModuleList.add(Constants.OP130); |
|
73 |
Constants.ModuleList.add(Constants.OP140); |
|
74 |
Constants.ModuleList.add(Constants.OP150); |
|
75 |
Constants.ModuleList.add(Constants.OP160); |
|
76 |
Constants.ModuleList.add(Constants.OP170); |
|
77 |
Constants.ModuleList.add(Constants.OP180); |
|
78 |
Constants.ModuleList.add(Constants.OP210); |
|
79 |
Constants.ModuleList.add(Constants.OP220); |
|
80 |
|
0ca254
|
81 |
OPCUaSubscription opcUaSubscription = new OPCUaSubscription( |
A |
82 |
miloService, |
|
83 |
daPassingStationCollectionService, |
|
84 |
collectionParamConfService, |
|
85 |
daParamCollectionService, |
5b755f
|
86 |
omProductionOrdeInfoService, |
C |
87 |
daTestDeviceInterfaceTempService); |
0ca254
|
88 |
|
A |
89 |
List<String> lists = getSubList(); |
|
90 |
System.out.println("订阅内容:"+lists); |
|
91 |
miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription); |
109e2f
|
92 |
|
0ca254
|
93 |
} |
A |
94 |
|
|
95 |
/** |
|
96 |
* 订阅内容 |
|
97 |
*/ |
|
98 |
public List<String> getSubList(){ |
109e2f
|
99 |
List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>() |
C |
100 |
.eq(DaOpcuaConfig::getState, Constants.USE_ING)) |
|
101 |
.stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
0ca254
|
102 |
return lists; |
A |
103 |
} |
|
104 |
} |
|
105 |
|