From e5de740f9e5c28bc0026efc9d285ce0f7652b424 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期二, 28 十二月 2021 16:31:52 +0800
Subject: [PATCH] YCQ

---
 src/main/webapp/views/crn.html |   98 ++++++++++++++++++++++++++++++------------------
 1 files changed, 61 insertions(+), 37 deletions(-)

diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index 397ed7d..0a247fa 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -44,18 +44,20 @@
 <!-- 鏃ュ織鐩戞帶鏉� -->
 <div class="log-board">
     <!-- 鎵ц鍛戒护 -->
+
+    <!-- 鎵ц鍛戒护 -->
     <div class="command-log">
         <h2>鎵ц涓殑鍛戒护</h2>
         <div class="crn-command-item">
             <label>1#</label>
-<!--            <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)">婕旂ず</button>-->
-                        <span>&nbsp;</span>
+            <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
+            <!--            <span>&nbsp;</span>-->
             <input id="crn1" disabled="disabled">
         </div>
         <div class="crn-command-item">
             <label>2#</label>
-<!--            <button id="demoBtn-2" class="demoBtn" onclick="demoSwitch(this.id)">婕旂ず</button>-->
-                        <span>&nbsp;</span>
+            <button id="demoBtn-2" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
+            <!--            <span>&nbsp;</span>-->
             <input id="crn2" disabled="disabled">
         </div>
     </div>
@@ -70,13 +72,13 @@
                     <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>
@@ -96,7 +98,6 @@
                 <th>鐩爣绔�</th>
                 <th>婧愬簱浣�</th>
                 <th>鐩爣搴撲綅</th>
-                <th>寮傚父</th>
                 <th>璧拌閫熷害锛坢/min)</th>
                 <th>鍗囬檷閫熷害锛坢/min)</th>
                 <th>鍙夌墮閫熷害锛坢/min)</th>
@@ -229,6 +230,7 @@
     setInterval(function () {
         getCrnOutput();
         operatorBlockShow();
+        initDemo();
     },500);
 
     // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
@@ -287,13 +289,13 @@
                         setVal(tr.children("td").eq(3), table[i-1].loading);
                         setVal(tr.children("td").eq(4), table[i-1].bay);
                         setVal(tr.children("td").eq(5), table[i-1].lev);
-                        setVal(tr.children("td").eq(6), table[i-1].xorigin);
-                        setVal(tr.children("td").eq(7), table[i-1].yorigin);
+                        setVal(tr.children("td").eq(6), table[i-1].liftPos);
+                        setVal(tr.children("td").eq(7), table[i-1].sitePos);
                         setVal(tr.children("td").eq(8), table[i-1].forkOffset);
-                        setVal(tr.children("td").eq(9), table[i-1].xlocation);
-                        setVal(tr.children("td").eq(10), table[i-1].ylocation);
-                        setVal(tr.children("td").eq(11), table[i-1].stop);
-                        setVal(tr.children("td").eq(12), table[i-1].warnCode);
+                        setVal(tr.children("td").eq(9), table[i-1].alarm1);
+                        setVal(tr.children("td").eq(10), table[i-1].alarm2);
+                        setVal(tr.children("td").eq(11), table[i-1].alarm3);
+                        setVal(tr.children("td").eq(12), table[i-1].alarm4);
                     }
                 } else if (res.code === 403){
                     window.location.href = baseUrl+"/login";
@@ -327,14 +329,13 @@
                         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].error);
-                        setVal(tr.children("td").eq(8), table[i-1].xspeed);
-                        setVal(tr.children("td").eq(9), table[i-1].yspeed);
-                        setVal(tr.children("td").eq(10), table[i-1].zspeed);
-                        setVal(tr.children("td").eq(11), table[i-1].xdistance);
-                        setVal(tr.children("td").eq(12), table[i-1].ydistance);
-                        setVal(tr.children("td").eq(13), table[i-1].xduration);
-                        setVal(tr.children("td").eq(14), table[i-1].yduration);
+                        setVal(tr.children("td").eq(7), table[i-1].xspeed);
+                        setVal(tr.children("td").eq(8), table[i-1].yspeed);
+                        setVal(tr.children("td").eq(9), table[i-1].zspeed);
+                        setVal(tr.children("td").eq(10), table[i-1].xdistance);
+                        setVal(tr.children("td").eq(11), table[i-1].ydistance);
+                        setVal(tr.children("td").eq(12), table[i-1].xduration);
+                        setVal(tr.children("td").eq(13), table[i-1].yduration);
                     }
                 } else if (res.code === 403){
                     window.location.href = baseUrl+"/login";
@@ -538,7 +539,6 @@
                 "       <td></td>\n" +
                 "       <td></td>\n" +
                 "       <td></td>\n" +
-                "       <td></td>\n" +
                 "     </tr>\n";
         }
         $('#crn-msg-table tbody').after(html);
@@ -550,22 +550,45 @@
         crnOutputDom.scrollTop = crnOutputDom.scrollHeight;
     }
 
-    // function demoSwitch(el) {
-    //     var crnId = el.split("-")[1];
-    //     layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞跺紑濮�'+crnId+"鍙峰爢鍨涙満婕旂ず", formType: 1, shadeClose: true}, function (pass, idx) {
-    //         layer.close(idx);
-    //         doDemo(crnId, pass); // 鍋滄wcs绯荤粺
-    //     });
-    // }
+
+    var crnDemoData;
+    function initDemo() {
+        $.ajax({
+            url: baseUrl+"/crn/demo/status",
+            async: false,
+            method: 'GET',
+            success: function (res) {
+                if (res.code === 200) {
+                    crnDemoData = res.data;
+                    crnDemoData.forEach(function (e) {
+                        $("#demoBtn-"+e.crnNo).html(e.demo?'鍋滄':'婕旂ず');
+                    })
+                } else if (res.code === 403){
+                    parent.location.href = baseUrl+"/login";
+                }  else {
+                    layer.msg(res.msg, {icon: 2});
+                }
+            }
+        })
+    }
 
     function demoSwitch(el) {
         var crnId = el.split("-")[1];
-        layer.confirm(crnId + ' 鍙峰爢鍨涙満纭畾寮�濮嬫紨绀哄悧锛�', function(){
-            doDemo(crnId, 'root'); // 鍋滄wcs绯荤粺
+        var opt;
+        if (crnDemoData == null) {
+            initDemo();
+        }
+        for (var i = 0; i<crnDemoData.length; i++) {
+            if (Number(crnDemoData[i].crnNo) === Number(crnId)) {
+                opt = !crnDemoData[i].demo;
+            }
+        }
+        layer.confirm(crnId + ' 鍙峰爢鍨涙満纭畾'+ (opt?'寮�濮�':'鍋滄') + '婕旂ず鍚楋紵', function(){
+            doDemo(crnId, 'root', opt); // 鍋滄wcs绯荤粺
         });
     }
 
-    function doDemo(crnId, password) {
+    function doDemo(crnId, password, opt) {
         // 鍔犺浇tips
         var index = layer.load(1, {
             shade: [0.1,'#fff']
@@ -576,7 +599,8 @@
             // async: false,
             data: {
                 crnId: Number(crnId),
-                password: password
+                password: password,
+                opt: opt
             },
             method: 'POST',
             success: function (res) {

--
Gitblit v1.9.1