cl
2024-07-19 8e210282102b8808d8e7ea218368f1d41f448eb4
提交 | 用户 | 时间
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;
93996d 6 import com.jcdm.main.da.cellData.service.IDaCellDataService;
0ca254 7 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
109e2f 8 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
C 9 import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
0ca254 10 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
A 11 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
5b755f 12 import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
0ca254 13 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
A 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;
109e2f 22 import java.util.stream.Collectors;
0ca254 23
A 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
109e2f 43
2de856 44     @Autowired
109e2f 45     private IDaOpcuaConfigService daOpcuaConfigService;
C 46
5b755f 47     @Autowired
C 48     private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
0ca254 49
93996d 50     @Autowired
C 51     private IDaCellDataService daCellDataService;
52
0ca254 53     @Override
A 54     public void run(ApplicationArguments args) throws Exception {
884731 55
C 56         //PLC到MES物料转换
57         Constants.materialMap.put("1","9900199052A");
58         Constants.materialMap.put("2","9900199053B");
59
e0c9c6 60         //分段010-090段 电芯工位
aa8ab9 61         Constants.OP020_OP090.add(Constants.OP020);
C 62         Constants.OP020_OP090.add(Constants.OP030);
63         Constants.OP020_OP090.add(Constants.OP040);
64         Constants.OP020_OP090.add(Constants.OP050);
65         Constants.OP020_OP090.add(Constants.OP060);
66         Constants.OP020_OP090.add(Constants.OP090);
0ca254 67
e0c9c6 68         //人工工位
C 69         Constants.OP100_OP150.add(Constants.OP100_1);
70         Constants.OP100_OP150.add(Constants.OP100_2);
884731 71         Constants.OP100_OP150.add(Constants.OP150);
e0c9c6 72
eda15e 73         //模组工位List
C 74         Constants.ModuleList.add(Constants.OP110);
75         Constants.ModuleList.add(Constants.OP120);
76         Constants.ModuleList.add(Constants.OP130);
77         Constants.ModuleList.add(Constants.OP140);
58c9d4 78         //Constants.ModuleList.add(Constants.OP150);
eda15e 79         Constants.ModuleList.add(Constants.OP160);
C 80         Constants.ModuleList.add(Constants.OP170);
81         Constants.ModuleList.add(Constants.OP180);
82         Constants.ModuleList.add(Constants.OP210);
83         Constants.ModuleList.add(Constants.OP220);
84
0ca254 85         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
A 86                 miloService,
87                 daPassingStationCollectionService,
88                 collectionParamConfService,
89                 daParamCollectionService,
5b755f 90                 omProductionOrdeInfoService,
8e2102 91                 daTestDeviceInterfaceTempService/*,
C 92                 daCellDataService*/);
0ca254 93
A 94         List<String> lists = getSubList();
95         System.out.println("订阅内容:"+lists);
96         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
109e2f 97
0ca254 98     }
A 99
100     /**
101      * 订阅内容
102      */
103     public List<String> getSubList(){
109e2f 104         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
C 105                         .eq(DaOpcuaConfig::getState, Constants.USE_ING))
106                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
0ca254 107         return lists;
A 108     }
109 }
110