cl
2024-07-21 ddf2c28b00b38469c9119dcad42d986f849bc62d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.jcdm.main.plcserver;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jcdm.main.constant.Constants;
import com.jcdm.main.da.cellData.service.IDaCellDataService;
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
import com.jcdm.main.plcserver.sub.OPCUaSubscription;
import com.kangaroohy.milo.service.MiloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
 
import java.util.List;
import java.util.stream.Collectors;
 
@Component
public class CustomRunner implements ApplicationRunner {
 
    @Autowired
    private MiloService miloService;
 
    @Autowired
    private IDaPassingStationCollectionService daPassingStationCollectionService;
 
    @Autowired
    private IDaCollectionParamConfService collectionParamConfService;
 
    @Autowired
    private IDaParamCollectionService daParamCollectionService;
 
 
    @Autowired
    private IOmProductionOrdeInfoService omProductionOrdeInfoService;
 
 
    @Autowired
    private IDaOpcuaConfigService daOpcuaConfigService;
 
    @Autowired
    private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
 
    @Autowired
    private IDaCellDataService daCellDataService;
 
    @Override
    public void run(ApplicationArguments args) throws Exception {
 
        //PLC到MES物料转换
        Constants.materialMap.put("1","9900199052A");
        Constants.materialMap.put("2","9900199053B");
 
        //分段010-090段 电芯工位
        Constants.OP020_OP090.add(Constants.OP020);
        Constants.OP020_OP090.add(Constants.OP030);
        Constants.OP020_OP090.add(Constants.OP040);
        Constants.OP020_OP090.add(Constants.OP050);
        Constants.OP020_OP090.add(Constants.OP060);
        Constants.OP020_OP090.add(Constants.OP090);
 
        //人工工位
        Constants.OP100_OP150.add(Constants.OP100_1);
        Constants.OP100_OP150.add(Constants.OP100_2);
        Constants.OP100_OP150.add(Constants.OP150);
 
        //模组工位List
        Constants.ModuleList.add(Constants.OP110);
        Constants.ModuleList.add(Constants.OP120);
        Constants.ModuleList.add(Constants.OP130);
        Constants.ModuleList.add(Constants.OP140);
        //Constants.ModuleList.add(Constants.OP150);
        Constants.ModuleList.add(Constants.OP160);
        Constants.ModuleList.add(Constants.OP170);
        Constants.ModuleList.add(Constants.OP180);
        Constants.ModuleList.add(Constants.OP210);
        Constants.ModuleList.add(Constants.OP220);
 
        OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
                miloService,
                daPassingStationCollectionService,
                collectionParamConfService,
                daParamCollectionService,
                omProductionOrdeInfoService,
                daTestDeviceInterfaceTempService,
                daCellDataService);
 
        List<String> lists = getSubList();
        System.out.println("订阅内容:"+lists);
        miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
 
    }
 
    /**
     * 订阅内容
     */
    public List<String> getSubList(){
        List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
                        .eq(DaOpcuaConfig::getState, Constants.USE_ING))
                .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
        return lists;
    }
}