admin
2024-08-28 c2e92c3bd4fc134b27ba6a6271f63b032b2b9d99
提交 | 用户 | 时间
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;
237733 5 import cn.hutool.core.util.ObjectUtil;
6a462f 6 import cn.hutool.core.util.StrUtil;
8f0f8d 7 import cn.hutool.db.Db;
6a462f 8 import cn.hutool.http.HttpRequest;
W 9 import cn.hutool.http.HttpResponse;
768498 10 import cn.hutool.json.JSONObject;
6a462f 11 import cn.hutool.json.JSONUtil;
7bee80 12 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
768498 13 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
0ce25f 14 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4e83fa 15 import com.google.gson.Gson;
237733 16 import com.jcdm.common.core.domain.AjaxResult;
e57a89 17 import com.jcdm.common.utils.DateUtils;
768498 18 import com.jcdm.common.utils.SecurityUtils;
a60fef 19 import com.jcdm.common.utils.StringUtils;
c2e92c 20 import com.jcdm.framework.websocket.WebSocketUsers;
7bee80 21 import com.jcdm.main.bs.formula.service.IBsFormulaInfoService;
22 import com.jcdm.main.bs.formula.service.impl.BsFormulaInfoServiceImpl;
b77c7b 23 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
24 import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper;
7bee80 25 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
6a462f 26 import com.jcdm.main.constant.Constants;
b64ed2 27 import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
28 import com.jcdm.main.da.collectionParamConf.mapper.DaCollectionParamConfMapper;
5966d6 29 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
e57a89 30 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
31 import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
32 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
8cfe20 33 import com.jcdm.main.da.paramCollectionTemp.domain.DaParamCollectionTemp;
A 34 import com.jcdm.main.da.paramCollectionTemp.service.IDaParamCollectionTempService;
32483a 35 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
36 import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper;
37 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
768498 38 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
2fbce7 39 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
054a69 40 import com.jcdm.main.plcserver.sub.OPCUaSubscription;
237733 41 import com.jcdm.main.restful.factoryMes.service.RestfulService;
6a462f 42 import com.jcdm.main.restful.qingYan.doman.ChildVO;
W 43 import com.jcdm.main.restful.qingYan.doman.ParentVO;
32483a 44 import com.kangaroohy.milo.model.ReadWriteEntity;
45 import com.kangaroohy.milo.service.MiloService;
bdb404 46 import lombok.extern.slf4j.Slf4j;
054a69 47 import org.apache.ibatis.session.ExecutorType;
48 import org.apache.ibatis.session.SqlSession;
49 import org.apache.ibatis.session.SqlSessionFactory;
bdb404 50 import org.slf4j.Logger;
A 51 import org.slf4j.LoggerFactory;
e57a89 52 import org.springframework.beans.factory.annotation.Autowired;
5966d6 53 import org.springframework.security.core.parameters.P;
e57a89 54 import org.springframework.stereotype.Service;
55
054a69 56 import javax.annotation.Resource;
c2e92c 57 import javax.websocket.Session;
5966d6 58 import java.text.SimpleDateFormat;
A 59 import java.time.Instant;
b64ed2 60 import java.util.*;
d76bba 61 import java.util.concurrent.CompletableFuture;
6a462f 62 import java.util.stream.Collectors;
e57a89 63
64 /**
65  * 设备产品过程参数采集Service业务层处理
66  * 
67  * @author yyt
68  * @date 2023-12-13
69  */
bdb404 70 @Slf4j
e57a89 71 @Service
0ce25f 72 public class DaParamCollectionServiceImpl extends ServiceImpl<DaParamCollectionMapper,DaParamCollection> implements IDaParamCollectionService
e57a89 73 {
bdb404 74     private static final Logger logger = LoggerFactory.getLogger("sys-user");
A 75
e57a89 76     @Autowired
77     private DaParamCollectionMapper daParamCollectionMapper;
b64ed2 78
79     @Autowired
80     private DaCollectionParamConfMapper daCollectionParamConfMapper;
b77c7b 81
82     @Autowired
83     private BsFormulaChildInfoMapper bsFormulaChildInfoMapper;
7bee80 84
85     @Autowired
86     private IBsFormulaChildInfoService bsFormulaChildInfoService;
32483a 87
88     @Autowired
89     private MiloService miloService;
90
91     @Autowired
92     private DaPassingStationCollectionMapper daPassingStationCollectionMapper;
e57a89 93
054a69 94     @Resource
95     private SqlSessionFactory sqlSessionFactory;
96
ddb300 97     @Autowired
A 98     private IDaParamCollectionService daParamCollectionService;
5966d6 99
A 100     @Autowired
101     private IDaCollectionParamConfService daCollectionParamConfService;
8cfe20 102
A 103     @Autowired
104     private IDaParamCollectionTempService daParamCollectionTempService;
2fbce7 105
A 106     @Autowired
107     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
768498 108
A 109     @Autowired
110     private IDaPassingStationCollectionService daPassingStationCollectionService;
237733 111
A 112     public SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
c2e92c 113
A 114     Map<String, Session> map = WebSocketUsers.getUsers();
115
ddb300 116
e57a89 117     /**
118      * 查询设备产品过程参数采集
119      * 
120      * @param id 设备产品过程参数采集主键
121      * @return 设备产品过程参数采集
122      */
123     @Override
124     public DaParamCollection selectDaParamCollectionById(Long id)
125     {
126         return daParamCollectionMapper.selectDaParamCollectionById(id);
127     }
128
129     /**
130      * 查询设备产品过程参数采集列表
131      * 
132      * @param daParamCollection 设备产品过程参数采集
133      * @return 设备产品过程参数采集
134      */
135     @Override
136     public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection)
137     {
138         return daParamCollectionMapper.selectDaParamCollectionList(daParamCollection);
054a69 139     }
140
141     @Override
142     public void saveBeachDaParamCollection(List<DaParamCollection> list) {
143         // ExecutorType.SIMPLE: 这个执行器类型不做特殊的事情。它为每个语句的执行创建一个新的预处理语句。
144         // ExecutorType.REUSE: 这个执行器类型会复用预处理语句。
145         // ExecutorType.BATCH: 这个执行器会批量执行所有更新语句,如果 SELECT 在它们中间执行还会标定它们是 必须的,来保证一个简单并易于理解的行为。
bdb404 146         logger.info("进入乐工批量方法saveBeachDaParamCollection");
054a69 147
148         // 关闭session的自动提交
149         SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
150         try {
151             DaParamCollectionMapper userMapper = sqlSession.getMapper(DaParamCollectionMapper.class);
152             list.stream().forEach(DaParamCollection -> userMapper.insertDaParamCollection(DaParamCollection));
153             // 提交数据
154             sqlSession.commit();
155             sqlSession.rollback();
bdb404 156             logger.info("结束乐工批量方法saveBeachDaParamCollection");
A 157
054a69 158         } catch (Exception e) {
159             sqlSession.rollback();
160         } finally {
161             sqlSession.close();
162         }
e57a89 163     }
164
165     /**
166      * 新增设备产品过程参数采集
167      * 
168      * @param daParamCollection 设备产品过程参数采集
169      * @return 结果
170      */
171     @Override
172     public int insertDaParamCollection(DaParamCollection daParamCollection)
173     {
174         daParamCollection.setCreateTime(DateUtils.getNowDate());
175         return daParamCollectionMapper.insertDaParamCollection(daParamCollection);
176     }
177
178     /**
179      * 修改设备产品过程参数采集
180      * 
181      * @param daParamCollection 设备产品过程参数采集
182      * @return 结果
183      */
184     @Override
185     public int updateDaParamCollection(DaParamCollection daParamCollection)
186     {
187         daParamCollection.setUpdateTime(DateUtils.getNowDate());
188         return daParamCollectionMapper.updateDaParamCollection(daParamCollection);
189     }
190
191     /**
192      * 批量删除设备产品过程参数采集
193      * 
194      * @param ids 需要删除的设备产品过程参数采集主键
195      * @return 结果
196      */
197     @Override
198     public int deleteDaParamCollectionByIds(Long[] ids)
199     {
200         return daParamCollectionMapper.deleteDaParamCollectionByIds(ids);
201     }
202
203     /**
204      * 删除设备产品过程参数采集信息
205      * 
206      * @param id 设备产品过程参数采集主键
207      * @return 结果
208      */
209     @Override
210     public int deleteDaParamCollectionById(Long id)
211     {
212         return daParamCollectionMapper.deleteDaParamCollectionById(id);
213     }
b64ed2 214
215     @Override
216     public void addBasicParameters(DaParamCollection daParamCollection) {
217         // 假设这是从数据库或其他地方获取的参数数据
218         Map<String, String> map = new HashMap<>();
219         map.put("GC", "南浔工厂");
220         map.put("CXBH", "Pack线");
221         map.put("SBBH", "设备001");
222         map.put("YGBH", "员工001");
223         map.put("GDBH", daParamCollection.getWorkOrderNo());
224         map.put("CPXH", daParamCollection.getModel());
225         map.put("INT", DateUtil.formatDateTime(new Date()));
226
227         map.forEach((key, value) -> {
228             DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
229             daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
230             daCollectionParamConf.setCollectParameterId(key);
231             List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
232             DaParamCollection saveData = new DaParamCollection();
233             saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
234             saveData.setProductCode(daParamCollection.getProductCode());
235             saveData.setLocationCode(daParamCollection.getLocationCode());
3c2299 236             saveData.setSfcCode(daParamCollection.getProductBarcode());
b64ed2 237             saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
238             saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
239             saveData.setCollectionTime(new Date());
240             saveData.setParamValue(value);
241             daParamCollectionMapper.insertDaParamCollection(saveData);
242         });
243     }
49c784 244
245     @Override
246     public void addTighteningParameters(DaParamCollection daParamCollection) {
b77c7b 247         String paramCode = daParamCollection.getParamCode();
a60fef 248         String tightenData = daParamCollection.getTightenTheArray();
A 249         if(StringUtils.isNotBlank(paramCode)&&StringUtils.isNotBlank(tightenData)){
250             tightenData = tightenData.replace("[", "").replace("]", "").replace(" ", "");
251             String[] tightenDataParts = tightenData.split(",");
252             String[] paramCodeParts = paramCode.split(",");
253             for (int i = 0; i < paramCodeParts.length; i++) {
254                 daParamCollection.setParamValue(tightenDataParts[i]);
255                 daParamCollection.setParamCode(paramCodeParts[i]);
256                 daParamCollection.setCollectionTime(new Date());
257                 daParamCollection.setSfcCode(daParamCollection.getProductBarcode());
258                 daParamCollectionMapper.insertDaParamCollection(daParamCollection);
8cfe20 259
A 260                 DaParamCollectionTemp daParamCollectionTemp = new DaParamCollectionTemp();
261                 daParamCollectionTemp.setParamValue(tightenDataParts[i]);
262                 daParamCollectionTemp.setParamCode(paramCodeParts[i]);
263                 daParamCollectionTemp.setCollectionTime(new Date());
264                 daParamCollectionTemp.setSfcCode(daParamCollection.getProductBarcode());
265                 daParamCollectionTemp.setLocationCode(daParamCollection.getLocationCode());
d76bba 266                 daParamCollectionTemp.setProductCode(daParamCollection.getProductCode());
273d64 267                 daParamCollectionTemp.setWorkOrderNo(daParamCollection.getWorkOrderNo());
8cfe20 268                 daParamCollectionTempService.save(daParamCollectionTemp);
a60fef 269             }
b77c7b 270         }
49c784 271     }
32483a 272
273     @Override
274     public void saveCampaignTimeParameters(DaParamCollection daParamCollection) {
768498 275 //        List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>()
A 276 //                .eq(BsFormulaChildInfo::getProcessesCode, daParamCollection.getLocationCode())
277 //                .eq(BsFormulaChildInfo::getSpareField4, "1")
278 //        );
279         BsFormulaChildInfo childInfo = daParamCollection.getFormulaChildEntity();
280         if(StringUtils.isNotBlank(childInfo.getResults())){
281             if(!childInfo.getResults().equals("OK")){
237733 282                 try {
A 283                     miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build());
284                 } catch (Exception e) {
285                     throw new RuntimeException(e);
286                 }
287                 return;
288             }
289         }else {
7bee80 290             try {
291                 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build());
292             } catch (Exception e) {
293                 throw new RuntimeException(e);
294             }
295             return;
296         }
768498 297 //        BsFormulaChildInfo bsFormulaChildInfo = new BsFormulaChildInfo();
A 298 //        bsFormulaChildInfo.setProcessesCode(daParamCollection.getLocationCode());
299 //        bsFormulaChildInfo.setProductCode(daParamCollection.getProductCode());
300 //        bsFormulaChildInfo.setSpareField4("1");
301 //        List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
302         String result = childInfo.getResults();
32483a 303         if(result != null && !result.isEmpty()){
304             try {
768498 305 //                //更新参数采集配置表
A 306 //                DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
307 //                daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
308 //                daCollectionParamConf.setCollectParameterId("OUTT");
309 //                List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
310 //                DaParamCollection saveData = new DaParamCollection();
311 //                saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
312 //                saveData.setProductCode(daParamCollection.getProductCode());
313 //                saveData.setLocationCode(daParamCollection.getLocationCode());
314 //                saveData.setSfcCode(daParamCollection.getProductBarcode());
315 //                saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
316 //                saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
317 //                saveData.setCollectionTime(new Date());
318 //                saveData.setParamValue(DateUtil.formatDateTime(new Date()));
319 //                daParamCollectionMapper.insertDaParamCollection(saveData);
32483a 320
768498 321                 //增加过站记录
32483a 322                 DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection();
323                 daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo());
768498 324                 daPassingStationCollection.setSfcCode(daParamCollection.getProductBarcode());
A 325                 daPassingStationCollection.setProductCode(daParamCollection.getProductCode());
1df825 326                 daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode());
768498 327                 daPassingStationCollection.setInboundTime(daParamCollection.getInboundTime());
A 328                 daPassingStationCollection.setOutboundTime(new Date());
329                 daPassingStationCollection.setCreateTime(new Date());
330                 daPassingStationCollection.setOutRsSign("1");
331                 boolean save = daPassingStationCollectionService.save(daPassingStationCollection);
332
333                 //添加基础参数
334                 this.manualWorkstationsAddBasicParameters(daParamCollection);
335
336 //                //更新过站记录表出站时间
337 //                DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection();
338 //                daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo());
339 //                daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode());
340 //                List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection);
341 //                daPassingStationCollections.get(0).setOutboundTime(new Date());
342 //                int i = daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0));
32483a 343
8f0f8d 344 //                OPCUaSubscription.SaveParamData(daParamCollection.getProductBarcode(),"OP",daParamCollection.getLocationCode(),daParamCollection.getWorkOrderNo(),daParamCollection.getProductCode());
054a69 345
32483a 346                 //给opc发21
7bee80 347                 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build());
273d64 348                 if(daParamCollection.getLocationCode().equals("POP240")){
2fbce7 349                     try{
A 350                         CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
351                             logger.info("OP230报工开始-工厂MES异步方法");
4e83fa 352                             String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), "POP230", format.format(new Date()));
768498 353                             JSONObject jsonObject = new JSONObject(reportResult);
A 354                             String code = jsonObject.getStr("code");
355                             if("success".equals(code)){
356                                 //如果成功,执行报工成功方法,修改是否报工为1,添加报工时间
4e83fa 357                                 omProductionOrdeInfoService.updateOrderByProductNum("1",daParamCollection.getProductBarcode(),"POP230");
2fbce7 358                             }else{
A 359                                 //解析工厂mes返回结果,如果失败,执行报工失败方法,修改是否报工为2,添加报工时间
4e83fa 360                                 omProductionOrdeInfoService.updateOrderByProductNum("2",daParamCollection.getProductBarcode(),"POP230");
2fbce7 361                             }
A 362                             logger.info("OP230报工结束-工厂MES异步方法{}"+reportResult);
363                         });
364                     }catch (Exception e){
365                         System.out.println(e.getMessage());
366                     }
367 //                    RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(),"OP230",format.format(new Date()));
237733 368                 }
e9e2c4 369                 if(daParamCollection.getLocationCode().equals("POP430")){
A 370                     this.enterWeighing(daParamCollection);
371                 }
372
2fbce7 373
A 374
32483a 375             } catch (Exception e) {
376                 throw new RuntimeException(e);
377             }
378         }
379     }
8f0f8d 380
381     @Override
382     public void insertBatch(List<DaParamCollection> confList){
383         try{
384             this.saveBatch(confList);
385         }catch (Exception e){
386             return;
387         }
388
389     }
ddb300 390
A 391     @Override
392     public void replaceAssemblyCode(DaParamCollection daParamCollection) {
393         List<DaParamCollection> list = daParamCollectionService.list(new LambdaQueryWrapper<DaParamCollection>()
2c7661 394                 .eq(DaParamCollection::getSfcCode, daParamCollection.getYzSfcCode())
ddb300 395         );
A 396         if(list.size() > 0){
397             for (DaParamCollection paramCollection : list) {
2c7661 398                 paramCollection.setSfcCode(daParamCollection.getSfcCode());
ddb300 399                 daParamCollectionService.saveOrUpdate(paramCollection);
A 400             }
401         }
402
403     }
4a5f2a 404
A 405     @Override
406     public void yzAddBasicParameters(DaParamCollection daParamCollection) {
407         // 假设这是从数据库或其他地方获取的参数数据
408         Map<String, String> map = new HashMap<>();
409 //        map.put("GC", "南浔工厂");
410 //        map.put("CXBH", "Pack线");
411 //        map.put("SBBH", "设备001");
412 //        map.put("YGBH", "员工001");
413 //        map.put("GDBH", daParamCollection.getWorkOrderNo());
414 //        map.put("CPXH", daParamCollection.getModel());
415         map.put("INT", DateUtil.formatDateTime(new Date()));
416
417         map.forEach((key, value) -> {
418             DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
419             daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
420             daCollectionParamConf.setCollectParameterId(key);
421             List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
422             DaParamCollection saveData = new DaParamCollection();
423             saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
424             saveData.setProductCode(daParamCollection.getProductCode());
425             saveData.setLocationCode(daParamCollection.getLocationCode());
426             saveData.setSfcCode(daParamCollection.getProductBarcode());
427             saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
428             saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
429             saveData.setCollectionTime(new Date());
430             saveData.setParamValue(value);
431             daParamCollectionMapper.insertDaParamCollection(saveData);
432         });
433     }
1c84ae 434
A 435     @Override
436     public void jrmSaveCampaignTimeParameters(DaParamCollection daParamCollection) {
4e83fa 437         //增加过站记录
1c84ae 438         DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection();
A 439         daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo());
4e83fa 440         daPassingStationCollection.setSfcCode(daParamCollection.getProductBarcode());
A 441         daPassingStationCollection.setProductCode(daParamCollection.getProductCode());
1c84ae 442         daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode());
4e83fa 443         daPassingStationCollection.setInboundTime(daParamCollection.getInboundTime());
A 444         daPassingStationCollection.setOutboundTime(new Date());
445         daPassingStationCollection.setCreateTime(new Date());
446         daPassingStationCollection.setOutRsSign("1");
447         boolean save = daPassingStationCollectionService.save(daPassingStationCollection);
1c84ae 448
4e83fa 449         //添加基础参数
A 450         this.manualWorkstationsAddBasicParameters(daParamCollection);
1c84ae 451
A 452         //给opc发21
453         try {
454 //            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build());
4e83fa 455             String str = daParamCollection.getLocationCode();
A 456             miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+str+".RecordDataDone").value(21).build());
1c84ae 457         } catch (Exception e) {
A 458             throw new RuntimeException(e);
459         }
460     }
6a462f 461
W 462
463     public void sendToFactoryMes(String stationCode,String productNum ){
a846f2 464 //        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
A 465         String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
6a462f 466         ParentVO vo =new ParentVO();
W 467         List<ChildVO> checkList = new ArrayList<>();
468         List<DaParamCollection> list = this.list(new LambdaQueryWrapper<DaParamCollection>()
469                 .eq(DaParamCollection::getSfcCode, productNum)
470                 .eq(DaParamCollection::getLocationCode, stationCode));
471         vo.setTotalResult("1");
472         String string = new Random(10).toString();
473         vo.setRecordId(string);
474         vo.setProductNum(productNum);
475         vo.setSiteCode("3983");
476         vo.setStationCode(stationCode);
477         if (CollUtil.isNotEmpty(list)){
478             List<DaParamCollection> collect = list.stream().filter(x -> Constants.NG.equals(x.getParamValue())).collect(Collectors.toList());
479             if (CollUtil.isNotEmpty(collect)){
480                 vo.setTotalResult("0");
481             }
482             List<BsFormulaChildInfo> bsFormulaChildInfoList = bsFormulaChildInfoService.list();
483             for (DaParamCollection daParamCollection : list) {
484                 ChildVO childVO = new ChildVO();
485                 childVO.setItemCode(daParamCollection.getParamCode());
486                 String time = daParamCollection.getCollectionTime() != null ? daParamCollection.getCollectionTime().toString() : "";
487                 childVO.setCheckResult("1");
488                 if (StrUtil.isNotBlank(daParamCollection.getParamValue())){
489                     if (Constants.NG.equals(daParamCollection.getParamValue())){
490                         childVO.setCheckResult("0");
491                     }
492                 }
493                 childVO.setCheckTime(time);
494                 childVO.setItemValue(daParamCollection.getParamValue());
495                 childVO.setItemType("3");
496                 childVO.setItemText(daParamCollection.getParamName());
497                 if (StrUtil.isNotBlank(daParamCollection.getParamCode())){
498                     List<BsFormulaChildInfo> collect1 = bsFormulaChildInfoList.stream().filter(x -> daParamCollection.getParamCode().equals(x.getParamCode())).collect(Collectors.toList());
499                     if (CollUtil.isNotEmpty(collect1)){
500                         BsFormulaChildInfo bsFormulaChildInfo = collect1.get(0);
501                         childVO.setItemType(bsFormulaChildInfo.getOperationType());
502                     }
503                 }
504
505                 checkList.add(childVO);
506             }
507         }
508         vo.setCheckList(checkList);
509         HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute();
510
511     }
5966d6 512
A 513     @Override
514     public void pushGeelycvMesFeedback(String packID, String stationCode) {
d76bba 515         logger.info("进入人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID);
5966d6 516         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
6e3e50 517 //        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
A 518         String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
5966d6 519         String totalResult = "0";
8cfe20 520         List<DaParamCollectionTemp> paramList = daParamCollectionTempService.list(new LambdaQueryWrapper<DaParamCollectionTemp>().eq(DaParamCollectionTemp::getSfcCode, packID).eq(DaParamCollectionTemp::getLocationCode, stationCode));
A 521         if(paramList.size() > 0){
522             ParentVO parentVO = new ParentVO();
523             parentVO.setSiteCode("3983");
524             parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
525             parentVO.setStationCode(stationCode);
526             parentVO.setProductNum(packID);
527             parentVO.setTotalResult("1");
528             List<ChildVO> listChildVo = new ArrayList<>();
529
530             for (DaParamCollectionTemp daParamCollection : paramList) {
531                 ChildVO childVO = new ChildVO();
532                 childVO.setItemCode(daParamCollection.getParamCode());
aa0211 533                 List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
A 534                         .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())
535                         .eq(DaCollectionParamConf::getProductModel, "PE01B")
536                 );
8cfe20 537                 DaCollectionParamConf paramConfOne = paramConfOneList.get(0);
A 538                 if(paramConfOne!=null){
539                     childVO.setItemType(paramConfOne.getSpareField1());
540                     childVO.setItemText(paramConfOne.getCollectParameterName());
541                 }else {
542                     childVO.setItemType("3");
543                     childVO.setItemText("");
544                 }
545                 childVO.setItemValue(daParamCollection.getParamValue());
546
547                 if(daParamCollection.getParamValue().equals("1")){
548                     childVO.setCheckResult("1");
549                 }else if(daParamCollection.getParamValue().equals("2")){
550                     childVO.setCheckResult("0");
551                     parentVO.setTotalResult("0");
552                     totalResult = "1";
553                 }else {
554                     childVO.setCheckResult("1");
555                 }
556                 childVO.setCheckTime(format.format(daParamCollection.getCollectionTime()));
557                 listChildVo.add(childVO);
558
559             }
560             parentVO.setCheckList(listChildVo);
d76bba 561             try{
A 562                 CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
273d64 563                     logger.info("工位{}---开始执行异步方法---pack码是{}"+stationCode,packID);
d76bba 564                     HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
273d64 565                     logger.info("工位{}---异步方法执行结束---pack码是{}"+stationCode,packID);
A 566                     logger.info("手动工位{}传工厂入参VO{}---pack码是{}" + stationCode,new Gson().toJson(parentVO),packID);
567                     logger.info("手动工位{}传工厂MES异步方法{}---pack码是{}"+stationCode,execute.body(),packID);
2fbce7 568
A 569                     DaParamCollectionTemp daParamCollectionTemp = new DaParamCollectionTemp();
570                     daParamCollectionTemp.setSfcCode(packID);
571                     daParamCollectionTemp.setLocationCode(stationCode);
572                     int i = daParamCollectionTempService.deleteDaParamCollectionTempBySfcCodeAndLocationCode(daParamCollectionTemp);
d76bba 573                     logger.info("删除临时表数据条数{}-工位{}-pack码{}",i,stationCode,packID);
A 574                 });
575             }catch (Exception e){
576                 System.out.println(e.getMessage());
577             }
578             logger.info("结束人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID);
8cfe20 579         }
A 580
581     }
582
583     @Override
584     public void automaticWorkstationPushGeelycvMesFeedback(String packID, String stationCode,List<DaParamCollection> paramList) {
bdb404 585         logger.info("进入工位{}-工厂MES推送数据方法automaticWorkstationPushGeelycvMesFeedback",stationCode);
8cfe20 586         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
6e3e50 587 //        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
A 588         String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
8cfe20 589         String totalResult = "0";
5966d6 590         if(paramList.size() > 0){
bdb404 591             logger.info("进入工位{}-拼数据",stationCode);
5966d6 592             ParentVO parentVO = new ParentVO();
A 593             parentVO.setSiteCode("3983");
594             parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
595             parentVO.setStationCode(stationCode);
596             parentVO.setProductNum(packID);
597             parentVO.setTotalResult("1");
598             List<ChildVO> listChildVo = new ArrayList<>();
599
600             for (DaParamCollection daParamCollection : paramList) {
601                 ChildVO childVO = new ChildVO();
602                 childVO.setItemCode(daParamCollection.getParamCode());
8cfe20 603 //                BsFormulaChildInfo childOne = bsFormulaChildInfoService.getOne(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getParamCode, daParamCollection.getParamCode()));
A 604 //                DaCollectionParamConf paramConfOne = daCollectionParamConfService.getOne(new LambdaQueryWrapper<DaCollectionParamConf>().eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode()));
aa0211 605                 List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
A 606                         .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())
607                         .eq(DaCollectionParamConf::getProductModel, "PE01B")
608                 );
8cfe20 609                 DaCollectionParamConf paramConfOne = paramConfOneList.get(0);
5966d6 610                 if(paramConfOne!=null){
237733 611                     childVO.setItemType(paramConfOne.getSpareField1());
5966d6 612                     childVO.setItemText(paramConfOne.getCollectParameterName());
A 613                 }else {
237733 614                     childVO.setItemType("3");
5966d6 615                     childVO.setItemText("");
A 616                 }
617                 childVO.setItemValue(daParamCollection.getParamValue());
618
619                 if(daParamCollection.getParamValue().equals("1")){
620                     childVO.setCheckResult("1");
621                 }else if(daParamCollection.getParamValue().equals("2")){
622                     childVO.setCheckResult("0");
623                     parentVO.setTotalResult("0");
624                     totalResult = "1";
625                 }else {
626                     childVO.setCheckResult("1");
627                 }
628                 childVO.setCheckTime(format.format(daParamCollection.getCollectionTime()));
629                 listChildVo.add(childVO);
630             }
631             parentVO.setCheckList(listChildVo);
bdb404 632             logger.info("结束工位{}-拼数据",stationCode);
A 633             logger.info("进入工位{}-工厂MES推送数据方法HttpResponseSend",stationCode);
d76bba 634             try{
A 635                 CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
273d64 636                     logger.info("工位{}---自动工位开始执行异步方法---pack码是{}"+stationCode,packID);
d76bba 637                     HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
273d64 638                     logger.info("工位{}---自动工位异步方法执行结束---pack码是{}"+stationCode,packID);
4e83fa 639                     logger.info("自动工位{}传工厂入参VO{}" + stationCode,new Gson().toJson(parentVO));
A 640                     logger.info("自动工位{}传工厂MES异步方法返回{}"+stationCode,execute.body());
d76bba 641                 });
A 642             }catch (Exception e){
643                 System.out.println(e.getMessage());
644             }
645 //            HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
bdb404 646             logger.info("结束工位{}-工厂MES推送数据方法HttpResponseSend",stationCode);
5966d6 647         }
bdb404 648         logger.info("结束工位{}-工厂MES推送数据方法automaticWorkstationPushGeelycvMesFeedback",stationCode);
5966d6 649     }
616f98 650
237733 651     @Override
A 652     public AjaxResult checkRecordDataDone(DaParamCollection daParamCollection) {
653         String result = "";
8cfe20 654
A 655
237733 656         try {
8cfe20 657             List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getSpareField4, "1").eq(BsFormulaChildInfo::getProcessesCode, daParamCollection.getLocationCode()));
A 658             if(list.size()>0){
659                 String results = list.get(0).getResults();
660                 if(results!= null && !results.equals("") && results.equals("OK")){
661                     result = "21";
662                 }
663             }
664             /*Object recordDataDone = miloService.readFromOpcUa("PACK" + "." + daParamCollection.getLocationCode() + ".RecordDataDone").getValue();
237733 665             if(ObjectUtil.isNotNull(recordDataDone)){
A 666                 result = recordDataDone.toString();
8cfe20 667             }*/
237733 668         } catch (Exception e) {
A 669             throw new RuntimeException(e);
670         }
671         return AjaxResult.success(result);
672     }
673
8cfe20 674     @Override
A 675     public void enterWeighing(DaParamCollection daParamCollection) {
676         String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
6e3e50 677 //        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
e9e2c4 678         try{
A 679             daParamCollection.setWeightValue(getRandomNumberBetween(312.5, 313.5));
9f636f 680             Object recordDataDone = miloService.readFromOpcUa("PACK" + "." + daParamCollection.getLocationCode() + ".weight").getValue();
A 681             if(ObjectUtil.isNotNull(recordDataDone)){
682                 daParamCollection.setWeightValue(recordDataDone.toString());
683             }
e9e2c4 684             long timestampMillis = Instant.now().toEpochMilli();
A 685             ParentVO parentVO = new ParentVO();
686             ChildVO childVO = new ChildVO();
687             List<ChildVO> childVOList = new ArrayList<>();
688             childVO.setItemCode("PWD_PW");
689             childVO.setItemType("3");
690             childVO.setItemText("Pack重量值");
691             childVO.setItemValue(daParamCollection.getWeightValue());
692             childVO.setCheckTime(format.format(new Date()));
693             childVO.setCheckResult("1");
694             childVOList.add(childVO);
695             parentVO.setSiteCode("3983");
696             parentVO.setRecordId(""+timestampMillis);
697             parentVO.setStationCode("POP430");
698             parentVO.setProductNum(daParamCollection.getProductBarcode());
699             parentVO.setTotalResult("1");
700             parentVO.setCheckList(childVOList);
701             CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
702                 logger.info("POP430报工开始-工厂MES异步方法");
703                 HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
704                 logger.info("称重430返回结果"+execute.body());
705                 String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), "POP430", format.format(new Date()));
706                 JSONObject jsonObject = new JSONObject(reportResult);
707                 String code = jsonObject.getStr("code");
708                 String resultCode = jsonObject.getJSONObject("data").getStr("resultCode");
709                 if("success".equals(code)&&"S".equals(resultCode)){
710                     //如果成功,执行报工成功方法,修改是否报工为1,添加报工时间
c2e92c 711                     WebSocketUsers.sendMessageToUserByText(map.get("POP430"), "reportSuccess");
e9e2c4 712                     omProductionOrdeInfoService.updateOrderByProductNum("1",daParamCollection.getProductBarcode(),"POP430");
A 713                 }else{
c2e92c 714                     WebSocketUsers.sendMessageToUserByText(map.get("POP430"), "reportError");
e9e2c4 715                     //解析工厂mes返回结果,如果失败,执行报工失败方法,修改是否报工为2,添加报工时间
A 716                     omProductionOrdeInfoService.updateOrderByProductNum("2",daParamCollection.getProductBarcode(),"POP430");
717                 }
718                 logger.info("OP430报工结束-工厂MES异步方法{}"+reportResult);
719             });
720         }catch (Exception e){
c2e92c 721             WebSocketUsers.sendMessageToUserByText(map.get("POP430"), "reportError");
e9e2c4 722             System.out.println(e.getMessage());
A 723         }
724 //        HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
725 //        RestfulService.getWorkReportResultFeedback(daParamCollection.getSfcCode(),"POP430",format.format(new Date()));
8cfe20 726     }
A 727
768498 728     @Override
A 729     public void manualWorkstationsAddBasicParameters(DaParamCollection daParamCollection) {
730         // 假设这是从数据库或其他地方获取的参数数据
731         Map<String, String> map = new HashMap<>();
732         map.put("GC", "南浔工厂");
733         map.put("CXBH", "Pack线");
734         map.put("SBBH", "设备001");
735         map.put("YGBH", SecurityUtils.getUsername());
736         map.put("GDBH", daParamCollection.getWorkOrderNo());
737         map.put("CPXH", daParamCollection.getProductCode());
738         map.put("INT", format.format(daParamCollection.getInboundTime()));
739         map.put("OUTT",format.format(new Date()));
740
741         map.forEach((key, value) -> {
742             DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
743             daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
744             daCollectionParamConf.setCollectParameterId(key);
745             List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
746             DaParamCollection saveData = new DaParamCollection();
747             saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
748             saveData.setProductCode(daParamCollection.getProductCode());
749             saveData.setLocationCode(daParamCollection.getLocationCode());
750             saveData.setSfcCode(daParamCollection.getProductBarcode());
751             saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
752             saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
753             saveData.setCollectionTime(new Date());
754             saveData.setParamValue(value);
755             daParamCollectionMapper.insertDaParamCollection(saveData);
273d64 756
A 757             DaParamCollectionTemp saveDataTemp = new DaParamCollectionTemp();
758             saveDataTemp.setWorkOrderNo(daParamCollection.getWorkOrderNo());
759             saveDataTemp.setProductCode(daParamCollection.getProductCode());
760             saveDataTemp.setLocationCode(daParamCollection.getLocationCode());
761             saveDataTemp.setSfcCode(daParamCollection.getProductBarcode());
762             saveDataTemp.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
763             saveDataTemp.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
764             saveDataTemp.setCollectionTime(new Date());
765             saveDataTemp.setParamValue(value);
766             daParamCollectionTempService.save(saveDataTemp);
767
768498 768         });
A 769     }
770
771     @Override
772     public void preInstallOut(DaParamCollection daParamCollection) {
4e83fa 773         String locationCode = daParamCollection.getLocationCode();
768498 774         //增加过站记录
A 775         DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection();
776         daPassingStationCollection.setSfcCode(daParamCollection.getProductBarcode());
4e83fa 777         daPassingStationCollection.setLocationCode(locationCode);
768498 778         daPassingStationCollection.setInboundTime(daParamCollection.getInboundTime());
A 779         daPassingStationCollection.setOutboundTime(new Date());
780         daPassingStationCollection.setCreateTime(new Date());
781         daPassingStationCollection.setOutRsSign("1");
782         boolean save = daPassingStationCollectionService.save(daPassingStationCollection);
783         //添加基础参数
784         this.manualWorkstationsAddBasicParameters(daParamCollection);
4e83fa 785
A 786         try {
787             String str = "PACK."+locationCode+".RecordDataDone";
788             miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(21).build());
789             logger.info("预装工位写入OPC成功,工位:{},值{}",str,21);
790         } catch (Exception e) {
791             throw new RuntimeException(e);
792         }
768498 793     }
A 794
01beb5 795     @Override
A 796     public AjaxResult addRepairTighteningData(DaParamCollection daParamCollection) {
797         try {
b849c6 798         String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
A 799 //            String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
01beb5 800             String processesCode =  daParamCollection.getLocationCode();
A 801
802             long timestampMillis = Instant.now().toEpochMilli();
803             ParentVO parentVO = new ParentVO();
804             List<ChildVO> childVOList = new ArrayList<>();
805             parentVO.setSiteCode("3983");
806             parentVO.setRecordId(""+timestampMillis);
807             parentVO.setStationCode(processesCode);
808             parentVO.setProductNum(daParamCollection.getSfcCode());
809             parentVO.setTotalResult("1");
810             parentVO.setCheckList(childVOList);
811
812             String screwNumber = daParamCollection.getScrewNumber();
813             String torque = daParamCollection.getTorque();
814             String angle = daParamCollection.getAngle();
815             String torqueResult = daParamCollection.getTorqueResult();
816             String angleResult = daParamCollection.getAngleResult();
817
818             Map<String, String> map = new HashMap<>();
819             map.put("POP320","模组");
820             map.put("POP400","箱盖");
821
822             List<String> nameLikeString = new ArrayList<>();
823             nameLikeString.add(map.get(processesCode)+"拧紧最终扭矩");
824             nameLikeString.add(map.get(processesCode)+"拧紧最终角度");
825             nameLikeString.add(map.get(processesCode)+"拧紧最终扭矩是否在范围内");
826             nameLikeString.add(map.get(processesCode)+"拧紧最终角度是否在范围内");
827
828             if(screwNumber.contains(",")){
829                 String[] screwNumberSplit = screwNumber.split(",");
830                 String[] torqueSplit = torque.split(",");
831                 String[] angleSplit = angle.split(",");
832                 String[] torqueResultSplit = torqueResult.split(",");
833                 String[] angleResultSplit = angleResult.split(",");
834
835                 List<String[]> dataList = new ArrayList<String[]>();
836                 dataList.add(torqueSplit);
837                 dataList.add(angleSplit);
838                 dataList.add(torqueResultSplit);
839                 dataList.add(angleResultSplit);
840
841                 for (int k = 0; k < nameLikeString.size(); k++) {
842                     for (int i = 0; i < screwNumberSplit.length; i++) {
843                         String s1 = nameLikeString.get(k)+screwNumberSplit[i];
844                         List<DaCollectionParamConf> confList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
845                                 .eq(DaCollectionParamConf::getProcessesCode, processesCode)
846                                 .eq(DaCollectionParamConf::getCollectParameterName, s1)
847                         );
848                         DaCollectionParamConf daCollectionParamConf = confList.get(0);
849                         ChildVO childVO = new ChildVO();
850                         childVO.setItemCode(daCollectionParamConf.getCollectParameterId());
851                         childVO.setItemType(daCollectionParamConf.getSpareField1());
852                         childVO.setItemText(daCollectionParamConf.getCollectParameterName());
853                         String itemValue = dataList.get(k)[i];
854                         childVO.setItemValue(itemValue);
855                         childVO.setCheckTime(format.format(new Date()));
856                         childVO.setCheckResult("1");
857                         childVOList.add(childVO);
858                     }
859                 }
860             }else {
861                 List<String> dataList = new ArrayList<>();
862                 dataList.add(torque);
863                 dataList.add(angle);
864                 dataList.add(torqueResult);
865                 dataList.add(angleResult);
866                 for (int k = 0; k < nameLikeString.size(); k++) {
867                     String collectParameterName = nameLikeString.get(k)+screwNumber;
868                     List<DaCollectionParamConf> confList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
869                             .eq(DaCollectionParamConf::getProcessesCode, processesCode)
870                             .eq(DaCollectionParamConf::getCollectParameterName, collectParameterName)
871                     );
872                     DaCollectionParamConf daCollectionParamConf = confList.get(0);
873                     ChildVO childVO = new ChildVO();
874                     childVO.setItemCode(daCollectionParamConf.getCollectParameterId());
875                     childVO.setItemType(daCollectionParamConf.getSpareField1());
876                     childVO.setItemText(daCollectionParamConf.getCollectParameterName());
877                     String itemValue = dataList.get(k);
878                     childVO.setItemValue(itemValue);
879                     childVO.setCheckTime(format.format(new Date()));
880                     childVO.setCheckResult("1");
881                     childVOList.add(childVO);
882                 }
883             }
884
885             System.out.println(childVOList);
886             logger.info("工位{}-----------返修数据上传入参vo:{}",processesCode,new Gson().toJson(parentVO));
887             HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
888             logger.info("工位{}-----------返修数据上传结果:{}",processesCode,execute.body());
889             return AjaxResult.success("上传成功");
890         }catch (Exception e){
891             return AjaxResult.error("上传失败,参数不对请检查!");
892         }
893     }
894
e9e2c4 895     public static String getRandomNumberBetween(double min, double max) {
A 896         return String.format("%.1f",min + (Math.random() * (max - min)));
897     }
898
01beb5 899
e57a89 900 }