|  |  |  | 
|---|
|  |  |  | import React, { | 
|---|
|  |  |  | useState, | 
|---|
|  |  |  | useRef, | 
|---|
|  |  |  | useEffect, | 
|---|
|  |  |  | useMemo, | 
|---|
|  |  |  | useCallback, | 
|---|
|  |  |  | } from "react"; | 
|---|
|  |  |  | import { useNavigate, useLocation } from "react-router-dom"; | 
|---|
|  |  |  | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; | 
|---|
|  |  |  | import { useNavigate, useLocation } from 'react-router-dom'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | List, | 
|---|
|  |  |  | DatagridConfigurable, | 
|---|
|  |  |  | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | } from "react-admin"; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from "@mui/material"; | 
|---|
|  |  |  | import { styled } from "@mui/material/styles"; | 
|---|
|  |  |  | Button | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import { styled } from '@mui/material/styles'; | 
|---|
|  |  |  | import AsnOrderItemCreate from "./AsnOrderItemCreate"; | 
|---|
|  |  |  | import AsnOrderItemPanel from "./AsnOrderItemPanel"; | 
|---|
|  |  |  | import EmptyData from "../components/EmptyData"; | 
|---|
|  |  |  | import MyCreateButton from "../components/MyCreateButton"; | 
|---|
|  |  |  | import MyExportButton from "../components/MyExportButton"; | 
|---|
|  |  |  | import MyExportButton from '../components/MyExportButton'; | 
|---|
|  |  |  | import PageDrawer from "../components/PageDrawer"; | 
|---|
|  |  |  | import MyField from "../components/MyField"; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  | import CustomerTopToolBar from "../components/EditTopToolBar"; | 
|---|
|  |  |  | import QrCodeIcon from "@mui/icons-material/QrCode"; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | PAGE_DRAWER_WIDTH, | 
|---|
|  |  |  | OPERATE_MODE, | 
|---|
|  |  |  | DEFAULT_PAGE_SIZE, | 
|---|
|  |  |  | } from "@/config/setting"; | 
|---|
|  |  |  | import * as Common from "@/utils/common"; | 
|---|
|  |  |  | import ImportButton from "../components/ImportButton"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
|---|
|  |  |  | "& .css-1vooibu-MuiSvgIcon-root": { | 
|---|
|  |  |  | height: ".9em", | 
|---|
|  |  |  | '& .css-1vooibu-MuiSvgIcon-root': { | 
|---|
|  |  |  | height: '.9em', | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | "& .RaDatagrid-row": { | 
|---|
|  |  |  | cursor: "auto", | 
|---|
|  |  |  | '& .RaDatagrid-row': { | 
|---|
|  |  |  | cursor: 'auto' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | "& .column-name": {}, | 
|---|
|  |  |  | "& .opt": { | 
|---|
|  |  |  | width: 200, | 
|---|
|  |  |  | '& .column-name': { | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .opt': { | 
|---|
|  |  |  | width: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <TextInput source="poDetlId" label="table.field.asnOrderItem.poDetlId" />, | 
|---|
|  |  |  | <TextInput source="poDetlCode" label="table.field.asnOrderItem.poDetlCode" />, | 
|---|
|  |  |  | <TextInput source="matnrId" label="table.field.asnOrderItem.matnrId" />, | 
|---|
|  |  |  | <TextInput source="matnk" label="table.field.asnOrderItem.matnk" />, | 
|---|
|  |  |  | <TextInput source="maktx" label="table.field.asnOrderItem.maktx" />, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.asnOrderItem.anfme" />, | 
|---|
|  |  |  | <TextInput source="stockUnit" label="table.field.asnOrderItem.stockUnit" />, | 
|---|
|  |  |  | <NumberInput source="purQty" label="table.field.asnOrderItem.purQty" />, | 
|---|
|  |  |  | 
|---|
|  |  |  | label="common.field.status" | 
|---|
|  |  |  | source="status" | 
|---|
|  |  |  | choices={[ | 
|---|
|  |  |  | { id: "1", name: "common.enums.statusTrue" }, | 
|---|
|  |  |  | { id: "0", name: "common.enums.statusFalse" }, | 
|---|
|  |  |  | { id: '1', name: 'common.enums.statusTrue' }, | 
|---|
|  |  |  | { id: '0', name: 'common.enums.statusFalse' }, | 
|---|
|  |  |  | ]} | 
|---|
|  |  |  | resettable | 
|---|
|  |  |  | />, | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const AsnOrderItemList = () => { | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const location = useLocation(); | 
|---|
|  |  |  | const queryParams = new URLSearchParams(location.search); | 
|---|
|  |  |  | const ruleId = queryParams.get("ruleId"); | 
|---|
|  |  |  | const asnId = queryParams.get("asnId"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const creatCode = () => {}; | 
|---|
|  |  |  | const creatCode = () => { }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | theme.transitions.create(["all"], { | 
|---|
|  |  |  | duration: theme.transitions.duration.enteringScreen, | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | title={"menu.asnOrderItem"} | 
|---|
|  |  |  | empty={ | 
|---|
|  |  |  | <EmptyData | 
|---|
|  |  |  | onClick={() => { | 
|---|
|  |  |  | setCreateDialog(true); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | } | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | actions={ | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <Button onClick={creatCode} label={"toolbar.creatcode"}> | 
|---|
|  |  |  | <QrCodeIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton | 
|---|
|  |  |  | onClick={() => { | 
|---|
|  |  |  | setCreateDialog(true); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey="asnOrderItem" /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | } | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey="asnOrderItem" | 
|---|
|  |  |  | bulkActionButtons={() => ( | 
|---|
|  |  |  | <BulkDeleteButton mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | {asnId && <CustomerTopToolBar backPrevious={true} />} | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | theme.transitions.create(['all'], { | 
|---|
|  |  |  | duration: theme.transitions.duration.enteringScreen, | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | title={"menu.asnOrderItem"} | 
|---|
|  |  |  | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} | 
|---|
|  |  |  | filters={filters} | 
|---|
|  |  |  | sort={{ field: "create_time", order: "desc" }} | 
|---|
|  |  |  | actions={( | 
|---|
|  |  |  | <TopToolbar> | 
|---|
|  |  |  | <Button onClick={creatCode} label={"toolbar.creatcode"}> | 
|---|
|  |  |  | <QrCodeIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='asnOrderItem' /> | 
|---|
|  |  |  | <ImportButton value={'asnOrder'} parmas={{ asnId: asnId }} /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={() => <AsnOrderItemPanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={["id", "createTime", "createBy", "memo"]} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <NumberField source="asnId" label="table.field.asnOrderItem.asnId" /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="asnCode" | 
|---|
|  |  |  | label="table.field.asnOrderItem.asnCode" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="poDetlId" | 
|---|
|  |  |  | label="table.field.asnOrderItem.poDetlId" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="poDetlCode" | 
|---|
|  |  |  | label="table.field.asnOrderItem.poDetlCode" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="matnrId" | 
|---|
|  |  |  | label="table.field.asnOrderItem.matnrId" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField source="matnk" label="table.field.asnOrderItem.matnk" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.asnOrderItem.anfme" /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="stockUnit" | 
|---|
|  |  |  | label="table.field.asnOrderItem.stockUnit" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <NumberField | 
|---|
|  |  |  | source="purQty" | 
|---|
|  |  |  | label="table.field.asnOrderItem.purQty" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="purUnit" | 
|---|
|  |  |  | label="table.field.asnOrderItem.purUnit" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.asnOrderItem.qty" /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="splrCode" | 
|---|
|  |  |  | label="table.field.asnOrderItem.splrCode" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="splrName" | 
|---|
|  |  |  | label="table.field.asnOrderItem.splrName" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField source="qrcode" label="table.field.asnOrderItem.qrcode" /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="barcode" | 
|---|
|  |  |  | label="table.field.asnOrderItem.barcode" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | source="packName" | 
|---|
|  |  |  | label="table.field.asnOrderItem.packName" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='asnOrderItem' | 
|---|
|  |  |  | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={() => <AsnOrderItemPanel />} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <NumberField source="asnId" label="table.field.asnOrderItem.asnId" /> | 
|---|
|  |  |  | <TextField source="asnCode" label="table.field.asnOrderItem.asnCode" /> | 
|---|
|  |  |  | <TextField source="poDetlId" label="table.field.asnOrderItem.poDetlId" /> | 
|---|
|  |  |  | <TextField source="poDetlCode" label="table.field.asnOrderItem.poDetlCode" /> | 
|---|
|  |  |  | <TextField source="matnrId" label="table.field.asnOrderItem.matnrId" /> | 
|---|
|  |  |  | <TextField source="maktx" label="table.field.asnOrderItem.maktx" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.asnOrderItem.anfme" /> | 
|---|
|  |  |  | <TextField source="stockUnit" label="table.field.asnOrderItem.stockUnit" /> | 
|---|
|  |  |  | <NumberField source="purQty" label="table.field.asnOrderItem.purQty" /> | 
|---|
|  |  |  | <TextField source="purUnit" label="table.field.asnOrderItem.purUnit" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.asnOrderItem.qty" /> | 
|---|
|  |  |  | <TextField source="splrCode" label="table.field.asnOrderItem.splrCode" /> | 
|---|
|  |  |  | <TextField source="splrName" label="table.field.asnOrderItem.splrName" /> | 
|---|
|  |  |  | <TextField source="qrcode" label="table.field.asnOrderItem.qrcode" /> | 
|---|
|  |  |  | <TextField source="barcode" label="table.field.asnOrderItem.barcode" /> | 
|---|
|  |  |  | <TextField source="packName" label="table.field.asnOrderItem.packName" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <ReferenceField | 
|---|
|  |  |  | source="updateBy" | 
|---|
|  |  |  | label="common.field.updateBy" | 
|---|
|  |  |  | reference="user" | 
|---|
|  |  |  | link={false} | 
|---|
|  |  |  | sortable={false} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <DateField | 
|---|
|  |  |  | source="updateTime" | 
|---|
|  |  |  | label="common.field.updateTime" | 
|---|
|  |  |  | showTime | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ReferenceField | 
|---|
|  |  |  | source="createBy" | 
|---|
|  |  |  | label="common.field.createBy" | 
|---|
|  |  |  | reference="user" | 
|---|
|  |  |  | link={false} | 
|---|
|  |  |  | sortable={false} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | <EditButton sx={{ padding: "1px", fontSize: ".75rem" }} /> | 
|---|
|  |  |  | <DeleteButton | 
|---|
|  |  |  | sx={{ padding: "1px", fontSize: ".75rem" }} | 
|---|
|  |  |  | mutationMode={OPERATE_MODE} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <AsnOrderItemCreate open={createDialog} setOpen={setCreateDialog} /> | 
|---|
|  |  |  | <PageDrawer | 
|---|
|  |  |  | title="AsnOrderItem Detail" | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | ></PageDrawer> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <DateField source="updateTime" label="common.field.updateTime" showTime /> | 
|---|
|  |  |  | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> | 
|---|
|  |  |  | <TextField source="nickname" /> | 
|---|
|  |  |  | </ReferenceField> | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
|---|
|  |  |  | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <AsnOrderItemCreate | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | row={{ asnId }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <PageDrawer | 
|---|
|  |  |  | title='AsnOrderItem Detail' | 
|---|
|  |  |  | drawerVal={drawerVal} | 
|---|
|  |  |  | setDrawerVal={setDrawerVal} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </PageDrawer> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | AsnOrderItemList.Context = React.createContext() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default AsnOrderItemList; | 
|---|