From 7ea7fa055306a766420d578f508a7dc358afebc1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 25 八月 2022 14:09:16 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/ste.html |  309 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 251 insertions(+), 58 deletions(-)

diff --git a/src/main/webapp/views/ste.html b/src/main/webapp/views/ste.html
index eba9ade..85a8c0b 100644
--- a/src/main/webapp/views/ste.html
+++ b/src/main/webapp/views/ste.html
@@ -21,8 +21,7 @@
             <!-- 鏃ュ織鐩戞帶鏉� -->
             <div class="log-board">
                 <div class="command-log">
-                    <h3>绌挎杞︿綅缃�</h3>
-                    <div class="ste-command-item">
+                    <div class="ste-command-item" style="margin-top: 30px">
                         <label>1#</label>
                         <div class="dropdown-menu">
                             <button id="steBtn-1" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
@@ -42,7 +41,7 @@
                                 </ul>
                         </div>
                     </div>
-                    <div class="ste-command-item" style="margin-top: 25px">
+                    <div class="ste-command-item" style="margin-top: 30px">
                         <label>2#</label>
                         <div class="dropdown-menu">
                             <button id="steBtn-2" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
@@ -62,7 +61,7 @@
                                 </ul>
                         </div>
                     </div>
-                    <div class="ste-command-item" style="margin-top: 25px">
+                    <div class="ste-command-item" style="margin-top: 30px">
                         <label>3#</label>
                         <div class="dropdown-menu">
                             <button id="steBtn-3" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
@@ -97,9 +96,8 @@
                                 <th>鎺�</th>
                                 <th>鍒�</th>
                                 <th>灞�</th>
-                                <th>璐у弶瀹氫綅</th>
-                                <th>杞借揣鍙板畾浣�</th>
-                                <th>璧拌鍦ㄥ畾浣�</th>
+                                <th>绛夊緟WCS纭</th>
+                                <th>瀹氫綅</th>
                                 <th>鎶ヨ淇℃伅1</th>
                                 <th>鎶ヨ淇℃伅2</th>
                             </tr>
@@ -109,26 +107,20 @@
                     </table>
                 </div>
             </div>
-            <!-- 鍫嗗灈鏈虹姸鎬� -->
+            <!-- 绌挎杞︾姸鎬� -->
             <div class="ste-msg">
                 <table id="ste-msg-table">
                     <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>褰撳墠閫熷害</th>
-                            <th>楂樹綆浣�</th>
-                            <th>杩囪处鎸囦护浠诲姟鍙�</th>
-                            <th>杩囪处鎸囦护鐘舵��</th>
-                            <th>鐩樼偣鏁伴噺</th>
-                            <th>绌挎鏉垮氨缁�</th>
-                            <th>鍏呯數妗╁彿</th>
-                            <th>鍫嗗灈鏈鸿繍琛�</th>
-                            <th>鍫嗗灈鏈轰几鍙�</th>
-                            <th>鍫嗗灈鏈烘惉绉�</th>
                         </tr>
                     </thead>
                     <tbody>
@@ -138,11 +130,11 @@
             <!-- 鎵嬪姩鎿嶄綔 -->
             <div class="ste-operation">
                 <!-- 閬僵灞� -->
-<!--                <div class="ste-operation-shade">-->
-<!--                    <span class="ste-operation-shade-span">-->
-<!--                        WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔-->
-<!--                    </span>-->
-<!--                </div>-->
+                <div class="ste-operation-shade">
+                    <span class="ste-operation-shade-span">
+                        WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
+                    </span>
+                </div>
                 <!-- 璁惧浠诲姟閫夋嫨 -->
                 <div class="task-select">
                     <!-- 閫夋嫨 -->
@@ -160,30 +152,28 @@
                     <fieldset>
                         <legend>鎵嬪姩鎿嶄綔</legend>
                         <div class="button-group">
-                            <button class="item" onclick="leftTake()">宸﹀嚭搴�</button>
-                            <button class="item" onclick="rightTake()">鍙冲嚭搴�</button>
-                            <button class="item" onclick="leftPut()">宸﹀叆搴�</button>
-                            <button class="item" onclick="rightPut()">鍙冲叆搴�</button>
-                            <button class="item" onclick="leftStockMove()">宸︾Щ搴�</button>
-                            <button class="item" onclick="rightStockMove()">鍙崇Щ搴�</button>
-                            <button class="item" onclick="oOrigin()">鍘熺偣</button>
-                            <button class="item" onclick="farPoint()">杩滅偣</button>
-                            <button class="item" onclick="aPoint()">A 鐐�</button>
-                            <button class="item" onclick="bPoint()">B 鐐�</button>
-                            <button class="item" onclick="moveLift()">宸︽惉绉�</button>
-                            <button class="item" onclick="moveRight()">鍙虫惉绉�</button>
-                            <button class="item" onclick="charging()">鍏呯數</button>
-                            <button class="item" onclick="pause()">宸︾洏鐐�</button>
-                            <button class="item" onclick="boot()">鍙崇洏鐐�</button>
-                            <button class="item" onclick="boot()">浠诲姟瀹屾垚</button>
-                            <button class="item" onclick="clearCommand()">娓呴櫎鍛戒护</button>
-                            <button class="item" onclick="handleReset()">澶嶄綅</button>
+                            <button class="item" onclick="steOperator(1)">宸﹀嚭搴�</button>
+                            <button class="item" onclick="steOperator(2)">鍙冲嚭搴�</button>
+                            <button class="item" onclick="steOperator(3)">宸﹀叆搴�</button>
+                            <button class="item" onclick="steOperator(4)">鍙冲叆搴�</button>
+                            <button class="item" onclick="steOperator(5)">宸︾Щ搴�</button>
+                            <button class="item" onclick="steOperator(6)">鍙崇Щ搴�</button>
+                            <button class="item" onclick="steOperator(7)">鍘熺偣</button>
+                            <button class="item" onclick="steOperator(8)">杩滅偣</button>
+                            <button class="item" onclick="steOperator(9)">A 鐐�</button>
+                            <button class="item" onclick="steOperator(10)">B 鐐�</button>
+                            <button class="item" onclick="steOperator(11)">宸︽惉绉�</button>
+                            <button class="item" onclick="steOperator(12)">鍙虫惉绉�</button>
+                            <button class="item" onclick="steOperator(13)">鍏呯數</button>
+                            <button class="item" onclick="steOperator(14)">宸︾洏鐐�</button>
+                            <button class="item" onclick="steOperator(15)">鍙崇洏鐐�</button>
+                            <button class="item" onclick="steOperator(16)">浠诲姟瀹屾垚</button>
                         </div>
                     </fieldset>
                 </div>
 
             </div>
-            <!-- 鍫嗗灈鏈烘棩蹇楄緭鍑� -->
+            <!-- 绌挎杞︽棩蹇楄緭鍑� -->
             <div class="ste-output-board">
                 <textarea id="ste-output"></textarea>
             </div>
@@ -201,28 +191,231 @@
     })
 </script>
 <script>
+    // 绌虹櫧琛屾暟
+    var steStateTableBlankRows = 0;
+    var steMsgTableBlankRows = 0;
+    // 瀹為檯琛屾暟
+    var steStateTableFullRows = 0;
+    var steMsgTableFullRows = 0;
+    // 鍒濆鍖�
+    var steOutputDom = document.getElementById("ste-output");
+    $(document).ready(function() {
+        initSteStateTable();
+        getSteStateInfo();
+        initSteMsgTable();
+        getSteMsgInfo();
+        operatorBlockShow();
+    });
+
+    setInterval(function () {
+        getSteStateInfo()
+        getSteMsgInfo();
+    },1000)
+    setInterval(function () {
+        getSteOutput();
+        operatorBlockShow();
+    },500);
+
+    // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
+    function operatorBlockShow() {
+        if (parent.systemRunning) {
+            $('.ste-operation').css("opacity", "0.5");
+            $('.ste-operation-shade').show();
+            $('.ste-operation-shade-span').show();
+        }  else {
+            $('.ste-operation').css("opacity", "1");
+            $('.ste-operation-shade').hide();
+            $('.ste-operation-shade-span').hide();
+        }
+    }
+
     // 淇敼绌挎杞︿綅缃�
     function changePosition(id) {
-        console.log(id)
-        // $.ajax({
-        //     url: baseUrl +
-        // })
+
     }
+
     // 绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
-
     function getSteStateInfo() {
-        var tableEl = $('ste-state-table');
+        let tableEl = $('#ste-state-table');
         $.ajax({
-            url: baseUrl + "/crn/table/crn/state",
+            url: baseUrl+ "/ste/table/ste/state",
             headers: {'token': localStorage.getItem('token')},
-            method: 'GET',
+            method: 'POST',
             success: function (res) {
-                console.log(res)
+                if (res.code === 200){
+                    let table = res.data;
+                    if (table.length > steStateTableBlankRows && table.length !== steStateTableFullRows) {
+                        initSteStateTable(table.length-steStateTableBlankRows);
+                        steStateTableFullRows = table.length;
+                    }
+                    for (let i=1;i<=table.length;i++){
+                        let tr = tableEl.find("tr").eq(i);
+                        setVal(tr.children("td").eq(0), table[i-1].steNo);
+                        setVal(tr.children("td").eq(1), table[i-1].statusType);
+                        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].charge);
+                        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].alarm1);
+                        setVal(tr.children("td").eq(12), table[i-1].alarm2);
+                    }
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    console.log(res.msg);
+                }
+            }
+        });
+    }
 
+    // 绌挎杞︽暟鎹〃鑾峰彇 ---- 琛ㄤ簩
+    function getSteMsgInfo() {
+        let tableEl = $('#ste-msg-table');
+        $.ajax({
+            url: baseUrl+ "/ste/table/ste/msg",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    var table = res.data;
+                    if (table.length > steMsgTableBlankRows && table.length !== steMsgTableFullRows) {
+                        initSteMsgTable(table.length-steMsgTableBlankRows);
+                        steMsgTableFullRows = table.length;
+                    }
+                    for (var i=1;i<=table.length;i++){
+                        var tr = tableEl.find("tr").eq(i);
+                        setVal(tr.children("td").eq(0), table[i-1].steNo);
+                        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].closer);
+                    }
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    console.log(res.msg);
+                }
+            }
+        });
+    }
+
+    // 绌挎杞︽棩蹇楄緭鍑� -----------------------------------------------------------------------
+    function getSteOutput() {
+        $.ajax({
+            url: baseUrl + "/ste/output/ste",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    steOutput(res.data);
+                } else if (res.code === 403) {
+                    window.location.href = baseUrl + "/login";
+                } else {
+                    console.log(res.msg);
+                }
             }
         })
     }
-    setInterval(function () {
-        getSteStateInfo()
-    },1000)
-</script>
\ No newline at end of file
+
+    // 浠诲姟鎸囦护涓嬪彂
+    function steOperator(steTaskMode) {
+        http.post(baseUrl+"/ste/operator/ste", {
+            steNo: $('input[name="steSelect"]:checked').val(),
+            steTaskMode: steTaskMode
+        }, function (res) {
+            layer.msg(res.msg, {icon: 1});
+        });
+    }
+
+
+    // ------------------------------------------------------------------------------------------------
+
+    // 绌挎杞︿俊鎭〃鑾峰彇  ----- 琛ㄤ竴
+    function initSteStateTable(row) {
+        let line;
+        if (row === undefined){
+            let one = $('#ste-state-table thead').height();
+            let total = $('.ste-state').height();
+            let count = total / one;
+            count = parseInt(count) - 1;
+            steStateTableBlankRows = count;
+            line = count;
+        } else {
+            line = row;
+        }
+        let html = "";
+        for (let i = 0; i < line; i ++){
+            html += " <tr>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "     </tr>\n";
+        }
+        $('#ste-state-table tbody').after(html);
+    }
+
+    // 绌挎杞︽暟鎹〃鑾峰彇  ----- 琛ㄤ簩
+    function initSteMsgTable(row) {
+        let line;
+        if (row === undefined){
+            let one = $('#ste-msg-table thead').height();
+            let total = $('.ste-msg').height();
+            let count = total / one;
+            count = parseInt(count) - 1;
+            steMsgTableBlankRows = count;
+            line = count;
+        } else {
+            line = row;
+        }
+        let html = "";
+        for (let i = 0; i < line; i ++){
+            html += " <tr>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "       <td></td>\n" +
+                "     </tr>\n";
+        }
+        $('#ste-msg-table tbody').after(html);
+    }
+
+    // 鏃ュ織杈撳嚭妗�
+    function steOutput(content){
+        steOutputDom.value += content;
+        steOutputDom.scrollTop = steOutputDom.scrollHeight;
+    }
+
+
+
+</script>

--
Gitblit v1.9.1