|  |  |  | 
|---|
|  |  |  | 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'; | 
|---|
|  |  |  | 
|---|
|  |  |  | '& .opt': { | 
|---|
|  |  |  | width: 248 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .MuiTableCell-root': { | 
|---|
|  |  |  | whiteSpace: 'nowrap', | 
|---|
|  |  |  | overflow: 'visible', | 
|---|
|  |  |  | textOverflow: 'unset' | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(() => { | 
|---|
|  |  |  | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | 
|---|
|  |  |  | sort={{ field: "sort", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <BulkAutoStartButton autoExce={autoExce} setAutoExce={setAutoExce}/> | 
|---|
|  |  |  | <BulkAutoPauseButton autoExce={autoExce} setAutoExce={setAutoExce} /> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='task' /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 />} /> : <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 拣料出库 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ? | 
|---|
|  |  |  | (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 />} | 
|---|