From 8d7d4c402c57ac7a0d6826ce2e355ada4eded875 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 27 三月 2023 16:06:27 +0800
Subject: [PATCH] 四向穿梭车页面数据显示、复位操作

---
 src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java |    7 +
 src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java    |   37 ++++---
 src/main/java/com/zy/asrs/controller/ShuttleController.java   |   46 ++++++--
 src/main/java/com/zy/core/thread/ShuttleThread.java           |    8 +
 src/main/java/com/zy/core/enums/ShuttleTaskModeType.java      |    1 
 src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java  |  125 ++++++++++++++++++++----
 src/main/webapp/views/shuttle.html                            |   67 ++++++------
 7 files changed, 203 insertions(+), 88 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java
index 9b3e677..c9257f4 100644
--- a/src/main/java/com/zy/asrs/controller/ShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -67,16 +67,27 @@
                 continue;
             }
             vo.setTaskNo(shuttleProtocol.getTaskNo().intValue());  //  浠诲姟鍙�
-            if (!Cools.isEmpty(shuttleProtocol.getBusyStatus())) {
-                vo.setStatus(shuttleProtocol.getBusyStatusType().desc); //  鐘舵��
-            }
-            vo.setBatteryPower(shuttleProtocol.getBatteryPower() + "%");
-            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());
+            vo.setBusyStatus(shuttleProtocol.getBusyStatusType().desc); //鍥涘悜绌挎杞︾姸鎬�
+            vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//褰撳墠浠诲姟鐘舵��
+            vo.setCurrentCode(shuttleProtocol.getCurrentCode());//褰撳墠浜岀淮鐮�
+            vo.setBatteryTemp(shuttleProtocol.getBatteryTemp$() + "掳");//鐢垫睜娓╁害
+            vo.setBatteryPower(shuttleProtocol.getBatteryPower$() + "%");//鐢垫睜鐢甸噺
+            vo.setPlcOutputStatusIO(shuttleProtocol.getPlcOutputStatusIO());//Plc杈撳嚭鐘舵�両O
+            vo.setPlcInputStatus(shuttleProtocol.getPlcInputStatus());//PLC杈撳叆鐘舵��
+            vo.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode());//褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+            vo.setCodeOffsetX(shuttleProtocol.getCodeOffsetX());//璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+            vo.setCodeOffsetY(shuttleProtocol.getCodeOffsetY());//璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+            vo.setCurrentVoltage(shuttleProtocol.getCurrentVoltage());//褰撳墠鐨勭數鍘嬪��
+            vo.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue());//褰撳墠鐨勬ā鎷熼噺鍊�
+            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//绉诲姩閫熷害
+            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad());//褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad());//褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
             if (!Cools.isEmpty(shuttleProtocol.getErrorCode())) {
-                vo.setAlarm1(String.valueOf(shuttleProtocol.getErrorCode()));
+                vo.setErrorCode(shuttleProtocol.getErrorCode());//閿欒缂栧彿
             }
             if (!Cools.isEmpty(shuttleProtocol.getStatusErrorCode())) {
-                vo.setAlarm2(String.valueOf(shuttleProtocol.getStatusErrorCode()));
+                vo.setStatusErrorCode(shuttleProtocol.getStatusErrorCode());//閿欒淇℃伅鐮�
             }
         }
         return R.ok().add(list);
@@ -102,18 +113,21 @@
                 continue;
             }
 
-            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());  //  浠诲姟鍙�
+            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());//浠诲姟鍙�
             if (shuttleProtocol.getTaskNo() > 0) {
                 WrkMast wrkMast = wrkMastService.selectById(shuttleProtocol.getTaskNo());
                 if (wrkMast != null) {
-                    //vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc());   //  妯″紡鐘舵��
-                    vo.setSourceStaNo(wrkMast.getSourceStaNo$());    //  婧愮珯
-                    vo.setStaNo(wrkMast.getStaNo$());   //  鐩爣绔�
-                    vo.setSourceLocNo(wrkMast.getSourceLocNo());    //  婧愬簱浣�
-                    vo.setLocNo(wrkMast.getLocNo());    //  鐩爣搴撲綅
+                    vo.setSourceLocNo(wrkMast.getSourceLocNo());//婧愬簱浣�
+                    vo.setDistLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
                 }
             }
-            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());  // 閫熷害
+            if (shuttleProtocol.getProtocolStatusType() != null) {
+                vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//鐘舵��
+            }
+            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//褰撳墠鐨勮璧颁己鏈嶉�熷害
+            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad() + "%");//褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad() + "%");//褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
             vo.setPakMk(shuttleProtocol.getPakMk()?"Y" : "N");    // 浣滀笟鏍囪
         }
         return R.ok().add(list);
@@ -251,6 +265,10 @@
             return R.parse(BaseRes.PARAM);
         }
 
+        if (Cools.isEmpty(param.getSourceLocNo(), param.getDistLocNo())) {
+            return R.parse(BaseRes.PARAM);
+        }
+
         for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
             if (param.getShuttleNo().equals(shuttleSlave.getId())) {
                 ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
diff --git a/src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java b/src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java
index df88570..3802838 100644
--- a/src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java
+++ b/src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java
@@ -14,31 +14,36 @@
     // 鐘舵��
     private String status = "-";
 
-    // 婧愮珯
-    private String sourceStaNo = "-";
-
-    // 鐩爣绔�
-    private String staNo = "-";
-
     // 婧愬簱浣�
     private String sourceLocNo = "-";
 
     // 鐩爣搴撲綅
-    private String locNo = "-";
-
-    // 寮傚父
-    private String error = "";
-
-    // 鍘熺偣
-    private String origin = "";
+    private String distLocNo = "-";
 
     // 鍛戒护
     private String command = "";
 
-    // 閫熷害
-    private Short speed = 0;
-
     // 浣滀笟鏍囪
     private String pakMk = "-";
 
+    /**
+     * 褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+     */
+    private Short currentLiftServoSpeed;
+
+    /**
+     * 褰撳墠鐨勮璧颁己鏈嶉�熷害
+     */
+    private Short currentMoveServoSpeed;
+
+    /**
+     * 褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+     */
+    private String currentLiftServoLoad;
+
+    /**
+     * 褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+     */
+    private String currentMoveServoLoad;
+
 }
diff --git a/src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java b/src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java
index 8c5d06a..c51d251 100644
--- a/src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java
+++ b/src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java
@@ -1,5 +1,7 @@
 package com.zy.asrs.domain.vo;
 
+import com.zy.core.enums.ShuttleErrorCodeType;
+import com.zy.core.enums.ShuttleStatusType;
 import lombok.Data;
 
 @Data
@@ -11,34 +13,24 @@
     // 鐘舵��
     private String status = "-";
 
-    // 鏈夌墿
-    private String loading = "-";
+    //鍥涘悜绌挎杞﹀繖瑁呭~
+    private String busyStatus = "-";
+
+    /**
+     * 灏忚溅蹇欑姸鎬佷綅鏋氫妇
+     */
+    private ShuttleStatusType busyStatusType;
 
     /**
      * 浠诲姟鍙�
      */
     public Integer taskNo;
 
-    // 姝e湪鎵ц浠诲姟
-    private String execute;
-
-    // 浠诲姟瀹屾垚锛岀瓑寰匴CS纭
-    private String waiting;
-
-    // 鎺�
-    private Short row;
-
-    // 鍒�
-    private Short bay;
-
-    // 灞�
-    private Short lev;
-
-    // 寮傚父鐮�1
-    private String alarm1 = "-";
-
-    // 寮傚父鐮�2
-    private String alarm2 = "-";
+    /**
+     * 褰撳墠浜岀淮鐮�
+     * 0涓虹┖
+     */
+    private Short currentCode;
 
     /**
      * 鐢垫睜鐢甸噺
@@ -46,9 +38,79 @@
     public String batteryPower = "-";
 
     /**
-     * 褰撳墠閫熷害
+     * 鐢垫睜娓╁害
      */
-    public Short speed;
+    public String batteryTemp = "-";
+
+    /**
+     * 閿欒缂栧彿
+     */
+    private Short errorCode;
+
+    /**
+     * Plc杈撳嚭鐘舵�両O
+     */
+    private Short plcOutputStatusIO;
+
+    /**
+     * 閿欒淇℃伅鐮�
+     */
+    private Short statusErrorCode;
+
+    /**
+     * 閿欒淇℃伅鐮佹灇涓�
+     */
+    private ShuttleErrorCodeType statusErrorCodeType;
+
+    /**
+     * PLC杈撳叆鐘舵��
+     */
+    private Short plcInputStatus;
+
+    /**
+     * 褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+     */
+    private Short currentOrBeforeCode;
+
+    /**
+     * 璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+     */
+    private Short codeOffsetX;
+
+    /**
+     * 璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+     */
+    private Short codeOffsetY;
+
+    /**
+     * 褰撳墠鐨勭數鍘嬪��
+     */
+    private Short currentVoltage;
+
+    /**
+     * 褰撳墠鐨勬ā鎷熼噺鍊�
+     */
+    private Short currentAnalogValue;
+
+    /**
+     * 褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+     */
+    private Short currentLiftServoSpeed;
+
+    /**
+     * 褰撳墠鐨勮璧颁己鏈嶉�熷害
+     */
+    private Short currentMoveServoSpeed;
+
+    /**
+     * 褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+     */
+    private Short currentLiftServoLoad;
+
+    /**
+     * 褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+     */
+    private Short currentMoveServoLoad;
 
     /**
      * 鍏呯數鐘舵��
@@ -60,4 +122,19 @@
      */
     public String loca = "-";
 
+    public String getStatusErrorCode$() {
+        if(this.statusErrorCodeType == null) return null;
+        return this.statusErrorCodeType.desc;
+    }
+
+    public void setStatusErrorCode(Short statusErrorCode) {
+        this.statusErrorCode = statusErrorCode;
+        this.statusErrorCodeType = ShuttleErrorCodeType.get(statusErrorCode.intValue());
+    }
+
+    public void setStatusErrorCode(ShuttleErrorCodeType type) {
+        this.statusErrorCode = type.id.shortValue();
+        this.statusErrorCodeType = type;
+    }
+
 }
diff --git a/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java b/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
index 583d156..b827217 100644
--- a/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
+++ b/src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
@@ -11,6 +11,7 @@
     MOVE_RIGHT(6, "鍙崇Щ"),
     MOVE_TOP(7, "鍓嶇Щ"),
     MOVE_BOTTOM(8, "鍚庣Щ"),
+    RESET(9, "鐘舵�佸浣�"),
     ;
 
     public Integer id;
diff --git a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
index 0a29623..029e9e2 100644
--- a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -233,10 +233,15 @@
     }
 
     //鑾峰彇鐢垫睜鐢甸噺
-    public Short getBatteryPower() {
+    public Short getBatteryPower$() {
         return (short) (this.batteryPower * 0.1);
     }
 
+    //鑾峰彇鐢垫睜娓╁害
+    public Short getBatteryTemp$() {
+        return (short) (this.batteryTemp * 0.1);
+    }
+
     /**
      * 璁剧疆灏忚溅鐘舵��
      */
diff --git a/src/main/java/com/zy/core/thread/ShuttleThread.java b/src/main/java/com/zy/core/thread/ShuttleThread.java
index 13db8e1..e5ecf37 100644
--- a/src/main/java/com/zy/core/thread/ShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -372,6 +372,14 @@
                 command.setRunDirection((short) (assignCommand.getTaskMode() - 4));
                 command.setCommandEnd((short) 1);
                 break;
+            case 9://鐘舵�佸浣�
+                command.setCommandWord((short) 0);
+                //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
+                shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+                //浠诲姟鍙锋竻闆�
+                shuttleProtocol.setTaskNo((short) 0);
+                break;
+            default:
         }
 
         command.setCommandEnd((short) 1);
diff --git a/src/main/webapp/views/shuttle.html b/src/main/webapp/views/shuttle.html
index 1fde92d..22252e4 100644
--- a/src/main/webapp/views/shuttle.html
+++ b/src/main/webapp/views/shuttle.html
@@ -33,19 +33,18 @@
                         <thead>
                             <tr>
                                 <th>鍥涘悜绌挎杞�</th>
-                                <th>寰呭畾</th>
-                                <th>鐘舵��</th>
-                                <th>鏈夌墿</th>
-                                <th>鍦ㄨ建</th>
+                                <th>浠诲姟鐘舵��</th>
+                                <th>灏忚溅鐘舵��</th>
+                                <th>褰撳墠浜岀淮鐮�</th>
                                 <th>鐢甸噺</th>
-                                <th>鎺�</th>
-                                <th>鍒�</th>
-                                <th>灞�</th>
-                                <th>绛夊緟WCS纭</th>
-                                <th>瀹氫綅</th>
-                                <th>鍏呯數鐘舵��</th>
-                                <th>鎶ヨ淇℃伅1</th>
-                                <th>鎶ヨ淇℃伅2</th>
+                                <th>鐢垫睜娓╁害</th>
+                                <th>閿欒缂栧彿</th>
+                                <th>plc杈撳嚭鐘舵�両O</th>
+                                <th>褰撳墠鎴栦箣鍓嶄簩缁寸爜</th>
+                                <th>x鍋忕Щ閲�</th>
+                                <th>y鍋忕Щ閲�</th>
+                                <th>鐢靛帇</th>
+                                <th>妯℃嫙閲�</th>
                             </tr>
                         </thead>
                         <tbody>
@@ -61,11 +60,12 @@
                             <th>鍥涘悜绌挎杞�</th>
                             <th>宸ヤ綔鍙�</th>
                             <th>鐘舵��</th>
-                            <th>婧愮珯</th>
-                            <th>鐩爣绔�</th>
                             <th>婧愬簱浣�</th>
                             <th>鐩爣搴撲綅</th>
-                            <th>閫熷害</th>
+                            <th>鍗囬檷浼烘湇閫熷害</th>
+                            <th>琛岃蛋浼烘湇閫熷害</th>
+                            <th>鍗囬檷浼烘湇璐熻浇</th>
+                            <th>琛岃蛋浼烘湇璐熻浇</th>
                             <th>浣滀笟鏍囪</th>
                         </tr>
                     </thead>
@@ -123,6 +123,7 @@
                             <button class="item" onclick="shuttleOperator(6)">鍙崇Щ</button>
                             <button class="item" onclick="shuttleOperator(7)">鍓嶇Щ</button>
                             <button class="item" onclick="shuttleOperator(8)">鍚庣Щ</button>
+                            <button class="item" onclick="shuttleOperator(9)">澶嶄綅</button>
                         </div>
                     </fieldset>
                 </div>
@@ -585,18 +586,17 @@
                         let tr = tableEl.find("tr").eq(i);
                         setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
                         setVal(tr.children("td").eq(1), table[i-1].status);
-                        setVal(tr.children("td").eq(2), table[i-1].status);
-                        setVal(tr.children("td").eq(3), table[i-1].loading);
-                        setVal(tr.children("td").eq(4), table[i-1].track);
-                        setVal(tr.children("td").eq(5), table[i-1].batteryPower);
-                        setVal(tr.children("td").eq(6), table[i-1].row);
-                        setVal(tr.children("td").eq(7), table[i-1].bay);
-                        setVal(tr.children("td").eq(8), table[i-1].lev);
-                        setVal(tr.children("td").eq(9), table[i-1].waiting);
-                        setVal(tr.children("td").eq(10), table[i-1].loca);
-                        setVal(tr.children("td").eq(11), table[i-1].chargeStatus);
-                        setVal(tr.children("td").eq(12), table[i-1].alarm1);
-                        setVal(tr.children("td").eq(13), table[i-1].alarm2);
+                        setVal(tr.children("td").eq(2), table[i-1].busyStatus);
+                        setVal(tr.children("td").eq(3), table[i-1].currentCode);
+                        setVal(tr.children("td").eq(4), table[i-1].batteryPower);
+                        setVal(tr.children("td").eq(5), table[i-1].batteryTemp);
+                        setVal(tr.children("td").eq(6), table[i-1].statusErrorCode$);
+                        setVal(tr.children("td").eq(7), table[i-1].plcOutputStatusIO);
+                        setVal(tr.children("td").eq(8), table[i-1].currentOrBeforeCode);
+                        setVal(tr.children("td").eq(9), table[i-1].codeOffsetX);
+                        setVal(tr.children("td").eq(10), table[i-1].codeOffsetY);
+                        setVal(tr.children("td").eq(11), table[i-1].currentVoltage);
+                        setVal(tr.children("td").eq(12), table[i-1].currentAnalogValue);
                     }
                 } else if (res.code === 403){
                     window.location.href = baseUrl+"/login";
@@ -626,12 +626,13 @@
                         setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
                         setVal(tr.children("td").eq(1), table[i-1].workNo);
                         setVal(tr.children("td").eq(2), table[i-1].status);
-                        setVal(tr.children("td").eq(3), table[i-1].sourceStaNo);
-                        setVal(tr.children("td").eq(4), table[i-1].staNo);
-                        setVal(tr.children("td").eq(5), table[i-1].sourceLocNo);
-                        setVal(tr.children("td").eq(6), table[i-1].locNo);
-                        setVal(tr.children("td").eq(7), table[i-1].speed);
-                        setVal(tr.children("td").eq(8), table[i-1].pakMk);
+                        setVal(tr.children("td").eq(3), table[i-1].sourceLocNo);
+                        setVal(tr.children("td").eq(4), table[i-1].distLocNo);
+                        setVal(tr.children("td").eq(5), table[i-1].currentLiftServoSpeed);
+                        setVal(tr.children("td").eq(6), table[i-1].currentMoveServoSpeed);
+                        setVal(tr.children("td").eq(7), table[i-1].currentLiftServoLoad);
+                        setVal(tr.children("td").eq(8), table[i-1].currentMoveServoLoad);
+                        setVal(tr.children("td").eq(9), table[i-1].pakMk);
                     }
                 } else if (res.code === 403){
                     window.location.href = baseUrl+"/login";

--
Gitblit v1.9.1