|  |  |  | 
|---|
|  |  |  | ReferenceInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | BulkDeleteButton, | 
|---|
|  |  |  | useRedirect, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | 
|---|
|  |  |  | import AddTaskIcon from '@mui/icons-material/AddTask'; | 
|---|
|  |  |  | import PublicIcon from '@mui/icons-material/Public'; | 
|---|
|  |  |  | import SelectMatnrModal from "./SelectMatnrModal"; | 
|---|
|  |  |  | import CheckOrderModal from "./CheckOrderModal"; | 
|---|
|  |  |  | import EditIcon from '@mui/icons-material/Edit'; | 
|---|
|  |  |  | import AddIcon from '@mui/icons-material/Add'; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | import PageEditDrawer from "../../components/PageEditDrawer"; | 
|---|
|  |  |  | import CheckOrderPub from "./CheckOrderPub"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.checkOrder.code" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="poCode" label="table.field.checkOrder.poCode" />, | 
|---|
|  |  |  | <NumberInput source="poId" label="table.field.checkOrder.poId" />, | 
|---|
|  |  |  | <ReferenceInput source="type" reference="dictData" filter={{ dictTypeCode: 'sys_order_type', group: '3' }} label="table.field.checkOrder.type" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.checkOrder.type" optionValue="value" /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_check_order_type' }} label="table.field.checkOrder.wkType" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.checkOrder.wkType" optionValue="value" /> | 
|---|
|  |  |  | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_check_order_type' }} label="table.field.checkOrder.checkType" alwaysOn> | 
|---|
|  |  |  | <AutocompleteInput label="table.field.checkOrder.checkType" optionValue="value" /> | 
|---|
|  |  |  | </ReferenceInput>, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.checkOrder.anfme" />, | 
|---|
|  |  |  | <NumberInput source="qty" label="table.field.checkOrder.qty" />, | 
|---|
|  |  |  | <TextInput source="logisNo" label="table.field.checkOrder.logisNo" />, | 
|---|
|  |  |  | <DateInput source="arrTime" label="table.field.checkOrder.arrTime" />, | 
|---|
|  |  |  | <SelectInput source="rleStatus" label="table.field.checkOrder.rleStatus" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: 0, name: ' 正常' }, | 
|---|
|  |  |  | { id: 1, name: ' 已释放' }, | 
|---|
|  |  |  | ]} | 
|---|
|  |  |  | />, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <TextInput label="common.field.memo" source="memo" />, | 
|---|
|  |  |  | <DictionarySelect | 
|---|
|  |  |  | label='table.field.checkOrder.exceStatus' | 
|---|
|  |  |  | name="exceStatus" | 
|---|
|  |  |  | dictTypeCode="sys_asn_exce_status" | 
|---|
|  |  |  | dictTypeCode="sys_check_exce_status" | 
|---|
|  |  |  | alwaysOn | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='check' /> | 
|---|
|  |  |  | <ImportButton value={'checkItem'} /> | 
|---|
|  |  |  | <ImportButton value={'check'} /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='check' | 
|---|
|  |  |  | bulkActionButtons={<PublicTaskButton setWaveRule={setWaveRule} setSelectIds={setSelectIds} />} | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode="pessimistic" />} | 
|---|
|  |  |  | rowClick={false} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo', 'rleStatus$']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.checkOrder.code" /> | 
|---|
|  |  |  | <TextField source="poCode" label="table.field.checkOrder.poCode" /> | 
|---|
|  |  |  | <TextField source="type$" label="table.field.checkOrder.type" /> | 
|---|
|  |  |  | <TextField cellClassName="wkType" source="checkType$" label="table.field.checkOrder.wkType" /> | 
|---|
|  |  |  | {/* <TextField source="type$" label="table.field.checkOrder.type" /> */} | 
|---|
|  |  |  | <TextField cellClassName="wkType" source="wkType$" label="table.field.checkOrder.type" /> | 
|---|
|  |  |  | <TextField  source="checkType$" label="table.field.checkOrder.checkType" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.checkOrder.anfme" /> | 
|---|
|  |  |  | <NumberField source="workQty" label="table.field.checkOrder.workQty" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.checkOrder.qty" /> | 
|---|
|  |  |  | <TextField source="logisNo" label="table.field.checkOrder.logisNo" /> | 
|---|
|  |  |  | <TextField source="rleStatus$" label="table.field.checkOrder.rleStatus" sortable={false} /> | 
|---|
|  |  |  | <DateField source="arrTime" label="table.field.checkOrder.arrTime" /> | 
|---|
|  |  |  | <TextField source="updateBy$" label="common.field.updateBy" /> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <TextField source="createBy$" label="common.field.createBy" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <MyButton setCreateDialog={setManualDialog} setmodalType={setmodalType} /> | 
|---|
|  |  |  | <EditButton label="toolbar.detail" icon={(<DetailsIcon />)}></EditButton> | 
|---|
|  |  |  | <CancelButton /> | 
|---|
|  |  |  | <PublicButton setDrawerVal={setDrawerVal} drawerVal={drawerVal} setSelect={setSelect} /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | {/* <CheckOrderCreate | 
|---|
|  |  |  | open={manualDialog} | 
|---|
|  |  |  | setOpen={setManualDialog} | 
|---|
|  |  |  | /> */} | 
|---|
|  |  |  | <SelectMatnrModal | 
|---|
|  |  |  | asnId={modalType} | 
|---|
|  |  |  | billReload={billReload} | 
|---|
|  |  |  | 
|---|
|  |  |  | setOpen={setManualDialog} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | {/* <OutStockWaveDialog open={waveRule} setOpen={setWaveRule} onClose={closeDialog} /> | 
|---|
|  |  |  | <OutOrderPreview open={preview} setOpen={setPreview} /> | 
|---|
|  |  |  | <OutOrderPreview open={preview} setOpen={setPreview} />*/} | 
|---|
|  |  |  | <PageEditDrawer | 
|---|
|  |  |  | title={"toolbar.publicWorking"} | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <OutStockPublic record={select} open={drawerVal} setOpen={setDrawerVal}  /> | 
|---|
|  |  |  | </PageEditDrawer> */} | 
|---|
|  |  |  | <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal} /> | 
|---|
|  |  |  | </PageEditDrawer> | 
|---|
|  |  |  | </Box > | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const cancelOrder = async () => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.get(`/outStock/cancel/${record?.id}`); | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.get(`/check/cancel/${record?.id}`); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | record?.exceStatus == 10 ? <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelOutlinedIcon />} onConfirm={cancelOrder} size={"small"} /> : <></> | 
|---|
|  |  |  | record?.exceStatus == 0 ? <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelOutlinedIcon />} onConfirm={cancelOrder} size={"small"} /> : <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //下发执行 | 
|---|
|  |  |  | const PublicButton = ({ setDrawerVal, setSelect }) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const taskEvent = () => { | 
|---|
|  |  |  | setDrawerVal(true) | 
|---|
|  |  |  | setSelect(record) | 
|---|
|  |  |  | refresh(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | record.workQty < record.anfme ? <Button label={"toolbar.publicWorking"} startIcon={<AddTaskIcon />} onClick={taskEvent} size={"small"} /> : <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|