| | |
| | | public AjaxResult initializedData(@RequestParam String sfcCode, @RequestParam String locationCode) { |
| | | |
| | | try { |
| | | String nodeId = "CFL4CVT." + locationCode + ".MesSNCode"; |
| | | ReadWriteEntity entity = new ReadWriteEntity(nodeId, sfcCode); |
| | | miloService.writeToOpcUa(entity); |
| | | String SaveSNCode ="CFL4CVT." + locationCode + ".SaveSNCode"; |
| | | ReadWriteEntity SaveSNCodeEntity = new ReadWriteEntity(SaveSNCode, 11); |
| | | miloService.writeToOpcUa(SaveSNCodeEntity); |
| | | return AjaxResult.success("SFC Code updated successfully"); |
| | | String str = "CFL4CVT."+locationCode+".RecordData"; |
| | | Object recordDataObject = miloService.readFromOpcUa(str).getValue(); |
| | | if(Integer.valueOf(recordDataObject.toString())== 1){ |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("CFL4CVT." + locationCode + ".MesSNCode").value(sfcCode).build()); |
| | | ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT." + locationCode + ".MesRecordDataDone", 11); |
| | | miloService.writeToOpcShort(entity); |
| | | return AjaxResult.success("扫码成功"); |
| | | }else { |
| | | return AjaxResult.error(500,"未进站禁止扫码"); |
| | | } |
| | | // ReadWriteEntity entity = new ReadWriteEntity("CFL4CVT." + locationCode + ".MesSNCode", sfcCode); |
| | | // miloService.writeToOpcChar(entity); |
| | | // String nodeId = "CFL4CVT." + locationCode + ".MesSNCode"; |
| | | // String SaveSNCode ="CFL4CVT." + locationCode + ".SaveSNCode"; |
| | | // ReadWriteEntity SaveSNCodeEntity = new ReadWriteEntity(SaveSNCode, 11); |
| | | // miloService.writeToOpcShort(SaveSNCodeEntity); |
| | | // return AjaxResult.success("SFC Code updated successfully"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("Failed to update SFC Code in OPC UA", e); |
| | | } |