|  |  |  | 
|---|
|  |  |  | DatagridConfigurable, | 
|---|
|  |  |  | SearchInput, | 
|---|
|  |  |  | TopToolbar, | 
|---|
|  |  |  | Toolbar, | 
|---|
|  |  |  | SelectColumnsButton, | 
|---|
|  |  |  | EditButton, | 
|---|
|  |  |  | FilterButton, | 
|---|
|  |  |  | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | useRedirect, | 
|---|
|  |  |  | useUnselectAll, | 
|---|
|  |  |  | useRecordSelection, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack, Drawer } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import MyCreateButton from "../../components/MyCreateButton"; | 
|---|
|  |  |  | import BillStatusField from '../../components/BillStatusField'; | 
|---|
|  |  |  | import ConfirmButton from '../../components/ConfirmButton'; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack, Drawer } from '@mui/material'; | 
|---|
|  |  |  | import DictionarySelect from "../../components/DictionarySelect"; | 
|---|
|  |  |  | import BillStatusField from '../../components/BillStatusField'; | 
|---|
|  |  |  | import MyCreateButton from "../../components/MyCreateButton"; | 
|---|
|  |  |  | import PageEditDrawer from "../../components/PageEditDrawer"; | 
|---|
|  |  |  | import ConfirmButton from '../../components/ConfirmButton'; | 
|---|
|  |  |  | import ImportButton from "../../components/ImportButton"; | 
|---|
|  |  |  | import DetailsIcon from '@mui/icons-material/Details'; | 
|---|
|  |  |  | import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | 
|---|
|  |  |  | import AddIcon from '@mui/icons-material/Add'; | 
|---|
|  |  |  | import OutOrderModal from "./OutOrderModal"; | 
|---|
|  |  |  | import AddTaskIcon from '@mui/icons-material/AddTask'; | 
|---|
|  |  |  | import PublicIcon from '@mui/icons-material/Public'; | 
|---|
|  |  |  | import SelectMatnrModal from "./SelectMatnrModal"; | 
|---|
|  |  |  | import AddTaskIcon from '@mui/icons-material/AddTask'; | 
|---|
|  |  |  | import PageEditDrawer from "../../components/PageEditDrawer"; | 
|---|
|  |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
|---|
|  |  |  | import OutOrderPreview from "./OutOrderPreview"; | 
|---|
|  |  |  | import AddIcon from '@mui/icons-material/Add'; | 
|---|
|  |  |  | import OutStockPublic from "./OutStockPublic"; | 
|---|
|  |  |  | import OutOrderModal from "./OutOrderModal"; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | import OutStockWaveDialog from "./OutStockWaveDialog"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | dictTypeCode="sys_asn_exce_status" | 
|---|
|  |  |  | alwaysOn | 
|---|
|  |  |  | />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const OutOrderList = (props) => { | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  | const [manualDialog, setManualDialog] = useState(false); | 
|---|
|  |  |  | const [selectIds, setSelectIds] = useState([]); | 
|---|
|  |  |  | const [preview, setPreview] = useState(false); | 
|---|
|  |  |  | const [waveRule, setWaveRule] = useState(false); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  | const [modalType, setmodalType] = useState(0); | 
|---|
|  |  |  | const [select, setSelect] = useState(0); | 
|---|
|  |  |  | const billReload = useRef(); | 
|---|
|  |  |  | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取波次规则 | 
|---|
|  |  |  | const closeDialog = async (value) => { | 
|---|
|  |  |  | setWaveRule(false) | 
|---|
|  |  |  | const res = await request.post(`/outStock/generate/wave`, { ids: selectIds, waveRuleId: value.id }); | 
|---|
|  |  |  | if (res?.data?.code === 200) { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | 
|---|
|  |  |  | <CreateByOrderButton setCreateDialog={setCreateDialog} /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='outStock' /> | 
|---|
|  |  |  | <ImportButton value={'outStock'} /> | 
|---|
|  |  |  | {/* <MyExportButton /> */} | 
|---|
|  |  |  | <ImportButton value={'outStockItem'} /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | sx={{ width: '100%' }} | 
|---|
|  |  |  | preferenceKey='outStock' | 
|---|
|  |  |  | bulkActionButtons={<PublicTaskButton />} | 
|---|
|  |  |  | bulkActionButtons={<PublicTaskButton setWaveRule={setWaveRule} setSelectIds={setSelectIds} />} | 
|---|
|  |  |  | rowClick={false} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo', 'rleStatus$']} | 
|---|
|  |  |  | 
|---|
|  |  |  | <OutOrderModal | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | preview={preview} | 
|---|
|  |  |  | setPreview={setPreview} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <OutStockWaveDialog open={waveRule} setOpen={setWaveRule} onClose={closeDialog} /> | 
|---|
|  |  |  | <OutOrderPreview open={preview} setOpen={setPreview} /> | 
|---|
|  |  |  | <PageEditDrawer | 
|---|
|  |  |  | title={"toolbar.publicWorking"} | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <OutStockPublic record={select} open={drawerVal}/> | 
|---|
|  |  |  | <OutStockPublic record={select} open={drawerVal} setOpen={setDrawerVal}  /> | 
|---|
|  |  |  | </PageEditDrawer> | 
|---|
|  |  |  | </Box > | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | 
|---|
|  |  |  | export default OutOrderList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const PublicTaskButton = () => { | 
|---|
|  |  |  | const PublicTaskButton = ({ setWaveRule, setSelectIds }) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const { selectedIds, onUnselectItems } = useListContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const redirect = useRedirect(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const pubClick = async (event) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | const pubClick = async () => { | 
|---|
|  |  |  | onUnselectItems(); | 
|---|
|  |  |  | const res = await request.post(`/outStock/generate/wave`, { ids: selectedIds }); | 
|---|
|  |  |  | if (res?.data?.code === 200) { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | redirect("/wave") | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | refresh(); | 
|---|
|  |  |  | setWaveRule(true); | 
|---|
|  |  |  | setSelectIds(selectedIds) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | 
|---|
|  |  |  | onClick={pubClick} | 
|---|
|  |  |  | label={"toolbar.createWave"} | 
|---|
|  |  |  | startIcon={<PublicIcon />} | 
|---|
|  |  |  | />); | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const MyButton = ({ setCreateDialog, setmodalType }) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const createByOrder = async (event) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | setCreateDialog(true); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <ConfirmButton label={"toolbar.publicWorking"} startIcon={<AddTaskIcon />} onConfirm={taskEvent} size={"small"} /> | 
|---|
|  |  |  | record.workQty < record.anfme ? <Button label={"toolbar.publicWorking"} startIcon={<AddTaskIcon />} onClick={taskEvent} size={"small"} /> : <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|