cl
2024-07-05 8e3998d3a3b55eb493a290df869187110b47fe78
提交 | 用户 | 时间
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 {
109e2f 51         //分段010-065段
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
A 59         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
60                 miloService,
61                 daPassingStationCollectionService,
62                 collectionParamConfService,
63                 daParamCollectionService,
5b755f 64                 omProductionOrdeInfoService,
C 65                 daTestDeviceInterfaceTempService);
0ca254 66
A 67         List<String> lists = getSubList();
68         System.out.println("订阅内容:"+lists);
69         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
109e2f 70
0ca254 71     }
A 72
73     /**
74      * 订阅内容
75      */
76     public List<String> getSubList(){
109e2f 77         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
C 78                         .eq(DaOpcuaConfig::getState, Constants.USE_ING))
79                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
0ca254 80         return lists;
A 81     }
82 }
83