From 1739d0c61e3a781a38cab29543575b15c4cd48b2 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 09 四月 2024 15:12:27 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/device/shuttle/index.jsx |   64 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/zy-asrs-flow/src/pages/device/shuttle/index.jsx b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
index c370945..be86591 100644
--- a/zy-asrs-flow/src/pages/device/shuttle/index.jsx
+++ b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
@@ -13,6 +13,11 @@
     const [openOpera, setOpenOpera] = useState(false);
     const [currentData, setCurrentData] = useState(null);
     const [targetLoc, setTargetLoc] = useState("");
+    const [xStart, setXStart] = useState(1);
+    const [xTarget, setXTarget] = useState(1);
+    const [yStart, setYStart] = useState(1);
+    const [yTarget, setYTarget] = useState(1);
+    const [moveLocType, setMoveLocType] = useState(1);
 
     useEffect(() => {
         var newWs = new WebSocket("ws://127.0.0.1:9090/wcs/ws/shuttle/websocket");
@@ -112,6 +117,54 @@
             message.warning("璇锋眰澶辫触");
             return false;
         }
+    }
+
+    const shuttleMoveLoc = async () => {
+        if (xStart == '' || xTarget == '' || yStart == '' || yTarget == '') {
+            message.warning('璇疯緭鍏ュ弬鏁�');
+            return;
+        }
+
+        try {
+            const resp = await Http.doPost('api/basShuttle/moveLoc', {
+                shuttleNo: currentData.shuttleNo,
+                moveType: moveLocType,
+                startX: xStart,
+                targetX: xTarget,
+                startY: yStart,
+                targetY: yTarget,
+            });
+            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)
+    }
+
+    const xTargetChange = (e) => {
+        setXTarget(e.target.value)
+    }
+
+    const yStartChange = (e) => {
+        setYStart(e.target.value)
+    }
+
+    const yTargetChange = (e) => {
+        setYTarget(e.target.value)
+    }
+
+    const moveLocTypeChange = (e) => {
+        setMoveLocType(e)
     }
 
     let codeContent = (<PageContainer
@@ -230,18 +283,19 @@
                     <div style={{ marginBottom: '15px' }}>
                         <Card title="璺戝簱绯荤粺" style={{ width: 300 }}>
                             <div className="commandItem">
-                                <div><Input addonBefore="X璧风偣" defaultValue="1" /></div>
-                                <div><Input addonBefore="X缁堢偣" defaultValue="1" /></div>
-                                <div><Input addonBefore="Y璧风偣" defaultValue="1" /></div>
-                                <div><Input addonBefore="Y缁堢偣" defaultValue="1" /></div>
+                                <div><Input addonBefore="X璧风偣" defaultValue="1" onChange={xStartChange} /></div>
+                                <div><Input addonBefore="X缁堢偣" defaultValue="1" onChange={xTargetChange} /></div>
+                                <div><Input addonBefore="Y璧风偣" defaultValue="1" onChange={yStartChange} /></div>
+                                <div><Input addonBefore="Y缁堢偣" defaultValue="1" onChange={yTargetChange} /></div>
                                 <div>
                                     <Select
                                         defaultValue="0"
+                                        onChange={moveLocTypeChange}
                                         style={{ width: 120 }}
                                         options={[{ value: '0', label: '璺戣建閬�' }, { value: '1', label: '璺戝簱浣�' }, { value: '2', label: '姣嶈建閬撳惊鐜窇' }, { value: '3', label: '瀛愯建閬撳惊鐜窇' }]}
                                     />
                                 </div>
-                                <Button>璺戝簱</Button>
+                                <Button onClick={() => shuttleMoveLoc()}>璺戝簱</Button>
                             </div>
                         </Card>
                     </div>

--
Gitblit v1.9.1