From 09fcc4ec56a1ce6c0fcb308348d8dd5e2c08d336 Mon Sep 17 00:00:00 2001
From: fyxc <fyxc@qq.com>
Date: 星期四, 22 五月 2025 14:33:06 +0800
Subject: [PATCH] server commit files

---
 src/main/java/com/zy/core/model/protocol/LiftProtocol.java |  377 ++++++++++++++++++++++++-----------------------------
 1 files changed, 173 insertions(+), 204 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 790bb2f..4451b72 100644
--- a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,189 +1,129 @@
 package com.zy.core.model.protocol;
 
+import com.core.common.Cools;
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasLiftErr;
+import com.zy.asrs.service.BasLiftErrService;
+import com.zy.common.utils.RedisUtil;
 import com.zy.core.enums.LiftProtocolStatusType;
-import com.zy.core.model.command.LiftAssignCommand;
+import com.zy.core.enums.RedisKeyType;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 
-import java.util.Date;
-
-/**
- * 鎻愬崌鏈�
- */
 @Slf4j
 @Data
-public class LiftProtocol {
+public class LiftProtocol implements Cloneable {
 
+    //**********************蹇呴』瀛樺湪灞炴��**********************
     /**
      * 鎻愬崌鏈哄彿
      */
-    private Short liftNo;
-
-    /**
-     * 鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
-     */
-    private Short barcode = 1699;
+    private Integer liftNo;
 
     /**
      * 浠诲姟鍙�
      */
-    private Short taskNo = 0;
+    private Integer taskNo;
 
     /**
      * 鍥涘悜绌挎杞﹀彿
      */
-    private Short shuttleNo = 0;
+    private Integer shuttleNo = 0;
 
     /**
      * 褰撳墠鎻愬崌鏈虹姸鎬侊紙鍐呴儴鑷垜缁存姢锛�
      */
-    private Integer protocolStatus = 1;
+    private Integer protocolStatus = -1;
 
     /**
      * 褰撳墠鎻愬崌鏈虹姸鎬佹灇涓�
      */
-    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
+    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.NONE;
 
     /**
-     * 灞�
+     * 妯″紡 => 鑷姩/鎵嬪姩
      */
-    private Short lev;
+    private Boolean model;
 
     /**
-     * 鎻愬崌鏈洪攣瀹�
+     * 杩愯鐘舵��
      */
-    private Boolean liftLock;
+    private Boolean run;
 
     /**
-     * 浣嶇疆鍒拌揪鍙嶉
-     */
-    private Short positionArrivalFeedback;
-
-    /**
-     * 鍑嗗灏辩华
-     * 灏辩华涓�1锛屾湭灏辩华涓�0
+     * 灏辩华鐘舵��
      */
     private Boolean ready;
 
     /**
-     * 杩愯涓�
-     * 杩愯涓负1锛屾湭杩愯涓�0
+     * 鍓嶈秴闄�
      */
-    private Boolean running;
+    private Boolean frontOverrun;
 
     /**
-     * 鑱旀満/鍗曟満
-     * 鑱旀満涓�1锛屽崟鏈轰负0
+     * 鍚庤秴闄�
      */
-    private Boolean mode;
+    private Boolean backOverrun;
 
     /**
-     * 杈撻�佺嚎鍓嶇鍏夌數鏈夎揣
-     * 鏈夎揣涓�1锛屾棤璐т负0锛堝墠绔寚闈犺繎璐ф灦渚э級
+     * 宸﹁秴闄�
      */
-    private Boolean lineFrontHasStock;
+    private Boolean leftOverrun;
 
     /**
-     * 杈撻�佺嚎姝h浆鍙嶉
-     * 姝h浆杩愯涓�1锛屽惁鍒欎负0
+     * 鍙宠秴闄�
      */
-    private Boolean forwardRotationFeedback;
+    private Boolean rightOverrun;
 
     /**
-     * 杈撻�佺嚎鍙嶈浆鍙嶉
-     * 鍙嶈浆杩愯涓�1锛屽惁鍒欎负0
+     * 瓒呴珮
      */
-    private Boolean reverseFeedback;
+    private Boolean overHeight;
 
     /**
-     * 杈撻�佺嚎鐢垫満杩囪浇
-     * 杩囪浇涓�0锛屾甯镐负1
+     * 瓒呴噸
      */
-    private Boolean motorOverload;
+    private Boolean overWeight;
 
     /**
-     * 杈撻�佺嚎鏈鍏夌數鏈夎揣
-     * 鏈夎揣涓�1锛屾棤璐т负0
+     * 鏈夋墭鐩�
      */
-    private Boolean lineEndHasStock;
+    private Boolean hasTray;
 
     /**
-     * 杩涜緭閫佺嚎鍗℃墭鐩樻姤璀�
-     * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0
+     * 鏈夊皬杞�
      */
-    private Boolean inConveyLineCardTrayAlarm;
+    private Boolean hasCar;
 
     /**
-     * 鍑鸿緭閫佺嚎鍗℃墭鐩樻姤璀�
-     * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0
+     * 鏁呴殰
      */
-    private Boolean outConveyLineCardTrayAlarm;
+    private Boolean error;
 
     /**
-     * 骞冲彴浣嶇疆鍋忓樊鎶ヨ
-     * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0
+     * 鏁呴殰鐮�
      */
-    private Boolean platPositionDeviationAlarm;
+    private String errorCode;
 
     /**
-     * 骞冲彴鎵煩鍋忓樊鎶ヨ
-     * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0
+     * 浠诲姟鍦板潃
      */
-    private Boolean platTorqueDeviationAlarm;
+    private Short taskAddress;
 
     /**
-     * 骞冲彴鍥涘悜杞︽娴�
-     * 鏈夎溅涓�1锛屾棤杞︿负0
+     * 鐩殑鍦板潃
      */
-    private Boolean platShuttleCheck;
+    private Short distAddress;
 
     /**
-     * 鏈氨缁姸鎬�
-     * 1.	涓嶅湪鎸囧畾灞�
-     * 2.	鍥涜酱涓嶅悓姝�
-     * 3.	骞冲彴鍓嶉檺鍏夌數琚尅鍒帮紙闈犺繎璐ф灦锛�
-     * 4.	骞冲彴鍚庨檺鍏夌數琚尅鍒帮紙杩滅璐ф灦锛�
-     * 5.	骞冲彴涓婇檺浣嶆姤璀�
-     * 6.	骞冲彴涓嬮檺浣嶆姤璀�
-     * 7.	鐢垫煖鎬ュ仠鎶ヨ
-     * 8.	杈撻�佺嚎鍓嶉檺浣嶈鎸″埌锛堥潬杩戣揣鏋讹級
-     * 9.	杈撻�佺嚎鍚庨檺浣嶈鎸″埌锛堣繙绂昏揣鏋讹級
-     * 10.	瑙︽懜灞忕揣鎬ュ仠姝㈣鎸変笅
-     * 11.	鍥涜酱鍔ㄥ姏绾挎柇绾�
-     * 12.	鍗曟満妯″紡
-     * 13.	鍥涜酱鎶ヨ
-     * 14.	浣嶇疆鍋忓樊杩囧ぇ
-     * 15.	鎵煩鍋忓樊杩囧ぇ
-     * 16.	杈撻�佺嚎杩囪浇
-     * 17.	杩涙彁鍗囨満鍗℃墭鐩�
-     * 18.	鍑烘彁鍗囨満鍗℃墭鐩�
+     * 宸插畬鎴愮殑浠诲姟鍙�
      */
-    private Short notReady;
+    private String completeTaskNo;
 
     /**
-     * 浼烘湇1閿欒
+     * 灞�
      */
-    private Short servoError1;
-
-    /**
-     * 浼烘湇2閿欒
-     */
-    private Short servoError2;
-
-    /**
-     * 浼烘湇3閿欒
-     */
-    private Short servoError3;
-
-    /**
-     * 浼烘湇4閿欒
-     */
-    private Short servoError4;
-
-    /**
-     * 鎻愬崌鏈哄疄闄呴�熷害鍙嶉
-     */
-    private Short liftActualSpeed;
+    private Integer lev;
 
     /**
      * 浣滀笟鏍囪
@@ -191,42 +131,114 @@
     private Boolean pakMk = true;
 
     /**
-     * 鍥涘悜绌挎杞﹁皟搴︽彁鍗囨満鏃讹紝闇�瑕侀攣瀹氭鏍囪
+     * 鎸囦护涓嬪彂鏃堕棿
      */
-    private Boolean securityMk = false;
+    private Long sendTime = 0L;
 
     /**
-     * 浠诲姟鍛戒护
+     * 鏃ュ織閲囬泦鏃堕棿
      */
-    private LiftAssignCommand assignCommand;
+    private Long deviceDataLog = System.currentTimeMillis();
 
     /**
-     * 鍑哄叆搴撴ā寮忥紝1锛氬叆搴擄紝2锛氬嚭搴�
+     * 鎵╁睍瀛楁
      */
-    private Integer outInModel;
+    private Object extend;
 
-    /**
-     * 鍑哄叆搴撴ā寮忚捣濮嬬珯鐐�
-     */
-    private Integer startSta;
+    public String getRun$() {
+        if (this.run == null) {
+            return "鏈煡";
+        }
 
-    /**
-     * 鍑哄叆搴撴ā寮忕洰鏍囩珯鐐�
-     */
-    private Integer distSta;
+        return this.run ? "杩愯涓�" : "绌洪棽";
+    }
 
-    /**
-     * 鍑哄叆搴撴ā寮忔鏁�
-     */
-    private Integer outInModelStep;
+    public String getReady$() {
+        if (this.ready == null) {
+            return "鏈煡";
+        }
 
-    /**
-     * 宸ヤ綔鏃堕棿
-     */
-    private Date wrkTime;
+        return this.ready ? "灏辩华" : "鏈氨缁�";
+    }
 
-    public Short getLiftLockShortValue() {
-        return liftLock ? (short) 1 : (short) 0;
+    public String getModel$() {
+        if (this.model == null) {
+            return "鏈煡";
+        }
+
+        return this.model ? "鑷姩" : "鎵嬪姩";
+    }
+
+    public String getHasTray$() {
+        if (this.hasTray == null) {
+            return "鏈煡";
+        }
+
+        return this.hasTray ? "Y" : "N";
+    }
+
+    public String getHasCar$() {
+        if (this.hasCar == null) {
+            return "鏈煡";
+        }
+
+        return this.hasCar ? "Y" : "N";
+    }
+
+    public String getFrontOverrun$() {
+        if (this.frontOverrun == null) {
+            return "鏈煡";
+        }
+
+        return this.frontOverrun ? "Y" : "N";
+    }
+
+    public String getBackOverrun$() {
+        if (this.backOverrun == null) {
+            return "鏈煡";
+        }
+
+        return this.backOverrun ? "Y" : "N";
+    }
+
+    public String getLeftOverrun$() {
+        if (this.leftOverrun == null) {
+            return "鏈煡";
+        }
+
+        return this.leftOverrun ? "Y" : "N";
+    }
+
+    public String getRightOverrun$() {
+        if (this.rightOverrun == null) {
+            return "鏈煡";
+        }
+
+        return this.rightOverrun ? "Y" : "N";
+    }
+
+    public String getOverHeight$() {
+        if (this.overHeight == null) {
+            return "鏈煡";
+        }
+
+        return this.overHeight ? "Y" : "N";
+    }
+
+    public String getOverWeight$() {
+        if (this.overWeight == null) {
+            return "鏈煡";
+        }
+
+        return this.overWeight ? "Y" : "N";
+    }
+
+    public String getProtocolStatus$() {
+        if (this.protocolStatusType == null) {
+            return "鏈煡";
+        }
+
+        return this.protocolStatusType.desc;
     }
 
     /**
@@ -245,91 +257,48 @@
         this.protocolStatusType = status;
     }
 
-    // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
-    public Boolean isIdle() {
-        if(this.taskNo == null
-                || this.liftLock == null
-                || this.ready == null
-                || this.running == null
-                || this.mode == null
-                || this.pakMk == null
-        ){
-            return false;
+    public synchronized void setTaskNo(Integer taskNo) {
+        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+        if (null != redisUtil) {
+            redisUtil.set(RedisKeyType.LIFT_FLAG.key + this.liftNo, taskNo);
+            this.taskNo = taskNo;
         }
-
-        boolean res = this.taskNo == 0
-                && !this.liftLock
-//                && this.ready
-                && !this.running
-                && this.mode
-                && this.pakMk.equals(true)
-                && !this.securityMk
-                ;
-        return res;
     }
 
-    // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝涓嶅垽鏂换鍔″彿
-    public Boolean isIdleNoTask() {
-        if(this.taskNo == null
-                || this.liftLock == null
-                || this.ready == null
-                || this.running == null
-                || this.mode == null
-                || this.pakMk == null
-        ){
-            return false;
+    public Integer getTaskNo() {
+        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+        if (null != redisUtil) {
+            Object o = redisUtil.get(RedisKeyType.LIFT_FLAG.key + this.liftNo);
+            if (!Cools.isEmpty(o)) {
+                this.taskNo = Integer.valueOf(String.valueOf(o));
+            }
         }
-
-        boolean res = !this.liftLock
-//                && this.ready
-                && !this.running
-                && this.mode
-                && this.pakMk
-                && !this.securityMk
-                ;
-        return res;
+        return this.taskNo == null ? 0 : this.taskNo;
     }
 
-    public void setPositionArrivalFeedback(Short position) {
-        Short lev = null;
-        switch (position) {
-            case 1:
-                lev = 1;
-                break;
-            case 4:
-                lev = 2;
-                break;
-            case 8:
-                lev = 3;
-                break;
-            case 16:
-                lev = 4;
-                break;
+    /**
+     * 閿欒鐮�
+     */
+    public String getErrCode$() {
+        if (this.errorCode == null) {
+            return "";
         }
-        this.lev = lev;//灞傞珮
-        this.positionArrivalFeedback = position;//浣嶇疆鍒拌揪鍙嶉
+        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
+        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
+        if (basLiftErr == null) {
+            return String.valueOf(this.errorCode);
+        }
+        return basLiftErr.getErrName();
     }
 
-    public Integer getPositionArrivalFeedback$() {
-        if (this.positionArrivalFeedback == null) {
-            return null;
+    @Override
+    public LiftProtocol clone() {
+        try {
+            return (LiftProtocol) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
         }
-
-        switch (this.positionArrivalFeedback) {
-            case 1:
-                return 1;
-            case 2:
-                return 2;
-            case 4:
-                return 3;
-            case 8:
-                return 4;
-            case 16:
-                return 5;
-        }
-
         return null;
     }
-
 
 }

--
Gitblit v1.9.1