提交 | 用户 | 时间
|
3e03af
|
1 |
package com.jcdm.main.plcserver; |
C |
2 |
|
|
3 |
|
9e6d86
|
4 |
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
W |
5 |
import com.jcdm.main.bs.technologyRouteChild.service.IBsTechnologyRouteChildInfoService; |
3e03af
|
6 |
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
059083
|
7 |
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig; |
W |
8 |
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService; |
3e03af
|
9 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
059083
|
10 |
import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl; |
3e03af
|
11 |
import com.jcdm.main.plcserver.sub.OPCUaSubscription; |
9e6d86
|
12 |
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService; |
3e03af
|
13 |
import com.kangaroohy.milo.service.MiloService; |
C |
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.boot.ApplicationArguments; |
|
16 |
import org.springframework.boot.ApplicationRunner; |
|
17 |
import org.springframework.stereotype.Component; |
|
18 |
|
059083
|
19 |
import javax.annotation.Resource; |
3e03af
|
20 |
import java.util.List; |
059083
|
21 |
import java.util.stream.Collectors; |
3e03af
|
22 |
|
C |
23 |
@Component |
|
24 |
public class CustomRunner implements ApplicationRunner { |
|
25 |
|
|
26 |
@Autowired |
|
27 |
public MiloService miloService; |
|
28 |
|
|
29 |
@Autowired |
|
30 |
public IDaCollectionParamConfService collectionParamConfService; |
|
31 |
|
|
32 |
@Autowired |
|
33 |
public IDaParamCollectionService daParamCollectionService; |
|
34 |
|
059083
|
35 |
@Resource |
W |
36 |
private DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl; |
|
37 |
|
|
38 |
@Resource |
|
39 |
private IDaOpcuaConfigService iDaOpcuaConfigService; |
|
40 |
|
9e6d86
|
41 |
@Resource |
W |
42 |
private IBsOrderSchedulingService bsOrderSchedulingService; |
|
43 |
|
|
44 |
@Resource |
|
45 |
private IRmRepairRecordService rmRepairRecordService; |
|
46 |
|
|
47 |
@Resource |
|
48 |
private IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService; |
|
49 |
|
3e03af
|
50 |
@Override |
C |
51 |
public void run(ApplicationArguments args) throws Exception { |
|
52 |
|
059083
|
53 |
List<DaOpcuaConfig> lists = getSubList(); |
W |
54 |
List<String> collect = lists.stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
3e03af
|
55 |
OPCUaSubscription opcUaSubscription = new OPCUaSubscription( |
C |
56 |
miloService, |
|
57 |
collectionParamConfService, |
9e6d86
|
58 |
daParamCollectionService, |
W |
59 |
passingStationCollectionServiceImpl, |
|
60 |
bsOrderSchedulingService, |
|
61 |
lists, |
|
62 |
rmRepairRecordService, |
|
63 |
bsTechnologyRouteChildInfoService); |
3e03af
|
64 |
|
059083
|
65 |
|
W |
66 |
miloService.subscriptionFromOpcUa(collect,opcUaSubscription); |
3e03af
|
67 |
|
C |
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* 订阅内容 |
|
72 |
*/ |
059083
|
73 |
public List<DaOpcuaConfig> getSubList(){ |
W |
74 |
DaOpcuaConfig config = new DaOpcuaConfig(); |
9e6d86
|
75 |
config.setState(1L); |
059083
|
76 |
List<DaOpcuaConfig> list = iDaOpcuaConfigService.selectDaOpcuaConfigList(config); |
W |
77 |
// List<String> lists = new ArrayList<>(); |
|
78 |
// if (CollUtil.isNotEmpty(list)){ |
|
79 |
// lists = list.stream().map(DaOpcuaConfig::getNode).distinct().collect(Collectors.toList()); |
|
80 |
// } |
|
81 |
// List<String> lists = new ArrayList<>(); |
|
82 |
//// lists.add(OPCElement.OP010_SaveRequest);//请求保存 |
|
83 |
//// lists.add(OPCElement.OP010_CodeCheck);//请求检索条码 |
|
84 |
//// lists.add(OPCElement.OP020_SaveRequest);//请求保存 |
|
85 |
// lists.add(OPCElement.OP120_SaveRequestLast);//请求保存 |
|
86 |
// lists.add(OPCElement.OP120_ZZ_CODE_CHECK);//请求保存 |
|
87 |
return list; |
3e03af
|
88 |
} |
C |
89 |
} |
|
90 |
|