cl
2024-07-07 eda15ed46a021ae8ea988c9438b23b6a14359819
提交 | 用户 | 时间
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
eda15e 64         //模组工位List
C 65         Constants.ModuleList.add(Constants.OP110);
66         Constants.ModuleList.add(Constants.OP120);
67         Constants.ModuleList.add(Constants.OP130);
68         Constants.ModuleList.add(Constants.OP140);
69         Constants.ModuleList.add(Constants.OP150);
70         Constants.ModuleList.add(Constants.OP160);
71         Constants.ModuleList.add(Constants.OP170);
72         Constants.ModuleList.add(Constants.OP180);
73         Constants.ModuleList.add(Constants.OP210);
74         Constants.ModuleList.add(Constants.OP220);
75
0ca254 76         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
A 77                 miloService,
78                 daPassingStationCollectionService,
79                 collectionParamConfService,
80                 daParamCollectionService,
5b755f 81                 omProductionOrdeInfoService,
C 82                 daTestDeviceInterfaceTempService);
0ca254 83
A 84         List<String> lists = getSubList();
85         System.out.println("订阅内容:"+lists);
86         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
109e2f 87
0ca254 88     }
A 89
90     /**
91      * 订阅内容
92      */
93     public List<String> getSubList(){
109e2f 94         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
C 95                         .eq(DaOpcuaConfig::getState, Constants.USE_ING))
96                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
0ca254 97         return lists;
A 98     }
99 }
100