|  |  | 
 |  |  |   DatagridConfigurable, | 
 |  |  |   SearchInput, | 
 |  |  |   TopToolbar, | 
 |  |  |   Toolbar, | 
 |  |  |   SelectColumnsButton, | 
 |  |  |   EditButton, | 
 |  |  |   FilterButton, | 
 |  |  |   CreateButton, | 
 |  |  |   ExportButton, | 
 |  |  |   BulkDeleteButton, | 
 |  |  |   useDataProvider, | 
 |  |  |   WrapperField, | 
 |  |  |   useRecordContext, | 
 |  |  |   useTranslate, | 
 |  |  |   useNotify, | 
 |  |  |   useRefresh, | 
 |  |  |   useListContext, | 
 |  |  |   FunctionField, | 
 |  |  |   TextField, | 
 |  |  |   NumberField, | 
 |  |  |   DateField, | 
 |  |  |   BooleanField, | 
 |  |  |   ReferenceField, | 
 |  |  |   TextInput, | 
 |  |  |   DateTimeInput, | 
 |  |  |   DateInput, | 
 |  |  |   SelectInput, | 
 |  |  |   NumberInput, | 
 |  |  |   ReferenceInput, | 
 |  |  |   ReferenceArrayInput, | 
 |  |  |   AutocompleteInput, | 
 |  |  |   DeleteButton, | 
 |  |  |   Button, | 
 |  |  |   BulkDeleteButton, | 
 |  |  |   useRedirect, | 
 |  |  |   useUnselectAll, | 
 |  |  |   useRecordSelection, | 
 |  |  | } from 'react-admin'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | 
 |  |  | import DetailsIcon from '@mui/icons-material/Details'; | 
 |  |  | import AddTaskIcon from '@mui/icons-material/AddTask'; | 
 |  |  | import PublicIcon from '@mui/icons-material/Public'; | 
 |  |  | import SelectMatnrModal from "./SelectMatnrModal"; | 
 |  |  | 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.outStock.code" alwaysOn />, | 
 |  |  |   <TextInput source="poCode" label="table.field.outStock.poCode" />, | 
 |  |  |   <NumberInput source="poId" label="table.field.outStock.poId" />, | 
 |  |  |   <ReferenceInput source="type" reference="dictData" filter={{ dictTypeCode: 'sys_order_type', group: '2' }} label="table.field.outStock.type" alwaysOn> | 
 |  |  |     <AutocompleteInput label="table.field.outStock.type" optionValue="value" /> | 
 |  |  |   <TextInput source="code" label="table.field.checkOrder.code" alwaysOn />, | 
 |  |  |   <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_business_type', group: '2' }} label="table.field.outStock.wkType" alwaysOn> | 
 |  |  |     <AutocompleteInput label="table.field.outStock.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.outStock.anfme" />, | 
 |  |  |   <NumberInput source="qty" label="table.field.outStock.qty" />, | 
 |  |  |   <TextInput source="logisNo" label="table.field.outStock.logisNo" />, | 
 |  |  |   <DateInput source="arrTime" label="table.field.outStock.arrTime" />, | 
 |  |  |   <SelectInput source="rleStatus" label="table.field.outStock.rleStatus" | 
 |  |  |     choices={[ | 
 |  |  |       { id: 0, name: ' 正常' }, | 
 |  |  |       { id: 1, name: ' 已释放' }, | 
 |  |  |     ]} | 
 |  |  |   />, | 
 |  |  |  | 
 |  |  |   <TextInput source="logisNo" label="table.field.checkOrder.logisNo" />, | 
 |  |  |   <DateInput source="arrTime" label="table.field.checkOrder.arrTime" />, | 
 |  |  |   <TextInput label="common.field.memo" source="memo" />, | 
 |  |  |   <DictionarySelect | 
 |  |  |     label='table.field.outStock.exceStatus' | 
 |  |  |     label='table.field.checkOrder.exceStatus' | 
 |  |  |     name="exceStatus" | 
 |  |  |     dictTypeCode="sys_asn_exce_status" | 
 |  |  |     dictTypeCode="sys_check_exce_status" | 
 |  |  |     alwaysOn | 
 |  |  |   />, | 
 |  |  | ] | 
 |  |  | 
 |  |  |   const translate = useTranslate(); | 
 |  |  |   const refresh = useRefresh(); | 
 |  |  |   const notify = useNotify(); | 
 |  |  |  | 
 |  |  |   const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |   const [manualDialog, setManualDialog] = useState(false); | 
 |  |  |   const [selectIds, setSelectIds] = useState([]); | 
 |  |  | 
 |  |  |   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 dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_check_order_type')) || []; | 
 |  |  |  | 
 |  |  |   //获取波次规则 | 
 |  |  |   // const closeDialog = async (value) => { | 
 |  |  | 
 |  |  |         actions={( | 
 |  |  |           <TopToolbar> | 
 |  |  |             <FilterButton /> | 
 |  |  |             <CreateByOrderButton setCreateDialog={setCreateDialog} /> | 
 |  |  |             <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> | 
 |  |  |             <SelectColumnsButton preferenceKey='check' /> | 
 |  |  |             <ImportButton value={'outStockItem'} /> | 
 |  |  |             <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="wkType$" 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" /> | 
 |  |  | 
 |  |  |           </WrapperField> | 
 |  |  |         </StyledDatagrid> | 
 |  |  |       </List> | 
 |  |  |       {/* <OutOrderCreate | 
 |  |  |         open={manualDialog} | 
 |  |  |         setOpen={setManualDialog} | 
 |  |  |       /> */} | 
 |  |  |       {/* <SelectMatnrModal | 
 |  |  |       <SelectMatnrModal | 
 |  |  |         asnId={modalType} | 
 |  |  |         billReload={billReload} | 
 |  |  |         open={manualDialog} | 
 |  |  |         setOpen={setManualDialog} | 
 |  |  |       /> | 
 |  |  |       <OutOrderModal | 
 |  |  |         open={createDialog} | 
 |  |  |         setOpen={setCreateDialog} | 
 |  |  |         preview={preview} | 
 |  |  |         setPreview={setPreview} | 
 |  |  |       /> | 
 |  |  |       <OutStockWaveDialog open={waveRule} setOpen={setWaveRule} onClose={closeDialog} /> | 
 |  |  |       <OutOrderPreview open={preview} setOpen={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} setOpen={setDrawerVal}  /> | 
 |  |  |       </PageEditDrawer> */} | 
 |  |  |         <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal} /> | 
 |  |  |       </PageEditDrawer> | 
 |  |  |     </Box > | 
 |  |  |   ) | 
 |  |  | } | 
 |  |  | 
 |  |  |   ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const CreateByOrderButton = ({ setCreateDialog }) => { | 
 |  |  |   const record = useRecordContext(); | 
 |  |  |   const notify = useNotify(); | 
 |  |  |   const refresh = useRefresh(); | 
 |  |  |   const createByOrder = async (event) => { | 
 |  |  |     event.stopPropagation(); | 
 |  |  |     setCreateDialog(true); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   return ( | 
 |  |  |     <Button onClick={createByOrder} label={'toolbar.asnCreate'}> <AddIcon /> </Button> | 
 |  |  |   ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | const CancelButton = () => { | 
 |  |  |   const record = useRecordContext(); | 
 |  |  |   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(); |