| | |
| | | if (CollUtil.isNotEmpty(collect1)){ |
| | | collect3 = collect3.stream().filter(x -> !collect1.contains(x)).collect(Collectors.toList()); |
| | | } |
| | | String[] parts = Node.split("[.]"); |
| | | String par = parts[0]+"."+parts[1]; |
| | | if (CollUtil.isNotEmpty(collect3)){ |
| | | collect3.forEach(x -> { |
| | | ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
| | | readWriteEntity.setIdentifier(x); |
| | | readWriteEntity.setIdentifier(par+"."+x); |
| | | readWriteEntity.setValue(2); |
| | | writeList.add(readWriteEntity); |
| | | }); |
| | |
| | | //数据库查询出的工位 |
| | | collect4.forEach(x -> { |
| | | ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
| | | readWriteEntity.setIdentifier(x); |
| | | readWriteEntity.setIdentifier(par+"."+x); |
| | | readWriteEntity.setValue(1); |
| | | writeList.add(readWriteEntity); |
| | | }); |
| | |
| | | // writeList.add(readWriteEntity); |
| | | // }); |
| | | // } |
| | | String[] parts = Node.split("[.]"); |
| | | |
| | | String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]); |
| | | if (StrUtil.isNotBlank(a)){ |
| | | int input = Integer.parseInt(a); |
| | |
| | | readWriteEntity.setIdentifier("Repair_sign"); |
| | | readWriteEntity.setValue(minOP); |
| | | writeList.add(readWriteEntity); |
| | | miloService.writeToOpcByte(writeList); |
| | | if (CollUtil.isNotEmpty(writeList)){ |
| | | List<ReadWriteEntity> tempList = new ArrayList<>(); |
| | | for (int i = 0; i < writeList.size(); i++) { |
| | | tempList.add(writeList.get(i)); |
| | | if (tempList.size()>10){ |
| | | miloService.writeToOpcByte(tempList); |
| | | log.info("写入返修:,{}",tempList); |
| | | tempList = new ArrayList<>(); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(tempList)){ |
| | | miloService.writeToOpcByte(tempList); |
| | | log.info("写入返修:,{}",tempList); |
| | | } |
| | | |
| | | |
| | | } |
| | | // miloService.writeToOpcByte(writeList); |
| | | } |
| | | |
| | | |
| | | public void SaveData(String Node) throws Exception { |
| | | |
| | | String[] parts = Node.split("[.]"); |
| | | Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
| | | if (null == SNCodeObject){ |
| | |
| | | return nodeid; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | if(!nodeIdList.isEmpty()){ |
| | | List<ReadWriteEntity> readWriteEntityList = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(nodeIdList)){ |
| | | long time1 = new Date().getTime(); |
| | | List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
| | | readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
| | | long time2 = new Date().getTime(); |
| | | log.info("读取点位花费时间:{},",time2-time1); |
| | | |
| | | } |
| | | //返回plc保存成功 |
| | | if (parts.length==3){ |
| | | if ("SaveRequest".equals(parts[2])){ |
| | |
| | | log.info("-------请求返回-----,{}",LocalDateTime.now()); |
| | | } |
| | | List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
| | | for(int i=0;i<nodeIdList.size();i++){ |
| | | if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | ParamCollection.setLocationCode(parts[1]); |
| | | if (readWriteEntityList.get(i) == null){ |
| | | ParamCollection.setParamValue("0"); |
| | | }else { |
| | | ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
| | | if (CollUtil.isNotEmpty(nodeIdList)){ |
| | | for(int i=0;i<nodeIdList.size();i++){ |
| | | if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | ParamCollection.setLocationCode(parts[1]); |
| | | if (readWriteEntityList.get(i) == null){ |
| | | ParamCollection.setParamValue("0"); |
| | | }else { |
| | | ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
| | | } |
| | | ParamCollection.setSfcCode(SNCode); |
| | | ParamCollection.setParamName(list.get(i).getCollectParameterName()); |
| | | ParamCollection.setParamUpper(list.get(i).getParamUpper()); |
| | | ParamCollection.setParamLower(list.get(i).getParamLower()); |
| | | ParamCollection.setUnit(list.get(i).getCollectParameterUnit()); |
| | | ParamCollection.setState("合格"); |
| | | ParamCollection.setType(list.get(i).getCollectParameterType()); |
| | | ParamCollection.setCollectionTime(new Date()); |
| | | daParamCollectionlist.add(ParamCollection); |
| | | } |
| | | ParamCollection.setSfcCode(SNCode); |
| | | ParamCollection.setParamName(list.get(i).getCollectParameterName()); |
| | | ParamCollection.setParamUpper(list.get(i).getParamUpper()); |
| | | ParamCollection.setParamLower(list.get(i).getParamLower()); |
| | | ParamCollection.setUnit(list.get(i).getCollectParameterUnit()); |
| | | ParamCollection.setState("合格"); |
| | | ParamCollection.setType(list.get(i).getCollectParameterType()); |
| | | ParamCollection.setCollectionTime(new Date()); |
| | | daParamCollectionlist.add(ParamCollection); |
| | | } |
| | | daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
| | | log.info("-------保存数据完成---------"); |
| | | } |
| | | daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
| | | log.info("-------保存数据完成---------"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | Long beatTime = 0L; |