|  |  |  | 
|---|
|  |  |  | useList, | 
|---|
|  |  |  | ListContextProvider, | 
|---|
|  |  |  | useListContext, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | useRecordContext, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | Dialog, | 
|---|
|  |  |  | 
|---|
|  |  |  | import StatusSelectInput from "../../components/StatusSelectInput"; | 
|---|
|  |  |  | import OutOrderItemList from "./OutOrderItemList"; | 
|---|
|  |  |  | import MemoInput from "../../components/MemoInput"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import AddIcon from '@mui/icons-material/Add'; | 
|---|
|  |  |  | import SelectMatnrModal from "./SelectMatnrModal"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  | const [matCreate, setMatCreate] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleClose = (event, reason) => { | 
|---|
|  |  |  | if (reason !== "backdropClick") { | 
|---|
|  |  |  | 
|---|
|  |  |  | </DialogTitle> | 
|---|
|  |  |  | <DialogContent sx={{ mt: 2 }}> | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Grid container rowSpacing={2} columnSpacing={2}> | 
|---|
|  |  |  | <Grid container> | 
|---|
|  |  |  | <Grid item xs={12} display="flex" gap={1}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label="table.field.asnOrder.poCode" | 
|---|
|  |  |  | 
|---|
|  |  |  | source="anfme" | 
|---|
|  |  |  | validate={required()} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={12} display="flex" gap={1}> | 
|---|
|  |  |  | <NumberInput | 
|---|
|  |  |  | label="table.field.asnOrder.qty" | 
|---|
|  |  |  | source="qty" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={12} display="flex" gap={1}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label="table.field.asnOrder.logisNo" | 
|---|
|  |  |  | source="logisNo" | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <SelectMatnrModal open={matCreate} setOpen={setMatCreate} /> | 
|---|
|  |  |  | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> | 
|---|
|  |  |  | <Toolbar sx={{ width: '100%', justifyContent: 'end' }}  > | 
|---|
|  |  |  | <AddOutOrderButton setMatCreate={setMatCreate} /> | 
|---|
|  |  |  | <SaveButton /> | 
|---|
|  |  |  | </Toolbar> | 
|---|
|  |  |  | </DialogActions> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Box> | 
|---|
|  |  |  | <ListContextProvider | 
|---|
|  |  |  | // resource="waveItemÏ" | 
|---|
|  |  |  | value={listContext} | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | theme.transitions.create(['all'], { | 
|---|
|  |  |  | duration: theme.transitions.duration.enteringScreen, | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | title={"menu.waveItem"} | 
|---|
|  |  |  | empty={false} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | filters={false} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='waveItem' /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='waveItem' | 
|---|
|  |  |  | bulkActionButtons={false} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={false} | 
|---|
|  |  |  | expandSingle={false} | 
|---|
|  |  |  | omit={['id', 'createTime', 'matnrId', 'waveId', 'batch', 'orderItemId', 'unit', 'batch', 'trackCode', 'fieldsIndex', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <NumberField source="waveId" label="table.field.waveItem.waveId" /> | 
|---|
|  |  |  | <TextField source="waveCode" label="table.field.waveItem.waveCode" /> | 
|---|
|  |  |  | <TextField source="orderCode" label="table.field.waveItem.orderCode" /> | 
|---|
|  |  |  | <NumberField source="matnrId" label="table.field.waveItem.matnrId" /> | 
|---|
|  |  |  | <TextField source="matnrCode" label="table.field.waveItem.matnrCode" /> | 
|---|
|  |  |  | <TextField source="batch" label="table.field.waveItem.batch" /> | 
|---|
|  |  |  | <TextField source="splrBatch" label="table.field.waveItem.splrBatch" /> | 
|---|
|  |  |  | <NumberField source="orderItemId" label="table.field.waveItem.orderItemId" /> | 
|---|
|  |  |  | <TextField source="unit" label="table.field.waveItem.unit" /> | 
|---|
|  |  |  | <TextField source="trackCode" label="table.field.waveItem.trackCode" /> | 
|---|
|  |  |  | <TextField source="fieldsIndex" label="table.field.waveItem.fieldsIndex" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.waveItem.anfme" /> | 
|---|
|  |  |  | <NumberField source="workQty" label="table.field.waveItem.workQty" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.waveItem.qty" /> | 
|---|
|  |  |  | <NumberField source="stockQty" label="table.field.waveItem.stockQty" /> | 
|---|
|  |  |  | <WrapperField cellClassName="opt" label="table.field.waveItem.stockLocs"> | 
|---|
|  |  |  | {/* <TagsField /> */} | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </ListContextProvider> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | </DialogContent> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default OutOrderCreate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const AddOutOrderButton = (setMatCreate) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const addMats = (event) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | setMatCreate(true) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button label={"common.action.newAddMats"} onClick={addMats} variant="contained" sx={{ padding: '0.6em', marginRight: '1em' }}> | 
|---|
|  |  |  | <AddIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|