From b40eab1e582d72ca2e71afb2f5604671f5193f22 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 13 八月 2025 20:09:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensCrnThread.java |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index 64dd38d..f9ecce5 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -10,8 +10,10 @@
 import com.core.common.SpringUtils;
 import com.zy.asrs.entity.BasCrnOpt;
 import com.zy.asrs.entity.BasCrnp;
+import com.zy.asrs.entity.DeviceDataLog;
 import com.zy.asrs.service.BasCrnOptService;
 import com.zy.asrs.service.BasCrnpService;
+import com.zy.asrs.service.DeviceDataLogService;
 import com.zy.common.utils.News;
 import com.zy.core.CrnThread;
 import com.zy.core.cache.MessageQueue;
@@ -25,6 +27,7 @@
 import lombok.extern.slf4j.Slf4j;
 
 import java.text.MessageFormat;
+import java.util.Base64;
 import java.util.Date;
 
 /**
@@ -205,6 +208,22 @@
                     }
                 }
 
+                if (System.currentTimeMillis() - crnProtocol.getDeviceDataLog() > 1000 * 5) {
+                    //閲囬泦鏃堕棿瓒呰繃5s锛屼繚瀛樹竴娆℃暟鎹褰�
+                    //淇濆瓨鏁版嵁璁板綍
+                    DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class);
+                    DeviceDataLog deviceDataLog = new DeviceDataLog();
+                    deviceDataLog.setOriginData(Base64.getEncoder().encodeToString(result.Content));
+                    deviceDataLog.setWcsData(JSON.toJSONString(crnProtocol));
+                    deviceDataLog.setType("crn");
+                    deviceDataLog.setDeviceNo(crnProtocol.getCrnNo());
+                    deviceDataLog.setCreateTime(new Date());
+                    deviceDataLogService.insert(deviceDataLog);
+
+                    //鏇存柊閲囬泦鏃堕棿
+                    crnProtocol.setDeviceDataLog(System.currentTimeMillis());
+                }
+
                 try {
                     // 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
                     BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);

--
Gitblit v1.9.1