From 843d5b6dd50567dadcc56257f074840e80d757aa Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 20 五月 2025 18:42:18 +0800 Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop --- rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/BasContainerMapper.java | 12 rsf-admin/src/page/basicInfo/basContainer/BasContainerCreate.jsx | 139 ++++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java | 45 + rsf-server/src/main/resources/mapper/manager/BasContainerMapper.xml | 5 rsf-admin/src/page/basicInfo/basContainer/BasContainerPanel.jsx | 69 +++ rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java | 6 rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasContainer.java | 202 +++++++++ rsf-admin/src/page/components/DictionaryArraySelect.jsx | 68 +++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/BasContainerService.java | 8 rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx | 5 rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx | 8 rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx | 161 +++++++ rsf-admin/src/page/basicInfo/basContainer/index.jsx | 18 rsf-server/src/main/java/basContainer.sql | 24 + rsf-admin/src/page/basicInfo/basContainer/BasContainerEdit.jsx | 111 +++++ rsf-admin/src/i18n/zh.js | 9 rsf-admin/src/page/basicInfo/basStation/ContainerTypesField.jsx | 118 +++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasContainerController.java | 142 ++++++ rsf-admin/src/i18n/en.js | 23 + rsf-admin/src/page/ResourceContent.js | 3 rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx | 5 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java | 42 + rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/BasContainerServiceImpl.java | 12 23 files changed, 1,201 insertions(+), 34 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index a286aa8..858bcf1 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -202,10 +202,31 @@ deviceBind: 'Device Bind', tasks: 'Tasks', wave: 'Wave Manage', - + basStation: 'BasStation', + basContainer: 'BasContainer', }, table: { field: { + basContainer: { + containerType:'containerType', + codeType: 'codeType', + areas: 'areas', + }, + basStation: { + stationName: 'stationName', + inAble: 'inAble', + outAble: 'outAble', + useStatus: 'useStatus', + status: 'status', + area: 'area', + isCrossZone: 'isCrossZone', + crossZoneArea: 'crossZoneArea', + isWcs: 'isWcs', + wcsData: 'wcsData', + containerType: 'containerType', + barcode: 'barcode', + autoTransfer: 'autoTransfer', + }, host: { }, diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index a4e2cf6..e71dd67 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -1,3 +1,4 @@ +import basContainer from "../page/basicInfo/basContainer"; import chineseMessages from "./core/chineseMessages"; const customChineseMessages = { @@ -204,10 +205,16 @@ deviceBind: '璁惧缁戝畾', tasks: '浠诲姟绠$悊', wave: '娉㈡绠$悊', - basStation: '绔欑偣淇℃伅' + basStation: '绔欑偣淇℃伅', + basContainer: '瀹瑰櫒绠$悊', }, table: { field: { + basContainer: { + containerType:'瀹瑰櫒绫诲瀷', + codeType: '鏉$爜绫诲瀷', + areas: '鍙叆搴撳尯', + }, basStation: { stationName: '绔欑偣鍚嶇О', inAble: '鑳藉叆', diff --git a/rsf-admin/src/page/ResourceContent.js b/rsf-admin/src/page/ResourceContent.js index 1a87dd5..3f3cbb4 100644 --- a/rsf-admin/src/page/ResourceContent.js +++ b/rsf-admin/src/page/ResourceContent.js @@ -48,6 +48,7 @@ import locItem from './locItem' import basStation from './basicInfo/basStation'; import warehouseStock from './statistics/stockManage'; +import basContainer from './basicInfo/basContainer'; const ResourceContent = (node) => { switch (node.component) { @@ -139,6 +140,8 @@ return locItem; case 'basStation': return basStation; + case 'basContainer': + return basContainer; default: return { list: ListGuesser, diff --git a/rsf-admin/src/page/basicInfo/basContainer/BasContainerCreate.jsx b/rsf-admin/src/page/basicInfo/basContainer/BasContainerCreate.jsx new file mode 100644 index 0000000..5132283 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basContainer/BasContainerCreate.jsx @@ -0,0 +1,139 @@ +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, + SelectArrayInput, +} 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"; +import DictionarySelect from "../../components/DictionarySelect"; + +const BasContainerCreate = (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 (error) => { + notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); + }; + + 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 sx={{ mt: 2 }}> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <DictionarySelect + label={translate("table.field.basStation.containerType")} + name="containerType" + size="small" + validate={[required()]} + dictTypeCode="sys_container_type" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.basContainer.codeType" + source="codeType" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceArrayInput source="areaIds" reference="warehouseAreas"> + <SelectArrayInput + label="table.field.basStation.crossZoneArea" + optionText="name" + optionValue="id" + fullWidth + validate={[required()]} + /> + </ReferenceArrayInput> + </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 BasContainerCreate; diff --git a/rsf-admin/src/page/basicInfo/basContainer/BasContainerEdit.jsx b/rsf-admin/src/page/basicInfo/basContainer/BasContainerEdit.jsx new file mode 100644 index 0000000..4621bc4 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basContainer/BasContainerEdit.jsx @@ -0,0 +1,111 @@ +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, + SelectArrayInput, +} 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"; +import DictionarySelect from "../../components/DictionarySelect"; + +const FormToolbar = () => { + const { getValues } = useFormContext(); + + return ( + <Toolbar sx={{ justifyContent: 'space-between' }}> + <SaveButton /> + <DeleteButton mutationMode="optimistic" /> + </Toolbar> + ) +} + +const BasContainerEdit = () => { + 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}> + <DictionarySelect + label={translate("table.field.basStation.containerType")} + name="containerType" + size="small" + validate={[required()]} + dictTypeCode="sys_container_type" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.basContainer.codeType" + source="codeType" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceArrayInput source="areaIds" reference="warehouseAreas"> + <SelectArrayInput + label="table.field.basContainer.areas" + optionText="name" + optionValue="id" + fullWidth + validate={[required()]} + /> + </ReferenceArrayInput> + </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 BasContainerEdit; diff --git a/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx b/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx new file mode 100644 index 0000000..a48033f --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx @@ -0,0 +1,161 @@ +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, + useNotify, + useListContext, + FunctionField, + 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 BasContainerCreate from "./BasContainerCreate"; +import BasContainerPanel from "./BasContainerPanel"; +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, DEFAULT_PAGE_SIZE } from '@/config/setting'; +import * as Common from '@/utils/common'; +import CrossZoneAreaField from "../basStation/CrossZoneAreaField"; + +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 />, + + <NumberInput source="containerType" label="table.field.basContainer.containerType" />, + <TextInput source="codeType" label="table.field.basContainer.codeType" />, + <TextInput source="areas" label="table.field.basContainer.areas" />, + + <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' }, + ]} + resettable + />, +] + +const BasContainerList = () => { + const translate = useTranslate(); + const [areaFieldDialog, setAreaFieldDialog] = useState(false); + 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.basContainer"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='basContainer' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='basContainer' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <NumberField source="containerType$" label="table.field.basContainer.containerType" /> + <TextField source="codeType" label="table.field.basContainer.codeType" /> + <WrapperField cellClassName="areas" label="table.field.basContainer.areas"> + <CrossZoneAreaField + open={areaFieldDialog} + setOpen={setAreaFieldDialog} + /> + </WrapperField> + + <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> + <BasContainerCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='BasContainer Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default BasContainerList; diff --git a/rsf-admin/src/page/basicInfo/basContainer/BasContainerPanel.jsx b/rsf-admin/src/page/basicInfo/basContainer/BasContainerPanel.jsx new file mode 100644 index 0000000..ee57ec9 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basContainer/BasContainerPanel.jsx @@ -0,0 +1,69 @@ +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 BasContainerPanel = () => { + 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.basContainer.id'))}: {record.id} + </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.basContainer.containerType" + property={record.containerType} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.basContainer.codeType" + property={record.codeType} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.basContainer.areas" + property={record.areas} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default BasContainerPanel; diff --git a/rsf-admin/src/page/basicInfo/basContainer/index.jsx b/rsf-admin/src/page/basicInfo/basContainer/index.jsx new file mode 100644 index 0000000..7fa0e9a --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basContainer/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import BasContainerList from "./BasContainerList"; +import BasContainerEdit from "./BasContainerEdit"; + +export default { + list: BasContainerList, + edit: BasContainerEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.id}` + } +}; diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx index b6d60a2..0993b27 100644 --- a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx +++ b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx @@ -32,6 +32,7 @@ import StatusSelectInput from "../../components/StatusSelectInput"; import MemoInput from "../../components/MemoInput"; import DictionarySelect from "../../components/DictionarySelect"; +import DictionaryArraySelect from "../../components/DictionaryArraySelect"; const BasStationCreate = (props) => { const { open, setOpen } = props; @@ -171,9 +172,9 @@ /> </Grid> <Grid item xs={6} display="flex" gap={1}> - <DictionarySelect + <DictionaryArraySelect label={translate("table.field.basStation.containerType")} - name="containerType" + name="containerTypes" size="small" validate={[required()]} dictTypeCode="sys_container_type" diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx index e5a3d4c..973ee19 100644 --- a/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx +++ b/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx @@ -30,6 +30,7 @@ import MemoInput from "../../components/MemoInput"; import StatusSelectInput from "../../components/StatusSelectInput"; import DictionarySelect from "../../components/DictionarySelect"; +import DictionaryArraySelect from "../../components/DictionaryArraySelect"; const FormToolbar = () => { const { getValues } = useFormContext(); @@ -146,9 +147,9 @@ /> </Stack> <Stack direction='row' gap={2}> - <DictionarySelect + <DictionaryArraySelect label={translate("table.field.basStation.containerType")} - name="containerType" + name="containerTypes" size="small" validate={[required()]} dictTypeCode="sys_container_type" diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx index f82f9c9..a4aa944 100644 --- a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx +++ b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx @@ -46,6 +46,7 @@ import * as Common from '@/utils/common'; import WarehouseAreaField from "./WarehouseAreaField"; import CrossZoneAreaField from "./CrossZoneAreaField"; +import ContainerTypesField from "./ContainerTypesField"; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -97,6 +98,7 @@ const [createDialog, setCreateDialog] = useState(false); const [drawerVal, setDrawerVal] = useState(false); const [areaFieldDialog, setAreaFieldDialog] = useState(false); + const [areaFieldDialog2, setAreaFieldDialog2] = useState(false); return ( <Box display="flex"> <List @@ -160,6 +162,12 @@ render={record => record.inAble === 1 ? '鏄�' : '鍚�'} /> <NumberField source="containerType$" label="table.field.basStation.containerType" /> + <WrapperField cellClassName="containerType" label="table.field.basStation.containerType"> + <ContainerTypesField + open={areaFieldDialog2} + setOpen={setAreaFieldDialog2} + /> + </WrapperField> <TextField source="barcode" label="table.field.basStation.barcode" /> <FunctionField source="autoTransfer" diff --git a/rsf-admin/src/page/basicInfo/basStation/ContainerTypesField.jsx b/rsf-admin/src/page/basicInfo/basStation/ContainerTypesField.jsx new file mode 100644 index 0000000..0a69c5a --- /dev/null +++ b/rsf-admin/src/page/basicInfo/basStation/ContainerTypesField.jsx @@ -0,0 +1,118 @@ +import * as React from 'react'; +import { Stack, Chip, Dialog, DialogTitle, DialogContent, IconButton, CircularProgress } from '@mui/material'; +import { useTranslate, useRecordContext } from 'react-admin'; +import CloseIcon from '@mui/icons-material/Close'; +import request from '@/utils/request'; + +const ContainerTypesField = () => { + const translate = useTranslate(); + const record = useRecordContext(); + const [open, setOpen] = React.useState(false); + const [areaNames, setAreaNames] = React.useState([]); + const [loading, setLoading] = React.useState(false); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; + + const fetchAreaNames = async () => { + if (!record?.containerTypes || record.containerTypes.length === 0) return; + + setLoading(true); + try { + const res = await request.post(`/dictData/many/${record.containerTypes$.join(',')}`); + if (res?.data?.code === 200) { + setAreaNames(res.data.data || []); + } + } catch (error) { + console.error('鑾峰彇鍖哄煙鍚嶇О澶辫触:', error); + } finally { + setLoading(false); + } + }; + + React.useEffect(() => { + if (record?.containerTypes && record.containerTypes.length > 0) { + fetchAreaNames(); + } + }, [record]); + + if (loading) { + return <CircularProgress size={20} />; + } + + return ( + <> + <Stack + direction="row" + gap={1} + flexWrap="wrap" + onClick={handleOpen} + sx={{ cursor: 'pointer' }} + > + {areaNames.slice(0, 1).map((item, idx) => ( + <Chip + size="small" + key={item.id} + label={item.label || item.id} + /> + ))} + {areaNames.length > 1 && ( + <Chip + size="small" + label={`+${areaNames.length - 1}`} + /> + )} + {areaNames.length === 0 && record.containerTypes && record.containerTypes.length > 0 && ( + <Chip + size="small" + label={`${record.containerTypes.length} 涓尯鍩焋} + /> + )} + </Stack> + + <Dialog + open={open} + onClose={handleClose} + maxWidth="md" + fullWidth + > + <DialogTitle> + {translate('table.field.basStation.crossZoneArea')} + <IconButton + aria-label="close" + onClick={handleClose} + sx={{ + position: 'absolute', + right: 8, + top: 8, + }} + > + <CloseIcon /> + </IconButton> + </DialogTitle> + <DialogContent> + {loading ? ( + <CircularProgress /> + ) : ( + <Stack direction="row" gap={1} flexWrap="wrap" sx={{ mt: 1 }}> + {areaNames.map((item) => ( + <Chip + size="small" + key={item.id} + label={item.label || item.id} + /> + ))} + </Stack> + )} + </DialogContent> + </Dialog> + </> + ); +}; + +export default ContainerTypesField; \ No newline at end of file diff --git a/rsf-admin/src/page/components/DictionaryArraySelect.jsx b/rsf-admin/src/page/components/DictionaryArraySelect.jsx new file mode 100644 index 0000000..f4f929c --- /dev/null +++ b/rsf-admin/src/page/components/DictionaryArraySelect.jsx @@ -0,0 +1,68 @@ +import EditIcon from '@mui/icons-material/Edit'; +import { useState, useEffect } from 'react'; +import { + Button, useListContext, SelectInput, + required, SelectArrayInput, + useTranslate, useNotify, + SelectArrayInputClasses +} from 'react-admin'; +import request from '@/utils/request'; + +const DictionarySelect = (props) => { + const { + dictTypeCode, + name, + multiple = false, + perPage = 100, // 榛樿姣忛〉鏄剧ず100鏉℃暟鎹� + page = 1, // 榛樿绗竴椤� + ...parmas + } = props; + const translate = useTranslate(); + const notify = useNotify(); + const [list, setList] = useState([]); + const [loading, setLoading] = useState(false); + + useEffect(() => { + http(); + }, [dictTypeCode, page, perPage]); + + const http = async () => { + setLoading(true); + try { + const res = await request.post('/dictData/page', { + dictTypeCode, + current: page, + pageSize: perPage + }); + + if (res?.data?.code === 200) { + setList(res.data.data.records.map((item) => { + return { + id: item.value, + name: item.label + } + })); + } else { + notify(res.data.msg); + } + } catch (error) { + notify('鍔犺浇瀛楀吀鏁版嵁澶辫触', 'error'); + console.error('鍔犺浇瀛楀吀鏁版嵁澶辫触:', error); + } finally { + setLoading(false); + } + }; + + const InputComponent = multiple ? SelectArrayInput : SelectInput; + + return ( + <SelectArrayInput + source={name} + choices={list} + isLoading={loading} + {...parmas} + /> + ); +}; + +export default DictionarySelect; \ No newline at end of file diff --git a/rsf-server/src/main/java/basContainer.sql b/rsf-server/src/main/java/basContainer.sql new file mode 100644 index 0000000..9c9ba12 --- /dev/null +++ b/rsf-server/src/main/java/basContainer.sql @@ -0,0 +1,24 @@ +-- save basContainer record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.basContainer', '0', '/manager/basContainer', 'basContainer', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 瀹瑰櫒绠$悊', '', '1', 'manager:basContainer:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 瀹瑰櫒绠$悊', '', '1', 'manager:basContainer:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 瀹瑰櫒绠$悊', '', '1', 'manager:basContainer:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 瀹瑰櫒绠$悊', '', '1', 'manager:basContainer:remove', '3', '1', '1'); + +-- locale menu name +basContainer: 'BasContainer', + +-- locale field +basContainer: { + containerType: "containerType", + codeType: "codeType", + areas: "areas", +}, + +-- ResourceContent +import basContainer from './basContainer'; + +case 'basContainer': + return basContainer; diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java index 92bec43..3036d17 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java @@ -15,15 +15,15 @@ generator.frontendPrefixPath = "rsf-admin/"; generator.sqlOsType = SqlOsType.MYSQL; - generator.url = "192.168.4.56:3306/rsf"; + generator.url = "192.168.4.50:3306/rsf"; generator.username = "root"; generator.password = "34821015"; // generator.url="47.97.1.152:51433;databasename=jkasrs"; // generator.username="sa"; // generator.password="Zoneyung@zy56$"; - generator.table = "man_qly_inspect_result"; - generator.tableDesc = "璐ㄦ缁撴灉"; + generator.table = "man_bas_container"; + generator.tableDesc = "瀹瑰櫒绠$悊"; generator.packagePath = "com.vincent.rsf.server.manager"; generator.build(); diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasContainerController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasContainerController.java new file mode 100644 index 0000000..e352697 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasContainerController.java @@ -0,0 +1,142 @@ +package com.vincent.rsf.server.manager.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.server.common.utils.ExcelUtil; +import com.vincent.rsf.server.common.annotation.OperationLog; +import com.vincent.rsf.server.common.domain.BaseParam; +import com.vincent.rsf.server.common.domain.KeyValVo; +import com.vincent.rsf.server.common.domain.PageParam; +import com.vincent.rsf.server.manager.entity.BasContainer; +import com.vincent.rsf.server.manager.entity.BasStation; +import com.vincent.rsf.server.manager.service.BasContainerService; +import com.vincent.rsf.server.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 +public class BasContainerController extends BaseController { + + @Autowired + private BasContainerService basContainerService; + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @PostMapping("/basContainer/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<BasContainer, BaseParam> pageParam = new PageParam<>(baseParam, BasContainer.class); + PageParam<BasContainer, BaseParam> page = basContainerService.page(pageParam, pageParam.buildWrapper(true)); + for (BasContainer container : page.getRecords()) { + if (!Cools.isEmpty(container.getAreas())) { + String content = container.getAreas().substring(1, container.getAreas().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + container.setAreaIds(longArray); + } + + } + return R.ok().add(page); + } + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @PostMapping("/basContainer/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(basContainerService.list()); + } + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @PostMapping({"/basContainer/many/{ids}", "/basContainers/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(basContainerService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @GetMapping("/basContainer/{id}") + public R get(@PathVariable("id") Long id) { + BasContainer basContainer = basContainerService.getById(id); + String content = basContainer.getAreas().substring(1, basContainer.getAreas().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + basContainer.setAreaIds(longArray); + return R.ok().add(basContainer); + } + + @PreAuthorize("hasAuthority('manager:basContainer:save')") + @OperationLog("Create 瀹瑰櫒绠$悊") + @PostMapping("/basContainer/save") + public R save(@RequestBody BasContainer basContainer) { + basContainer.setCreateBy(getLoginUserId()); + basContainer.setCreateTime(new Date()); + basContainer.setUpdateBy(getLoginUserId()); + basContainer.setUpdateTime(new Date()); + BasContainer container = basContainerService.getOne(new LambdaQueryWrapper<BasContainer>().eq(BasContainer::getContainerType, basContainer.getContainerType())); + if (null != container) { + return R.error("璇ョ被鍨嬪凡琚垵濮嬪寲"); + } + if (null !=basContainer.getAreaIds()){ + basContainer.setAreas(Arrays.toString(basContainer.getAreaIds())); + } + if (!basContainerService.save(basContainer)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(basContainer); + } + + @PreAuthorize("hasAuthority('manager:basContainer:update')") + @OperationLog("Update 瀹瑰櫒绠$悊") + @PostMapping("/basContainer/update") + public R update(@RequestBody BasContainer basContainer) { + basContainer.setUpdateBy(getLoginUserId()); + basContainer.setUpdateTime(new Date()); + if (null !=basContainer.getAreaIds()){ + basContainer.setAreas(Arrays.toString(basContainer.getAreaIds())); + } + if (!basContainerService.updateById(basContainer)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(basContainer); + } + + @PreAuthorize("hasAuthority('manager:basContainer:remove')") + @OperationLog("Delete 瀹瑰櫒绠$悊") + @PostMapping("/basContainer/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!basContainerService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @PostMapping("/basContainer/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<BasContainer> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(BasContainer::getId, condition); + } + basContainerService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getId())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('manager:basContainer:list')") + @PostMapping("/basContainer/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(basContainerService.list(), BasContainer.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java index 2d70b3b..60cde28 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java @@ -42,6 +42,15 @@ } station.setAreaIds(longArray); } + if (!Cools.isEmpty(station.getContainerType())) { + String content = station.getContainerType().substring(1, station.getContainerType().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + station.setContainerTypes(longArray); + } } return R.ok().add(page); @@ -62,18 +71,29 @@ @PreAuthorize("hasAuthority('manager:basStation:list')") @GetMapping("/basStation/{id}") public R get(@PathVariable("id") Long id) { - BasStation basStation = basStationService.getById(id); + BasStation station = basStationService.getById(id); - String content = basStation.getCrossZoneArea().substring(1, basStation.getCrossZoneArea().length() - 1); - String[] parts = content.split(","); - Long[] longArray = new Long[parts.length]; - for (int i = 0; i < parts.length; i++) { - longArray[i] = Long.parseLong(parts[i].trim()); + if (!Cools.isEmpty(station.getCrossZoneArea())) { + String content = station.getCrossZoneArea().substring(1, station.getCrossZoneArea().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + station.setAreaIds(longArray); } - basStation.setAreaIds(longArray); + if (!Cools.isEmpty(station.getContainerType())) { + String content = station.getContainerType().substring(1, station.getContainerType().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + station.setContainerTypes(longArray); + } - return R.ok().add(basStation); + return R.ok().add(station); } @PreAuthorize("hasAuthority('manager:basStation:save')") @@ -91,6 +111,9 @@ if (null !=basStation.getAreaIds()){ basStation.setCrossZoneArea(Arrays.toString(basStation.getAreaIds())); } + if (null !=basStation.getContainerTypes()){ + basStation.setContainerType(Arrays.toString(basStation.getContainerTypes())); + } if (!basStationService.save(basStation)) { return R.error("淇濆瓨澶辫触"); } @@ -106,6 +129,9 @@ if (null !=basStation.getAreaIds()){ basStation.setCrossZoneArea(Arrays.toString(basStation.getAreaIds())); } + if (null !=basStation.getContainerTypes()){ + basStation.setContainerType(Arrays.toString(basStation.getContainerTypes())); + } if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(StaUseStatusType.TYPE_O.type)){ basStation.setBarcode(null); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasContainer.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasContainer.java new file mode 100644 index 0000000..1ea353c --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasContainer.java @@ -0,0 +1,202 @@ +package com.vincent.rsf.server.manager.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.vincent.rsf.server.system.entity.DictData; +import com.vincent.rsf.server.system.service.DictDataService; +import org.springframework.format.annotation.DateTimeFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.SpringUtils; +import com.vincent.rsf.server.system.service.UserService; +import com.vincent.rsf.server.system.entity.User; +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("man_bas_container") +public class BasContainer implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value= "id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 瀹瑰櫒绫诲瀷 + */ + @ApiModelProperty(value= "瀹瑰櫒绫诲瀷") + private Long containerType; + + /** + * 瀹瑰櫒鏉$爜绫诲瀷 + */ + @ApiModelProperty(value= "瀹瑰櫒鏉$爜绫诲瀷") + private String codeType; + + /** + * 鍙叆搴撳尯 + */ + @ApiModelProperty(value= "鍙叆搴撳尯") + private String areas; + + /** + * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ") + @TableLogic + private Integer deleted; + + /** + * 鐘舵�� + */ + @ApiModelProperty(value= "鐘舵��") + private Integer status; + + /** + * 绉熸埛 + */ + @ApiModelProperty(value= "绉熸埛") + private Integer tenantId; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value= "娣诲姞浜哄憳") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value= "娣诲姞鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value= "淇敼浜哄憳") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value= "淇敼鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value= "澶囨敞") + private String memo; + + @TableField(exist = false) + private Long[] areaIds; + + public BasContainer() {} + + public BasContainer(Long containerType,String codeType,String areas,Integer deleted,Integer status,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.containerType = containerType; + this.codeType = codeType; + this.areas = areas; + this.deleted = deleted; + this.status = status; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// BasContainer basContainer = new BasContainer( +// null, // 瀹瑰櫒绫诲瀷 +// null, // 瀹瑰櫒鏉$爜绫诲瀷 +// null, // 鍙叆搴撳尯 +// null, // 鏄惁鍒犻櫎 +// null, // 鐘舵�� +// null, // 绉熸埛 +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿[闈炵┖] +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿[闈炵┖] +// null // 澶囨敞 +// ); + + public String getContainerType$(){ + if (Cools.isEmpty(this.containerType)){ + return ""; + } + DictDataService service = SpringUtils.getBean(DictDataService.class); + DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>() + .eq(DictData::getDictTypeCode, "sys_container_type") + .eq(DictData::getValue, this.containerType) + ); + if (!Cools.isEmpty(dictData)){ + return String.valueOf(dictData.getLabel()); + } + return ""; + } + + public String getCreateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.createBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getCreateTime$(){ + if (Cools.isEmpty(this.createTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.updateBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getUpdateTime$(){ + if (Cools.isEmpty(this.updateTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + + + public Boolean getStatusBool(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return true; + case 0: + return false; + default: + return null; + } + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java index bfa10a0..c5ddc4b 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java @@ -1,8 +1,7 @@ package com.vincent.rsf.server.manager.entity; import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; +import java.util.*; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.annotation.*; @@ -24,6 +23,7 @@ import com.vincent.rsf.server.system.entity.User; import java.io.Serializable; import java.util.Date; +import java.util.stream.Collectors; @Data @TableName("man_bas_station") @@ -96,7 +96,7 @@ * 瀹瑰櫒绫诲瀷 */ @ApiModelProperty(value= "瀹瑰櫒绫诲瀷") - private Integer containerType; + private String containerType; /** * 鏉$爜 @@ -152,6 +152,9 @@ @TableField(exist = false) private Long[] areaIds; + @TableField(exist = false) + private Long[] containerTypes; + public BasStation() {} @@ -175,6 +178,27 @@ // null, // 鏇存柊浜� // null // 鏇存柊鏃堕棿 // ); + + public List<Long> getContainerTypes$(){ + if (Cools.isEmpty(this.containerType)){ + return new ArrayList<>(); + } + DictDataService service = SpringUtils.getBean(DictDataService.class); + + + String content = this.getContainerType().substring(1, this.getContainerType().length() - 1); + String[] parts = content.split(","); + Long[] longArray = new Long[parts.length]; + for (int i = 0; i < parts.length; i++) { + longArray[i] = Long.parseLong(parts[i].trim()); + } + List<DictData> dictData = service.list(new LambdaQueryWrapper<DictData>() + .eq(DictData::getDictTypeCode, "sys_container_type") + .in(DictData::getValue, longArray) + ); + List<Long> longs = dictData.stream().map(DictData::getId).collect(Collectors.toList()); + return longs; + } public String getCreateTime$(){ if (Cools.isEmpty(this.createTime)){ @@ -205,20 +229,7 @@ return ""; } - public String getContainerType$(){ - if (Cools.isEmpty(this.useStatus)){ - return ""; - } - DictDataService service = SpringUtils.getBean(DictDataService.class); - DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>() - .eq(DictData::getDictTypeCode, "sys_container_type") - .eq(DictData::getValue, this.containerType) - ); - if (!Cools.isEmpty(dictData)){ - return String.valueOf(dictData.getLabel()); - } - return ""; - } + public String getArea$(){ if (null == this.area){ return null; } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/BasContainerMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/BasContainerMapper.java new file mode 100644 index 0000000..cb09960 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/BasContainerMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.mapper; + +import com.vincent.rsf.server.manager.entity.BasContainer; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface BasContainerMapper extends BaseMapper<BasContainer> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/BasContainerService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/BasContainerService.java new file mode 100644 index 0000000..37fa24b --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/BasContainerService.java @@ -0,0 +1,8 @@ +package com.vincent.rsf.server.manager.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.vincent.rsf.server.manager.entity.BasContainer; + +public interface BasContainerService extends IService<BasContainer> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/BasContainerServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/BasContainerServiceImpl.java new file mode 100644 index 0000000..5f36b75 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/BasContainerServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.service.impl; + +import com.vincent.rsf.server.manager.mapper.BasContainerMapper; +import com.vincent.rsf.server.manager.entity.BasContainer; +import com.vincent.rsf.server.manager.service.BasContainerService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("basContainerService") +public class BasContainerServiceImpl extends ServiceImpl<BasContainerMapper, BasContainer> implements BasContainerService { + +} diff --git a/rsf-server/src/main/resources/mapper/manager/BasContainerMapper.xml b/rsf-server/src/main/resources/mapper/manager/BasContainerMapper.xml new file mode 100644 index 0000000..e18a279 --- /dev/null +++ b/rsf-server/src/main/resources/mapper/manager/BasContainerMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.vincent.rsf.server.manager.mapper.BasContainerMapper"> + +</mapper> -- Gitblit v1.9.1