From d835d1b51f832889929cdf69010034a30ef44d02 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:57:29 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx |  121 +++++++++++++++++++++++++++++++++------
 1 files changed, 101 insertions(+), 20 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx b/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
index f3c5508..7d5b0ff 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
@@ -4,6 +4,8 @@
 import { createStyles } from 'antd-style';
 import * as Utils from '../../utils'
 import Http from '@/utils/http';
+import BoolValueIcon from '@/components/BoolValueIcon';
+import ShuttleHandle from './handle';
 
 const useStyles = createStyles(({ token, css }) => {
     return {
@@ -27,7 +29,16 @@
     }
 })
 
-
+const updateEnable = async (deviceNo, enable) => {
+    const resp = await Http.doPost('api/dict/update', { val });
+    if (resp.code === 200) {
+        message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
+        return true;
+    } else {
+        message.error(resp.msg);
+        return false;
+    }
+}
 
 const ShuttleView = (props) => {
     const intl = useIntl();
@@ -35,6 +46,7 @@
 
     const { data } = props;
     const [loading, setLoading] = React.useState(false);
+    const [childrenDrawer, setChildrenDrawer] = useState(false);
     const [info, setInfo] = React.useState(null);
 
     useEffect(() => {
@@ -47,6 +59,13 @@
             setLoading(false);
         }
         fetchShuttleInfo(data.no);
+
+        const timer = setInterval(() => {
+            fetchShuttleInfo(data.no);
+        }, 1000);
+        return () => {
+            clearInterval(timer);
+        }
     }, [data]);
 
     return (
@@ -59,45 +78,99 @@
                         <Descriptions
                             bordered
                             title=''
-                            size='small'
-                            layout="vertical"
-                            column={3}
+                            size='middle'    // default | middle | small
+                            layout="vertical"   // horizontal | vertical
+                            column={4}
                             items={
                                 [
                                     {
-                                        key: '1',
-                                        label: intl.formatMessage({ id: 'map.conveyor.no', defaultMessage: '绌挎杞︾紪鍙�' }),
+                                        label: intl.formatMessage({ id: 'map.shuttle.no', defaultMessage: '绌挎杞︾紪鍙�' }),
                                         children: info?.shuttleNo,
                                     },
                                     {
-                                        key: '1',
+                                        label: intl.formatMessage({ id: 'map.task.no', defaultMessage: '浠诲姟鍙�' }),
+                                        children: info?.taskNo,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.device.status', defaultMessage: '璁惧鐘舵��' }),
+                                        children: <Badge status="processing" text={info?.status} />,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.current.code', defaultMessage: '瀹氫綅鏉$爜' }),
+                                        children: info?.currentCode,
+                                    },
+                                    {
                                         label: intl.formatMessage({ id: 'map.loc.no', defaultMessage: '搴撲綅鍙�' }),
-                                        children: <Badge status="processing" text="Running" />,
+                                        children: info?.currentLocNo,
                                     },
                                     {
-                                        key: '2',
                                         label: intl.formatMessage({ id: 'map.pallet.barcode', defaultMessage: '鎵樼洏鏉$爜' }),
-                                        children: '80000010',
-                                        span: 1
+                                        children: info?.zpallet,
                                     },
                                     {
-                                        key: '3',
+                                        label: intl.formatMessage({ id: 'map.origin.loc', defaultMessage: '璧峰搴撲綅' }),
+                                        children: info?.originLocNo,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.dest.loc', defaultMessage: '鐩爣搴撲綅' }),
+                                        children: info?.destLocNo,
+                                    },
+
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.batter.power', defaultMessage: '鐢垫睜鐢甸噺' }),
+                                        children: info?.batteryPower,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.batter.voltage', defaultMessage: '鐢垫睜鐢靛帇' }),
+                                        children: info?.batteryVoltage,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.batter.temp', defaultMessage: '鐢垫睜娓╁害' }),
+                                        children: info?.batteryTemp,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.error', defaultMessage: '寮傚父淇″彿' }),
+                                        children: info?.errorCode,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.has.lift', defaultMessage: '椤跺崌淇″彿' }),
+                                        children: <BoolValueIcon value={info?.hasLift} />,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.has.pallet', defaultMessage: '鎵樼洏淇″彿' }),
+                                        children: <BoolValueIcon value={info?.hasPallet} />,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.shuttle.has.charge', defaultMessage: '鍏呯數淇″彿' }),
+                                        children: <BoolValueIcon value={info?.hasCharge} />,
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.pakmk', defaultMessage: '浣滀笟鏍囪' }),
+                                        children: <BoolValueIcon value={info?.pakMk} />,
+                                    },
+                                    {
                                         label: intl.formatMessage({ id: 'map.is.enable', defaultMessage: '鏄惁鍚敤' }),
-                                        children: 'Disabled',
+                                        children: <BoolValueIcon value={info?.enable} />,
                                     },
                                     {
-                                        key: '4',
                                         label: intl.formatMessage({ id: 'map.loc.operation', defaultMessage: '搴撲綅鎿嶄綔' }),
+                                        span: 3,
                                         children: (
                                             <>
-                                                <Button className={styles.tableButton} size='large' type="primary" danger>
-                                                    <FormattedMessage id='map.loc.lock' defaultMessage='閿佸畾' />
+                                                <Button className={styles.tableButton} size='default' type="primary" danger>
+                                                    <FormattedMessage id='map.diable' defaultMessage='绂佺敤' />
                                                 </Button>
-                                                <Button className={styles.tableButton} size='large' disabled>
-                                                    <FormattedMessage id='map.loc.unlock' defaultMessage='瑙i攣' />
+                                                <Button className={styles.tableButton} size='default' disabled>
+                                                    <FormattedMessage id='map.enable' defaultMessage='鍚敤' />
                                                 </Button>
-                                                <Button className={styles.tableButton} size='large'>
-                                                    <FormattedMessage id='map.loc.reset' defaultMessage='娓呴櫎搴撲綅' />
+                                                <Button
+                                                    className={styles.tableButton}
+                                                    size='default'
+                                                    onClick={() => {
+                                                        setChildrenDrawer(true);
+                                                    }}
+                                                >
+                                                    <FormattedMessage id='map.handle' defaultMessage='鎵嬪姩鎿嶄綔' />
                                                 </Button>
                                             </>
                                         )
@@ -105,6 +178,14 @@
                                 ]
                             }
                         />
+                        <ShuttleHandle
+                            open={childrenDrawer}
+                            refCurr={props.refCurr}
+                            shuttleNo={data.no}
+                            onClose={() => {
+                                setChildrenDrawer(false)
+                            }}
+                        />
                     </div>
                 )}
             </div>

--
Gitblit v1.9.1