From ca6062762cf95a074635626ce185d2fd14512e76 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 20 十二月 2023 16:16:07 +0800
Subject: [PATCH] #提升机异常码

---
 src/main/java/com/zy/core/thread/LiftThread.java           |    7 +++++++
 src/main/java/com/zy/core/model/protocol/LiftProtocol.java |   20 ++++++++++++++++++++
 src/main/webapp/views/lift.html                            |    2 ++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
index ed9bd30..e64959d 100644
--- a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,5 +1,8 @@
 package com.zy.core.model.protocol;
 
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasLiftErr;
+import com.zy.asrs.service.BasLiftErrService;
 import com.zy.core.enums.LiftProtocolStatusType;
 import com.zy.core.model.command.LiftAssignCommand;
 import lombok.Data;
@@ -91,6 +94,11 @@
      * 璁惧鏁呴殰
      */
     private Boolean deviceError;
+
+    /**
+     * 鏁呴殰鐮�
+     */
+    private Short errorCode;
 
     /**
      * 浠诲姟鍦板潃
@@ -214,5 +222,17 @@
         return res;
     }
 
+    public String getErrCode$() {
+        if (this.errorCode == null) {
+            return "";
+        }
+        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
+        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
+        if (basLiftErr == null) {
+            return String.valueOf(this.errorCode);
+        }
+        return basLiftErr.getErrName();
+    }
+
 
 }
diff --git a/src/main/java/com/zy/core/thread/LiftThread.java b/src/main/java/com/zy/core/thread/LiftThread.java
index d58a02d..e2845c5 100644
--- a/src/main/java/com/zy/core/thread/LiftThread.java
+++ b/src/main/java/com/zy/core/thread/LiftThread.java
@@ -272,6 +272,13 @@
                 }
             }
 
+            Thread.sleep(100);
+            //鑾峰彇鎻愬崌鏈哄紓甯告暟鎹�
+            OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB82.22.0", (short) 2);
+            if (result3.IsSuccess) {
+                liftProtocol.setErrorCode(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0));//閿欒鐮�
+            }
+
         } catch (Exception e) {
             OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆戞彁鍗囨満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
         }
diff --git a/src/main/webapp/views/lift.html b/src/main/webapp/views/lift.html
index 29fdfe0..93cc432 100644
--- a/src/main/webapp/views/lift.html
+++ b/src/main/webapp/views/lift.html
@@ -40,6 +40,7 @@
                         <th>鍙宠秴闄�</th>
                         <th>瓒呴珮</th>
                         <th>瓒呴噸</th>
+                        <th>寮傚父淇℃伅</th>
                     </tr>
                     </thead>
                     <tbody>
@@ -286,6 +287,7 @@
                         setVal(tr.children("td").eq(11), table[i-1].rightOverrun$);
                         setVal(tr.children("td").eq(12), table[i-1].overHeight$);
                         setVal(tr.children("td").eq(13), table[i-1].overWeight$);
+                        setVal(tr.children("td").eq(14), table[i-1].errCode$);
                     }
                 } else if (res.code === 403){
                     window.location.href = baseUrl+"/login";

--
Gitblit v1.9.1