From 3fd514d4b802534159518924f3711dc5152732d4 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 20 八月 2024 16:12:10 +0800
Subject: [PATCH] #任务增加缓存队列
---
zy-asrs-flow/src/pages/device/shuttle/index.jsx | 44 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/zy-asrs-flow/src/pages/device/shuttle/index.jsx b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
index 43eff9c..b6c1609 100644
--- a/zy-asrs-flow/src/pages/device/shuttle/index.jsx
+++ b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
@@ -6,6 +6,7 @@
PageContainer,
} from '@ant-design/pro-components';
import './index.less'
+import { WEBSOCKET_BASE_URL } from '@/config/setting';
const Main = () => {
const [deviceInfos, setDeviceInfos] = useState([]);
@@ -21,8 +22,7 @@
const [moveLocType, setMoveLocType] = useState(1);
useEffect(() => {
- var newWs = new WebSocket("ws://127.0.0.1:9090/wcs/ws/shuttle/websocket");
- setWs(newWs);
+ connect();
return () => {
if (ws) {
@@ -58,6 +58,7 @@
ws.onclose = function (e) {
console.log("close");
+ reconnect();
}
ws.onerror = function (e) {
@@ -65,6 +66,18 @@
}
}
}, [ws]);
+
+ const connect = () => {
+ var newWs = new WebSocket(WEBSOCKET_BASE_URL + "/ws/shuttle/websocket");
+ setWs(newWs);
+ }
+
+ const reconnect = () => {
+ setTimeout(() => {
+ console.log('WebSocketClient: Attempting to reconnect...');
+ connect();
+ }, 3000);
+ }
const sendWs = (message) => {
if (ws.readyState == WebSocket.OPEN) {
@@ -163,6 +176,25 @@
}
}
+ const shuttleMoveLocClose = async () => {
+ try {
+ const resp = await Http.doPost('api/basShuttle/moveLocClose', {
+ shuttleNo: currentData.shuttleNo,
+ });
+ if (resp.code === 200) {
+ message.success("璇锋眰鎴愬姛");
+ return true;
+ } else {
+ message.warning(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.warning("璇锋眰澶辫触");
+ return false;
+ }
+ }
+
+
const xStartChange = (e) => {
setXStart(e.target.value)
}
@@ -259,7 +291,12 @@
key: '13',
label: '鑷姩',
children: item.mode ? 'Y' : 'N',
- }
+ },
+ {
+ key: '14',
+ label: '搴撲綅鍙�',
+ children: item.currentLocNo,
+ },
];
return <div key={item.id} style={{ width: '45%' }}>
<div style={{ marginBottom: '10px' }}>
@@ -325,6 +362,7 @@
/>
</div>
<Button onClick={() => shuttleMoveLoc()}>璺戝簱</Button>
+ <Button onClick={() => shuttleMoveLocClose()}>璺戝簱鍏抽棴</Button>
</div>
</Card>
</div>
--
Gitblit v1.9.1