From 5aa831dffdfb0ca524362e8d649c28babc681ece Mon Sep 17 00:00:00 2001
From: cpT <1@123>
Date: 星期一, 30 六月 2025 16:43:18 +0800
Subject: [PATCH] #改造

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

diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index 1074858..3b40137 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.BasErrLog;
 import com.zy.asrs.service.BasCrnOptService;
 import com.zy.asrs.service.BasCrnpService;
+import com.zy.asrs.service.BasErrLogService;
 import com.zy.asrs.service.DeviceErrorService;
 import com.zy.core.CrnThread;
 import com.zy.core.cache.CrnErrCache;
@@ -98,20 +100,6 @@
                     // 澶嶄綅
                     case 4:
                         CrnCommand command4 = (CrnCommand) task.getData();
-                        if (null == command4) {
-                            command4 = new CrnCommand();
-                        }
-                        command4.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
-                        command4.setTaskNo((short) 9999); // 宸ヤ綔鍙�
-                        command4.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
-                        command4.setTaskMode(CrnTaskModeType.GO_ORIGIN); // 浠诲姟妯″紡
-                        command4.setSourcePosX((short)0);     // 婧愬簱浣嶆帓
-                        command4.setSourcePosY((short)0);     // 婧愬簱浣嶅垪
-                        command4.setSourcePosZ((short)0);     // 婧愬簱浣嶅眰
-                        int row = slave.getId() * 2;
-                        command4.setDestinationPosX((short)row);     // 鐩爣搴撲綅鎺�
-                        command4.setDestinationPosY((short)1);     // 鐩爣搴撲綅鍒�
-                        command4.setDestinationPosZ((short)1);     // 鐩爣搴撲綅灞�
                         write(command4);
                         break;
                     default:
@@ -242,7 +230,7 @@
                 if (System.currentTimeMillis()-currentTimeMilliConnectCrn>1000*60*10){
                     try{
                         DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
-                        deviceErrorService.addDeviceError("Crn", slave.getId(), "璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐�");
+                        deviceErrorService.addDeviceError("CrnErr", slave.getId(), "璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐�");
                     } catch (Exception e2){
                         Thread.sleep(1000);
 //                log.error("e2:"+e2.getMessage());
@@ -281,7 +269,19 @@
             return false;
         }
         CrnErrCache.updateCrnErr(slave.getId(), "-");
-
+        try{
+            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+            deviceErrorService.addDeviceError("crnWrite", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍫嗗灈鏈烘寚浠や笅鍙�:"+JSON.toJSONString(command.getNowTask()));
+        } catch (Exception e2){
+        }
+        try{
+            BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class);
+            BasErrLog basErrLog = new BasErrLog(command,"","闈炲紓甯革紝浠诲姟涓嬪彂璁板綍");
+            if (!basErrLogService.insert(basErrLog)) {
+                log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", slave.getId(), "浠诲姟涓嬪彂璁板綍澶辫触");
+            }
+        } catch (Exception e3){
+        }
 //        convertRow(command);
         command.setCrnNo(slave.getId());
         short[] array = new short[10];
@@ -318,6 +318,20 @@
                     CrnErrCache.updateCrnErr(slave.getId(), "鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�");
 
                     log.error("鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐id:{}]>>>>閲嶅啓[{}] >>>>> 鍐欏叆[{}],===>>鍥炶[{}]", slave.getId(), i,JSON.toJSON(command),JSON.toJSON(one));
+
+                    try{
+                        DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+                        deviceErrorService.addDeviceError("crnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+i+";鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�:"+JSON.toJSONString(command.getNowTask()));
+                    } catch (Exception e2){
+                    }
+                    try{
+                        BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class);
+                        BasErrLog basErrLog = new BasErrLog(command,"鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐�","");
+                        if (!basErrLogService.insert(basErrLog)) {
+                            log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", slave.getId(), "鍫嗗灈鏈哄懡浠ゅ湴鍧�鍐欏叆鍚庡洖璇诲け璐ヨ褰曞け璐�");
+                        }
+                    } catch (Exception e3){
+                    }
                     result = siemensNet.Write("DB100.0", array);
                 }else{
                     break;
@@ -339,7 +353,19 @@
                     log.info("涓嬪彂DB100.18  鍥炶澶辫触" + "commandFinish:"+commandFinish);
                     log.info("涓嬪彂DB100.18  鍥炶澶辫触" + "array:"+ JSON.toJSONString(array));
                     CrnErrCache.updateCrnErr(slave.getId(), "涓嬪彂DB100.18  鍥炶澶辫触");
-
+                    try{
+                        DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+                        deviceErrorService.addDeviceError("crnErr", slave.getId(), "宸烽亾鍙�"+command.getLaneNo()+";鍐欏叆娆℃暟"+signFinish+";涓嬪彂DB100.18  鍥炶澶辫触:"+JSON.toJSONString(command.getNowTask()));
+                    } catch (Exception e2){
+                    }
+                    try{
+                        BasErrLogService basErrLogService = SpringUtils.getBean(BasErrLogService.class);
+                        BasErrLog basErrLog = new BasErrLog(command,"涓嬪彂DB100.18  鍥炶澶辫触","");
+                        if (!basErrLogService.insert(basErrLog)) {
+                            log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", slave.getId(), "涓嬪彂DB100.18  鍥炶澶辫触璁板綍澶辫触");
+                        }
+                    } catch (Exception e3){
+                    }
                     result = siemensNet.Write("DB100.18", commandFinish);
                     signFinish++;
                 }else {

--
Gitblit v1.9.1