From 2d564a5921cec98b2c7e6065cc8f066abd614b76 Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期三, 18 九月 2024 18:40:24 +0800
Subject: [PATCH] 打印功能修改,进站校验sn

---
 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 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 298a5a5..09ebfc2 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
@@ -127,13 +127,19 @@
 
                         }
                     }else {//鑷姩宸ヤ綅
-                        //鎵�鏈夎繘绔欏皢杩涚珯鏃堕棿鍐欑粰PLC
-                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                        String currentDate = dateFormat.format(new Date());
-                        miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StartTime").value(currentDate).build());
+                        Object snCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue();
+                        if (ObjectUtil.isNull(snCodeObject)){
+                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
+                        }else{
+                            //鎵�鏈夎繘绔欏皢杩涚珯鏃堕棿鍐欑粰PLC
+                            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            String currentDate = dateFormat.format(new Date());
+                            miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StartTime").value(currentDate).build());
 
-                        Integer recordDataDone = 11;
-                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build());
+                            Integer recordDataDone = 11;
+                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build());
+                        }
+
                     }
 
                 } else if(Constants.TWO.equals(valueString)){//鍑虹珯

--
Gitblit v1.9.3