| | |
| | | package com.jcdm.main.da.opcuaconfig.cert; |
| | | |
| | | import cn.hutool.core.date.StopWatch; |
| | | import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
| | | import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
| | | import com.jcdm.main.da.opcuaconfig.client.ClientHandler; |
| | |
| | | DaCollectionParamConf daCollectionParamConf=new DaCollectionParamConf(); |
| | | daCollectionParamConf.setGatherAddress(parts[0]+"."+parts[1]); |
| | | b=collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | |
| | | if(b!=null&&b.size()>0){ |
| | | List<NodeId> nodeId = b.stream().map(info -> { |
| | | NodeId nodeid = new NodeId(2,info.getGatherAddress()); |
| | | return nodeid; |
| | | }).collect(Collectors.toList()); |
| | | List<DataValue> s=readValues(nodeId); |
| | | //保存PLC采集数据 |
| | | for(int i=0;i<nodeId.size();i++) |
| | | { |
| | | DaParamCollection Config=new DaParamCollection(); |
| | | Config.setParamCode(nodeId.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | Config.setLocationCode(nodeId.get(i).getIdentifier().toString().split("[.]")[1]); |
| | | Config.setParamValue(s.get(i).getValue().getValue().toString()); |
| | | Config.setSfcCode(SNCode); |
| | | Config.setParamName(b.get(i).getGatherAddress()); |
| | | daParamCollectionService.insertDaParamCollection(Config); |
| | | // StopWatch stopWatch = new StopWatch(); |
| | | // stopWatch.start(); |
| | | List<DaParamCollection> DaParamCollectionlist = new ArrayList<>(); |
| | | for(int i=0;i<nodeId.size();i++){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | ParamCollection.setParamCode(nodeId.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | ParamCollection.setLocationCode(nodeId.get(i).getIdentifier().toString().split("[.]")[1]); |
| | | ParamCollection.setParamValue(s.get(i).getValue().getValue().toString()); |
| | | ParamCollection.setSfcCode(SNCode); |
| | | ParamCollection.setParamName(b.get(i).getGatherAddress()); |
| | | DaParamCollectionlist.add(ParamCollection); |
| | | } |
| | | daParamCollectionService.saveBeachDaParamCollection(DaParamCollectionlist); |
| | | // stopWatch.stop(); |
| | | // System.out.println("使用sqlSessionFactory实现批量插入耗时:" + stopWatch.getTotalTimeMillis()); |
| | | } |
| | | //记录过站,并计算节拍。 |
| | | DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |