From e6cf7f032bee1cef9c49258746da44d66ca85c6c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 17 九月 2025 14:56:59 +0800
Subject: [PATCH] 添加仓库类型 单据添加上报完成类型

---
 rsf-admin/src/page/task/TaskList.jsx |   96 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 71 insertions(+), 25 deletions(-)

diff --git a/rsf-admin/src/page/task/TaskList.jsx b/rsf-admin/src/page/task/TaskList.jsx
index 52dd7e2..55d5af7 100644
--- a/rsf-admin/src/page/task/TaskList.jsx
+++ b/rsf-admin/src/page/task/TaskList.jsx
@@ -37,7 +37,10 @@
 import TaskPanel from "./TaskPanel";
 import MyField from "../components/MyField";
 import ConfirmButton from "../components/ConfirmButton";
-import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, AUTO_RUN_CHECK_ORDERS } from '@/config/setting';
+import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
+import PauseIcon from '@mui/icons-material/Pause';
+import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
 import * as Common from '@/utils/common';
 import ColorizeOutlinedIcon from '@mui/icons-material/ColorizeOutlined';
 import GradingOutlinedIcon from '@mui/icons-material/GradingOutlined';
@@ -54,6 +57,12 @@
     '& .opt': {
         width: 248
     },
+    '& .MuiTableCell-root': {
+    whiteSpace: 'nowrap',
+    overflow: 'visible',
+    textOverflow: 'unset'
+    }
+
 }));
 
 
@@ -61,7 +70,19 @@
     const translate = useTranslate();
     const refresh = useRefresh();
     const [drawerVal, setDrawerVal] = useState(false);
+    const [autoExce, setAutoExce] = useState(false);
     const dict = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_warehouse_type')) || [];
+
+    useEffect(() => {
+        getConfig()
+    }, [])
+
+    const getConfig = async () => {
+        const { data: { code, data, msg } } = await request.get('/config/flag/' + AUTO_RUN_CHECK_ORDERS);
+        if (code === 200) {
+            setAutoExce(JSON.parse(data?.val))
+        }
+    }
 
     // useEffect(() => {
     //     const interval = setInterval(() => {
@@ -103,8 +124,6 @@
         />,
     ]
 
-
-
     return (
         <Box display="flex">
             <List
@@ -123,6 +142,8 @@
                 sort={{ field: "sort", order: "desc" }}
                 actions={(
                     <TopToolbar>
+                        <BulkAutoStartButton autoExce={autoExce} setAutoExce={setAutoExce}/>
+                        <BulkAutoPauseButton autoExce={autoExce} setAutoExce={setAutoExce} />
                         <FilterButton />
                         <SelectColumnsButton preferenceKey='task' />
                     </TopToolbar>
@@ -131,17 +152,11 @@
             >
                 <StyledDatagrid
                     preferenceKey='task'
-                    bulkActionButtons={false
-                        // <>
-                        //     <BulkResortButton />
-                        //     <BulkCancelButton />
-                        //     <BulkDeleteButton mutationMode={OPERATE_MODE} />
-                        // </>
-                    }
+                    bulkActionButtons={false}
                     rowClick={false}
                     expand={<TaskPanel />}
                     expandSingle={true}
-                    omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status']}
+                    omit={['id', 'createTime', 'createBy$', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status','warehType$']}
                 >
                     <NumberField source="id" />
                     <TextField source="taskCode" label="table.field.task.taskCode" />
@@ -162,7 +177,6 @@
                     <TextField source="createBy$" label="common.field.createBy" />
                     <DateField source="updateTime" label="common.field.updateTime" showTime />
                     <DateField source="createTime" label="common.field.createTime" showTime />
-                    {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */}
                     <TextField source="memo" label="common.field.memo" sortable={false} />
                     <WrapperField cellClassName="opt" label="common.field.opt" onClick={(e) => e.stopPropagation()} >
                         <EditButton label="toolbar.detail" />
@@ -207,6 +221,40 @@
 
     return (record?.taskStatus == 199 && record?.taskType == 107 ? <ConfirmButton label={"toolbar.check"} startIcon={<GradingOutlinedIcon />} onConfirm={checkClick} /> : <></>)
 }
+
+/**鑷姩涓嬪彂浠诲姟**/
+const BulkAutoStartButton = ({ autoExce, setAutoExce }) => {
+    const notify = useNotify();
+    const startClick = async () => {
+        setAutoExce(true)
+        const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: true, flag: 'AUTO_RUN_CHECK_ORDERS' });
+        if (code === 200) {
+            notify(msg);
+        } else {
+            notify(msg);
+        }
+    }
+    return (
+        !autoExce ? <Button label="toolbar.autoStartLocs" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} /> : <></>
+    )
+}
+
+const BulkAutoPauseButton = ({ autoExce, setAutoExce }) => {
+    const notify = useNotify();
+    const pauseClick = async () => {
+        const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: false, flag: 'AUTO_RUN_CHECK_ORDERS' });
+        if (code === 200) {
+            notify(msg);
+            setAutoExce(false)
+        } else {
+            notify(msg);
+        }
+    }
+    return (
+        autoExce ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseIcon />} /> : <></>
+    )
+}
+
 
 /**
  * 鎷f枡鍑哄簱
@@ -255,7 +303,7 @@
         }
     }
     return (
-        ((record?.taskStatus < 98) || (record?.taskType >= 101 && record?.taskStatus < 198))  || (record?.taskType == 11 && record?.taskStatus == 101) ? (<ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskAltIcon />} onConfirm={clickComplete} />) : (<></>)
+        ((record?.taskStatus < 98) || (record?.taskType >= 101 && record?.taskStatus < 198)) || (record?.taskType == 11 && record?.taskStatus == 101) ? (<ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskAltIcon />} onConfirm={clickComplete} />) : (<></>)
     )
 }
 
@@ -267,13 +315,11 @@
     const record = useRecordContext();
     const notify = useNotify();
     const refresh = useRefresh();
-    const clickCancel = (event) => {
-        event.stopPropagation();
+    const clickCancel = () => {
         cancleTask(record)
     };
     //鍙栨秷浠诲姟
     const cancleTask = async (row) => {
-        console.log(row);
         const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id);
         if (code === 200) {
             notify(msg);
@@ -283,12 +329,12 @@
         }
     }
     return (
-        (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ?
-            <Button
-                onClick={clickCancel}
-                label="toolbar.cancel">
-                <CancelIcon />
-            </Button>
+        (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 107 || record.taskType == 103 || record.taskType == 11) ?
+            <ConfirmButton
+                onConfirm={clickCancel}
+                startIcon={<CancelIcon />}
+                label={"toolbar.cancel"}>
+            </ConfirmButton>
             :
             <></>
     )
@@ -313,7 +359,7 @@
             refresh();
         } else {
             notify(msg);
-        } 
+        }
     }
     return (
         (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ?
@@ -322,8 +368,8 @@
                 label="toolbar.top">
                 <AlignVerticalTopIcon />
             </Button>
-        :
-        <></>
+            :
+            <></>
     )
 }
 

--
Gitblit v1.9.1