From 0b56fe0aa8ed38fd2d4370fe8a1e6d8d59f9cd08 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期三, 18 九月 2024 09:24:15 +0800
Subject: [PATCH] 优化堆垛机交互
---
Web/src/views/device/deviceInfo/index.vue | 41 ++++++++++++++++++++++++++++++++++-------
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 2 +-
Web/src/views/device/deviceInfo/data.ts | 2 +-
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index e97215b..2137784 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -430,7 +430,7 @@
}
}
}
- Thread.Sleep(1000);
+ Thread.Sleep(300);
}
catch (Exception ex)
{
diff --git a/Web/src/views/device/deviceInfo/data.ts b/Web/src/views/device/deviceInfo/data.ts
index b6a88d9..b7dc8cc 100644
--- a/Web/src/views/device/deviceInfo/data.ts
+++ b/Web/src/views/device/deviceInfo/data.ts
@@ -1,6 +1,6 @@
import { ref } from 'vue';
//鍫嗗灈鏈烘暟鎹�
-const cellsDataLine = ref([
+const cellsDataLine = ref<any>([
{ Id: 1, Code: '001', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
{ Id: 2, Code: '10', LineCode: '01', EndLocat: '01010101', IsShow: 0, IsUse: 0, BoxHeight: 0 },
{ Id: 3, Code: '003', LineCode: '', EndLocat: '', IsShow: 1, IsUse: 0, BoxHeight: 10 },
diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue
index e6526f7..cac9429 100644
--- a/Web/src/views/device/deviceInfo/index.vue
+++ b/Web/src/views/device/deviceInfo/index.vue
@@ -90,7 +90,7 @@
var res = await listStatus();
state.value = res.data.result.modService;
stackers.value = res.data.result.listPlc.filter(s => s.type == 0);
- conveyors.value = res.data.result.listPlc.filter(s => s.type == 1 || s.type == 4);
+ conveyors.value = res.data.result.listPlc.filter(s => s.type == 1);
var res2 = await listPosition();
res2.data.result.forEach(s => {
@@ -147,19 +147,46 @@
}
else if (data.type == 0) {
// 鏇存柊鍫嗗灈鏈烘暟鎹�
- const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum);
- if (foundCell) {
- //淇敼楂樺害
- foundCell.BoxHeight = data.boxHeight;
- }
+ updateStacker(data)
+ // const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum);
+ // if (foundCell) {
+ // //淇敼楂樺害
+ // foundCell.BoxHeight = data.boxHeight;
+ // }
}
});
});
const handleSwitchChange = (field: string, value: boolean) => {
const param = { [field]: value };
- debugger;
signalR.invoke('UpdateService', param);
};
+//鏇存柊鍫嗗灈鏈�
+// updateStacker({ stationNum: '10', boxHeight: 200 })
+function updateStacker(data: any) {
+ debugger;
+ const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum);
+ if (foundCell) {
+ const startHeight = foundCell.BoxHeight;
+ const targetHeight = data.boxHeight;
+ const duration = 1000; // 鍔ㄧ敾鎸佺画鏃堕棿锛堟绉掞級
+ const interval = 50; // 鏇存柊闂撮殧锛堟绉掞級
+ const step = (targetHeight - startHeight) / (duration / interval);
+
+ const update = () => {
+ if ((step > 0 && foundCell.BoxHeight < targetHeight) || (step < 0 && foundCell.BoxHeight > targetHeight)) {
+ foundCell.BoxHeight += step;
+ if ((step > 0 && foundCell.BoxHeight >= targetHeight) || (step < 0 && foundCell.BoxHeight <= targetHeight)) {
+ foundCell.BoxHeight = targetHeight; // 纭繚鏈�缁堝�煎噯纭�
+ clearInterval(timer);
+ }
+ } else {
+ clearInterval(timer);
+ }
+ };
+
+ const timer = setInterval(update, interval);
+ }
+}
// 鏇存柊杈撻�佺嚎鏁版嵁鐨勯�氱敤鍑芥暟
function updateCellData(cellsData: any[], data: any) {
--
Gitblit v1.8.0