From a4362dfe3e0e9c6fad426685da0065455799d018 Mon Sep 17 00:00:00 2001
From: hdy <1105738590@qq.com>
Date: 星期三, 10 七月 2024 20:06:15 +0800
Subject: [PATCH] cvt交互逻辑更新

---
 jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/controller/DaPassingStationCollectionController.java |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/controller/DaPassingStationCollectionController.java b/jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/controller/DaPassingStationCollectionController.java
index 029e9f8..15c89c8 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/controller/DaPassingStationCollectionController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/controller/DaPassingStationCollectionController.java
@@ -157,13 +157,23 @@
     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);
         }

--
Gitblit v1.9.3