cl
2024-08-07 346fa4579d97d115f9737fb5be0417896c454596
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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.psConf.service.IDaPsConfService;
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;
 
    @Autowired
    private IDaPsConfService daPsConfService;
 
    @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);
 
        getDate();//将日期放入MAP集合,1P1S用
 
        OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
                miloService,
                daPassingStationCollectionService,
                collectionParamConfService,
                daParamCollectionService,
                omProductionOrdeInfoService,
                daTestDeviceInterfaceTempService,
                daCellDataService,
                daPsConfService);
 
        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;
    }
 
    /**
     * 将日期放入MAP集合,1P1S用
     */
    public static  void getDate(){
        //年
        Constants.YEARSMAP.put(2024,"E");
        Constants.YEARSMAP.put(2025,"F");
        Constants.YEARSMAP.put(2026,"G");
        Constants.YEARSMAP.put(2027,"H");
        Constants.YEARSMAP.put(2028,"J");
        Constants.YEARSMAP.put(2029,"K");
        Constants.YEARSMAP.put(2030,"L");
        Constants.YEARSMAP.put(2031,"M");
        Constants.YEARSMAP.put(2032,"N");
        Constants.YEARSMAP.put(2033,"P");
        Constants.YEARSMAP.put(2034,"R");
        Constants.YEARSMAP.put(2035,"S");
        Constants.YEARSMAP.put(2036,"T");
        Constants.YEARSMAP.put(2037,"V");
        Constants.YEARSMAP.put(2038,"W");
        Constants.YEARSMAP.put(2039,"X");
        Constants.YEARSMAP.put(2040,"Y");
 
        //月
        Constants.MONTHSMAP.put(1,"1");
        Constants.MONTHSMAP.put(2,"2");
        Constants.MONTHSMAP.put(3,"3");
        Constants.MONTHSMAP.put(4,"4");
        Constants.MONTHSMAP.put(5,"5");
        Constants.MONTHSMAP.put(6,"6");
        Constants.MONTHSMAP.put(7,"7");
        Constants.MONTHSMAP.put(8,"8");
        Constants.MONTHSMAP.put(9,"9");
        Constants.MONTHSMAP.put(10,"A");
        Constants.MONTHSMAP.put(11,"B");
        Constants.MONTHSMAP.put(12,"C");
 
        //日
        Constants.DAYMAP.put(1,"1");
        Constants.DAYMAP.put(2,"2");
        Constants.DAYMAP.put(3,"3");
        Constants.DAYMAP.put(4,"4");
        Constants.DAYMAP.put(5,"5");
        Constants.DAYMAP.put(6,"6");
        Constants.DAYMAP.put(7,"7");
        Constants.DAYMAP.put(8,"8");
        Constants.DAYMAP.put(9,"9");
        Constants.DAYMAP.put(10,"A");
        Constants.DAYMAP.put(11,"B");
        Constants.DAYMAP.put(12,"C");
        Constants.DAYMAP.put(13,"D");
        Constants.DAYMAP.put(14,"E");
        Constants.DAYMAP.put(15,"F");
        Constants.DAYMAP.put(16,"G");
        Constants.DAYMAP.put(17,"H");
        Constants.DAYMAP.put(18,"J");
        Constants.DAYMAP.put(19,"K");
        Constants.DAYMAP.put(20,"L");
        Constants.DAYMAP.put(21,"M");
        Constants.DAYMAP.put(22,"N");
        Constants.DAYMAP.put(23,"P");
        Constants.DAYMAP.put(24,"R");
        Constants.DAYMAP.put(25,"S");
        Constants.DAYMAP.put(26,"T");
        Constants.DAYMAP.put(27,"V");
        Constants.DAYMAP.put(28,"W");
        Constants.DAYMAP.put(29,"X");
        Constants.DAYMAP.put(30,"Y");
        Constants.DAYMAP.put(31,"0");
 
    }
 
}