提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.main.da.paramCollection.service.impl; |
懒 |
2 |
|
6a462f
|
3 |
import cn.hutool.core.collection.CollUtil; |
b64ed2
|
4 |
import cn.hutool.core.date.DateUtil; |
6a462f
|
5 |
import cn.hutool.core.util.StrUtil; |
8f0f8d
|
6 |
import cn.hutool.db.Db; |
6a462f
|
7 |
import cn.hutool.http.HttpRequest; |
W |
8 |
import cn.hutool.http.HttpResponse; |
|
9 |
import cn.hutool.json.JSONUtil; |
7bee80
|
10 |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
0ce25f
|
11 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
e57a89
|
12 |
import com.jcdm.common.utils.DateUtils; |
7bee80
|
13 |
import com.jcdm.main.bs.formula.service.IBsFormulaInfoService; |
懒 |
14 |
import com.jcdm.main.bs.formula.service.impl.BsFormulaInfoServiceImpl; |
b77c7b
|
15 |
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo; |
懒 |
16 |
import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper; |
7bee80
|
17 |
import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService; |
6a462f
|
18 |
import com.jcdm.main.constant.Constants; |
b64ed2
|
19 |
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
懒 |
20 |
import com.jcdm.main.da.collectionParamConf.mapper.DaCollectionParamConfMapper; |
5966d6
|
21 |
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
e57a89
|
22 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
懒 |
23 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
|
24 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
32483a
|
25 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
懒 |
26 |
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
|
27 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
054a69
|
28 |
import com.jcdm.main.plcserver.sub.OPCUaSubscription; |
6a462f
|
29 |
import com.jcdm.main.restful.qingYan.doman.ChildVO; |
W |
30 |
import com.jcdm.main.restful.qingYan.doman.ParentVO; |
32483a
|
31 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
懒 |
32 |
import com.kangaroohy.milo.service.MiloService; |
054a69
|
33 |
import org.apache.ibatis.session.ExecutorType; |
懒 |
34 |
import org.apache.ibatis.session.SqlSession; |
|
35 |
import org.apache.ibatis.session.SqlSessionFactory; |
e57a89
|
36 |
import org.springframework.beans.factory.annotation.Autowired; |
5966d6
|
37 |
import org.springframework.security.core.parameters.P; |
e57a89
|
38 |
import org.springframework.stereotype.Service; |
懒 |
39 |
|
054a69
|
40 |
import javax.annotation.Resource; |
5966d6
|
41 |
import java.text.SimpleDateFormat; |
A |
42 |
import java.time.Instant; |
b64ed2
|
43 |
import java.util.*; |
6a462f
|
44 |
import java.util.stream.Collectors; |
e57a89
|
45 |
|
懒 |
46 |
/** |
|
47 |
* 设备产品过程参数采集Service业务层处理 |
|
48 |
* |
|
49 |
* @author yyt |
|
50 |
* @date 2023-12-13 |
|
51 |
*/ |
|
52 |
@Service |
0ce25f
|
53 |
public class DaParamCollectionServiceImpl extends ServiceImpl<DaParamCollectionMapper,DaParamCollection> implements IDaParamCollectionService |
e57a89
|
54 |
{ |
懒 |
55 |
@Autowired |
|
56 |
private DaParamCollectionMapper daParamCollectionMapper; |
b64ed2
|
57 |
|
懒 |
58 |
@Autowired |
|
59 |
private DaCollectionParamConfMapper daCollectionParamConfMapper; |
b77c7b
|
60 |
|
懒 |
61 |
@Autowired |
|
62 |
private BsFormulaChildInfoMapper bsFormulaChildInfoMapper; |
7bee80
|
63 |
|
懒 |
64 |
@Autowired |
|
65 |
private IBsFormulaChildInfoService bsFormulaChildInfoService; |
32483a
|
66 |
|
懒 |
67 |
@Autowired |
|
68 |
private MiloService miloService; |
|
69 |
|
|
70 |
@Autowired |
|
71 |
private DaPassingStationCollectionMapper daPassingStationCollectionMapper; |
e57a89
|
72 |
|
054a69
|
73 |
@Resource |
懒 |
74 |
private SqlSessionFactory sqlSessionFactory; |
|
75 |
|
ddb300
|
76 |
@Autowired |
A |
77 |
private IDaParamCollectionService daParamCollectionService; |
5966d6
|
78 |
|
A |
79 |
@Autowired |
|
80 |
private IDaCollectionParamConfService daCollectionParamConfService; |
ddb300
|
81 |
|
e57a89
|
82 |
/** |
懒 |
83 |
* 查询设备产品过程参数采集 |
|
84 |
* |
|
85 |
* @param id 设备产品过程参数采集主键 |
|
86 |
* @return 设备产品过程参数采集 |
|
87 |
*/ |
|
88 |
@Override |
|
89 |
public DaParamCollection selectDaParamCollectionById(Long id) |
|
90 |
{ |
|
91 |
return daParamCollectionMapper.selectDaParamCollectionById(id); |
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* 查询设备产品过程参数采集列表 |
|
96 |
* |
|
97 |
* @param daParamCollection 设备产品过程参数采集 |
|
98 |
* @return 设备产品过程参数采集 |
|
99 |
*/ |
|
100 |
@Override |
|
101 |
public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection) |
|
102 |
{ |
|
103 |
return daParamCollectionMapper.selectDaParamCollectionList(daParamCollection); |
054a69
|
104 |
} |
懒 |
105 |
|
|
106 |
@Override |
|
107 |
public void saveBeachDaParamCollection(List<DaParamCollection> list) { |
|
108 |
// ExecutorType.SIMPLE: 这个执行器类型不做特殊的事情。它为每个语句的执行创建一个新的预处理语句。 |
|
109 |
// ExecutorType.REUSE: 这个执行器类型会复用预处理语句。 |
|
110 |
// ExecutorType.BATCH: 这个执行器会批量执行所有更新语句,如果 SELECT 在它们中间执行还会标定它们是 必须的,来保证一个简单并易于理解的行为。 |
|
111 |
|
|
112 |
// 关闭session的自动提交 |
|
113 |
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); |
|
114 |
try { |
|
115 |
DaParamCollectionMapper userMapper = sqlSession.getMapper(DaParamCollectionMapper.class); |
|
116 |
list.stream().forEach(DaParamCollection -> userMapper.insertDaParamCollection(DaParamCollection)); |
|
117 |
// 提交数据 |
|
118 |
sqlSession.commit(); |
|
119 |
sqlSession.rollback(); |
|
120 |
} catch (Exception e) { |
|
121 |
sqlSession.rollback(); |
|
122 |
} finally { |
|
123 |
sqlSession.close(); |
|
124 |
} |
e57a89
|
125 |
} |
懒 |
126 |
|
|
127 |
/** |
|
128 |
* 新增设备产品过程参数采集 |
|
129 |
* |
|
130 |
* @param daParamCollection 设备产品过程参数采集 |
|
131 |
* @return 结果 |
|
132 |
*/ |
|
133 |
@Override |
|
134 |
public int insertDaParamCollection(DaParamCollection daParamCollection) |
|
135 |
{ |
|
136 |
daParamCollection.setCreateTime(DateUtils.getNowDate()); |
|
137 |
return daParamCollectionMapper.insertDaParamCollection(daParamCollection); |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* 修改设备产品过程参数采集 |
|
142 |
* |
|
143 |
* @param daParamCollection 设备产品过程参数采集 |
|
144 |
* @return 结果 |
|
145 |
*/ |
|
146 |
@Override |
|
147 |
public int updateDaParamCollection(DaParamCollection daParamCollection) |
|
148 |
{ |
|
149 |
daParamCollection.setUpdateTime(DateUtils.getNowDate()); |
|
150 |
return daParamCollectionMapper.updateDaParamCollection(daParamCollection); |
|
151 |
} |
|
152 |
|
|
153 |
/** |
|
154 |
* 批量删除设备产品过程参数采集 |
|
155 |
* |
|
156 |
* @param ids 需要删除的设备产品过程参数采集主键 |
|
157 |
* @return 结果 |
|
158 |
*/ |
|
159 |
@Override |
|
160 |
public int deleteDaParamCollectionByIds(Long[] ids) |
|
161 |
{ |
|
162 |
return daParamCollectionMapper.deleteDaParamCollectionByIds(ids); |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 |
* 删除设备产品过程参数采集信息 |
|
167 |
* |
|
168 |
* @param id 设备产品过程参数采集主键 |
|
169 |
* @return 结果 |
|
170 |
*/ |
|
171 |
@Override |
|
172 |
public int deleteDaParamCollectionById(Long id) |
|
173 |
{ |
|
174 |
return daParamCollectionMapper.deleteDaParamCollectionById(id); |
|
175 |
} |
b64ed2
|
176 |
|
懒 |
177 |
@Override |
|
178 |
public void addBasicParameters(DaParamCollection daParamCollection) { |
|
179 |
// 假设这是从数据库或其他地方获取的参数数据 |
|
180 |
Map<String, String> map = new HashMap<>(); |
|
181 |
map.put("GC", "南浔工厂"); |
|
182 |
map.put("CXBH", "Pack线"); |
|
183 |
map.put("SBBH", "设备001"); |
|
184 |
map.put("YGBH", "员工001"); |
|
185 |
map.put("GDBH", daParamCollection.getWorkOrderNo()); |
|
186 |
map.put("CPXH", daParamCollection.getModel()); |
|
187 |
map.put("INT", DateUtil.formatDateTime(new Date())); |
|
188 |
|
|
189 |
map.forEach((key, value) -> { |
|
190 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
191 |
daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
|
192 |
daCollectionParamConf.setCollectParameterId(key); |
|
193 |
List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
|
194 |
DaParamCollection saveData = new DaParamCollection(); |
|
195 |
saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
|
196 |
saveData.setProductCode(daParamCollection.getProductCode()); |
|
197 |
saveData.setLocationCode(daParamCollection.getLocationCode()); |
3c2299
|
198 |
saveData.setSfcCode(daParamCollection.getProductBarcode()); |
b64ed2
|
199 |
saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
懒 |
200 |
saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
|
201 |
saveData.setCollectionTime(new Date()); |
|
202 |
saveData.setParamValue(value); |
|
203 |
daParamCollectionMapper.insertDaParamCollection(saveData); |
|
204 |
}); |
|
205 |
} |
49c784
|
206 |
|
懒 |
207 |
@Override |
|
208 |
public void addTighteningParameters(DaParamCollection daParamCollection) { |
b77c7b
|
209 |
String tightenData = daParamCollection.getTightenTheArray(); |
懒 |
210 |
tightenData = tightenData.replace("[", "").replace("]", "").replace(" ", ""); |
|
211 |
String[] tightenDataParts = tightenData.split(","); |
|
212 |
String paramCode = daParamCollection.getParamCode(); |
|
213 |
String[] paramCodeParts = paramCode.split(","); |
|
214 |
for (int i = 0; i < paramCodeParts.length; i++) { |
|
215 |
daParamCollection.setParamValue(tightenDataParts[i]); |
|
216 |
daParamCollection.setParamCode(paramCodeParts[i]); |
|
217 |
daParamCollection.setCollectionTime(new Date()); |
|
218 |
daParamCollection.setSfcCode(daParamCollection.getProductBarcode()); |
|
219 |
daParamCollectionMapper.insertDaParamCollection(daParamCollection); |
|
220 |
} |
49c784
|
221 |
} |
32483a
|
222 |
|
懒 |
223 |
@Override |
|
224 |
public void saveCampaignTimeParameters(DaParamCollection daParamCollection) { |
7bee80
|
225 |
List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
懒 |
226 |
.eq(BsFormulaChildInfo::getProcessesCode, daParamCollection.getLocationCode()) |
|
227 |
.eq(BsFormulaChildInfo::getSpareField4, "1") |
|
228 |
); |
|
229 |
if(!list.get(0).getResults().equals("OK")){ |
|
230 |
try { |
|
231 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build()); |
|
232 |
} catch (Exception e) { |
|
233 |
throw new RuntimeException(e); |
|
234 |
} |
|
235 |
return; |
|
236 |
} |
32483a
|
237 |
BsFormulaChildInfo bsFormulaChildInfo = new BsFormulaChildInfo(); |
懒 |
238 |
bsFormulaChildInfo.setProcessesCode(daParamCollection.getLocationCode()); |
|
239 |
bsFormulaChildInfo.setProductCode(daParamCollection.getProductCode()); |
|
240 |
bsFormulaChildInfo.setSpareField4("1"); |
|
241 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
|
242 |
String result = bsFormulaChildInfos.get(0).getResults(); |
|
243 |
if(result != null && !result.isEmpty()){ |
|
244 |
try { |
|
245 |
//过站参数采集记录出站时间 |
|
246 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
247 |
daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
|
248 |
daCollectionParamConf.setCollectParameterId("OUTT"); |
|
249 |
List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
|
250 |
DaParamCollection saveData = new DaParamCollection(); |
|
251 |
saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
|
252 |
saveData.setProductCode(daParamCollection.getProductCode()); |
|
253 |
saveData.setLocationCode(daParamCollection.getLocationCode()); |
|
254 |
saveData.setSfcCode(daParamCollection.getProductBarcode()); |
|
255 |
saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
|
256 |
saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
|
257 |
saveData.setCollectionTime(new Date()); |
|
258 |
saveData.setParamValue(DateUtil.formatDateTime(new Date())); |
|
259 |
daParamCollectionMapper.insertDaParamCollection(saveData); |
|
260 |
|
|
261 |
//更新过站记录表出站时间 |
|
262 |
DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
|
263 |
daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
1df825
|
264 |
daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode()); |
32483a
|
265 |
List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
懒 |
266 |
daPassingStationCollections.get(0).setOutboundTime(new Date()); |
|
267 |
int i = daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); |
|
268 |
|
8f0f8d
|
269 |
// OPCUaSubscription.SaveParamData(daParamCollection.getProductBarcode(),"OP",daParamCollection.getLocationCode(),daParamCollection.getWorkOrderNo(),daParamCollection.getProductCode()); |
054a69
|
270 |
|
32483a
|
271 |
//给opc发21 |
7bee80
|
272 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); |
32483a
|
273 |
} catch (Exception e) { |
懒 |
274 |
throw new RuntimeException(e); |
|
275 |
} |
|
276 |
} |
|
277 |
} |
8f0f8d
|
278 |
|
懒 |
279 |
@Override |
|
280 |
public void insertBatch(List<DaParamCollection> confList){ |
|
281 |
try{ |
|
282 |
this.saveBatch(confList); |
|
283 |
}catch (Exception e){ |
|
284 |
return; |
|
285 |
} |
|
286 |
|
|
287 |
} |
ddb300
|
288 |
|
A |
289 |
@Override |
|
290 |
public void replaceAssemblyCode(DaParamCollection daParamCollection) { |
|
291 |
List<DaParamCollection> list = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>() |
2c7661
|
292 |
.eq(DaParamCollection::getSfcCode, daParamCollection.getYzSfcCode()) |
ddb300
|
293 |
); |
A |
294 |
if(list.size() > 0){ |
|
295 |
for (DaParamCollection paramCollection : list) { |
2c7661
|
296 |
paramCollection.setSfcCode(daParamCollection.getSfcCode()); |
ddb300
|
297 |
daParamCollectionService.saveOrUpdate(paramCollection); |
A |
298 |
} |
|
299 |
} |
|
300 |
|
|
301 |
} |
4a5f2a
|
302 |
|
A |
303 |
@Override |
|
304 |
public void yzAddBasicParameters(DaParamCollection daParamCollection) { |
|
305 |
// 假设这是从数据库或其他地方获取的参数数据 |
|
306 |
Map<String, String> map = new HashMap<>(); |
|
307 |
// map.put("GC", "南浔工厂"); |
|
308 |
// map.put("CXBH", "Pack线"); |
|
309 |
// map.put("SBBH", "设备001"); |
|
310 |
// map.put("YGBH", "员工001"); |
|
311 |
// map.put("GDBH", daParamCollection.getWorkOrderNo()); |
|
312 |
// map.put("CPXH", daParamCollection.getModel()); |
|
313 |
map.put("INT", DateUtil.formatDateTime(new Date())); |
|
314 |
|
|
315 |
map.forEach((key, value) -> { |
|
316 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
317 |
daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
|
318 |
daCollectionParamConf.setCollectParameterId(key); |
|
319 |
List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
|
320 |
DaParamCollection saveData = new DaParamCollection(); |
|
321 |
saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
|
322 |
saveData.setProductCode(daParamCollection.getProductCode()); |
|
323 |
saveData.setLocationCode(daParamCollection.getLocationCode()); |
|
324 |
saveData.setSfcCode(daParamCollection.getProductBarcode()); |
|
325 |
saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
|
326 |
saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
|
327 |
saveData.setCollectionTime(new Date()); |
|
328 |
saveData.setParamValue(value); |
|
329 |
daParamCollectionMapper.insertDaParamCollection(saveData); |
|
330 |
}); |
|
331 |
} |
1c84ae
|
332 |
|
A |
333 |
@Override |
|
334 |
public void jrmSaveCampaignTimeParameters(DaParamCollection daParamCollection) { |
|
335 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
336 |
daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
|
337 |
daCollectionParamConf.setCollectParameterId("OUTT"); |
|
338 |
List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
|
339 |
DaParamCollection saveData = new DaParamCollection(); |
|
340 |
saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
|
341 |
saveData.setProductCode(daParamCollection.getProductCode()); |
|
342 |
saveData.setLocationCode(daParamCollection.getLocationCode()); |
|
343 |
saveData.setSfcCode(daParamCollection.getProductBarcode()); |
|
344 |
saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
|
345 |
saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
|
346 |
saveData.setCollectionTime(new Date()); |
|
347 |
saveData.setParamValue(DateUtil.formatDateTime(new Date())); |
|
348 |
daParamCollectionMapper.insertDaParamCollection(saveData); |
|
349 |
|
|
350 |
//更新过站记录表出站时间 |
|
351 |
DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
|
352 |
daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
|
353 |
daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode()); |
|
354 |
List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
|
355 |
daPassingStationCollections.get(0).setOutboundTime(new Date()); |
|
356 |
int i = daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); |
|
357 |
|
|
358 |
// OPCUaSubscription.SaveParamData(daParamCollection.getProductBarcode(),"OP",daParamCollection.getLocationCode(),daParamCollection.getWorkOrderNo(),daParamCollection.getProductCode()); |
|
359 |
|
|
360 |
//给opc发21 |
|
361 |
try { |
|
362 |
// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); |
|
363 |
String strA = daParamCollection.getLocationCode() + "A"; |
|
364 |
String strB = daParamCollection.getLocationCode() + "B"; |
|
365 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+strA+".RecordDataDone").value(21).build()); |
|
366 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+strB+".RecordDataDone").value(21).build()); |
|
367 |
} catch (Exception e) { |
|
368 |
throw new RuntimeException(e); |
|
369 |
} |
|
370 |
} |
6a462f
|
371 |
|
W |
372 |
|
|
373 |
public void sendToFactoryMes(String stationCode,String productNum ){ |
|
374 |
String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback"; |
|
375 |
ParentVO vo =new ParentVO(); |
|
376 |
List<ChildVO> checkList = new ArrayList<>(); |
|
377 |
List<DaParamCollection> list = this.list(new LambdaQueryWrapper<DaParamCollection>() |
|
378 |
.eq(DaParamCollection::getSfcCode, productNum) |
|
379 |
.eq(DaParamCollection::getLocationCode, stationCode)); |
|
380 |
vo.setTotalResult("1"); |
|
381 |
String string = new Random(10).toString(); |
|
382 |
vo.setRecordId(string); |
|
383 |
vo.setProductNum(productNum); |
|
384 |
vo.setSiteCode("3983"); |
|
385 |
vo.setStationCode(stationCode); |
|
386 |
if (CollUtil.isNotEmpty(list)){ |
|
387 |
List<DaParamCollection> collect = list.stream().filter(x -> Constants.NG.equals(x.getParamValue())).collect(Collectors.toList()); |
|
388 |
if (CollUtil.isNotEmpty(collect)){ |
|
389 |
vo.setTotalResult("0"); |
|
390 |
} |
|
391 |
List<BsFormulaChildInfo> bsFormulaChildInfoList = bsFormulaChildInfoService.list(); |
|
392 |
for (DaParamCollection daParamCollection : list) { |
|
393 |
ChildVO childVO = new ChildVO(); |
|
394 |
childVO.setItemCode(daParamCollection.getParamCode()); |
|
395 |
String time = daParamCollection.getCollectionTime() != null ? daParamCollection.getCollectionTime().toString() : ""; |
|
396 |
childVO.setCheckResult("1"); |
|
397 |
if (StrUtil.isNotBlank(daParamCollection.getParamValue())){ |
|
398 |
if (Constants.NG.equals(daParamCollection.getParamValue())){ |
|
399 |
childVO.setCheckResult("0"); |
|
400 |
} |
|
401 |
} |
|
402 |
childVO.setCheckTime(time); |
|
403 |
childVO.setItemValue(daParamCollection.getParamValue()); |
|
404 |
childVO.setItemType("3"); |
|
405 |
childVO.setItemText(daParamCollection.getParamName()); |
|
406 |
if (StrUtil.isNotBlank(daParamCollection.getParamCode())){ |
|
407 |
List<BsFormulaChildInfo> collect1 = bsFormulaChildInfoList.stream().filter(x -> daParamCollection.getParamCode().equals(x.getParamCode())).collect(Collectors.toList()); |
|
408 |
if (CollUtil.isNotEmpty(collect1)){ |
|
409 |
BsFormulaChildInfo bsFormulaChildInfo = collect1.get(0); |
|
410 |
childVO.setItemType(bsFormulaChildInfo.getOperationType()); |
|
411 |
} |
|
412 |
} |
|
413 |
|
|
414 |
checkList.add(childVO); |
|
415 |
} |
|
416 |
} |
|
417 |
vo.setCheckList(checkList); |
|
418 |
HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute(); |
|
419 |
|
|
420 |
} |
5966d6
|
421 |
|
A |
422 |
@Override |
|
423 |
public void pushGeelycvMesFeedback(String packID, String stationCode) { |
|
424 |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
425 |
String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback"; |
|
426 |
String totalResult = "0"; |
|
427 |
List<DaParamCollection> paramList = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>().eq(DaParamCollection::getSfcCode, packID).eq(DaParamCollection::getLocationCode, stationCode)); |
|
428 |
if(paramList.size() > 0){ |
|
429 |
ParentVO parentVO = new ParentVO(); |
|
430 |
parentVO.setSiteCode("3983"); |
|
431 |
parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli())); |
|
432 |
parentVO.setStationCode(stationCode); |
|
433 |
parentVO.setProductNum(packID); |
|
434 |
parentVO.setTotalResult("1"); |
|
435 |
List<ChildVO> listChildVo = new ArrayList<>(); |
|
436 |
|
|
437 |
for (DaParamCollection daParamCollection : paramList) { |
|
438 |
ChildVO childVO = new ChildVO(); |
|
439 |
childVO.setItemCode(daParamCollection.getParamCode()); |
|
440 |
BsFormulaChildInfo childOne = bsFormulaChildInfoService.getOne(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getParamCode, daParamCollection.getParamCode())); |
|
441 |
DaCollectionParamConf paramConfOne = daCollectionParamConfService.getOne(new LambdaQueryWrapper<DaCollectionParamConf>().eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())); |
|
442 |
if(childOne!=null){ |
|
443 |
String operationType = childOne.getOperationType(); |
|
444 |
if(operationType.equals("1")){ |
|
445 |
childVO.setItemType("2"); |
|
446 |
}else if(operationType.equals("2")){ |
|
447 |
childVO.setItemType("1"); |
|
448 |
} |
|
449 |
}else { |
|
450 |
childVO.setItemType("3"); |
|
451 |
} |
|
452 |
if(paramConfOne!=null){ |
|
453 |
childVO.setItemText(paramConfOne.getCollectParameterName()); |
|
454 |
}else { |
|
455 |
childVO.setItemText(""); |
|
456 |
} |
|
457 |
childVO.setItemValue(daParamCollection.getParamValue()); |
|
458 |
|
|
459 |
if(daParamCollection.getParamValue().equals("1")){ |
|
460 |
childVO.setCheckResult("1"); |
|
461 |
}else if(daParamCollection.getParamValue().equals("2")){ |
|
462 |
childVO.setCheckResult("0"); |
|
463 |
parentVO.setTotalResult("0"); |
|
464 |
totalResult = "1"; |
|
465 |
}else { |
|
466 |
childVO.setCheckResult("1"); |
|
467 |
} |
|
468 |
childVO.setCheckTime(format.format(daParamCollection.getCollectionTime())); |
|
469 |
listChildVo.add(childVO); |
|
470 |
} |
|
471 |
parentVO.setCheckList(listChildVo); |
|
472 |
HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); |
|
473 |
System.out.println(execute.body()); |
|
474 |
System.out.println("-----------------------"+totalResult); |
|
475 |
} |
|
476 |
|
|
477 |
} |
616f98
|
478 |
|
e57a89
|
479 |
} |