From 8761351ef481dfba26ebe122600757d677ce24c9 Mon Sep 17 00:00:00 2001
From: liudl <673013083@qq.com>
Date: 星期五, 17 一月 2025 15:26:50 +0800
Subject: [PATCH] 重连机制
---
Web/src/views/device/deviceInfo/index.vue | 277 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 160 insertions(+), 117 deletions(-)
diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue
index 3dd560a..24e4dc1 100644
--- a/Web/src/views/device/deviceInfo/index.vue
+++ b/Web/src/views/device/deviceInfo/index.vue
@@ -85,117 +85,158 @@
</div>
<div style="margin: 10px 40px;height: 30%; width: 100%; ">
<el-row>
- <el-col :span="9">
- <div >
+ <el-col :span="9">
+ <div>
<el-form label-position="right" label-width="40px" style="">
<el-form-item label="宸ヤ綅">
- <el-input id="locaText" :disabled="lockInputStatus" v-model="stationValue.locatNo" style="width: 200px; margin-right: 10px;"></el-input>
- <el-button @click="textLock(stationValue)">{{lockText}}</el-button>
- <el-button @click="write('zidong',stationValue)">鑷姩</el-button>
- <el-button @click="write('shoudong',stationValue)">鎵嬪姩</el-button>
- <el-button @mousedown="writeDown('huifu',stationValue)" @mouseup="writeUp('huifu',stationValue)">鎶ヨ鎭㈠</el-button>
- </el-form-item>
-
- <el-form-item>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('1diandong',stationValue)" @mouseup="writeUp('1diandong',stationValue)">1鐐瑰姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('2diandong',stationValue)" @mouseup="writeUp('2diandong',stationValue)">2鐐瑰姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('3diandong',stationValue)" @mouseup="writeUp('3diandong',stationValue)">3鐐瑰姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('4diandong',stationValue)" @mouseup="writeUp('4diandong',stationValue)">4鐐瑰姩</el-button>
+ <el-input id="locaText" :disabled="lockInputStatus"
+ v-model="stationValue.locatNo"
+ style="width: 200px; margin-right: 10px;"></el-input>
+ <el-button @click="textLock(stationValue)">{{ lockText }}</el-button>
+ <el-button @click="write('zidong', stationValue)">鑷姩</el-button>
+ <el-button @click="write('shoudong', stationValue)">鎵嬪姩</el-button>
+ <el-button @mousedown="writeDown('huifu', stationValue)"
+ @mouseup="writeUp('huifu', stationValue)">鎶ヨ鎭㈠</el-button>
</el-form-item>
<el-form-item>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('1liandong',stationValue)" @mouseup="writeUp('1liandong',stationValue)">1鑱斿姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('2liandong',stationValue)" @mouseup="writeUp('2liandong',stationValue)">2鑱斿姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('3liandong',stationValue)" @mouseup="writeUp('3liandong',stationValue)">3鑱斿姩</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('4liandong',stationValue)" @mouseup="writeUp('4liandong',stationValue)">4鑱斿姩</el-button>
- </el-form-item>
-
- <el-form-item>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('yizaisheng',stationValue)" @mouseup="writeUp('yizaisheng',stationValue)">绉绘牻涓婂崌</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('fanzhuansheng',stationValue)" @mouseup="writeUp('fanzhuansheng',stationValue)">缈昏浆鏈轰笂鍗�</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('1diandong', stationValue)"
+ @mouseup="writeUp('1diandong', stationValue)">1鐐瑰姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('2diandong', stationValue)"
+ @mouseup="writeUp('2diandong', stationValue)">2鐐瑰姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('3diandong', stationValue)"
+ @mouseup="writeUp('3diandong', stationValue)">3鐐瑰姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('4diandong', stationValue)"
+ @mouseup="writeUp('4diandong', stationValue)">4鐐瑰姩</el-button>
</el-form-item>
<el-form-item>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('yizaijiang',stationValue)" @mouseup="writeUp('yizaijiang',stationValue)">绉绘牻涓嬮檷</el-button>
- <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('fanzhuanjiang',stationValue)" @mouseup="writeUp('fanzhuanjiang',stationValue)">缈昏浆鏈轰笅闄�</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('1liandong', stationValue)"
+ @mouseup="writeUp('1liandong', stationValue)">1鑱斿姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('2liandong', stationValue)"
+ @mouseup="writeUp('2liandong', stationValue)">2鑱斿姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('3liandong', stationValue)"
+ @mouseup="writeUp('3liandong', stationValue)">3鑱斿姩</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('4liandong', stationValue)"
+ @mouseup="writeUp('4liandong', stationValue)">4鑱斿姩</el-button>
+ </el-form-item>
+
+ <el-form-item>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('yizaisheng', stationValue)"
+ @mouseup="writeUp('yizaisheng', stationValue)">绉绘牻涓婂崌</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('fanzhuansheng', stationValue)"
+ @mouseup="writeUp('fanzhuansheng', stationValue)">缈昏浆鏈轰笂鍗�</el-button>
+ </el-form-item>
+
+ <el-form-item>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('yizaijiang', stationValue)"
+ @mouseup="writeUp('yizaijiang', stationValue)">绉绘牻涓嬮檷</el-button>
+ <el-button size="large" :disabled="lockStatus"
+ @mousedown="writeDown('fanzhuanjiang', stationValue)"
+ @mouseup="writeUp('fanzhuanjiang', stationValue)">缈昏浆鏈轰笅闄�</el-button>
</el-form-item>
</el-form>
</div>
</el-col>
<el-col :span="15">
- <div >
+ <div>
<el-form label-position="right" label-width="60px" style="" :inline="true">
<el-row :gutter="23">
<el-col :span="8">
- <el-form-item >
- <el-button @click="write('UpTask',stationValue)">鏇存敼浠诲姟</el-button>
- <el-button @click="writeTaskInfo('writeTask',stationValue)">浠诲姟鍐欏叆</el-button>
- <el-button @click="writeTaskInfo('writeTaskDelete',stationValue)">浠诲姟娓呯┖</el-button>
+ <el-form-item>
+ <el-button @click="write('UpTask', stationValue)">鏇存敼浠诲姟</el-button>
+ <el-button
+ @click="writeTaskInfo('writeTask', stationValue)">浠诲姟鍐欏叆</el-button>
+ <el-button
+ @click="writeTaskInfo('writeTaskDelete', stationValue)">浠诲姟娓呯┖</el-button>
</el-form-item>
- </el-col>
+ </el-col>
<el-col :span="6">
- <el-form-item label="浠诲姟鍙�" >
- <el-input v-model="stationValue.taskNo" style="width: 200px; "></el-input>
+ <el-form-item label="浠诲姟鍙�">
+ <el-input v-model="stationValue.taskNo"
+ style="width: 200px; "></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鎵樼洏鍙�">
- <el-input v-model="stationValue.palletNo" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.palletNo"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="璧峰宸ヤ綅">
- <el-input v-model="stationValue.startLoction" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.startLoction"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鐩爣宸ヤ綅">
- <el-input v-model="stationValue.endLoction" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.endLoction"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="璧峰鎺�">
- <el-input v-model="stationValue.startPai" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.startPai"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="璧峰鍒�">
- <el-input v-model="stationValue.startLie" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.startLie"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="璧峰灞�">
- <el-input v-model="stationValue.startCeng" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.startCeng"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鐩爣鎺�">
- <el-input v-model="stationValue.endPai" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.endPai"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鐩爣鍒�">
- <el-input v-model="stationValue.endLie" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.endLie"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鐩爣灞�">
- <el-input v-model="stationValue.endCeng" style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.endCeng"
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
-
+
<el-col :span="6">
<el-form-item label="缂犺啘淇″彿">
- <el-input v-model="stationValue.chanMo" disabled style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.chanMo" disabled
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鎷嗚啘淇″彿">
- <el-input v-model="stationValue.chaiMo" disabled style="width: 200px; margin-right: 10px;"></el-input>
+ <el-input v-model="stationValue.chaiMo" disabled
+ style="width: 200px; margin-right: 10px;"></el-input>
</el-form-item>
</el-col>
- </el-row>
+ </el-row>
</el-form>
</div>
</el-col>
@@ -209,7 +250,7 @@
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue';
import { listStatus, listPosition } from '/@/api/wcs/wcsPlc';
-import { GetLocationInfo,WriteLocationInfo,WriteInfo,WriteTaskInfo } from '/@/api/wcs/wcsDevice';
+import { GetLocationInfo, WriteLocationInfo, WriteInfo, WriteTaskInfo } from '/@/api/wcs/wcsDevice';
import { signalR } from './signalR';
import { cellsDataLine, cellsDataOne, cellsDataTwo, cellsDataThree } from './data';
import { ElMessage } from "element-plus";
@@ -223,31 +264,31 @@
const lockText = ref("閿佸畾");
-const lockStatus = ref(true);
-const lockInputStatus = ref(false);
+const lockStatus = ref(true);
+const lockInputStatus = ref(false);
const stationValue = ref<any>({
locatNo: '',//宸ヤ綅
- layer:'',//妤煎眰
- typeName:'',//鎿嶄綔绫诲瀷鍚嶇О
- funcName:'',//浜嬩欢缁撴灉 true/false
+ layer: '',//妤煎眰
+ typeName: '',//鎿嶄綔绫诲瀷鍚嶇О
+ funcName: '',//浜嬩欢缁撴灉 true/false
- taskNo:'',
- palletNo:'',
- startLoction:'',
- endLoction:'',
- startPai:'',
- startLie:'',
- startCeng:'',
- endPai:'',
- endLie:'',
- endCeng:'',
+ taskNo: '',
+ palletNo: '',
+ startLoction: '',
+ endLoction: '',
+ startPai: '',
+ startLie: '',
+ startCeng: '',
+ endPai: '',
+ endLie: '',
+ endCeng: '',
- chanMo:'',
- chaiMo:'',
+ chanMo: '',
+ chaiMo: '',
});
-
+
// 鏌ヨ鐘舵��
const handleQuery = async () => {
@@ -325,6 +366,11 @@
// }
}
});
+
+ signalR.onreconnected(() => {
+ console.log('閲嶈繛鎴愬姛plc***');
+ handleQuery();
+ });
});
const handleSwitchChange = (field: string, value: boolean) => {
const param = { [field]: value };
@@ -333,7 +379,6 @@
//鏇存柊鍫嗗灈鏈�
// updateStacker({ stationNum: '10', boxHeight: 200 })
function updateStacker(data: any) {
- debugger;
const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum);
if (foundCell) {
foundCell.EndLocat = data.endLocat;
@@ -388,7 +433,6 @@
//鍒囨崲灞傚钩闈�
function floorTogglePlain(buttonNumber) {
const floorData = [cellsDataOne.value, cellsDataTwo.value, cellsDataThree.value];
- debugger;
if (buttonNumber >= 1 && buttonNumber <= 3) {
const index = buttonNumber - 1;
floorStates.value = {
@@ -402,137 +446,136 @@
const textLock = async (row: any) => {
- if(lockText.value == "閿佸畾"){
- lockStatus.value=false;
- lockInputStatus.value=true;
- lockText.value ="瑙i攣";
+ if (lockText.value == "閿佸畾") {
+ lockStatus.value = false;
+ lockInputStatus.value = true;
+ lockText.value = "瑙i攣";
if (floorStates.value.isPlain1 == false) {
row.layer = 1;
- }else if(floorStates.value.isPlain2 == false){
+ } else if (floorStates.value.isPlain2 == false) {
row.layer = 2;
}
- else if(floorStates.value.isPlain3 == false){
+ else if (floorStates.value.isPlain3 == false) {
row.layer = 3;
}
row.typeName = "suoding";
-
+
console.log(row);
var res = await WriteLocationInfo(row);
var res2 = await GetLocationInfo(row);
let rowData = JSON.parse(JSON.stringify(res2.data.result));
stationValue.value = res2.data.result;
-// stationValue.value = {
-// locatNo: '',//宸ヤ綅
-// layer:'',//妤煎眰
-// typeName:'',//鎿嶄綔绫诲瀷鍚嶇О
-// funcName:null,//浜嬩欢缁撴灉 true/false
+ // stationValue.value = {
+ // locatNo: '',//宸ヤ綅
+ // layer:'',//妤煎眰
+ // typeName:'',//鎿嶄綔绫诲瀷鍚嶇О
+ // funcName:null,//浜嬩欢缁撴灉 true/false
-// taskNo:'',
-// palletNo:'',
-// startLoction:'',
-// endLoction:'',
-// startPai:'',
-// startLie:'',
-// startCeng:'',
-// endPai:'',
-// endLie:'',
-// endCeng:'',
-// }
+ // taskNo:'',
+ // palletNo:'',
+ // startLoction:'',
+ // endLoction:'',
+ // startPai:'',
+ // startLie:'',
+ // startCeng:'',
+ // endPai:'',
+ // endLie:'',
+ // endCeng:'',
+ // }
console.log(res2.data.result);
console.log(rowData);
-
- }else{
- lockStatus.value=true;
- lockInputStatus.value=false;
- lockText.value ="閿佸畾";
- }
-
+
+ } else {
+ lockStatus.value = true;
+ lockInputStatus.value = false;
+ lockText.value = "閿佸畾";
+ }
+
}
-const write = async (type: string,row: any) => {
+const write = async (type: string, row: any) => {
if (lockStatus.value == false) {
ElMessage.success("璇峰厛閿佸畾");
return;
}
if (floorStates.value.isPlain1 == false) {
row.layer = 1;
- }else if(floorStates.value.isPlain2 == false){
+ } else if (floorStates.value.isPlain2 == false) {
row.layer = 2;
}
- else if(floorStates.value.isPlain3 == false){
+ else if (floorStates.value.isPlain3 == false) {
row.layer = 3;
}
row.typeName = type;
-
+
console.log(row);
var res = await WriteInfo(row);
console.log(res.data.result);
ElMessage.success(res.data.result);
}
-const writeDown = async (type: string,row: any) => {
+const writeDown = async (type: string, row: any) => {
if (lockStatus.value == false) {
ElMessage.success("璇峰厛閿佸畾");
return;
}
if (floorStates.value.isPlain1 == false) {
row.layer = 1;
- }else if(floorStates.value.isPlain2 == false){
+ } else if (floorStates.value.isPlain2 == false) {
row.layer = 2;
}
- else if(floorStates.value.isPlain3 == false){
+ else if (floorStates.value.isPlain3 == false) {
row.layer = 3;
}
row.typeName = type;
row.funcName = "true";
var res = await WriteInfo(row);
- console.log(type+"鎸変笅浜嬩欢");
-
+ console.log(type + "鎸変笅浜嬩欢");
+
// ElMessage.success(res.data.result);
}
-const writeUp = async (type: string,row: any) => {
+const writeUp = async (type: string, row: any) => {
if (lockStatus.value == false) {
ElMessage.success("璇峰厛閿佸畾");
return;
}
if (floorStates.value.isPlain1 == false) {
row.layer = 1;
- }else if(floorStates.value.isPlain2 == false){
+ } else if (floorStates.value.isPlain2 == false) {
row.layer = 2;
}
- else if(floorStates.value.isPlain3 == false){
+ else if (floorStates.value.isPlain3 == false) {
row.layer = 3;
}
row.typeName = type;
row.funcName = "false";
var res = await WriteInfo(row);
- console.log(type+"鎶捣浜嬩欢");
-
+ console.log(type + "鎶捣浜嬩欢");
+
// ElMessage.success('asdf'+ res.data.result);
}
-const writeTaskInfo = async (type: string,row: any) => {
+const writeTaskInfo = async (type: string, row: any) => {
if (floorStates.value.isPlain1 == false) {
row.layer = 1;
- }else if(floorStates.value.isPlain2 == false){
+ } else if (floorStates.value.isPlain2 == false) {
row.layer = 2;
}
- else if(floorStates.value.isPlain3 == false){
+ else if (floorStates.value.isPlain3 == false) {
row.layer = 3;
}
row.typeName = type;
var res = await WriteTaskInfo(row);
- console.log(type+"鎶捣浜嬩欢");
-
+ console.log(type + "鎶捣浜嬩欢");
+
// ElMessage.success('asdf'+ res.data.result);
}
</script>
<style scoped>
-
.box-card {
height: 30px;
padding: 0;
--
Gitblit v1.8.0