cl
2024-08-07 fd4ea6a620c5d079d3ee8ee30b943f3dea93f4eb
提交 | 用户 | 时间
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物料转换
fd4ea6 57         Constants.materialMap.put("1","9900200461");//微卡电驱动系统总成
C 58         Constants.materialMap.put("2","9900207783");//微面电驱动系统总成
2b9842 59
257bd3 60         //通道
ce7b04 61         Constants.thoroughfareMap.put(Constants.OP010,"JCDM035-1");
C 62
63         Constants.thoroughfareMap.put(Constants.OP020,"JCDM035-2");
64         Constants.thoroughfareMap.put(Constants.OP030,"JCDM035-2");
65         Constants.thoroughfareMap.put(Constants.OP120_2,"JCDM035-2");
66         Constants.thoroughfareMap.put(Constants.OP130,"JCDM035-2");
67         Constants.thoroughfareMap.put(Constants.OP140,"JCDM035-2");
68         Constants.thoroughfareMap.put(Constants.OP150,"JCDM035-2");
69         Constants.thoroughfareMap.put(Constants.OP160,"JCDM035-2");
70         Constants.thoroughfareMap.put(Constants.OP165,"JCDM035-2");
71
257bd3 72         Constants.thoroughfareMap.put(Constants.OP040,"JCDM035-3");
C 73         Constants.thoroughfareMap.put(Constants.OP050,"JCDM035-3");
74         Constants.thoroughfareMap.put(Constants.OP060,"JCDM035-3");
75         Constants.thoroughfareMap.put(Constants.OP070,"JCDM035-3");
76         Constants.thoroughfareMap.put(Constants.OP080,"JCDM035-3");
77         Constants.thoroughfareMap.put(Constants.OP090,"JCDM035-3");
78         Constants.thoroughfareMap.put(Constants.OP100,"JCDM035-3");
79         Constants.thoroughfareMap.put(Constants.OP110,"JCDM035-3");
80
ce7b04 81         Constants.thoroughfareMap.put(Constants.OP170,"JCDM035-4");
C 82         Constants.thoroughfareMap.put(Constants.OP180,"JCDM035-4");
83         Constants.thoroughfareMap.put(Constants.OP190,"JCDM035-4");
84         Constants.thoroughfareMap.put(Constants.OP200,"JCDM035-4");
85         Constants.thoroughfareMap.put(Constants.OP210,"JCDM035-4");
86         Constants.thoroughfareMap.put(Constants.OP220,"JCDM035-4");
87         Constants.thoroughfareMap.put(Constants.OP230,"JCDM035-4");
88
2b9842 89         //主线人工工位
C 90         Constants.OP040_OP160.add(Constants.OP040);
ce7b04 91         //Constants.OP040_OP160.add(Constants.OP060);
2b9842 92         Constants.OP040_OP160.add(Constants.OP070);
ce7b04 93         Constants.OP040_OP160.add(Constants.OP100);
C 94         Constants.OP040_OP160.add(Constants.OP120_2);
2b9842 95
b78728 96         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
A 97                 miloService,
98                 daPassingStationCollectionService,
99                 collectionParamConfService,
100                 daParamCollectionService,
101                 omProductionOrdeInfoService,
102                 daTestDeviceInterfaceTempService,
103                 daCellDataService);
104
105         List<String> lists = getSubList();
106         System.out.println("订阅内容:"+lists);
107         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
108
109     }
110
111     /**
112      * 订阅内容
113      */
114     public List<String> getSubList(){
115         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
93dc3d 116                         .eq(DaOpcuaConfig::getState, Constants.USE_ING)
C 117                         .eq(DaOpcuaConfig::getSubscribe,Constants.YES))
b78728 118                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
A 119         return lists;
120     }
121 }
122