| | |
| | | String ecpStr = "";//异常记录标记 |
| | | try { |
| | | if (null != value) { |
| | | //BCOP40进站校验 |
| | | if (identifier.equals("CFL4CVT.BCOP040.RecordData") && null != value && "1".equals(value.toString())) { |
| | | //待添加从过站采集表取sfc_code写入plc的sncode方法 |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP040.MesRecordDataDone", 11); |
| | | miloService.writeToOpcByte(entity); |
| | | //BCOP010出站校验 |
| | | if (identifier.equals("CFL4CVT.BCOP010.RecordData") && null != value && "2".equals(value.toString())) { |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP010.MesRecordDataDone", 21); |
| | | miloService.writeToOpcShort(entity); |
| | | } |
| | | //BCOP40出站校验 |
| | | else if (identifier.equals("CFL4CVT.BCOP040.RecordData") && null != value && "2".equals(value.toString())) { |
| | | SaveData("CFL4CVT.BCOP40.RecordData"); |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP040.MesRecordDataDone", 21); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | //BCOP60进站校验 |
| | | else if (identifier.equals("CFL4CVT.BCOP060.RecordData") && null != value && "1".equals(value.toString())) { |
| | | //待添加从过站采集表取sfc_code写入plc的sncode方法 |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP060.MesRecordDataDone", 11); |
| | | miloService.writeToOpcByte(entity); |
| | | SaveData("CFL4CVT.BCOP040.RecordData"); |
| | | } |
| | | //BCOP60出站校验 |
| | | else if (identifier.equals("CFL4CVT.BCOP060.RecordData") && null != value && "2".equals(value.toString())) { |
| | | SaveData("CFL4CVT.BCOP060.RecordData"); |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP060.MesRecordDataDone", 21); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | //BCOP100进站校验 |
| | | else if (identifier.equals("CFL4CVT.BCOP100.RecordData") && null != value && "1".equals(value.toString())) { |
| | | //待添加从过站采集表取sfc_code写入plc的sncode方法 |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP100.MesRecordDataDone", 11); |
| | | miloService.writeToOpcByte(entity); |
| | | } |
| | | //BCOP100出站校验 |
| | | else if (identifier.equals("CFL4CVT.BCOP100.RecordData") && null != value && "2".equals(value.toString())) { |
| | | SaveData("CFL4CVT.BCOP100.RecordData"); |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BCOP100.MesRecordDataDone", 21); |
| | | miloService.writeToOpcByte(entity); |
| | | }//BP020进站校验 |
| | | else if (identifier.equals("CFL4CVT.BP020.RecordData") && null != value && "1".equals(value.toString())) { |
| | | //待添加从过站采集表取sfc_code写入plc的sncode方法 |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BP020.MesRecordDataDone", 11); |
| | | miloService.writeToOpcByte(entity); |
| | | |
| | | } |
| | | //BP020出站校验 |
| | | else if (identifier.equals("CFL4CVT.BP020.RecordData") && null != value && "2".equals(value.toString())) { |
| | | SaveData("CFL4CVT.BP020.RecordData"); |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.BP020.MesRecordDataDone", 21); |
| | | miloService.writeToOpcByte(entity); |
| | | |
| | | } |
| | | else if(identifier.equals("CFL4CVT.OP220.RecordData") && null != value && "2".equals(value.toString())) { |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT.OP220.MesRecordDataDone", 21); |
| | | miloService.writeToOpcShort(entity); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // public void SaveData(String Node) throws Exception { |
| | | // String[] parts = Node.split("[.]"); |
| | | // Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
| | | // |
| | | // if (null != SNCodeObject) { |
| | | // String SNCode = SNCodeObject.toString(); |
| | | // List<DaCollectionParamConf> list; |
| | | // DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | // daCollectionParamConf.setGatherAddress(parts[0] + "." + parts[1]); |
| | | // list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | // |
| | | // List<String> nodeIdList = list.stream().map(info -> { |
| | | // String nodeid = info.getGatherAddress(); |
| | | // return nodeid; |
| | | // }).collect(Collectors.toList()); |
| | | // |
| | | // if (!nodeIdList.isEmpty()) { |
| | | // List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
| | | // List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
| | | // for (int i = 0; i < nodeIdList.size(); i++) { |
| | | // DaParamCollection ParamCollection = new DaParamCollection(); |
| | | // if (!readWriteEntityList.get(i).getValue().toString().equals("0.0")) { |
| | | // ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | // ParamCollection.setLocationCode(parts[1]); |
| | | // Object value = readWriteEntityList.get(i).getValue(); |
| | | // if (ObjectUtils.isNotEmpty(value)) { |
| | | // String string = value.toString(); |
| | | // ParamCollection.setParamValue(string); |
| | | // } |
| | | // 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); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | public void SaveData(String Node) throws Exception { |
| | | String[] parts = Node.split("[.]"); |
| | | Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
| | | |
| | | if (null != SNCodeObject) { |
| | | Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".RecordData").getValue(); |
| | | if(null != SNCodeObject) |
| | | { |
| | | String SNCode = SNCodeObject.toString(); |
| | | List<DaCollectionParamConf> list; |
| | | DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | |
| | | return nodeid; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | if (!nodeIdList.isEmpty()) { |
| | | if(!nodeIdList.isEmpty()){ |
| | | List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
| | | List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
| | | for (int i = 0; i < nodeIdList.size(); i++) { |
| | | for(int i=0;i<nodeIdList.size();i++){ |
| | | DaParamCollection ParamCollection = new DaParamCollection(); |
| | | if (!readWriteEntityList.get(i).getValue().toString().equals("0.0")) { |
| | | if(!readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
| | | ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
| | | ParamCollection.setLocationCode(parts[1]); |
| | | Object value = readWriteEntityList.get(i).getValue(); |
| | | if (ObjectUtils.isNotEmpty(value)) { |
| | | String string = value.toString(); |
| | | ParamCollection.setParamValue(string); |
| | | } |
| | | ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
| | | ParamCollection.setSfcCode(SNCode); |
| | | ParamCollection.setParamName(list.get(i).getCollectParameterName()); |
| | | ParamCollection.setParamUpper(list.get(i).getParamUpper()); |
| | |
| | | } |
| | | } |
| | | daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
| | | ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] +".MesRecordDataDone", 21); |
| | | miloService.writeToOpcShort(entity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public void WriteSNCode(String Node) throws Exception { |
| | | |
| | | |
| | | } |
| | | } |