From e3687b1f791370f5b35f11d91e2b41c11e491aac Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 14 九月 2024 10:48:27 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/loc/LocList.jsx | 192 ++++++++++++ zy-acs-flow/src/i18n/en.js | 18 + zy-acs-flow/src/page/loc/LocPanel.jsx | 135 ++++++++ zy-acs-flow/src/page/loc/index.jsx | 18 + zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java | 4 zy-acs-flow/src/page/ResourceContent.js | 3 zy-acs-flow/src/page/loc/LocEdit.jsx | 204 ++++++++++++ zy-acs-flow/src/page/loc/LocCreate.jsx | 228 ++++++++++++++ zy-acs-flow/src/i18n/zh.js | 18 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java | 111 ++++++ 10 files changed, 927 insertions(+), 4 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index db0e246..25e20cb 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -101,6 +101,7 @@ funcSta: 'Function Station', locSts: 'Location Status', locType: 'Location Type', + loc: 'Location', }, table: { field: { @@ -269,7 +270,22 @@ uuid: "uuid", name: "name", }, - + loc: { + uuid: "uuid", + zoneId: "zone", + locNo: "loc no", + name: "name", + code: "code", + compDirect: "code direct", + locSts: "loc sts", + offset: "offset", + row: "row", + bay: "bay", + lev: "lev", + barcode: "barcode", + zpallet: "zpallet", + locType: "loc type", + }, } } }; diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index 7b7bc44..2873adb 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -101,6 +101,7 @@ funcSta: '鍔熻兘鍖鸿缃�', locSts: '搴撲綅鐘舵��', locType: '搴撲綅绫诲瀷', + loc: '搴撲綅绠$悊', }, table: { field: { @@ -268,7 +269,22 @@ uuid: "缂栧彿", name: "鍚嶇О", }, - + loc: { + uuid: "缂栧彿", + zoneId: "搴撳尯", + locNo: "搴撲綅鍙�", + name: "鍚嶇О", + code: "鍦伴潰鐮�", + compDirect: "鐮佹柟鍚�", + locSts: "搴撲綅鐘舵��", + offset: "鍋忕Щ閲�", + row: "鎺�", + bay: "鍒�", + lev: "灞�", + barcode: "搴撲綅鐮�", + zpallet: "鏂欑鐮�", + locType: "搴撲綅绫诲瀷", + }, } } }; diff --git a/zy-acs-flow/src/page/ResourceContent.js b/zy-acs-flow/src/page/ResourceContent.js index c251ab3..9ec88d9 100644 --- a/zy-acs-flow/src/page/ResourceContent.js +++ b/zy-acs-flow/src/page/ResourceContent.js @@ -23,6 +23,7 @@ import funcSta from './funcSta'; import locSts from './locSts'; import locType from './locType'; +import loc from './loc'; const ResourceContent = (node) => { @@ -65,6 +66,8 @@ return locSts; case 'locType': return locType; + case 'loc': + return loc; default: return { list: ListGuesser, diff --git a/zy-acs-flow/src/page/loc/LocCreate.jsx b/zy-acs-flow/src/page/loc/LocCreate.jsx new file mode 100644 index 0000000..89ab5a5 --- /dev/null +++ b/zy-acs-flow/src/page/loc/LocCreate.jsx @@ -0,0 +1,228 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + CreateBase, + useTranslate, + TextInput, + NumberInput, + BooleanInput, + DateInput, + SaveButton, + SelectInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + Toolbar, + required, + useDataProvider, + useNotify, + Form, + useCreateController, +} from 'react-admin'; +import { + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Stack, + Grid, + Box, +} from '@mui/material'; +import DialogCloseButton from "../components/DialogCloseButton"; +import StatusSelectInput from "../components/StatusSelectInput"; +import MemoInput from "../components/MemoInput"; + +const LocCreate = (props) => { + const { open, setOpen } = props; + + const translate = useTranslate(); + const notify = useNotify(); + + const handleClose = (event, reason) => { + if (reason !== "backdropClick") { + setOpen(false); + } + }; + + const handleSuccess = async (data) => { + setOpen(false); + notify('common.response.success'); + }; + + const handleError = async (data) => { + notify('common.response.fail'); + }; + + return ( + <> + <CreateBase + record={{}} + transform={(data) => { + return data; + }} + mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} + > + <Dialog + open={open} + onClose={handleClose} + aria-labelledby="form-dialog-title" + fullWidth + disableRestoreFocus + maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' + > + <Form> + <DialogTitle id="form-dialog-title" sx={{ + position: 'sticky', + top: 0, + backgroundColor: 'background.paper', + zIndex: 1000 + }} + > + {translate('create.title')} + <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> + <DialogCloseButton onClose={handleClose} /> + </Box> + </DialogTitle> + <DialogContent> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.loc.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="zoneId" + reference="zone" + > + <AutocompleteInput + label="table.field.loc.zoneId" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.loc.locNo" + source="locNo" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.loc.name" + source="name" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="code" + reference="code" + > + <AutocompleteInput + label="table.field.loc.code" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <SelectInput + label="table.field.loc.compDirect" + source="compDirect" + choices={[ + { id: 1, name: '澶т簬' }, + { id: 0, name: '灏忎簬' }, + ]} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="locSts" + reference="locSts" + > + <AutocompleteInput + label="table.field.loc.locSts" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.loc.offset" + source="offset" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.loc.row" + source="row" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.loc.bay" + source="bay" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.loc.lev" + source="lev" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.loc.barcode" + source="barcode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.loc.zpallet" + source="zpallet" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="locType" + reference="locType" + > + <AutocompleteInput + label="table.field.loc.locType" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Grid> + + <Grid item xs={6} display="flex" gap={1}> + <StatusSelectInput /> + </Grid> + <Grid item xs={12} display="flex" gap={1}> + <Stack direction="column" spacing={1} width={'100%'}> + <MemoInput /> + </Stack> + </Grid> + </Grid> + </DialogContent> + <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> + <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > + <SaveButton /> + </Toolbar> + </DialogActions> + </Form> + </Dialog> + </CreateBase> + </> + ) +} + +export default LocCreate; diff --git a/zy-acs-flow/src/page/loc/LocEdit.jsx b/zy-acs-flow/src/page/loc/LocEdit.jsx new file mode 100644 index 0000000..744c494 --- /dev/null +++ b/zy-acs-flow/src/page/loc/LocEdit.jsx @@ -0,0 +1,204 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + Edit, + SimpleForm, + FormDataConsumer, + useTranslate, + TextInput, + NumberInput, + BooleanInput, + DateInput, + SelectInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + SaveButton, + Toolbar, + Labeled, + NumberField, + required, + useRecordContext, + DeleteButton, +} from 'react-admin'; +import { useWatch, useFormContext } from "react-hook-form"; +import { Stack, Grid, Box, Typography } from '@mui/material'; +import * as Common from '@/utils/common'; +import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; +import EditBaseAside from "../components/EditBaseAside"; +import CustomerTopToolBar from "../components/EditTopToolBar"; +import MemoInput from "../components/MemoInput"; +import StatusSelectInput from "../components/StatusSelectInput"; + +const FormToolbar = () => { + const { getValues } = useFormContext(); + + return ( + <Toolbar sx={{ justifyContent: 'space-between' }}> + <SaveButton /> + <DeleteButton mutationMode="optimistic" /> + </Toolbar> + ) +} + +const LocEdit = () => { + const translate = useTranslate(); + + return ( + <Edit + redirect="list" + mutationMode={EDIT_MODE} + actions={<CustomerTopToolBar />} + aside={<EditBaseAside />} + > + <SimpleForm + shouldUnregister + warnWhenUnsavedChanges + toolbar={<FormToolbar />} + mode="onTouched" + defaultValues={{}} + // validate={(values) => { }} + > + <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> + <Grid item xs={12} md={8}> + <Typography variant="h6" gutterBottom> + {translate('common.edit.title.main')} + </Typography> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.loc.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="zoneId" + reference="zone" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.loc.zoneId" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.loc.locNo" + source="locNo" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.loc.name" + source="name" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="code" + reference="code" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.loc.code" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <SelectInput + label="table.field.loc.compDirect" + source="compDirect" + choices={[ + { id: 1, name: '澶т簬' }, + { id: 0, name: '灏忎簬' }, + ]} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="locSts" + reference="locSts" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.loc.locSts" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.loc.offset" + source="offset" + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.loc.row" + source="row" + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.loc.bay" + source="bay" + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.loc.lev" + source="lev" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.loc.barcode" + source="barcode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.loc.zpallet" + source="zpallet" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="locType" + reference="locType" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.loc.locType" + optionText="name" + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Stack> + + </Grid> + <Grid item xs={12} md={4}> + <Typography variant="h6" gutterBottom> + {translate('common.edit.title.common')} + </Typography> + <StatusSelectInput /> + <Box mt="2em" /> + <MemoInput /> + </Grid> + </Grid> + </SimpleForm> + </Edit > + ) +} + +export default LocEdit; diff --git a/zy-acs-flow/src/page/loc/LocList.jsx b/zy-acs-flow/src/page/loc/LocList.jsx new file mode 100644 index 0000000..4a4e0e7 --- /dev/null +++ b/zy-acs-flow/src/page/loc/LocList.jsx @@ -0,0 +1,192 @@ +import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; +import { useNavigate } from 'react-router-dom'; +import { + List, + DatagridConfigurable, + SearchInput, + TopToolbar, + SelectColumnsButton, + EditButton, + FilterButton, + CreateButton, + ExportButton, + BulkDeleteButton, + WrapperField, + useRecordContext, + useTranslate, + useListContext, + useCreatePath, + TextField, + NumberField, + DateField, + BooleanField, + ReferenceField, + TextInput, + DateTimeInput, + DateInput, + SelectInput, + NumberInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + DeleteButton, +} from 'react-admin'; +import { Box, Typography, Card, Stack } from '@mui/material'; +import { styled } from '@mui/material/styles'; +import LocCreate from "./LocCreate"; +import LocPanel from "./LocPanel"; +import EmptyData from "../components/EmptyData"; +import MyCreateButton from "../components/MyCreateButton"; +import MyExportButton from '../components/MyExportButton'; +import PageDrawer from "../components/PageDrawer"; +import MyField from "../components/MyField"; +import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; +import * as Common from '@/utils/common'; + +const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ + '& .css-1vooibu-MuiSvgIcon-root': { + height: '.9em' + }, + '& .RaDatagrid-row': { + cursor: 'auto' + }, + '& .column-name': { + }, + '& .opt': { + width: 200 + }, +})); + +const filters = [ + <SearchInput source="condition" alwaysOn />, + <DateInput label='common.time.after' source="timeStart" alwaysOn />, + <DateInput label='common.time.before' source="timeEnd" alwaysOn />, + + <TextInput source="uuid" label="table.field.loc.uuid" />, + <ReferenceInput source="zoneId" label="table.field.loc.zoneId" reference="zone"> + <AutocompleteInput label="table.field.loc.zoneId" optionText="name" filterToQuery={(val) => ({ name: val })} /> + </ReferenceInput>, + <TextInput source="locNo" label="table.field.loc.locNo" alwaysOn />, + <TextInput source="name" label="table.field.loc.name" />, + <ReferenceInput source="code" label="table.field.loc.code" reference="code" alwaysOn> + <AutocompleteInput label="table.field.loc.code" optionText="data" filterToQuery={(val) => ({ data: val })} /> + </ReferenceInput>, + <ReferenceInput source="locSts" label="table.field.loc.locSts" reference="locSts" alwaysOn> + <AutocompleteInput label="table.field.loc.locSts" optionText="name" filterToQuery={(val) => ({ name: val })} /> + </ReferenceInput>, + <NumberInput source="offset" label="table.field.loc.offset" />, + <NumberInput source="row" label="table.field.loc.row" alwaysOn />, + <NumberInput source="bay" label="table.field.loc.bay" alwaysOn />, + <NumberInput source="lev" label="table.field.loc.lev" alwaysOn />, + <TextInput source="barcode" label="table.field.loc.barcode" />, + <TextInput source="zpallet" label="table.field.loc.zpallet" />, + <ReferenceInput source="locType" label="table.field.loc.locType" reference="locType"> + <AutocompleteInput label="table.field.loc.locType" optionText="name" filterToQuery={(val) => ({ name: val })} /> + </ReferenceInput>, + + <TextInput label="common.field.memo" source="memo" />, + <SelectInput + label="common.field.status" + source="status" + choices={[ + { id: '1', name: 'common.enums.statusTrue' }, + { id: '0', name: 'common.enums.statusFalse' }, + ]} + />, +] + +const LocList = () => { + const translate = useTranslate(); + + const [createDialog, setCreateDialog] = useState(false); + const [drawerVal, setDrawerVal] = useState(false); + + 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.loc"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='loc' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='loc' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <LocPanel />} + expandSingle={true} + omit={['id', 'locType', 'uuid', 'updateBy', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="locNo" label="table.field.loc.locNo" /> + <TextField source="uuid" label="table.field.loc.uuid" /> + <ReferenceField source="zoneId" label="table.field.loc.zoneId" reference="zone" link={false} sortable={false}> + <TextField source="name" /> + </ReferenceField> + + {/* <TextField source="name" label="table.field.loc.name" /> */} + <ReferenceField source="code" label="table.field.loc.code" reference="code" link={false} sortable={false}> + <TextField source="data" /> + </ReferenceField> + {/* <TextField source="compDirect$" label="table.field.loc.compDirect" sortable={false} /> */} + <ReferenceField source="locSts" label="table.field.loc.locSts" reference="locSts" link={false} sortable={false}> + <TextField source="name" /> + </ReferenceField> + <NumberField source="row" label="table.field.loc.row" /> + <NumberField source="bay" label="table.field.loc.bay" /> + <NumberField source="lev" label="table.field.loc.lev" /> + <NumberField source="offset" label="table.field.loc.offset" /> + <TextField source="barcode" label="table.field.loc.barcode" /> + <TextField source="zpallet" label="table.field.loc.zpallet" /> + <ReferenceField source="locType" label="table.field.loc.locType" reference="locType" link={false} sortable={false}> + <TextField source="name" /> + </ReferenceField> + + <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> + <LocCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='Loc Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default LocList; diff --git a/zy-acs-flow/src/page/loc/LocPanel.jsx b/zy-acs-flow/src/page/loc/LocPanel.jsx new file mode 100644 index 0000000..d8a73b8 --- /dev/null +++ b/zy-acs-flow/src/page/loc/LocPanel.jsx @@ -0,0 +1,135 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; +import { + useTranslate, + useRecordContext, +} from 'react-admin'; +import PanelTypography from "../components/PanelTypography"; +import * as Common from '@/utils/common' + +const LocPanel = () => { + const record = useRecordContext(); + if (!record) return null; + const translate = useTranslate(); + return ( + <> + <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> + <CardContent> + <Grid container spacing={2}> + <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> + <Typography variant="h6" gutterBottom align="left" sx={{ + maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }}> + {Common.camelToPascalWithSpaces(translate('table.field.loc.locNo'))}: {record.locNo} + </Typography> + {/* inherit, primary, secondary, textPrimary, textSecondary, error */} + <Typography variant="h6" gutterBottom align="right" > + ID: {record.id} + </Typography> + </Grid> + </Grid> + <Grid container spacing={2}> + <Grid item xs={12} container alignContent="flex-end"> + <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> + {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} + </Typography> + </Grid> + </Grid> + <Box height={20}> </Box> + <Grid container spacing={2}> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.zoneId" + property={record.zoneId$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.locNo" + property={record.locNo} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.name" + property={record.name} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.code" + property={record.code$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.compDirect" + property={record.compDirect$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.locSts" + property={record.locSts$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.offset" + property={record.offset} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.row" + property={record.row} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.bay" + property={record.bay} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.lev" + property={record.lev} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.barcode" + property={record.barcode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.zpallet" + property={record.zpallet} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.loc.locType" + property={record.locType$} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default LocPanel; diff --git a/zy-acs-flow/src/page/loc/index.jsx b/zy-acs-flow/src/page/loc/index.jsx new file mode 100644 index 0000000..aa349b6 --- /dev/null +++ b/zy-acs-flow/src/page/loc/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import LocList from "./LocList"; +import LocEdit from "./LocEdit"; + +export default { + list: LocList, + edit: LocEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.locNo}` + } +}; diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java index a1e43dc..43bf58b 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java @@ -22,8 +22,8 @@ // generator.username="sa"; // generator.password="Zoneyung@zy56$"; - generator.table="man_loc_type"; - generator.tableDesc="LocType"; + generator.table="man_loc"; + generator.tableDesc="Loc"; generator.packagePath="com.zy.acs.manager.manager"; generator.build(); diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java new file mode 100644 index 0000000..fe87973 --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java @@ -0,0 +1,111 @@ +package com.zy.acs.manager.manager.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zy.acs.framework.common.Cools; +import com.zy.acs.framework.common.R; +import com.zy.acs.manager.common.utils.ExcelUtil; +import com.zy.acs.manager.common.annotation.OperationLog; +import com.zy.acs.manager.common.domain.BaseParam; +import com.zy.acs.manager.common.domain.KeyValVo; +import com.zy.acs.manager.common.domain.PageParam; +import com.zy.acs.manager.manager.entity.Loc; +import com.zy.acs.manager.manager.service.LocService; +import com.zy.acs.manager.system.controller.BaseController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@RestController +@RequestMapping("/api") +public class LocController extends BaseController { + + @Autowired + private LocService locService; + + @PreAuthorize("hasAuthority('manager:loc:list')") + @PostMapping("/loc/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class); + return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:loc:list')") + @PostMapping("/loc/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(locService.list()); + } + + @PreAuthorize("hasAuthority('manager:loc:list')") + @PostMapping({"/loc/many/{ids}", "/locs/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(locService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:loc:list')") + @GetMapping("/loc/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(locService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:loc:save')") + @OperationLog("Create Loc") + @PostMapping("/loc/save") + public R save(@RequestBody Loc loc) { + loc.setCreateBy(getLoginUserId()); + loc.setCreateTime(new Date()); + loc.setUpdateBy(getLoginUserId()); + loc.setUpdateTime(new Date()); + if (!locService.save(loc)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(loc); + } + + @PreAuthorize("hasAuthority('manager:loc:update')") + @OperationLog("Update Loc") + @PostMapping("/loc/update") + public R update(@RequestBody Loc loc) { + loc.setUpdateBy(getLoginUserId()); + loc.setUpdateTime(new Date()); + if (!locService.updateById(loc)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(loc); + } + + @PreAuthorize("hasAuthority('manager:loc:remove')") + @OperationLog("Delete Loc") + @PostMapping("/loc/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!locService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:loc:list')") + @PostMapping("/loc/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(Loc::getLocNo, condition); + } + locService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getLocNo())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('manager:loc:list')") + @PostMapping("/loc/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(locService.list(), Loc.class), response); + } + +} -- Gitblit v1.9.1