From c4b6b51afdd3374735ed5f358457987eaa6e476f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 05 九月 2025 16:55:20 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/shuttleNew.html |  138 ++++++++++++++++++++++++++++++---------------
 1 files changed, 92 insertions(+), 46 deletions(-)

diff --git a/src/main/webapp/views/shuttleNew.html b/src/main/webapp/views/shuttleNew.html
index 422bbf5..1314abe 100644
--- a/src/main/webapp/views/shuttleNew.html
+++ b/src/main/webapp/views/shuttleNew.html
@@ -106,10 +106,10 @@
                             </select>
                         </div>
                     </div>
-                    <div class="overflow-x-auto" style="height: 500px;">
+                    <div class="overflow-auto" style="height: 500px;">
                         <table class="w-full table-striped">
                             <thead>
-                            <tr class="text-left text-slate-300 border-b border-slate-600">
+                            <tr class="text-left text-slate-300 border-b border-slate-600 bg-slate-800 sticky top-0 z-10">
                                 <th class="py-3 px-4">缂栧彿</th>
                                 <th class="py-3 px-4">宸ヤ綔鍙�</th>
                                 <th class="py-3 px-4">浠诲姟鐘舵��</th>
@@ -131,39 +131,39 @@
                             </tr>
                             </thead>
                             <tbody>
-                            <tr v-for="(item,idx) in shuttleList" :key="idx" class="hover:bg-slate-700">
-                                <td class="py-3 px-4">{{ item.shuttleNo }}</td>
-                                <td class="py-3 px-4">{{ item.taskNo }}</td>
-                                <td class="py-3 px-4">{{ item.protocolStatus$ }}</td>
-                                <td class="py-3 px-4">{{ item.deviceStatus$ }}</td>
-                                <td class="py-3 px-4">{{ item.mode$ }}</td>
-                                <td class="py-3 px-4">{{ item.currentLocNo }}</td>
-                                <td class="py-3 px-4">{{ item.currentCode }}</td>
-                                <td class="py-3 px-4">
-                                    <div class="w-full bg-gray-200 rounded-full h-2.5">
-                                        <div v-if="item.batteryPower>=70&&item.batteryPower<=100">
-                                            <div class="bg-green-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
+                                <tr v-for="(item,idx) in shuttleList" :key="idx" class="hover:bg-slate-700">
+                                    <td class="py-3 px-4">{{ item.shuttleNo }}</td>
+                                    <td class="py-3 px-4">{{ item.taskNo }}</td>
+                                    <td class="py-3 px-4">{{ item.protocolStatus$ }}</td>
+                                    <td class="py-3 px-4">{{ item.deviceStatus$ }}</td>
+                                    <td class="py-3 px-4">{{ item.mode$ }}</td>
+                                    <td class="py-3 px-4">{{ item.currentLocNo }}</td>
+                                    <td class="py-3 px-4">{{ item.currentCode }}</td>
+                                    <td class="py-3 px-4">
+                                        <div class="w-full bg-gray-200 rounded-full h-2.5">
+                                            <div v-if="item.batteryPower>=70&&item.batteryPower<=100">
+                                                <div class="bg-green-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
+                                            </div>
+                                            <div v-else-if="item.batteryPower>=40&&item.batteryPower<70">
+                                                <div class="bg-yellow-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
+                                            </div>
+                                            <div v-else>
+                                                <div class="red h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
+                                            </div>
                                         </div>
-                                        <div v-else-if="item.batteryPower>=40&&item.batteryPower<70">
-                                            <div class="bg-yellow-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
-                                        </div>
-                                        <div v-else>
-                                            <div class="red h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
-                                        </div>
-                                    </div>
-                                    <span class="text-xs text-gray-500">{{ item.batteryPower }}%</span>
-                                </td>
-                                <td class="py-3 px-4">{{ item.extend.voltage }}</td>
-                                <td class="py-3 px-4">{{ item.speed }}</td>
-                                <td class="py-3 px-4">{{ item.hasPallet$ }}</td>
-                                <td class="py-3 px-4">{{ item.hasLift$ }}</td>
-                                <td class="py-3 px-4">{{ item.hasCharge$ }}</td>
-                                <td class="py-3 px-4">{{ item.statusErrorCode$ }}</td>
-<!--                                <td class="py-3 px-4">{{ item.suspendState }}</td>-->
-                                <td class="py-3 px-4">{{ item.lowerPower }}</td>
-                                <td class="py-3 px-4">{{ item.demo$ }}</td>
-                                <td class="py-3 px-4">{{ item.pakMk$ }}</td>
-                            </tr>
+                                        <span class="text-xs text-gray-500">{{ item.batteryPower }}%</span>
+                                    </td>
+                                    <td class="py-3 px-4">{{ item.extend.voltage }}</td>
+                                    <td class="py-3 px-4">{{ item.speed }}</td>
+                                    <td class="py-3 px-4">{{ item.hasPallet$ }}</td>
+                                    <td class="py-3 px-4">{{ item.hasLift$ }}</td>
+                                    <td class="py-3 px-4">{{ item.hasCharge$ }}</td>
+                                    <td class="py-3 px-4">{{ item.statusErrorCode$ }}</td>
+    <!--                                <td class="py-3 px-4">{{ item.suspendState }}</td>-->
+                                    <td class="py-3 px-4">{{ item.lowerPower }}</td>
+                                    <td class="py-3 px-4">{{ item.demo$ }}</td>
+                                    <td class="py-3 px-4">{{ item.pakMk$ }}</td>
+                                </tr>
                             </tbody>
                         </table>
                     </div>
@@ -183,12 +183,18 @@
                                 <el-input @change="changeControlShuttleNo" v-model="controlData.shuttleNo" style="width: 150px;" placeholder="杞﹁締缂栧彿"></el-input>
                             </div>
                             <div>
+                                <el-input @change="changeControlShuttleNo" v-model="controlData.taskNo" style="width: 150px;" placeholder="宸ヤ綔鍙�"></el-input>
+                            </div>
+                            <div>
                                 <el-input v-model="controlData.sourceLocNo" style="width: 200px;" placeholder="婧愬簱浣�"></el-input>
                             </div>
                             <div>
                                 <el-input v-model="controlData.targetLocNo" style="width: 200px;" placeholder="鐩爣搴撲綅"></el-input>
                             </div>
                             <div>
+                                <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('writeTaskNo')">
+                                    <i class="fas fa-credit-card-alt mr-1"></i>鍐欏叆宸ヤ綔鍙�
+                                </button>
                                 <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('transport')">
                                     <i class="fas fa-truck mr-1"></i>鎼繍璐х墿
                                 </button>
@@ -202,7 +208,7 @@
                         </div>
                     </div>
                     <div class="bg-slate-700 p-4 rounded-lg">
-                        <h3 class="text-lg font-medium mb-2">璁惧缁存姢</h3>
+                        <h3 class="text-lg font-medium mb-2">璁惧鎸囦护</h3>
                         <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
                             <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('palletLift')">
                                 <i class="fas fa-level-up mr-1"></i>鎵樼洏椤跺崌
@@ -224,6 +230,9 @@
                             </button>
                             <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('demoOff')">
                                 <i class="fas fa-hourglass-empty mr-1"></i>婕旂ず-鍏�
+                            </button>
+                            <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('clearPath')">
+                                <i class="fas fa-anchor mr-1"></i>娓呴櫎璺緞
                             </button>
                         </div>
                     </div>
@@ -393,6 +402,7 @@
             deviceStatusCountMap: {},
             controlData: {
                 shuttleNo: "",
+                taskNo: "",
                 sourceLocNo: "",
                 targetLocNo: ""
             },
@@ -406,9 +416,9 @@
         },
         methods: {
             init() {
-                this.websocketConnect();
-
                 this.consoleInterval = setInterval(() => {
+                    this.websocketConnect();
+
                     this.getShuttleStateInfo() //鑾峰彇鍥涘悜绌挎杞︿俊鎭�
                 }, 1000)
             },
@@ -545,6 +555,8 @@
                     requestParam.distLocNo = this.controlData.targetLocNo;
                 }else if (type == 'palletLift') {
                     requestParam.shuttleTaskMode = 1;
+                }else if (type == 'palletDown') {
+                    requestParam.shuttleTaskMode = 2;
                 }else if (type == 'chargeOn') {
                     requestParam.shuttleTaskMode = 15;
                 }else if (type == 'chargeOff') {
@@ -555,6 +567,34 @@
                     requestParam.shuttleTaskMode = 12;
                 }else if (type == 'demoOff') {
                     requestParam.shuttleTaskMode = 13;
+                }else if (type == 'clearPath') {
+                    requestParam.shuttleTaskMode = 17;
+                }else if (type == 'writeTaskNo') {
+                    requestParam.workNo = this.controlData.taskNo;
+                    requestParam.pakMk = "Y";
+
+                    $.ajax({
+                        url: baseUrl + "/shuttle/detl/update",
+                        headers: {'token': localStorage.getItem('token')},
+                        method: 'POST',
+                        data: requestParam,
+                        success: function (res) {
+                            if (res.code === 200) {
+                                that.$message({
+                                    message: res.msg,
+                                    type: 'success'
+                                });
+                            } else if (res.code === 403) {
+                                window.location.href = baseUrl + "/login";
+                            } else {
+                                that.$message({
+                                    message: res.msg,
+                                    type: 'warning'
+                                });
+                            }
+                        }
+                    });
+                    return;
                 }
 
                 $.ajax({
@@ -571,7 +611,7 @@
                         } else if (res.code === 403) {
                             window.location.href = baseUrl + "/login";
                         } else {
-                            this.$message({
+                            that.$message({
                                 message: res.msg,
                                 type: 'warning'
                             });
@@ -592,18 +632,20 @@
                 });
             },
             websocketConnect() {
-                this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
-                this.ws.onopen = this.webSocketOnOpen
-                this.ws.onerror = this.webSocketOnError
-                this.ws.onmessage = this.webSocketOnMessage
-                this.ws.onclose = this.webSocketClose
+                if (this.ws == null) {
+                    this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
+                    this.ws.onopen = this.webSocketOnOpen
+                    this.ws.onerror = this.webSocketOnError
+                    this.ws.onmessage = this.webSocketOnMessage
+                    this.ws.onclose = this.webSocketClose
+                }
             },
             webSocketOnOpen(e) {
                 console.log("open");
             },
             webSocketOnError(e) {
+                this.ws = null;
                 console.log(e);
-                this.websocketConnect();
             },
             webSocketOnMessage(e) {
                 const result = JSON.parse(e.data);
@@ -612,12 +654,16 @@
                 }
             },
             webSocketClose(e) {
+                this.ws = null;
                 console.log("close");
-                this.websocketConnect();
             },
             sendWs(message) {
+                if (this.ws == null) {
+                    return;
+                }
+
                 if (this.ws.readyState == WebSocket.OPEN) {
-                    this.ws.send(message)
+                    this.ws.send(message);
                 }
             }
         }

--
Gitblit v1.9.1