cl
2024-08-04 257bd3879f139cdf328e78158544130656c676fc
提交 | 用户 | 时间
b78728 1 package com.jcdm.main.plcserver;
A 2
3
4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 import com.jcdm.main.constant.Constants;
6 import com.jcdm.main.da.cellData.service.IDaCellDataService;
7 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
8 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
9 import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
10 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
11 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
12 import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
13 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
14 import com.jcdm.main.plcserver.sub.OPCUaSubscription;
15 import com.kangaroohy.milo.service.MiloService;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.boot.ApplicationArguments;
18 import org.springframework.boot.ApplicationRunner;
19 import org.springframework.stereotype.Component;
20
21 import java.util.List;
22 import java.util.stream.Collectors;
23
24 @Component
25 public class CustomRunner implements ApplicationRunner {
26
27     @Autowired
28     private MiloService miloService;
29
30     @Autowired
31     private IDaPassingStationCollectionService daPassingStationCollectionService;
32
33     @Autowired
34     private IDaCollectionParamConfService collectionParamConfService;
35
36     @Autowired
37     private IDaParamCollectionService daParamCollectionService;
38
39
40     @Autowired
41     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
42
43
44     @Autowired
45     private IDaOpcuaConfigService daOpcuaConfigService;
46
47     @Autowired
48     private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
49
50     @Autowired
51     private IDaCellDataService daCellDataService;
52
53     @Override
54     public void run(ApplicationArguments args) throws Exception {
55
f3862f 56         //PLC到MES物料转换
C 57         Constants.materialMap.put("1","9900199052A");
58         Constants.materialMap.put("2","9900199053B");
2b9842 59
257bd3 60         //通道
C 61         Constants.thoroughfareMap.put(Constants.OP040,"JCDM035-3");
62         Constants.thoroughfareMap.put(Constants.OP050,"JCDM035-3");
63         Constants.thoroughfareMap.put(Constants.OP060,"JCDM035-3");
64         Constants.thoroughfareMap.put(Constants.OP070,"JCDM035-3");
65         Constants.thoroughfareMap.put(Constants.OP080,"JCDM035-3");
66         Constants.thoroughfareMap.put(Constants.OP090,"JCDM035-3");
67         Constants.thoroughfareMap.put(Constants.OP100,"JCDM035-3");
68         Constants.thoroughfareMap.put(Constants.OP110,"JCDM035-3");
69
2b9842 70         //主线人工工位
C 71         Constants.OP040_OP160.add(Constants.OP040);
72         Constants.OP040_OP160.add(Constants.OP050);
73         Constants.OP040_OP160.add(Constants.OP060);
74         Constants.OP040_OP160.add(Constants.OP070);
75         Constants.OP040_OP160.add(Constants.OP080);
76
b78728 77         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
A 78                 miloService,
79                 daPassingStationCollectionService,
80                 collectionParamConfService,
81                 daParamCollectionService,
82                 omProductionOrdeInfoService,
83                 daTestDeviceInterfaceTempService,
84                 daCellDataService);
85
86         List<String> lists = getSubList();
87         System.out.println("订阅内容:"+lists);
88         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
89
90     }
91
92     /**
93      * 订阅内容
94      */
95     public List<String> getSubList(){
96         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
93dc3d 97                         .eq(DaOpcuaConfig::getState, Constants.USE_ING)
C 98                         .eq(DaOpcuaConfig::getSubscribe,Constants.YES))
b78728 99                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
A 100         return lists;
101     }
102 }
103