From 6c8ee211ae63de5f4ce0bd13b9c34f0524cd656f Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 06 五月 2026 19:11:49 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/network/real/ZyCrnV2RealConnect.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/core/network/real/ZyCrnV2RealConnect.java b/src/main/java/com/zy/core/network/real/ZyCrnV2RealConnect.java
index 5162732..2809c5f 100644
--- a/src/main/java/com/zy/core/network/real/ZyCrnV2RealConnect.java
+++ b/src/main/java/com/zy/core/network/real/ZyCrnV2RealConnect.java
@@ -237,6 +237,11 @@
     }
 
     private boolean clearCommandArea() throws InterruptedException {
+        boolean confirmClearResult = clearCommandConfirm();
+        if (!confirmClearResult) {
+            return false;
+        }
+
         short[] array = new short[10];
 
         int clearIdx = 0;
@@ -256,6 +261,27 @@
         return false;
     }
 
+    private boolean clearCommandConfirm() throws InterruptedException {
+        int clearConfirmIdx = 0;
+        do {
+            OperateResult result = siemensNet.Write("DB100.18", (short) 0);
+            if (result.IsSuccess) {
+                OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.18", (short) 2);
+                if (resultRead.IsSuccess) {
+                    short confirm = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0);
+                    if (confirm == 0) {
+                        return true;
+                    }
+                }
+            }
+
+            clearConfirmIdx++;
+            Thread.sleep(200);
+        } while (clearConfirmIdx < 5);
+
+        return false;
+    }
+
     private boolean isCommandAreaEmpty(byte[] content) {
         short ackFinish = siemensNet.getByteTransform().TransInt16(content, 0);
         short taskNo = siemensNet.getByteTransform().TransInt16(content, 2);

--
Gitblit v1.9.1