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 |  379 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 324 insertions(+), 55 deletions(-)

diff --git a/src/main/webapp/views/ste.html b/src/main/webapp/views/ste.html
index 8652f35..85a8c0b 100644
--- a/src/main/webapp/views/ste.html
+++ b/src/main/webapp/views/ste.html
@@ -5,8 +5,12 @@
     <title>绌挎杞︾洃鎺х鐞�</title>
     <link rel="stylesheet" type="text/css" href="../static/css/normalize.css">
     <link rel="stylesheet" type="text/css" href="../static/css/common.css">
+    <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
     <link rel="stylesheet" href="../static/css/ste.css">
+    <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
     <script type="text/javascript" src="../static/js/layer/layer.js"></script>
+    <script type="text/javascript" src="../static/layui/layui.js"></script>
+    <script type="text/javascript" src="../static/js/common.js"></script>
 </head>
 <body>
     <div style="padding: 10px;height: 100%;float: left;width: 6%">
@@ -17,24 +21,65 @@
             <!-- 鏃ュ織鐩戞帶鏉� -->
             <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>
-                        <button id="demoBtn-1" class="demoBtn" onclick="changePosition()">淇敼浣嶇疆</button>
-                        <!--            <span>&nbsp;</span>-->
-                        <button class="demoBtn" onclick="">鎵�灞炲爢鍨涙満</button>
+                        <div class="dropdown-menu">
+                            <button id="steBtn-1" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
+                                <ul class="dropdown-menu-nav dark" >
+                                    <div class="dropdown-anchor"></div>
+                                    <div class="form-item"><span>褰撳墠绌挎鏈猴細</span><input type="text"></div>
+                                    <div class="form-item"><span>鎺掞細</span><input type="text"></div>
+                                    <div class="form-item"><span>鍒楋細</span><input type="text"></div>
+                                    <div class="form-item"><span>灞傦細</span><input type="text"></div>
+                                </ul>
+                        </div>
+                        <div class="dropdown-menu">
+                            <button class="demoBtn" onclick="">鎵�灞炲爢鍨涙満</button>
+                                <ul class="dropdown-menu-nav dark">
+                                    <div class="dropdown-anchor"></div>
+                                    <div class="form-item"><span>鍫嗗灈鏈哄彿锛�</span><input type="text"></div>
+                                </ul>
+                        </div>
                     </div>
-                    <div class="ste-command-item" style="margin-top: 25px">
+                    <div class="ste-command-item" style="margin-top: 30px">
                         <label>2#</label>
-                        <button id="demoBtn-2" class="demoBtn" onclick="">淇敼浣嶇疆</button>
-                        <!--            <span>&nbsp;</span>-->
-                        <button class="demoBtn" onclick="">鎵�灞炲爢鍨涙満</button>
+                        <div class="dropdown-menu">
+                            <button id="steBtn-2" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
+                            <ul class="dropdown-menu-nav dark" >
+                                <div class="dropdown-anchor"></div>
+                                <div class="form-item"><span>褰撳墠绌挎鏈猴細</span><input type="text"></div>
+                                <div class="form-item"><span>鎺掞細</span><input type="text"></div>
+                                <div class="form-item"><span>鍒楋細</span><input type="text"></div>
+                                <div class="form-item"><span>灞傦細</span><input type="text"></div>
+                            </ul>
+                        </div>
+                        <div class="dropdown-menu">
+                            <button class="demoBtn" onclick="">鎵�灞炲爢鍨涙満</button>
+                                <ul class="dropdown-menu-nav dark">
+                                    <div class="dropdown-anchor"></div>
+                                    <div class="form-item"><span>鍫嗗灈鏈哄彿锛�</span><input type="text"></div>
+                                </ul>
+                        </div>
                     </div>
-                    <div class="ste-command-item" style="margin-top: 25px">
+                    <div class="ste-command-item" style="margin-top: 30px">
                         <label>3#</label>
-                        <button id="demoBtn-3" class="demoBtn" onclick="">淇敼浣嶇疆</button>
-                        <!--            <span>&nbsp;</span>-->
+                        <div class="dropdown-menu">
+                            <button id="steBtn-3" class="demoBtn" onclick="changePosition(this.id)">淇敼浣嶇疆</button>
+                            <ul class="dropdown-menu-nav dark" >
+                                <div class="dropdown-anchor"></div>
+                                <div class="form-item"><span>褰撳墠绌挎鏈猴細</span><input type="text"></div>
+                                <div class="form-item"><span>鎺掞細</span><input type="text"></div>
+                                <div class="form-item"><span>鍒楋細</span><input type="text"></div>
+                                <div class="form-item"><span>灞傦細</span><input type="text"></div>
+                            </ul>
+                        </div>
+                        <div class="dropdown-menu">
                         <button class="demoBtn" onclick="">鎵�灞炲爢鍨涙満</button>
+                            <ul class="dropdown-menu-nav dark">
+                                <div class="dropdown-anchor"></div>
+                                <div class="form-item"><span>鍫嗗灈鏈哄彿锛�</span><input type="text"></div>
+                            </ul>
+                        </div>
                     </div>
                 </div>
                 <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
@@ -51,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>
@@ -63,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>
@@ -92,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">
                     <!-- 閫夋嫨 -->
@@ -114,30 +152,28 @@
                     <fieldset>
                         <legend>鎵嬪姩鎿嶄綔</legend>
                         <div class="button-group">
-                            <button class="item" onclick="put()">宸﹀嚭搴�</button>
-                            <button class="item" onclick="take()">鍙冲嚭搴�</button>
-                            <button class="item" onclick="stockMove()">宸﹀叆搴�</button>
-                            <button class="item" onclick="siteMove()">鍙冲叆搴�</button>
-                            <button class="item" onclick="bacOrigin()">宸︾Щ搴�</button>
-                            <button class="item" onclick="reverseOrigin()">鍙崇Щ搴�</button>
-                            <button class="item" onclick="coorMove()">鍘熺偣</button>
-                            <button class="item" onclick="taskComplete()">杩滅偣 </button>
-                            <button class="item" onclick="pause()">A 鐐�</button>
-                            <button class="item" onclick="boot()">B 鐐�</button>
-                            <button class="item" onclick="pause()">宸︽惉绉�</button>
-                            <button class="item" onclick="boot()">鍙虫惉绉�</button>
-                            <button class="item" onclick="boot()">鍏呯數</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>
@@ -146,7 +182,240 @@
 </body>
 </html>
 <script>
-    function changePosition() {
+    layui.config({
+        base: baseUrl + "/static/layui/lay/modules/"
+    }).extend({
+        dropdown: 'dropdown/dropdown',
+    }).use(['dropdown'],function () {
+        var dropdown = layui.dropdown;
+    })
+</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) {
 
     }
-</script>
\ No newline at end of file
+
+    // 绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
+    function getSteStateInfo() {
+        let tableEl = $('#ste-state-table');
+        $.ajax({
+            url: baseUrl+ "/ste/table/ste/state",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (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);
+                }
+            }
+        })
+    }
+
+    // 浠诲姟鎸囦护涓嬪彂
+    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