From 2b9842aefcc46df98a889ae7a7346e030ed4ebae Mon Sep 17 00:00:00 2001 From: cl <418351270@qq.com> Date: 星期五, 02 八月 2024 11:07:57 +0800 Subject: [PATCH] 修改采集参数 --- jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java index b6b30da..48ee46f 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java +++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java @@ -103,9 +103,22 @@ try{ if (Constants.RECORD_DATA.equals(tab)) { //鍑哄叆绔� if (Constants.ONE.equals(valueString)) {//鍏ョ珯 - Integer recordDataDone = 11; - miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StartTime").value(new Date()).build()); - miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build()); + if(Constants.OP040_OP160.contains(device)){ + Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".snCode").getValue(); + if (ObjectUtil.isNull(snCodeObjcet)){ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); + }else{ + String productNum = snCodeObjcet.toString(); + //灏嗕骇鍝丼N鍙戦�佸埌鍓嶅彴 + productNum = "productNum,"+ productNum; + WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); + } + }else { + Integer recordDataDone = 11; + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StartTime").value(new Date()).build()); + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build()); + } } else if(Constants.TWO.equals(valueString)){//鍑虹珯 Integer result = 21; //鍏堝垽鏂槸鍚︽湁浜у搧SN -- Gitblit v1.9.3