From 25184cadd4011856d95e76f1d79b37ce51a3e548 Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期三, 30 十月 2024 11:34:12 +0800
Subject: [PATCH] 修改问题

---
 Web/src/views/device/deviceInfo/index.vue |  237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 225 insertions(+), 12 deletions(-)

diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue
index 14fe6f2..d422c71 100644
--- a/Web/src/views/device/deviceInfo/index.vue
+++ b/Web/src/views/device/deviceInfo/index.vue
@@ -20,6 +20,18 @@
 							<el-switch v-model="state.boDemo" active-text="" inactive-text="婕旂ず妯″紡"
 								@change="handleSwitchChange('boDemo', $event)"></el-switch>
 						</el-card>
+						<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
+							<el-switch v-model="state.boDrumReversal" active-text="" inactive-text="婊氬姩鍙嶈浆"
+								@change="handleSwitchChange('boDrumReversal', $event)"></el-switch>
+						</el-card>
+						<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
+							<el-switch v-model="state.boOutLock" active-text="" inactive-text="鍑哄簱閿佸畾"
+								@change="handleSwitchChange('boOutLock', $event)"></el-switch>
+						</el-card>
+						<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
+							<el-switch v-model="state.boEnterLock" active-text="" inactive-text="鍏ュ簱閿佸畾"
+								@change="handleSwitchChange('boEnterLock', $event)"></el-switch>
+						</el-card>
 					</el-collapse-item>
 
 					<el-collapse-item title="鍫嗗灈鏈�" name="2">
@@ -48,7 +60,7 @@
 					<el-button type="primary" :plain="floorStates.isPlain3"
 						@click="floorTogglePlain(3)">涓夊眰骞抽潰</el-button>
 				</div>
-				<div style="margin: 40px; height: 50%;">
+				<div style="margin: 40px; height: 58%;">
 					<div class="grid-container-line">
 						<div v-for="cell in cellsDataLine" :key="cell.Id">
 							<div v-if="cell.IsShow === 0" class="grid-item-line">
@@ -71,6 +83,113 @@
 						</div>
 					</div>
 				</div>
+				<div style="margin: 10px 40px;height: 30%; width: 100%; ">
+					<el-row>
+						<el-col :span="9">	
+							<div >
+								<el-form label-position="right" label-width="40px" style="">
+									<el-form-item label="宸ヤ綅">
+										<el-input v-model="stationValue.LocatNo" style="width: 200px; margin-right: 10px;"></el-input>
+										<el-button @click="write('zidong',stationValue)">鑷姩</el-button>
+										<el-button @click="write('shoudong',stationValue)">鎵嬪姩</el-button>
+										<el-button @click="write('huifu',stationValue)">鎶ヨ鎭㈠</el-button>
+									</el-form-item>
+																		
+									<el-form-item>
+										<el-button size="large" @mousedown="writeDown('1diandong',stationValue)"  @mouseup="writeUp('1diandong',stationValue)">1鐐瑰姩</el-button>
+										<el-button size="large" @mousedown="writeDown('2diandong',stationValue)"  @mouseup="writeUp('2diandong',stationValue)">2鐐瑰姩</el-button>
+										<el-button size="large" @mousedown="writeDown('3diandong',stationValue)"  @mouseup="writeUp('3diandong',stationValue)">3鐐瑰姩</el-button>
+										<el-button size="large" @mousedown="writeDown('4diandong',stationValue)"  @mouseup="writeUp('4diandong',stationValue)">4鐐瑰姩</el-button>
+									</el-form-item>
+
+									<el-form-item>
+										<el-button size="large" @mousedown="writeDown('1liandong',stationValue)"  @mouseup="writeUp('1liandong',stationValue)">1鑱斿姩</el-button>
+										<el-button size="large" @mousedown="writeDown('2liandong',stationValue)"  @mouseup="writeUp('2liandong',stationValue)">2鑱斿姩</el-button>
+										<el-button size="large" @mousedown="writeDown('3liandong',stationValue)"  @mouseup="writeUp('3liandong',stationValue)">3鑱斿姩</el-button>
+										<el-button size="large" @mousedown="writeDown('4liandong',stationValue)"  @mouseup="writeUp('4liandong',stationValue)">4鑱斿姩</el-button>
+									</el-form-item>
+									
+									<el-form-item>
+										<el-button size="large" @mousedown="writeDown('yizaisheng',stationValue)"  @mouseup="writeUp('yizaisheng',stationValue)">绉绘牻涓婂崌</el-button>
+										<el-button size="large" @mousedown="writeDown('fanzhuansheng',stationValue)"  @mouseup="writeUp('fanzhuansheng',stationValue)">缈昏浆鏈轰笂鍗�</el-button>
+									</el-form-item>
+
+									<el-form-item>
+										<el-button size="large" @mousedown="writeDown('yizaijiang',stationValue)"  @mouseup="writeUp('yizaijiang',stationValue)">绉绘牻涓嬮檷</el-button>
+										<el-button size="large" @mousedown="writeDown('fanzhuanjiang',stationValue)"  @mouseup="writeUp('fanzhuanjiang',stationValue)">缈昏浆鏈轰笅闄�</el-button>
+									</el-form-item>
+
+								</el-form>
+							</div>
+						</el-col>
+						<el-col :span="15">
+							<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-col>	
+										<el-col :span="6">
+											<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-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-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-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-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-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-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-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-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-form-item>
+										</el-col>
+										
+									</el-row>	
+								</el-form>
+							</div>
+						</el-col>
+					</el-row>
+				</div>
 			</el-col>
 		</el-row>
 	</div>
@@ -79,12 +198,33 @@
 <script lang="ts" setup>
 import { ref, reactive, onMounted } from 'vue';
 import { listStatus, listPosition } from '/@/api/wcs/wcsPlc';
+import { WriteInfo,WriteTaskInfo } from '/@/api/wcs/wcsDevice';
 import { signalR } from './signalR';
 import { cellsDataLine, cellsDataOne, cellsDataTwo, cellsDataThree } from './data';
+import { ElMessage } from "element-plus";
 
 const state = ref<any>({});
 const stackers = ref<any>({});
 const conveyors = ref<any>({});
+const stationValue = ref<any>({
+	LocatNo: '',//宸ヤ綅
+	Layer:'',//妤煎眰
+	TypeName:'',//鎿嶄綔绫诲瀷鍚嶇О
+	FuncName:'',//浜嬩欢缁撴灉  true/false
+
+	TaskNo:'',
+	PalletNo:'',
+	StartLoction:'',
+	EndLoction:'',
+	StartPai:'',
+	StartLie:'',
+	StartCeng:'',
+	EndPai:'',
+	EndLie:'',
+	EndCeng:'',
+});
+
+
 // 鏌ヨ鐘舵��
 const handleQuery = async () => {
 	var res = await listStatus();
@@ -105,9 +245,9 @@
 		}
 		else if (s.type == 1) {
 			// 鏇存柊杈撻�佺嚎鏁版嵁
-			updateCellData(cellsDataOne, s);
-			updateCellData(cellsDataTwo, s);
-			updateCellData(cellsDataThree, s);
+			updateCellData(cellsDataOne.value, s);
+			updateCellData(cellsDataTwo.value, s);
+			updateCellData(cellsDataThree.value, s);
 		}
 	});
 };
@@ -136,15 +276,20 @@
 	signalR.off('UpdateService');
 	signalR.on('UpdateService', (data: any) => {
 		state.value = data;
+		if (data.error) {
+			ElMessage({
+				message: data.error,
+				type: "error",
+			});
+		}
 	});
 	signalR.off('PublicPosition');
 	signalR.on('PublicPosition', (data: any) => {
-
 		if (data.type == 1) {
 			// 鏇存柊杈撻�佺嚎鏁版嵁
-			updateCellData(cellsDataOne, data);
-			updateCellData(cellsDataTwo, data);
-			updateCellData(cellsDataThree, data);
+			updateCellData(cellsDataOne.value, data);
+			updateCellData(cellsDataTwo.value, data);
+			updateCellData(cellsDataThree.value, data);
 		}
 		else if (data.type == 0) {
 			// 鏇存柊鍫嗗灈鏈烘暟鎹�
@@ -206,7 +351,7 @@
 const activeName = ['1', '2', '3'];
 
 //杈撻�佺嚎鏁版嵁
-let cellsData = ref(cellsDataOne);
+let cellsData = cellsDataOne.value;
 
 
 // 灞傚钩闈㈢姸鎬�
@@ -218,8 +363,8 @@
 
 //鍒囨崲灞傚钩闈�
 function floorTogglePlain(buttonNumber) {
-	const floorData = [cellsDataOne, cellsDataTwo, cellsDataThree];
-
+	const floorData = [cellsDataOne.value, cellsDataTwo.value, cellsDataThree.value];
+	debugger;
 	if (buttonNumber >= 1 && buttonNumber <= 3) {
 		const index = buttonNumber - 1;
 		floorStates.value = {
@@ -227,12 +372,80 @@
 			isPlain2: index !== 1,
 			isPlain3: index !== 2
 		};
-		cellsData.value = floorData[index];
+		cellsData = floorData[index];
 	}
 }
+
+const write = async (type: string,row: any) => {
+	if (floorStates.value.isPlain1 == false) {
+		row.Layer = 1;
+	}else if(floorStates.value.isPlain2 == false){
+		row.Layer = 2;
+	}
+	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) => {
+	if (floorStates.value.isPlain1 == false) {
+		row.Layer = 1;
+	}else if(floorStates.value.isPlain2 == false){
+		row.Layer = 2;
+	}
+	else if(floorStates.value.isPlain3 == false){
+		row.Layer = 3;
+	}
+	row.TypeName = type;
+	row.FuncName = "true";
+	var res = await WriteInfo(row);
+	console.log(type+"鎸変笅浜嬩欢");
+	
+	// ElMessage.success(res.data.result);
+}
+const writeUp = async (type: string,row: any) => {
+	if (floorStates.value.isPlain1 == false) {
+		row.Layer = 1;
+	}else if(floorStates.value.isPlain2 == false){
+		row.Layer = 2;
+	}
+	else if(floorStates.value.isPlain3 == false){
+		row.Layer = 3;
+	}
+	row.TypeName = type;
+	row.FuncName = "false";
+	var res = await WriteInfo(row);
+	console.log(type+"鎶捣浜嬩欢");
+	
+	// ElMessage.success('asdf'+ res.data.result);
+}
+
+const writeTaskInfo = async (type: string,row: any) => {
+	if (floorStates.value.isPlain1 == false) {
+		row.Layer = 1;
+	}else if(floorStates.value.isPlain2 == false){
+		row.Layer = 2;
+	}
+	else if(floorStates.value.isPlain3 == false){
+		row.Layer = 3;
+	}
+	row.TypeName = type;
+	var res = await WriteTaskInfo(row);
+	console.log(type+"鎶捣浜嬩欢");
+	
+	// ElMessage.success('asdf'+ res.data.result);
+}
+
 </script>
 
 <style scoped>
+
 .box-card {
 	height: 30px;
 	padding: 0;

--
Gitblit v1.8.0