提交 | 用户 | 时间
|
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; |
346fa4
|
12 |
import com.jcdm.main.da.psConf.service.IDaPsConfService; |
5b755f
|
13 |
import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; |
0ca254
|
14 |
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService; |
A |
15 |
import com.jcdm.main.plcserver.sub.OPCUaSubscription; |
|
16 |
import com.kangaroohy.milo.service.MiloService; |
|
17 |
import org.springframework.beans.factory.annotation.Autowired; |
|
18 |
import org.springframework.boot.ApplicationArguments; |
|
19 |
import org.springframework.boot.ApplicationRunner; |
|
20 |
import org.springframework.stereotype.Component; |
|
21 |
|
|
22 |
import java.util.List; |
109e2f
|
23 |
import java.util.stream.Collectors; |
0ca254
|
24 |
|
A |
25 |
@Component |
|
26 |
public class CustomRunner implements ApplicationRunner { |
|
27 |
|
|
28 |
@Autowired |
|
29 |
private MiloService miloService; |
|
30 |
|
|
31 |
@Autowired |
|
32 |
private IDaPassingStationCollectionService daPassingStationCollectionService; |
|
33 |
|
|
34 |
@Autowired |
|
35 |
private IDaCollectionParamConfService collectionParamConfService; |
|
36 |
|
|
37 |
@Autowired |
|
38 |
private IDaParamCollectionService daParamCollectionService; |
|
39 |
|
|
40 |
|
|
41 |
@Autowired |
|
42 |
private IOmProductionOrdeInfoService omProductionOrdeInfoService; |
|
43 |
|
109e2f
|
44 |
|
2de856
|
45 |
@Autowired |
109e2f
|
46 |
private IDaOpcuaConfigService daOpcuaConfigService; |
C |
47 |
|
5b755f
|
48 |
@Autowired |
C |
49 |
private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService; |
0ca254
|
50 |
|
93996d
|
51 |
@Autowired |
C |
52 |
private IDaCellDataService daCellDataService; |
|
53 |
|
346fa4
|
54 |
@Autowired |
C |
55 |
private IDaPsConfService daPsConfService; |
|
56 |
|
0ca254
|
57 |
@Override |
A |
58 |
public void run(ApplicationArguments args) throws Exception { |
884731
|
59 |
|
C |
60 |
//PLC到MES物料转换 |
|
61 |
Constants.materialMap.put("1","9900199052A"); |
|
62 |
Constants.materialMap.put("2","9900199053B"); |
|
63 |
|
e0c9c6
|
64 |
//分段010-090段 电芯工位 |
aa8ab9
|
65 |
Constants.OP020_OP090.add(Constants.OP020); |
C |
66 |
Constants.OP020_OP090.add(Constants.OP030); |
|
67 |
Constants.OP020_OP090.add(Constants.OP040); |
|
68 |
Constants.OP020_OP090.add(Constants.OP050); |
|
69 |
Constants.OP020_OP090.add(Constants.OP060); |
|
70 |
Constants.OP020_OP090.add(Constants.OP090); |
0ca254
|
71 |
|
e0c9c6
|
72 |
//人工工位 |
C |
73 |
Constants.OP100_OP150.add(Constants.OP100_1); |
|
74 |
Constants.OP100_OP150.add(Constants.OP100_2); |
884731
|
75 |
Constants.OP100_OP150.add(Constants.OP150); |
e0c9c6
|
76 |
|
eda15e
|
77 |
//模组工位List |
C |
78 |
Constants.ModuleList.add(Constants.OP110); |
|
79 |
Constants.ModuleList.add(Constants.OP120); |
|
80 |
Constants.ModuleList.add(Constants.OP130); |
|
81 |
Constants.ModuleList.add(Constants.OP140); |
58c9d4
|
82 |
//Constants.ModuleList.add(Constants.OP150); |
eda15e
|
83 |
Constants.ModuleList.add(Constants.OP160); |
C |
84 |
Constants.ModuleList.add(Constants.OP170); |
|
85 |
Constants.ModuleList.add(Constants.OP180); |
|
86 |
Constants.ModuleList.add(Constants.OP210); |
|
87 |
Constants.ModuleList.add(Constants.OP220); |
|
88 |
|
346fa4
|
89 |
getDate();//将日期放入MAP集合,1P1S用 |
C |
90 |
|
0ca254
|
91 |
OPCUaSubscription opcUaSubscription = new OPCUaSubscription( |
A |
92 |
miloService, |
|
93 |
daPassingStationCollectionService, |
|
94 |
collectionParamConfService, |
|
95 |
daParamCollectionService, |
5b755f
|
96 |
omProductionOrdeInfoService, |
ddf2c2
|
97 |
daTestDeviceInterfaceTempService, |
346fa4
|
98 |
daCellDataService, |
C |
99 |
daPsConfService); |
0ca254
|
100 |
|
A |
101 |
List<String> lists = getSubList(); |
|
102 |
System.out.println("订阅内容:"+lists); |
|
103 |
miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription); |
109e2f
|
104 |
|
0ca254
|
105 |
} |
A |
106 |
|
|
107 |
/** |
|
108 |
* 订阅内容 |
|
109 |
*/ |
|
110 |
public List<String> getSubList(){ |
109e2f
|
111 |
List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>() |
C |
112 |
.eq(DaOpcuaConfig::getState, Constants.USE_ING)) |
|
113 |
.stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
0ca254
|
114 |
return lists; |
A |
115 |
} |
346fa4
|
116 |
|
C |
117 |
/** |
|
118 |
* 将日期放入MAP集合,1P1S用 |
|
119 |
*/ |
|
120 |
public static void getDate(){ |
|
121 |
//年 |
|
122 |
Constants.YEARSMAP.put(2024,"E"); |
|
123 |
Constants.YEARSMAP.put(2025,"F"); |
|
124 |
Constants.YEARSMAP.put(2026,"G"); |
|
125 |
Constants.YEARSMAP.put(2027,"H"); |
|
126 |
Constants.YEARSMAP.put(2028,"J"); |
|
127 |
Constants.YEARSMAP.put(2029,"K"); |
|
128 |
Constants.YEARSMAP.put(2030,"L"); |
|
129 |
Constants.YEARSMAP.put(2031,"M"); |
|
130 |
Constants.YEARSMAP.put(2032,"N"); |
|
131 |
Constants.YEARSMAP.put(2033,"P"); |
|
132 |
Constants.YEARSMAP.put(2034,"R"); |
|
133 |
Constants.YEARSMAP.put(2035,"S"); |
|
134 |
Constants.YEARSMAP.put(2036,"T"); |
|
135 |
Constants.YEARSMAP.put(2037,"V"); |
|
136 |
Constants.YEARSMAP.put(2038,"W"); |
|
137 |
Constants.YEARSMAP.put(2039,"X"); |
|
138 |
Constants.YEARSMAP.put(2040,"Y"); |
|
139 |
|
|
140 |
//月 |
|
141 |
Constants.MONTHSMAP.put(1,"1"); |
|
142 |
Constants.MONTHSMAP.put(2,"2"); |
|
143 |
Constants.MONTHSMAP.put(3,"3"); |
|
144 |
Constants.MONTHSMAP.put(4,"4"); |
|
145 |
Constants.MONTHSMAP.put(5,"5"); |
|
146 |
Constants.MONTHSMAP.put(6,"6"); |
|
147 |
Constants.MONTHSMAP.put(7,"7"); |
|
148 |
Constants.MONTHSMAP.put(8,"8"); |
|
149 |
Constants.MONTHSMAP.put(9,"9"); |
|
150 |
Constants.MONTHSMAP.put(10,"A"); |
|
151 |
Constants.MONTHSMAP.put(11,"B"); |
|
152 |
Constants.MONTHSMAP.put(12,"C"); |
|
153 |
|
|
154 |
//日 |
|
155 |
Constants.DAYMAP.put(1,"1"); |
|
156 |
Constants.DAYMAP.put(2,"2"); |
|
157 |
Constants.DAYMAP.put(3,"3"); |
|
158 |
Constants.DAYMAP.put(4,"4"); |
|
159 |
Constants.DAYMAP.put(5,"5"); |
|
160 |
Constants.DAYMAP.put(6,"6"); |
|
161 |
Constants.DAYMAP.put(7,"7"); |
|
162 |
Constants.DAYMAP.put(8,"8"); |
|
163 |
Constants.DAYMAP.put(9,"9"); |
|
164 |
Constants.DAYMAP.put(10,"A"); |
|
165 |
Constants.DAYMAP.put(11,"B"); |
|
166 |
Constants.DAYMAP.put(12,"C"); |
|
167 |
Constants.DAYMAP.put(13,"D"); |
|
168 |
Constants.DAYMAP.put(14,"E"); |
|
169 |
Constants.DAYMAP.put(15,"F"); |
|
170 |
Constants.DAYMAP.put(16,"G"); |
|
171 |
Constants.DAYMAP.put(17,"H"); |
|
172 |
Constants.DAYMAP.put(18,"J"); |
|
173 |
Constants.DAYMAP.put(19,"K"); |
|
174 |
Constants.DAYMAP.put(20,"L"); |
|
175 |
Constants.DAYMAP.put(21,"M"); |
|
176 |
Constants.DAYMAP.put(22,"N"); |
|
177 |
Constants.DAYMAP.put(23,"P"); |
|
178 |
Constants.DAYMAP.put(24,"R"); |
|
179 |
Constants.DAYMAP.put(25,"S"); |
|
180 |
Constants.DAYMAP.put(26,"T"); |
|
181 |
Constants.DAYMAP.put(27,"V"); |
|
182 |
Constants.DAYMAP.put(28,"W"); |
|
183 |
Constants.DAYMAP.put(29,"X"); |
|
184 |
Constants.DAYMAP.put(30,"Y"); |
|
185 |
Constants.DAYMAP.put(31,"0"); |
|
186 |
|
|
187 |
} |
|
188 |
|
0ca254
|
189 |
} |
A |
190 |
|