| | |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Toolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | |
| | | Button, |
| | | useRedirect, |
| | | useUnselectAll, |
| | | useRecordSelection, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import AsnOrderModal from "./AsnOrderModal"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import BillStatusField from '../../components/BillStatusField'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | 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 CancelIcon from '@mui/icons-material/Cancel'; |
| | | import OutOrderCreate from "./OutOrderCreate"; |
| | | 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 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': { |
| | | height: '.9em' |
| | |
| | | <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_business_type' }} label="table.field.outStock.type" alwaysOn> |
| | | <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" /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_business_type' }} label="table.field.outStock.wkType" alwaysOn> |
| | | <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>, |
| | | <NumberInput source="anfme" label="table.field.outStock.anfme" />, |
| | |
| | | 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 |
| | | resource="outStock" |
| | | storeKey='outStock' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.outStock"} |
| | | empty={false} |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true) }} /> |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> |
| | | <SelectColumnsButton preferenceKey='outStock' /> |
| | | <ImportButton value={'asnOrderItem'} /> |
| | | <MyExportButton /> |
| | | <ImportButton value={'outStockItem'} /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | |
| | | <StyledDatagrid |
| | | sx={{ width: '100%' }} |
| | | preferenceKey='outStock' |
| | | bulkActionButtons={ |
| | | <> |
| | | <MyExportButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} |
| | | /> |
| | | </>} |
| | | bulkActionButtons={<PublicTaskButton setWaveRule={setWaveRule} setSelectIds={setSelectIds} />} |
| | | rowClick={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']} |
| | | omit={['id', 'createTime', 'createBy$', 'memo', 'rleStatus$']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.outStock.code" /> |
| | | <TextField source="poCode" label="table.field.outStock.poCode" /> |
| | | <NumberField source="poId" label="table.field.outStock.poId" /> |
| | | <TextField source="type$" label="table.field.outStock.type" /> |
| | | <TextField cellClassName="wkType" source="wkType$" label="table.field.outStock.wkType" /> |
| | | <NumberField source="anfme" label="table.field.outStock.anfme" /> |
| | | <NumberField source="workQty" label="table.field.outStock.workQty" /> |
| | | <NumberField source="qty" label="table.field.outStock.qty" /> |
| | | <TextField source="logisNo" label="table.field.outStock.logisNo" /> |
| | | <TextField source="rleStatus$" label="table.field.outStock.rleStatus" sortable={false} /> |
| | |
| | | <BillStatusField cellClassName="status" source="exceStatus" label="table.field.outStock.exceStatus" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt" > |
| | | <MyButton setCreateDialog={setManualDialog} setmodalType={setmodalType} /> |
| | | <EditButton label="toolbar.detail" icon={(<DetailsIcon />)}></EditButton> |
| | | <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} /> |
| | | <CancelButton></CancelButton> |
| | | <CancelButton /> |
| | | <PublicButton setDrawerVal={setDrawerVal} drawerVal={drawerVal} setSelect={setSelect} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <OutOrderCreate open={manualDialog} setOpen={setManualDialog} /> |
| | | <AsnOrderModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | {/* <OutOrderCreate |
| | | open={manualDialog} |
| | | setOpen={setManualDialog} |
| | | /> */} |
| | | <SelectMatnrModal |
| | | asnId={modalType} |
| | | billReload={billReload} |
| | | open={manualDialog} |
| | | setOpen={setManualDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='AsnOrder Detail' |
| | | <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} |
| | | > |
| | | </PageDrawer> |
| | | <OutStockPublic record={select} open={drawerVal} setOpen={setDrawerVal} /> |
| | | </PageEditDrawer> |
| | | </Box > |
| | | ) |
| | | } |
| | | export default OutOrderList; |
| | | |
| | | |
| | | const PublicTaskButton = ({ setWaveRule, setSelectIds }) => { |
| | | const record = useRecordContext(); |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | | const notify = useNotify(); |
| | | const redirect = useRedirect(); |
| | | |
| | | const pubClick = async () => { |
| | | onUnselectItems(); |
| | | setWaveRule(true); |
| | | setSelectIds(selectedIds) |
| | | } |
| | | |
| | | return ( |
| | | <Button |
| | | onClick={pubClick} |
| | | label={"toolbar.createWave"} |
| | | startIcon={<PublicIcon />} |
| | | /> |
| | | ); |
| | | } |
| | | |
| | | const MyButton = ({ setCreateDialog, setmodalType }) => { |
| | | const record = useRecordContext(); |
| | |
| | | const id = record.id; |
| | | setmodalType(id); |
| | | setCreateDialog(true); |
| | | |
| | | }; |
| | | return ( |
| | | <Button |
| | |
| | | ) |
| | | } |
| | | |
| | | 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(); |
| | | console.log(record); |
| | | |
| | | const cancelOrder = async () => { |
| | | console.log(event); |
| | | const { data: { code, data, msg } } = await request.get(`/outStock/cancel/${record?.id}`); |
| | | if (code === 200) { |
| | | notify(msg); |
| | |
| | | } |
| | | |
| | | return ( |
| | | <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelIcon />} onConfirm={cancelOrder} /> |
| | | record?.exceStatus == 10 ? <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"} /> : <></> |
| | | ) |
| | | } |