提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.main.plcserver.sub; |
A |
2 |
|
|
3 |
|
|
4 |
import cn.hutool.core.collection.CollUtil; |
|
5 |
import cn.hutool.core.util.ObjectUtil; |
|
6 |
import cn.hutool.core.util.StrUtil; |
109e2f
|
7 |
import cn.hutool.http.HttpRequest; |
C |
8 |
import cn.hutool.http.HttpResponse; |
ef58b9
|
9 |
import cn.hutool.json.JSONObject; |
109e2f
|
10 |
import cn.hutool.json.JSONUtil; |
0ca254
|
11 |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
ef58b9
|
12 |
import com.jcdm.common.core.domain.AjaxResult; |
0ca254
|
13 |
import com.jcdm.framework.websocket.WebSocketUsers; |
A |
14 |
import com.jcdm.main.constant.Constants; |
ddf2c2
|
15 |
import com.jcdm.main.da.cellData.domain.DaCellData; |
C |
16 |
import com.jcdm.main.da.cellData.service.IDaCellDataService; |
0ca254
|
17 |
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
A |
18 |
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
|
19 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
|
20 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
|
21 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
|
22 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
5b755f
|
23 |
import com.jcdm.main.da.testDeviceInterfaceTemp.domain.DaTestDeviceInterfaceTemp; |
C |
24 |
import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; |
8c5c9c
|
25 |
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; |
0ca254
|
26 |
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService; |
8c5c9c
|
27 |
import com.jcdm.main.plcserver.util.TimeUtil; |
ef58b9
|
28 |
import com.jcdm.main.restful.factoryMes.service.RestfulService; |
0ca254
|
29 |
import com.jcdm.main.restful.qingYan.doman.ChildVO; |
A |
30 |
import com.jcdm.main.restful.qingYan.doman.ParentVO; |
|
31 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
|
32 |
import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; |
|
33 |
import com.kangaroohy.milo.service.MiloService; |
|
34 |
import lombok.extern.slf4j.Slf4j; |
109e2f
|
35 |
import org.springframework.beans.factory.annotation.Value; |
0ca254
|
36 |
import org.springframework.stereotype.Component; |
ef58b9
|
37 |
import org.springframework.web.bind.annotation.GetMapping; |
0ca254
|
38 |
|
A |
39 |
import javax.websocket.Session; |
|
40 |
import java.text.SimpleDateFormat; |
|
41 |
import java.util.*; |
109e2f
|
42 |
import java.util.concurrent.CompletableFuture; |
0ca254
|
43 |
import java.util.stream.Collectors; |
109e2f
|
44 |
|
0ca254
|
45 |
|
A |
46 |
@Slf4j |
|
47 |
@Component |
|
48 |
public class OPCUaSubscription implements SubscriptionCallback { |
|
49 |
|
8c5c9c
|
50 |
public static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
0ca254
|
51 |
|
A |
52 |
|
8c5c9c
|
53 |
Map<String, Session> map = WebSocketUsers.getUsers(); |
0ca254
|
54 |
public static MiloService miloService; |
A |
55 |
|
|
56 |
|
109e2f
|
57 |
public static IDaPassingStationCollectionService daPassingStationCollectionService; |
0ca254
|
58 |
|
A |
59 |
public static IDaCollectionParamConfService collectionParamConfService; |
|
60 |
|
|
61 |
public static IDaParamCollectionService daParamCollectionService; |
|
62 |
|
|
63 |
public static IOmProductionOrdeInfoService omProductionOrdeInfoService; |
|
64 |
|
5b755f
|
65 |
public static IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService; |
C |
66 |
|
ddf2c2
|
67 |
public static IDaCellDataService daCellDataService; |
C |
68 |
|
0d7433
|
69 |
/* @Value("${orderLineUrl}") |
C |
70 |
private static String orderLineUrl;*/ |
0ca254
|
71 |
|
A |
72 |
public OPCUaSubscription(MiloService miloService, |
|
73 |
IDaPassingStationCollectionService daPassingStationCollectionService, |
|
74 |
IDaCollectionParamConfService collectionParamConfService, |
|
75 |
IDaParamCollectionService daParamCollectionService, |
5b755f
|
76 |
IOmProductionOrdeInfoService omProductionOrdeInfoService, |
ddf2c2
|
77 |
IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService, |
C |
78 |
IDaCellDataService daCellDataService) { |
0ca254
|
79 |
OPCUaSubscription.miloService = miloService; |
109e2f
|
80 |
OPCUaSubscription.daPassingStationCollectionService = daPassingStationCollectionService; |
0ca254
|
81 |
OPCUaSubscription.collectionParamConfService = collectionParamConfService; |
A |
82 |
OPCUaSubscription.daParamCollectionService = daParamCollectionService; |
|
83 |
OPCUaSubscription.omProductionOrdeInfoService = omProductionOrdeInfoService; |
5b755f
|
84 |
OPCUaSubscription.daTestDeviceInterfaceTempService = daTestDeviceInterfaceTempService; |
ddf2c2
|
85 |
OPCUaSubscription.daCellDataService = daCellDataService; |
0ca254
|
86 |
} |
A |
87 |
|
|
88 |
|
|
89 |
@Override |
|
90 |
public void onSubscribe(String identifier, Object value) { |
109e2f
|
91 |
log.info("地址:"+identifier+"值:"+value); |
0ca254
|
92 |
try { |
109e2f
|
93 |
if(null != value && !Constants.ZERO.equals(value.toString())) { |
0ca254
|
94 |
String[] nodes = identifier.split("[.]"); |
A |
95 |
String thoroughfare = nodes[0];//通道 |
|
96 |
String device = nodes[1];//设备 |
|
97 |
String tab = nodes[2];//标记 |
109e2f
|
98 |
String valueString = value.toString();//地址值 |
e4f9cb
|
99 |
|
C |
100 |
CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
|
101 |
subHandle(thoroughfare,device,tab,valueString); |
|
102 |
}); |
|
103 |
|
|
104 |
} |
|
105 |
} catch (Exception e) { |
|
106 |
log.error(e.getMessage()); |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
public void subHandle(String thoroughfare,String device,String tab,String valueString){ |
|
111 |
try{ |
|
112 |
if (Constants.RECORD_CHECK_CODE.equals(tab)){//电芯校验 |
|
113 |
if (Constants.ONE.equals(valueString)){ |
|
114 |
Integer scanResult = 11; |
|
115 |
if (Constants.OP010.equals(device)){ |
|
116 |
//OP010工位电芯条码校验||OP030工位电芯条码校验 |
|
117 |
Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Scaner").getValue(); |
|
118 |
if (ObjectUtil.isNotNull(value1)){ |
|
119 |
String keyCode = value1.toString(); |
|
120 |
log.info("读取到工位{}的Scaner数据:{}",device,keyCode); |
|
121 |
//仅校验长度是否合格 |
109e2f
|
122 |
// List<KeyCodeCheck> collect = keyCodeCheckService.list().stream().filter(x -> x.getKeyCode().contains(keyCode)).collect(Collectors.toList()); |
C |
123 |
// if (CollUtil.isNotEmpty(collect)){ |
|
124 |
// scanResult = 11; |
0ca254
|
125 |
// } |
e4f9cb
|
126 |
} |
C |
127 |
}else if(Constants.OP030.equals(device)){ |
9411b2
|
128 |
Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Scaner").getValue();//电芯码 |
e4f9cb
|
129 |
if (ObjectUtil.isNotNull(value1)){ |
1f4b2e
|
130 |
//String cellCode = value1.toString(); |
86e4f5
|
131 |
scanResult = 11; |
C |
132 |
//反馈电芯ocv检测结果,这里不用再进行检测,只要码没问题就可以了 |
1f4b2e
|
133 |
/*boolean b = OCVResultFeedBack(thoroughfare, device,cellCode);//对替换电芯校验 |
e4f9cb
|
134 |
//四个电芯的状态 |
C |
135 |
if (b){ |
|
136 |
scanResult = 11; |
ec7e2a
|
137 |
}else { |
C |
138 |
scanResult = 12; |
1f4b2e
|
139 |
}*/ |
e4f9cb
|
140 |
}else { |
C |
141 |
scanResult = 12; |
0ca254
|
142 |
} |
A |
143 |
} |
e4f9cb
|
144 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ScanerResult1").value(scanResult).build()); |
C |
145 |
log.info("写入到工位{}的ScanerResult1数据:{}",device,scanResult); |
|
146 |
} |
|
147 |
}else if (Constants.RECORD_SN.equals(tab)){//求下发模组码请9 |
|
148 |
if (Constants.ONE.equals(valueString)){ |
|
149 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());//没有要生产的工单 |
|
150 |
} |
|
151 |
}else if (Constants.RECORD_DATA.equals(tab)){//出入站 |
ddf2c2
|
152 |
if (Constants.ONE.equals(valueString)){//入站 //1:告知MES托盘已到站,请求下发进站状态 |
C |
153 |
|
|
154 |
//OP020 电芯挡位校验 |
|
155 |
if (Constants.OP020.equals(device)){ |
|
156 |
Integer result = 11; |
|
157 |
Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue(); |
|
158 |
if (ObjectUtil.isNull(cellGearObjcet)){ |
|
159 |
result = 16;//电芯挡位为空 |
|
160 |
}else{ |
|
161 |
String cellGear = cellGearObjcet.toString(); |
b6959b
|
162 |
/* List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
C |
163 |
result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别*/ |
ddf2c2
|
164 |
} |
C |
165 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
|
166 |
|
|
167 |
}else if (Constants.OP030.equals(device)){ |
e4f9cb
|
168 |
//反馈电芯ocv检测结果 |
997e69
|
169 |
boolean b = OCVResultFeedBack(thoroughfare, device);//进站对4个电芯校验 |
e4f9cb
|
170 |
//四个电芯的状态 |
C |
171 |
if (b){ |
109e2f
|
172 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
C |
173 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,11); |
e4f9cb
|
174 |
}else { |
C |
175 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
|
176 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,12); |
109e2f
|
177 |
} |
e4f9cb
|
178 |
} else if(Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){ |
C |
179 |
//1、进站PLC给产品类型,MES读取产品类型 |
|
180 |
Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型 |
|
181 |
if (ObjectUtil.isNotNull(productTypeObjcet)){ |
|
182 |
String productType = productTypeObjcet.toString();//产品类型 |
35c489
|
183 |
String materialCode = Constants.materialMap.get(productType); |
6a53e6
|
184 |
//接收工单,保存到数据库,并且将工单传给PLC |
e7860c
|
185 |
CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
C |
186 |
receivingWorkOrders(thoroughfare, device,materialCode); |
|
187 |
}); |
e4f9cb
|
188 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
C |
189 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,11); |
|
190 |
}else{ |
|
191 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
|
192 |
} |
|
193 |
|
58c9d4
|
194 |
}else if (Constants.OP150.contains(device)){//人工工位 |
C |
195 |
Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue(); |
|
196 |
if (ObjectUtil.isNull(modulCodeObjcet)){ |
|
197 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
|
198 |
}else{ |
|
199 |
String productNum = modulCodeObjcet.toString(); |
|
200 |
//将产品SN发送到前台 |
|
201 |
productNum = "productNum,"+ productNum; |
|
202 |
WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); |
|
203 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
|
204 |
} |
e4f9cb
|
205 |
}else if (Constants.ModuleList.contains(device)){//有模组码的工位 |
C |
206 |
Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue(); |
|
207 |
if (ObjectUtil.isNull(modulCodeObjcet)){ |
|
208 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); |
|
209 |
}else{ |
|
210 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
0ca254
|
211 |
} |
109e2f
|
212 |
} |
e4f9cb
|
213 |
else { |
C |
214 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
|
215 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,11); |
0ca254
|
216 |
} |
e4f9cb
|
217 |
}else if (Constants.TWO.equals(valueString)){//出站 |
C |
218 |
//分段010-065段 |
|
219 |
if (Constants.OP010.equals(device)){ |
|
220 |
//010工位无过站记录,只给放行信号 |
|
221 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(21).build()); |
|
222 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,21); |
|
223 |
}else if (Constants.OP020_OP090.contains(device)){ |
|
224 |
Integer result = 21; |
|
225 |
//读取电芯码 |
|
226 |
List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
b59023
|
227 |
if(ObjectUtil.isNull(cellCodeList) || cellCodeList.size() != 4 ){ |
e4f9cb
|
228 |
result = 23; |
C |
229 |
}else{ |
09dec7
|
230 |
String cellCode1 = cellCodeList.get(0); |
C |
231 |
String cellCode2 = cellCodeList.get(1); |
|
232 |
String cellCode3 = cellCodeList.get(2); |
|
233 |
String cellCode4 = cellCodeList.get(3); |
|
234 |
if ((!cellCode1.isEmpty() && cellCode2.isEmpty()) || (cellCode1.isEmpty() && !cellCode2.isEmpty()) |
|
235 |
|| (!cellCode3.isEmpty() && cellCode4.isEmpty()) || (!cellCode4.isEmpty() && cellCode3.isEmpty())) { |
|
236 |
result = 23; |
|
237 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
|
238 |
return; |
b59023
|
239 |
} |
C |
240 |
|
e4f9cb
|
241 |
result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
C |
242 |
if(result == 21) { |
ddf2c2
|
243 |
if(Constants.OP020.contains(device)){ |
C |
244 |
if(!cellCode1.isEmpty()){ |
|
245 |
daCellDataService.deleteDaCellDataByGbCellCode(cellCode1); |
|
246 |
} |
|
247 |
if(!cellCode2.isEmpty()){ |
|
248 |
daCellDataService.deleteDaCellDataByGbCellCode(cellCode2); |
|
249 |
} |
|
250 |
if(!cellCode3.isEmpty()){ |
|
251 |
daCellDataService.deleteDaCellDataByGbCellCode(cellCode3); |
|
252 |
} |
|
253 |
if(!cellCode4.isEmpty()){ |
|
254 |
daCellDataService.deleteDaCellDataByGbCellCode(cellCode4); |
|
255 |
} |
|
256 |
}else if(Constants.OP030.contains(device)){ |
|
257 |
if(!cellCode1.isEmpty()){ |
|
258 |
daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode1); |
|
259 |
} |
|
260 |
if(!cellCode2.isEmpty()){ |
|
261 |
daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode2); |
|
262 |
} |
|
263 |
if(!cellCode3.isEmpty()){ |
|
264 |
daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode3); |
|
265 |
} |
|
266 |
if(!cellCode4.isEmpty()) { |
|
267 |
daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode4); |
|
268 |
} |
052a06
|
269 |
} |
069a9b
|
270 |
result = saveParamCollection(device,cellCodeList);//保存参数,发送工厂MES |
e4f9cb
|
271 |
} |
052a06
|
272 |
|
e4f9cb
|
273 |
} |
052a06
|
274 |
|
e4f9cb
|
275 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
C |
276 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,result); |
|
277 |
} else if (Constants.OP100_OP150.contains(device)){//人工工位 |
|
278 |
WebSocketUsers.sendMessageToUserByText(map.get(device), "END"); |
|
279 |
} else { |
|
280 |
Integer result = 21; |
13a2a4
|
281 |
//Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型 |
e4f9cb
|
282 |
Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue(); |
C |
283 |
if (ObjectUtil.isNull(modulCodeObjcet)){ |
|
284 |
result = 23; |
|
285 |
}else{ |
|
286 |
String moduleCode = modulCodeObjcet.toString(); |
069a9b
|
287 |
Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址 |
C |
288 |
if (ObjectUtil.isNotNull(stationStatusObjcet)){ |
|
289 |
String stationStatus = stationStatusObjcet.toString(); |
|
290 |
result = savePassingStation(thoroughfare, device,moduleCode,stationStatus);//保存过站 |
|
291 |
if(result == 21) { |
|
292 |
result = saveParamCollection(device,moduleCode,stationStatus);//保存参数,发送工厂MES |
|
293 |
} |
|
294 |
}else{ |
|
295 |
result = 23; |
|
296 |
log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
e4f9cb
|
297 |
} |
069a9b
|
298 |
|
e4f9cb
|
299 |
} |
C |
300 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
|
301 |
log.info("写入到工位{}的RecordDataDone数据:{}",device,result); |
|
302 |
} |
|
303 |
} |
0ca254
|
304 |
} |
e4f9cb
|
305 |
}catch (Exception e) { |
8c5c9c
|
306 |
log.error(e.getMessage()); |
0ca254
|
307 |
} |
A |
308 |
} |
4878fe
|
309 |
|
e7860c
|
310 |
public synchronized void receivingWorkOrders(String thoroughfare ,String device ,String materialCode) |
ef58b9
|
311 |
{ |
C |
312 |
try { |
4d7a57
|
313 |
//先查询表中是否有剩余工单 |
C |
314 |
List<OmProductionOrdeInfo> orderList = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>() |
|
315 |
.eq(OmProductionOrdeInfo::getOrderStatus, Constants.ONE) |
|
316 |
.eq(OmProductionOrdeInfo::getStationCode,device)//工位 |
|
317 |
.eq(OmProductionOrdeInfo::getProductCode,materialCode));//产品类型 |
|
318 |
if (CollUtil.isNotEmpty(orderList)){ |
|
319 |
Long id = orderList.get(0).getId(); |
|
320 |
String productNum = orderList.get(0).getProductNum();//模组码 |
|
321 |
String orderNum = orderList.get(0).getWorkOrderNo(); |
|
322 |
|
58c9d4
|
323 |
//下发产品模组码 |
C |
324 |
miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build()); |
|
325 |
miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build()); |
ef58b9
|
326 |
|
58c9d4
|
327 |
//将产品SN发送到前台 |
C |
328 |
productNum = "productNum,"+ productNum; |
|
329 |
WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); |
4d7a57
|
330 |
}else{ |
C |
331 |
// 查询最新的工单信息 |
|
332 |
OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder(); |
ef58b9
|
333 |
|
4d7a57
|
334 |
log.info("请求工厂MES工单:入参device{},materialCode:{}", device, materialCode); |
C |
335 |
String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode); |
0a65c6
|
336 |
log.info("请求工厂MES工单:出参pack:{}", orderJsonString); |
C |
337 |
|
4d7a57
|
338 |
JSONObject jsonObject = new JSONObject(orderJsonString); |
C |
339 |
// 从JSONObject中获取data对象 |
|
340 |
JSONObject dataObject = jsonObject.getJSONObject("data"); |
|
341 |
String code = jsonObject.getStr("code"); |
|
342 |
// 判断接单是否成功 |
|
343 |
if(code.equals("success")) { |
|
344 |
OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo(); |
|
345 |
omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum")); |
|
346 |
omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum")); |
|
347 |
omProductionOrdeInfo.setStationCode(device); |
|
348 |
omProductionOrdeInfo.setProductCode(dataObject.getStr("materialCode")); |
|
349 |
omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity"))); |
|
350 |
omProductionOrdeInfo.setOnlineCompletionMark("0"); |
|
351 |
omProductionOrdeInfo.setSfResult("0"); |
|
352 |
omProductionOrdeInfo.setProductModel(dataObject.getStr("model")); |
|
353 |
omProductionOrdeInfo.setCreateTime(new Date()); |
|
354 |
omProductionOrdeInfo.setCreateUser("工厂MES"); |
|
355 |
omProductionOrdeInfoService.save(omProductionOrdeInfo); |
|
356 |
|
|
357 |
String productNum = dataObject.getStr("productNum"); |
|
358 |
String orderNum = dataObject.getStr("productionOrderNum"); |
|
359 |
//下发产品模组码 |
|
360 |
miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build()); |
|
361 |
miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build()); |
|
362 |
|
|
363 |
//将产品SN发送到前台 |
|
364 |
productNum = "productNum,"+ productNum; |
|
365 |
WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); |
|
366 |
} |
ef58b9
|
367 |
} |
4d7a57
|
368 |
|
ef58b9
|
369 |
} catch (Exception e) { |
C |
370 |
throw new RuntimeException(e); |
|
371 |
} |
35c489
|
372 |
} |
0ca254
|
373 |
|
A |
374 |
/** |
109e2f
|
375 |
* 读取电芯码 |
C |
376 |
* @param thoroughfare 通道 |
|
377 |
* @param device 工位 |
|
378 |
* @return list |
|
379 |
* @throws Exception e |
0ca254
|
380 |
*/ |
109e2f
|
381 |
private static List<String> readCellCodeList(String thoroughfare, String device){ |
C |
382 |
List<String> cellCodeList = new ArrayList<>(); |
2de856
|
383 |
Map map = new HashMap(); |
109e2f
|
384 |
//电芯码地址 |
C |
385 |
List<String> readList = new ArrayList<>(); |
|
386 |
readList.add(thoroughfare + "." + device +".CellCode_1"); |
|
387 |
readList.add(thoroughfare + "." + device +".CellCode_2"); |
|
388 |
readList.add(thoroughfare + "." + device +".CellCode_3"); |
|
389 |
readList.add(thoroughfare + "." + device +".CellCode_4"); |
0ca254
|
390 |
try { |
109e2f
|
391 |
List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(readList);//电芯码 |
C |
392 |
for (ReadWriteEntity readWriteEntity : readWriteEntityList) { |
b59023
|
393 |
if (ObjectUtil.isNotNull(readWriteEntity.getValue()) && !readWriteEntity.getValue().toString().trim().isEmpty()){ |
2de856
|
394 |
cellCodeList.add(readWriteEntity.getValue().toString());//封装电芯码 |
b59023
|
395 |
}else{ |
2de856
|
396 |
cellCodeList.add("");//封装电芯码 |
b59023
|
397 |
} |
0ca254
|
398 |
} |
2de856
|
399 |
|
0ca254
|
400 |
} catch (Exception e) { |
A |
401 |
throw new RuntimeException(e); |
|
402 |
} |
109e2f
|
403 |
return cellCodeList; |
2de856
|
404 |
} |
C |
405 |
|
|
406 |
|
|
407 |
/** |
|
408 |
* 保存过站数据 |
|
409 |
* @param thoroughfare 通道 |
|
410 |
* @param device 工位 |
|
411 |
* @param moduleCode 模组号 |
069a9b
|
412 |
* @param stationStatus 站状态 |
2de856
|
413 |
* @return list |
C |
414 |
* @throws Exception e |
|
415 |
*/ |
069a9b
|
416 |
private static Integer savePassingStation(String thoroughfare, String device,String moduleCode,String stationStatus){ |
2de856
|
417 |
Integer result = 21; |
C |
418 |
|
|
419 |
try { |
|
420 |
//读进站时间 |
|
421 |
Date startTime = new Date(); |
|
422 |
ReadWriteEntity startTimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StartTime");//进站时间 |
|
423 |
if (ObjectUtil.isNotNull(startTimeRead.getValue())){ |
|
424 |
startTime = format.parse(TimeUtil.test(TimeUtil.stringProcessing(startTimeRead.getValue().toString()))); |
|
425 |
}else{ |
|
426 |
result = 23; |
|
427 |
log.info("读取到工位{}的StartTime数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
|
428 |
return result; |
|
429 |
} |
|
430 |
|
|
431 |
DaPassingStationCollection passingStationCollection = new DaPassingStationCollection(); |
|
432 |
passingStationCollection.setSfcCode(moduleCode);//电芯码 |
|
433 |
passingStationCollection.setLocationCode(device);//工位 |
|
434 |
passingStationCollection.setInboundTime(startTime);//进站时间 |
|
435 |
passingStationCollection.setOutboundTime(new Date());//出站时间 |
|
436 |
passingStationCollection.setOutRsSign(stationStatus);//站状态值 |
|
437 |
passingStationCollection.setCollectionTime(new Date());//采集时间 |
|
438 |
daPassingStationCollectionService.save(passingStationCollection); |
|
439 |
|
|
440 |
} catch (Exception e) { |
|
441 |
throw new RuntimeException(e); |
|
442 |
} |
|
443 |
|
|
444 |
return result; |
0ca254
|
445 |
} |
A |
446 |
|
109e2f
|
447 |
/** |
C |
448 |
* 保存过站数据 |
|
449 |
* @param thoroughfare 通道 |
|
450 |
* @param device 工位 |
|
451 |
* @param cellCodeList 电芯码集合 |
|
452 |
* @return list |
|
453 |
* @throws Exception e |
|
454 |
*/ |
|
455 |
private static Integer savePassingStation(String thoroughfare, String device,List<String> cellCodeList){ |
|
456 |
Integer result = 21; |
|
457 |
|
|
458 |
try { |
|
459 |
//读进站时间 |
|
460 |
Date startTime = new Date(); |
|
461 |
ReadWriteEntity startTimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StartTime");//进站时间 |
|
462 |
if (ObjectUtil.isNotNull(startTimeRead.getValue())){ |
8c5c9c
|
463 |
startTime = format.parse(TimeUtil.test(TimeUtil.stringProcessing(startTimeRead.getValue().toString()))); |
109e2f
|
464 |
}else{ |
C |
465 |
result = 23; |
|
466 |
log.info("读取到工位{}的StartTime数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
2de856
|
467 |
return result; |
109e2f
|
468 |
} |
C |
469 |
|
|
470 |
//读工站状态 |
|
471 |
String stationStatus = Constants.PASS; |
|
472 |
ReadWriteEntity stationStatusRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus");//站状态地址 |
|
473 |
if (ObjectUtil.isNotNull(stationStatusRead.getValue())){ |
|
474 |
String string = stationStatusRead.getValue().toString(); |
|
475 |
if (Constants.TWO.equals(string)){ |
|
476 |
stationStatus = Constants.UN_PASS; |
|
477 |
} |
|
478 |
}else{ |
|
479 |
result = 23; |
2de856
|
480 |
log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
C |
481 |
return result; |
109e2f
|
482 |
} |
C |
483 |
|
|
484 |
List<DaPassingStationCollection> passingList = new ArrayList<>(); |
|
485 |
for (String cellCode : cellCodeList) { |
|
486 |
DaPassingStationCollection passingStationCollection = new DaPassingStationCollection(); |
2de856
|
487 |
if (ObjectUtil.isNotNull(cellCode) && !cellCode.isEmpty()){ |
109e2f
|
488 |
passingStationCollection.setSfcCode(cellCode);//电芯码 |
C |
489 |
passingStationCollection.setLocationCode(device);//工位 |
|
490 |
passingStationCollection.setInboundTime(startTime);//进站时间 |
|
491 |
passingStationCollection.setOutboundTime(new Date());//出站时间 |
|
492 |
passingStationCollection.setOutRsSign(stationStatus);//站状态值 |
|
493 |
passingStationCollection.setCollectionTime(new Date());//采集时间 |
|
494 |
passingList.add(passingStationCollection); |
|
495 |
} |
|
496 |
} |
|
497 |
|
|
498 |
if (CollUtil.isNotEmpty(passingList)){ |
|
499 |
daPassingStationCollectionService.insertBatch(passingList);//存储过站采集数据 |
|
500 |
} |
|
501 |
|
|
502 |
} catch (Exception e) { |
|
503 |
throw new RuntimeException(e); |
|
504 |
} |
|
505 |
|
|
506 |
return result; |
|
507 |
} |
|
508 |
|
2de856
|
509 |
|
109e2f
|
510 |
/** |
2de856
|
511 |
* 保存参数数据和发送工厂MES |
C |
512 |
* @param device 工位 |
|
513 |
* @param moduleCode 模组号 |
069a9b
|
514 |
* @param stationStatus 站状态 |
2de856
|
515 |
* @return list |
C |
516 |
* @throws Exception e |
|
517 |
*/ |
069a9b
|
518 |
private static Integer saveParamCollection(String device,String moduleCode,String stationStatus){ |
2de856
|
519 |
Integer result = 21;//返回结果 |
5c62de
|
520 |
String sendMes = ""; |
2de856
|
521 |
|
C |
522 |
try { |
|
523 |
//查询参数配置表 |
|
524 |
List<DaCollectionParamConf> list = collectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
|
525 |
.eq(DaCollectionParamConf::getProcessesCode, device)//工位 |
|
526 |
.eq(DaCollectionParamConf::getWhetherToCollect, Constants.ONE)//是否采集 |
|
527 |
); |
|
528 |
if (CollUtil.isNotEmpty(list)){ |
|
529 |
|
|
530 |
List<String> collect = list.stream() |
|
531 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
532 |
List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(collect); |
|
533 |
|
|
534 |
List<DaParamCollection> collectionList = new ArrayList<>(); |
|
535 |
List<ChildVO> mesList = new ArrayList<>(); |
|
536 |
for (int i = 0; i < readWriteEntityList.size(); i++) { |
|
537 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
538 |
daParamCollection.setSfcCode(moduleCode);//模组码 |
|
539 |
daParamCollection.setParamCode(list.get(i).getCollectParameterId());//参数编码 |
|
540 |
daParamCollection.setParamName(list.get(i).getCollectParameterName());//参数名称 |
|
541 |
String paramValue = ""; |
|
542 |
if (ObjectUtil.isNotNull(readWriteEntityList.get(i).getValue())){ |
|
543 |
paramValue = readWriteEntityList.get(i).getValue().toString();//参数值 |
e0c9c6
|
544 |
if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ |
C |
545 |
paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString(); |
aa5f09
|
546 |
}else if("MODEL".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ |
C |
547 |
paramValue = Constants.materialMap.get(paramValue); |
e0c9c6
|
548 |
} |
2de856
|
549 |
} |
C |
550 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
551 |
daParamCollection.setLocationCode(device);//工位 |
|
552 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
553 |
collectionList.add(daParamCollection);//封装参数采集list |
|
554 |
|
|
555 |
//发送给工厂mes参数封装 |
|
556 |
ChildVO childVO = new ChildVO(); |
|
557 |
childVO.setItemCode(list.get(i).getCollectParameterId());//参数编码 |
|
558 |
childVO.setItemType(list.get(i).getItemType()); |
|
559 |
childVO.setItemValue(paramValue);//参数值 |
|
560 |
childVO.setItemText(list.get(i).getCollectParameterName()); |
|
561 |
childVO.setCheckResult("1"); |
e0c9c6
|
562 |
childVO.setCheckTime(format.format(new Date())); |
2de856
|
563 |
mesList.add(childVO); |
C |
564 |
} |
|
565 |
|
|
566 |
CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
|
567 |
//插入参数采集表 |
|
568 |
daParamCollectionService.insertBatch(collectionList); |
997e69
|
569 |
|
9a5ab9
|
570 |
//如果220工位,进行报工,因为上层系统只支持6位,所有报工工位修改为M1P220 |
05181b
|
571 |
if(Constants.OP220.equals(device)) { |
9a5ab9
|
572 |
getWorkReportResultFeedback(moduleCode, "M1P220", format.format(new Date())); |
997e69
|
573 |
} |
C |
574 |
|
2de856
|
575 |
//上传到工厂mes |
C |
576 |
ParentVO parentVO = new ParentVO(); |
|
577 |
parentVO.setStationCode(device);//工位 |
|
578 |
parentVO.setSiteCode("3983"); |
|
579 |
|
|
580 |
parentVO.setRecordId(UUID.randomUUID().toString()); |
997e69
|
581 |
if("2".equals(stationStatus)){//工站状态 |
069a9b
|
582 |
parentVO.setTotalResult("0"); |
C |
583 |
}else { |
|
584 |
parentVO.setTotalResult("1"); |
|
585 |
} |
2de856
|
586 |
parentVO.setProductNum(moduleCode); |
5fbc7a
|
587 |
|
C |
588 |
//添加基础数据 |
06168f
|
589 |
List<ChildVO> basicList = getCollectParamBasicData(device,moduleCode); |
5fbc7a
|
590 |
mesList.addAll(basicList); |
C |
591 |
|
2de856
|
592 |
parentVO.setCheckList(mesList); |
C |
593 |
|
e4f9cb
|
594 |
log.info("执行工厂MES方法start,工位号{} 传入数据:{}",device ,parentVO); |
971788
|
595 |
HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); |
e4f9cb
|
596 |
log.info("执行工厂MES方法end,工位号{} 返回数据:{}",device,execute.body()); |
2de856
|
597 |
|
C |
598 |
}); |
|
599 |
} |
|
600 |
}catch (Exception e) { |
|
601 |
throw new RuntimeException(e); |
|
602 |
} |
|
603 |
return result; |
|
604 |
} |
|
605 |
|
|
606 |
/** |
|
607 |
* 保存参数数据和发送工厂MES |
109e2f
|
608 |
* @param device 工位 |
C |
609 |
* @param cellCodeList 电芯码集合 |
|
610 |
* @return list |
|
611 |
* @throws Exception e |
|
612 |
*/ |
069a9b
|
613 |
private static Integer saveParamCollection(String device,List<String> cellCodeList){ |
109e2f
|
614 |
Integer result = 21;//返回结果 |
743e2e
|
615 |
List<ChildVO> mesChildList1 = new ArrayList<>();//封装给工厂MES发送的childlist1 |
C |
616 |
List<ChildVO> mesChildList2 = new ArrayList<>();//封装给工厂MES发送的childlist2 |
|
617 |
List<ChildVO> mesChildList3 = new ArrayList<>();//封装给工厂MES发送的childlist3 |
|
618 |
List<ChildVO> mesChildList4 = new ArrayList<>();//封装给工厂MES发送的childlist4 |
|
619 |
List<ChildVO> mesChildList0 = new ArrayList<>();//封装给工厂MES发送的childlist4 |
109e2f
|
620 |
try { |
C |
621 |
//查询参数配置表 |
|
622 |
List<DaCollectionParamConf> list = collectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
|
623 |
.eq(DaCollectionParamConf::getProcessesCode, device)//工位 |
8c5c9c
|
624 |
.eq(DaCollectionParamConf::getWhetherToCollect, Constants.ONE)//是否采集 |
2de856
|
625 |
);//类型 |
109e2f
|
626 |
if (CollUtil.isNotEmpty(list)) { |
C |
627 |
List<DaParamCollection> saveParamList = new ArrayList<>();//封装参数采集list |
|
628 |
List<DaCollectionParamConf> confColl1 = list.stream().filter(x -> Constants.INT_ONE.equals(x.getKeyNum())).collect(Collectors.toList()); |
|
629 |
List<DaCollectionParamConf> confColl2 = list.stream().filter(x -> Constants.INT_TWO.equals(x.getKeyNum())).collect(Collectors.toList()); |
|
630 |
List<DaCollectionParamConf> confColl3 = list.stream().filter(x -> Constants.INT_THREE.equals(x.getKeyNum())).collect(Collectors.toList()); |
|
631 |
List<DaCollectionParamConf> confColl4 = list.stream().filter(x -> Constants.INT_FOUR.equals(x.getKeyNum())).collect(Collectors.toList()); |
|
632 |
List<DaCollectionParamConf> confColl0 = list.stream().filter(x -> Constants.INT_ZERO.equals(x.getKeyNum())).collect(Collectors.toList()); |
|
633 |
|
|
634 |
List<String> collect1 = confColl1.stream() |
|
635 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
636 |
List<ReadWriteEntity> paramCollectionList1 = miloService.readFromOpcUa(collect1);//电芯1 参数值 |
|
637 |
|
|
638 |
List<String> collect2 = confColl2.stream() |
|
639 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
640 |
List<ReadWriteEntity> paramCollectionList2 = miloService.readFromOpcUa(collect2);//电芯2 参数值 |
|
641 |
|
|
642 |
List<String> collect3 = confColl3.stream() |
|
643 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
644 |
List<ReadWriteEntity> paramCollectionList3 = miloService.readFromOpcUa(collect3);//电芯3 参数值 |
|
645 |
|
|
646 |
List<String> collect4 = confColl4.stream() |
|
647 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
648 |
List<ReadWriteEntity> paramCollectionList4 = miloService.readFromOpcUa(collect4);//电芯4 参数值 |
|
649 |
|
|
650 |
List<String> collect0 = confColl0.stream() |
|
651 |
.map(DaCollectionParamConf::getGatherAddress).collect(Collectors.toList()); |
|
652 |
List<ReadWriteEntity> paramCollectionList0 = miloService.readFromOpcUa(collect0);//电芯 参数值 |
|
653 |
|
|
654 |
//第一个电芯的数据 |
2de856
|
655 |
if (CollUtil.isNotEmpty(paramCollectionList1) && !cellCodeList.get(0).isEmpty()) { |
109e2f
|
656 |
for (int i = 0; i < paramCollectionList1.size(); i++) { |
C |
657 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
658 |
daParamCollection.setSfcCode(cellCodeList.get(0));//电芯码 |
|
659 |
daParamCollection.setParamCode(confColl1.get(i).getCollectParameterId());//参数编码 |
|
660 |
daParamCollection.setParamName(confColl1.get(i).getCollectParameterName());//参数名称 |
|
661 |
String paramValue = ""; |
|
662 |
if (ObjectUtil.isNotNull(paramCollectionList1.get(i).getValue())) { |
|
663 |
paramValue = paramCollectionList1.get(i).getValue().toString();//参数值 |
|
664 |
} |
|
665 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
666 |
daParamCollection.setLocationCode(device);//工位 |
|
667 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
668 |
saveParamList.add(daParamCollection);//封装参数采集list |
|
669 |
|
|
670 |
//发送给工厂mes参数封装 |
|
671 |
ChildVO childVO = new ChildVO(); |
e4f9cb
|
672 |
childVO.setItemCode(confColl1.get(i).getCollectParameterId());//参数 |
109e2f
|
673 |
childVO.setItemType(confColl1.get(i).getItemType()); |
C |
674 |
childVO.setItemValue(paramValue);//参数值 |
e4f9cb
|
675 |
childVO.setItemText(confColl1.get(i).getCollectParameterName()); |
109e2f
|
676 |
childVO.setCheckResult("1"); |
e0c9c6
|
677 |
childVO.setCheckTime(format.format(new Date())); |
109e2f
|
678 |
mesChildList1.add(childVO); |
C |
679 |
} |
743e2e
|
680 |
|
109e2f
|
681 |
} |
2de856
|
682 |
if (CollUtil.isNotEmpty(paramCollectionList2) && !cellCodeList.get(1).isEmpty()) { |
109e2f
|
683 |
|
C |
684 |
for (int i = 0; i < paramCollectionList2.size(); i++) { |
|
685 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
686 |
daParamCollection.setSfcCode(cellCodeList.get(1));//电芯码 |
|
687 |
daParamCollection.setParamCode(confColl2.get(i).getCollectParameterId());//参数编码 |
|
688 |
daParamCollection.setParamName(confColl2.get(i).getCollectParameterName());//参数名称 |
|
689 |
String paramValue = ""; |
|
690 |
if (ObjectUtil.isNotNull(paramCollectionList2.get(i).getValue())) { |
|
691 |
paramValue = paramCollectionList2.get(i).getValue().toString();//参数值 |
|
692 |
} |
|
693 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
694 |
daParamCollection.setLocationCode(device);//工位 |
|
695 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
696 |
saveParamList.add(daParamCollection);//封装参数采集list |
|
697 |
|
|
698 |
//发送给工厂mes参数封装 |
|
699 |
ChildVO childVO = new ChildVO(); |
e4f9cb
|
700 |
childVO.setItemCode(confColl2.get(i).getCollectParameterId());//参数 |
109e2f
|
701 |
childVO.setItemType(confColl2.get(i).getItemType()); |
C |
702 |
childVO.setItemValue(paramValue);//参数值 |
e4f9cb
|
703 |
childVO.setItemText(confColl2.get(i).getCollectParameterName()); |
109e2f
|
704 |
childVO.setCheckResult("1"); |
e0c9c6
|
705 |
childVO.setCheckTime(format.format(new Date())); |
109e2f
|
706 |
mesChildList2.add(childVO); |
C |
707 |
} |
|
708 |
} |
2de856
|
709 |
if (CollUtil.isNotEmpty(paramCollectionList3) && !cellCodeList.get(2).isEmpty()) { |
109e2f
|
710 |
for (int i = 0; i < paramCollectionList3.size(); i++) { |
C |
711 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
712 |
daParamCollection.setSfcCode(cellCodeList.get(2));//电芯码 |
|
713 |
daParamCollection.setParamCode(confColl3.get(i).getCollectParameterId());//参数编码 |
|
714 |
daParamCollection.setParamName(confColl3.get(i).getCollectParameterName());//参数名称 |
|
715 |
String paramValue = ""; |
|
716 |
if (ObjectUtil.isNotNull(paramCollectionList3.get(i).getValue())) { |
|
717 |
paramValue = paramCollectionList3.get(i).getValue().toString();//参数值 |
|
718 |
} |
|
719 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
720 |
daParamCollection.setLocationCode(device);//工位 |
|
721 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
722 |
saveParamList.add(daParamCollection);//封装参数采集list |
|
723 |
|
|
724 |
//发送给工厂mes参数封装 |
|
725 |
ChildVO childVO = new ChildVO(); |
e4f9cb
|
726 |
childVO.setItemCode(confColl3.get(i).getCollectParameterId());//参数 |
109e2f
|
727 |
childVO.setItemType(confColl3.get(i).getItemType()); |
C |
728 |
childVO.setItemValue(paramValue);//参数值 |
e4f9cb
|
729 |
childVO.setItemText(confColl3.get(i).getCollectParameterName()); |
109e2f
|
730 |
childVO.setCheckResult("1"); |
e0c9c6
|
731 |
childVO.setCheckTime(format.format(new Date())); |
109e2f
|
732 |
mesChildList3.add(childVO); |
C |
733 |
} |
|
734 |
} |
2de856
|
735 |
if (CollUtil.isNotEmpty(paramCollectionList4)&& !cellCodeList.get(3).isEmpty()) { |
109e2f
|
736 |
for (int i = 0; i < paramCollectionList4.size(); i++) { |
C |
737 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
738 |
daParamCollection.setSfcCode(cellCodeList.get(3));//电芯码 |
|
739 |
daParamCollection.setParamCode(confColl4.get(i).getCollectParameterId());//参数编码 |
|
740 |
daParamCollection.setParamName(confColl4.get(i).getCollectParameterName());//参数名称 |
|
741 |
String paramValue = ""; |
|
742 |
if (ObjectUtil.isNotNull(paramCollectionList4.get(i).getValue())) { |
|
743 |
paramValue = paramCollectionList4.get(i).getValue().toString();//参数值 |
|
744 |
} |
|
745 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
746 |
daParamCollection.setLocationCode(device);//工位 |
|
747 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
748 |
saveParamList.add(daParamCollection);//封装参数采集list |
|
749 |
|
|
750 |
//发送给工厂mes参数封装 |
|
751 |
ChildVO childVO = new ChildVO(); |
e4f9cb
|
752 |
childVO.setItemCode(confColl4.get(i).getCollectParameterId());//参数 |
109e2f
|
753 |
childVO.setItemType(confColl4.get(i).getItemType()); |
C |
754 |
childVO.setItemValue(paramValue);//参数值 |
e4f9cb
|
755 |
childVO.setItemText(confColl4.get(i).getCollectParameterName()); |
109e2f
|
756 |
childVO.setCheckResult("1"); |
e0c9c6
|
757 |
childVO.setCheckTime(format.format(new Date())); |
109e2f
|
758 |
mesChildList4.add(childVO); |
C |
759 |
} |
|
760 |
} |
|
761 |
|
|
762 |
//公共参数 |
|
763 |
if (CollUtil.isNotEmpty(paramCollectionList0)) { |
|
764 |
for (int i = 0; i < cellCodeList.size(); i++) {//循环4个电芯 |
2de856
|
765 |
if(!cellCodeList.get(i).isEmpty()){ |
C |
766 |
for (int j = 0; j < paramCollectionList0.size(); j++) { |
|
767 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
768 |
daParamCollection.setSfcCode(cellCodeList.get(i));//电芯码 |
|
769 |
daParamCollection.setParamCode(confColl0.get(j).getCollectParameterId());//参数编码 |
|
770 |
daParamCollection.setParamName(confColl0.get(j).getCollectParameterName());//参数名称 |
|
771 |
String paramValue = ""; |
|
772 |
if (ObjectUtil.isNotNull(paramCollectionList0.get(j).getValue())) { |
|
773 |
paramValue = paramCollectionList0.get(j).getValue().toString();//参数值 |
e0c9c6
|
774 |
if("DATE".equals(confColl0.get(j).getCollectParameterType()) && !paramValue.isEmpty()){ |
C |
775 |
paramValue = TimeUtil.test(TimeUtil.stringProcessing(paramValue)); |
|
776 |
} |
2de856
|
777 |
} |
C |
778 |
daParamCollection.setParamValue(paramValue);//参数值 |
|
779 |
daParamCollection.setLocationCode(device);//工位 |
|
780 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
781 |
saveParamList.add(daParamCollection); |
109e2f
|
782 |
|
2de856
|
783 |
//发送给工厂mes参数封装 |
C |
784 |
ChildVO childVO = new ChildVO(); |
e4f9cb
|
785 |
childVO.setItemCode(confColl0.get(j).getCollectParameterId());//参数 |
2de856
|
786 |
childVO.setItemType(confColl0.get(j).getItemType()); |
C |
787 |
childVO.setItemValue(paramValue);//参数值 |
e4f9cb
|
788 |
childVO.setItemText(confColl0.get(j).getCollectParameterName()); |
2de856
|
789 |
childVO.setCheckResult("1"); |
e0c9c6
|
790 |
childVO.setCheckTime(format.format(new Date())); |
2de856
|
791 |
mesChildList0.add(childVO); |
C |
792 |
} |
109e2f
|
793 |
} |
2de856
|
794 |
|
C |
795 |
//mesList.get(i).addAll(mesChildList0); |
|
796 |
|
109e2f
|
797 |
} |
C |
798 |
|
|
799 |
} |
|
800 |
|
|
801 |
CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
|
802 |
//插入参数采集表 |
|
803 |
daParamCollectionService.insertBatch(saveParamList); |
|
804 |
//上传到工厂mes |
|
805 |
ParentVO parentVO = new ParentVO(); |
|
806 |
parentVO.setStationCode(device);//工位 |
|
807 |
parentVO.setSiteCode("3983"); |
|
808 |
for (int i = 0; i < cellCodeList.size(); i++) {//循环4个电芯 |
2de856
|
809 |
if(!cellCodeList.get(i).isEmpty()){ |
8e2102
|
810 |
parentVO.setRecordId(UUID.randomUUID().toString()); |
C |
811 |
parentVO.setTotalResult("1"); |
2de856
|
812 |
parentVO.setProductNum(cellCodeList.get(i));//电芯码 |
743e2e
|
813 |
//封装给工厂MES发送的childlist4 |
C |
814 |
List<ChildVO> mesChildList = new ArrayList<>(mesChildList0); |
|
815 |
switch (i) { |
|
816 |
case 0 : |
|
817 |
mesChildList.addAll(mesChildList1); |
|
818 |
break; |
|
819 |
case 1 : |
|
820 |
mesChildList.addAll(mesChildList2); |
|
821 |
break; |
|
822 |
case 2 : |
|
823 |
mesChildList.addAll(mesChildList3); |
|
824 |
break; |
|
825 |
case 3 : |
|
826 |
mesChildList.addAll(mesChildList4); |
|
827 |
break; |
|
828 |
|
|
829 |
} |
5fbc7a
|
830 |
|
C |
831 |
//添加基础数据 |
06168f
|
832 |
List<ChildVO> basicList = getCollectParamBasicData(device,cellCodeList.get(i)); |
5fbc7a
|
833 |
mesChildList.addAll(basicList); |
C |
834 |
|
743e2e
|
835 |
parentVO.setCheckList(mesChildList);//参数 |
2de856
|
836 |
//CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
C |
837 |
log.info("执行工厂MES方法start,传入数据:{}",parentVO); |
971788
|
838 |
HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); |
2de856
|
839 |
log.info("执行工厂MES方法end,返回数据:{}",execute.body()); |
C |
840 |
} |
109e2f
|
841 |
} |
C |
842 |
}); |
|
843 |
} |
|
844 |
}catch (Exception e) { |
743e2e
|
845 |
log.error(e.getMessage()); |
109e2f
|
846 |
throw new RuntimeException(e); |
C |
847 |
} |
|
848 |
return result; |
|
849 |
} |
|
850 |
|
|
851 |
/** |
ddf2c2
|
852 |
* OP020校验电芯挡位 |
C |
853 |
* @param thoroughfare |
|
854 |
* @param device |
|
855 |
* @throws Exception |
|
856 |
*/ |
|
857 |
private Integer checkCellGear(String thoroughfare, String device,List<String> cellCodeList,String cellGear) throws Exception { |
|
858 |
Integer result = 11; |
|
859 |
|
|
860 |
for(int i = 0; i < cellCodeList.size(); i ++){ |
|
861 |
Integer cellStatus = 1; |
|
862 |
String cellCode = cellCodeList.get(i); |
|
863 |
if(!cellCode.isEmpty()){ |
|
864 |
List<DaCellData> list = daCellDataService.list(new LambdaQueryWrapper<DaCellData>() |
|
865 |
.eq(DaCellData::getGbCellCode,cellCode)); |
|
866 |
if(CollUtil.isNotEmpty(list)){ |
|
867 |
DaCellData daCellData = list.get(0); |
|
868 |
String cellValue = daCellData.getCellValue();//数据库中电芯挡位 |
|
869 |
String cellSerial = daCellData.getCellSerial();//数据库中电芯组别 |
|
870 |
if(!cellValue.isEmpty() && cellValue.equals(cellGear)){ |
|
871 |
cellStatus = 1; |
|
872 |
}else { |
|
873 |
cellStatus = 2; |
|
874 |
result = 17;//挡位校验不合格 |
|
875 |
} |
|
876 |
}else { |
|
877 |
cellStatus = 2; |
|
878 |
result = 17;//查不到要校验的挡位 |
|
879 |
} |
|
880 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_"+(i+1)).value(cellStatus).build()); |
|
881 |
} |
|
882 |
} |
|
883 |
return result; |
|
884 |
} |
|
885 |
|
ec7e2a
|
886 |
/** |
C |
887 |
* 030工位返回ocv测试结果 |
|
888 |
* @param thoroughfare |
|
889 |
* @param device |
6a53e6
|
890 |
* @param cellCode |
C |
891 |
* @throws Exception |
|
892 |
*/ |
|
893 |
private boolean OCVResultFeedBack(String thoroughfare, String device,String cellCode) throws Exception { |
|
894 |
boolean flag = true; |
|
895 |
List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>() |
|
896 |
.eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode) |
|
897 |
.orderByDesc(DaTestDeviceInterfaceTemp::getCreateTime) |
|
898 |
); |
|
899 |
if (CollUtil.isNotEmpty(list)){ |
|
900 |
DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0); |
|
901 |
if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){ |
|
902 |
flag = true; |
|
903 |
}else { |
|
904 |
flag = false; |
|
905 |
} |
|
906 |
//daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode); |
|
907 |
}else { |
|
908 |
flag = false; |
|
909 |
log.info("读取到工位{},测试设备返回的数据查询不到,电芯码为:{}",device,cellCode); |
|
910 |
} |
|
911 |
return flag; |
|
912 |
} |
|
913 |
/** |
|
914 |
* 030工位返回ocv测试结果 |
|
915 |
* @param thoroughfare |
|
916 |
* @param device |
109e2f
|
917 |
* @throws Exception |
C |
918 |
*/ |
2de856
|
919 |
private boolean OCVResultFeedBack(String thoroughfare, String device) throws Exception { |
C |
920 |
boolean flag = true; |
|
921 |
Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_1").getValue(); |
5b755f
|
922 |
if (ObjectUtil.isNotNull(value1)){ |
C |
923 |
String cellCode = value1.toString(); |
|
924 |
List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>() |
5f0f21
|
925 |
.eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode) |
A |
926 |
.orderByDesc(DaTestDeviceInterfaceTemp::getCreateTime) |
|
927 |
); |
2de856
|
928 |
if (CollUtil.isNotEmpty(list)){ |
5f0f21
|
929 |
DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0); |
5b755f
|
930 |
if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){ |
2de856
|
931 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(1).build()); |
C |
932 |
}else { |
|
933 |
flag = false; |
|
934 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(2).build()); |
|
935 |
} |
052a06
|
936 |
//daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode); |
86e4f5
|
937 |
}else { |
C |
938 |
flag = false; |
a6cddf
|
939 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(5).build()); |
86e4f5
|
940 |
log.info("读取到工位{},OP020工位没有给测试结果",device); |
2de856
|
941 |
} |
f18ebf
|
942 |
}else { |
C |
943 |
flag = false; |
a6cddf
|
944 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_1").value(5).build()); |
f18ebf
|
945 |
log.info("读取到工位{},PLC没有给电芯码",device); |
5b755f
|
946 |
} |
2de856
|
947 |
Object value2 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_2").getValue(); |
5b755f
|
948 |
if (ObjectUtil.isNotNull(value2)){ |
C |
949 |
String cellCode = value2.toString(); |
|
950 |
List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>() |
3bbfe1
|
951 |
.eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode) |
A |
952 |
.orderByDesc(DaTestDeviceInterfaceTemp::getCreateTime) |
|
953 |
); |
2de856
|
954 |
if (CollUtil.isNotEmpty(list)){ |
3bbfe1
|
955 |
DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0); |
5b755f
|
956 |
if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){ |
2de856
|
957 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(1).build()); |
C |
958 |
}else { |
|
959 |
flag = false; |
|
960 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(2).build()); |
|
961 |
} |
052a06
|
962 |
//daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode); |
86e4f5
|
963 |
}else { |
C |
964 |
flag = false; |
a6cddf
|
965 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(5).build()); |
86e4f5
|
966 |
log.info("读取到工位{},OP020工位没有给测试结果",device); |
2de856
|
967 |
} |
f18ebf
|
968 |
}else { |
C |
969 |
flag = false; |
a6cddf
|
970 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_2").value(5).build()); |
f18ebf
|
971 |
log.info("读取到工位{},PLC没有给电芯码",device); |
5b755f
|
972 |
} |
C |
973 |
|
2de856
|
974 |
Object value3 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_3").getValue(); |
5b755f
|
975 |
if (ObjectUtil.isNotNull(value3)){ |
C |
976 |
String cellCode = value3.toString(); |
|
977 |
List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>() |
3bbfe1
|
978 |
.eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode) |
A |
979 |
.orderByDesc(DaTestDeviceInterfaceTemp::getCreateTime) |
|
980 |
); |
2de856
|
981 |
if (CollUtil.isNotEmpty(list)){ |
3bbfe1
|
982 |
DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0); |
5b755f
|
983 |
if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){ |
2de856
|
984 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(1).build()); |
C |
985 |
}else { |
|
986 |
flag = false; |
|
987 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(2).build()); |
|
988 |
} |
052a06
|
989 |
//daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode); |
86e4f5
|
990 |
}else { |
C |
991 |
flag = false; |
a6cddf
|
992 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(5).build()); |
86e4f5
|
993 |
log.info("读取到工位{},OP020工位没有给测试结果",device); |
2de856
|
994 |
} |
f18ebf
|
995 |
}else { |
C |
996 |
flag = false; |
a6cddf
|
997 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_3").value(5).build()); |
f18ebf
|
998 |
log.info("读取到工位{},PLC没有给电芯码",device); |
5b755f
|
999 |
} |
C |
1000 |
|
2de856
|
1001 |
Object value4 = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellCode_4").getValue(); |
5b755f
|
1002 |
if (ObjectUtil.isNotNull(value4)){ |
C |
1003 |
String cellCode = value4.toString(); |
|
1004 |
List<DaTestDeviceInterfaceTemp> list = daTestDeviceInterfaceTempService.list(new LambdaQueryWrapper<DaTestDeviceInterfaceTemp>() |
3bbfe1
|
1005 |
.eq(DaTestDeviceInterfaceTemp::getProductNum,cellCode) |
A |
1006 |
.orderByDesc(DaTestDeviceInterfaceTemp::getCreateTime) |
|
1007 |
); |
2de856
|
1008 |
if (CollUtil.isNotEmpty(list)){ |
3bbfe1
|
1009 |
DaTestDeviceInterfaceTemp daTestDeviceInterfaceTemp = list.get(0); |
5b755f
|
1010 |
if (Constants.ONE.equals(daTestDeviceInterfaceTemp.getTotalResult())){ |
2de856
|
1011 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(1).build()); |
C |
1012 |
}else { |
|
1013 |
flag = false; |
|
1014 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(2).build()); |
|
1015 |
} |
052a06
|
1016 |
//daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode); |
86e4f5
|
1017 |
}else { |
C |
1018 |
flag = false; |
a6cddf
|
1019 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(5).build()); |
86e4f5
|
1020 |
log.info("读取到工位{},OP020工位没有给测试结果",device); |
2de856
|
1021 |
} |
f18ebf
|
1022 |
}else { |
C |
1023 |
flag = false; |
a6cddf
|
1024 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_4").value(5).build()); |
f18ebf
|
1025 |
log.info("读取到工位{},PLC没有给电芯码",device); |
5b755f
|
1026 |
} |
C |
1027 |
|
2de856
|
1028 |
return flag; |
109e2f
|
1029 |
} |
C |
1030 |
|
997e69
|
1031 |
/** |
C |
1032 |
* AMES报工结果回传 |
|
1033 |
* @param productNum |
|
1034 |
* @param stationCode |
|
1035 |
* @param confirmTime |
|
1036 |
* @return |
|
1037 |
*/ |
|
1038 |
//{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"} |
|
1039 |
public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) |
|
1040 |
{ |
|
1041 |
String result = ""; |
|
1042 |
try { |
|
1043 |
String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
|
1044 |
HttpResponse response = HttpRequest.get(url).execute(); |
|
1045 |
HttpRequest httpRequest = HttpRequest.get(url); |
|
1046 |
result = response.body(); |
|
1047 |
}catch (Exception e){ |
aa5f09
|
1048 |
throw new RuntimeException(e); |
997e69
|
1049 |
}finally { |
C |
1050 |
return result; |
|
1051 |
} |
|
1052 |
} |
|
1053 |
|
109e2f
|
1054 |
|
aa5f09
|
1055 |
/** |
C |
1056 |
* 获取采集参数基础数据 |
|
1057 |
* @param stationCode |
06168f
|
1058 |
* @param sfcCode |
aa5f09
|
1059 |
* @return list |
C |
1060 |
*/ |
06168f
|
1061 |
public static List<ChildVO> getCollectParamBasicData(String stationCode,String sfcCode) { |
aa5f09
|
1062 |
List<ChildVO> basicList = new ArrayList<>(); |
06168f
|
1063 |
List<DaParamCollection> collectionList = new ArrayList<>(); |
aa5f09
|
1064 |
try { |
C |
1065 |
//查询参数配置表 |
|
1066 |
List<DaCollectionParamConf> list = collectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
|
1067 |
.eq(DaCollectionParamConf::getProcessesCode, stationCode)//工位 |
|
1068 |
.eq(DaCollectionParamConf::getCollectParameterType, "BASIC")//采集参数类型 |
|
1069 |
); |
|
1070 |
if (CollUtil.isNotEmpty(list)){ |
|
1071 |
for(DaCollectionParamConf conf:list){ |
0a65c6
|
1072 |
//1P1S生成 |
C |
1073 |
if(conf.getCollectParameterId().equals("OCV_1P1SMID")){ |
|
1074 |
String result = ""; |
|
1075 |
conf.setParamCentral(result); |
|
1076 |
} |
aa5f09
|
1077 |
ChildVO childVO = new ChildVO(); |
C |
1078 |
childVO.setItemCode(conf.getCollectParameterId());//参数 |
|
1079 |
childVO.setItemType(conf.getItemType()); |
|
1080 |
childVO.setItemValue(conf.getParamCentral());//参数值 |
|
1081 |
childVO.setItemText(conf.getCollectParameterName()); |
|
1082 |
childVO.setCheckResult("1"); |
|
1083 |
childVO.setCheckTime(format.format(new Date())); |
|
1084 |
basicList.add(childVO); |
06168f
|
1085 |
|
C |
1086 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
1087 |
daParamCollection.setSfcCode(sfcCode);//模组码 |
|
1088 |
daParamCollection.setParamCode(conf.getCollectParameterId());//参数编码 |
|
1089 |
daParamCollection.setParamName(conf.getCollectParameterName());//参数名称 |
|
1090 |
|
|
1091 |
daParamCollection.setParamValue(conf.getParamCentral());//参数值 |
|
1092 |
daParamCollection.setLocationCode(stationCode);//工位 |
|
1093 |
daParamCollection.setCollectionTime(new Date());//采集时间 |
|
1094 |
collectionList.add(daParamCollection);//封装参数采集list |
aa5f09
|
1095 |
} |
06168f
|
1096 |
daParamCollectionService.insertBatch(collectionList); |
aa5f09
|
1097 |
} |
C |
1098 |
return basicList; |
|
1099 |
}catch (Exception e) { |
|
1100 |
throw new RuntimeException(e); |
|
1101 |
} |
|
1102 |
} |
|
1103 |
|
|
1104 |
|
|
1105 |
|
0ca254
|
1106 |
} |