From 83bebf33f2a141a13a7adef66d09b43145fc29e9 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期一, 26 五月 2025 08:47:28 +0800
Subject: [PATCH] 库位信息查询
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 37 ++
/dev/null | 165 -----------
rsf-admin/src/page/locItem/LocItemList.jsx | 265 ++++++++----------
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java | 40 +-
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java | 14 -
rsf-admin/src/page/locItem/LocItemEdit.jsx | 282 ++++++++++---------
rsf-admin/src/page/orders/stock/OrderItemList.jsx | 2
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java | 5
8 files changed, 345 insertions(+), 465 deletions(-)
diff --git a/rsf-admin/src/page/locItem/LocItemCreate.jsx b/rsf-admin/src/page/locItem/LocItemCreate.jsx
deleted file mode 100644
index 75454ff..0000000
--- a/rsf-admin/src/page/locItem/LocItemCreate.jsx
+++ /dev/null
@@ -1,236 +0,0 @@
-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 LocItemCreate = (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}>
- <NumberInput
- label="table.field.locItem.locId"
- source="locId"
- autoFocus
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.locCode"
- source="locCode"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.orderId"
- source="orderId"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.type"
- source="type"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.orderItemId"
- source="orderItemId"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.wkType"
- source="wkType"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.matnrId"
- source="matnrId"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.maktx"
- source="maktx"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.matnrCode"
- source="matnrCode"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.trackCode"
- source="trackCode"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.unit"
- source="unit"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.anfme"
- source="anfme"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.qty"
- source="qty"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.locItem.workQty"
- source="workQty"
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.batch"
- source="batch"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.splrBatch"
- source="splrBatch"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.spec"
- source="spec"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.model"
- source="model"
- parse={v => v}
- />
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <TextInput
- label="table.field.locItem.fieldsIndex"
- source="fieldsIndex"
- parse={v => v}
- />
- </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 LocItemCreate;
diff --git a/rsf-admin/src/page/locItem/LocItemEdit.jsx b/rsf-admin/src/page/locItem/LocItemEdit.jsx
index 120f850..9336316 100644
--- a/rsf-admin/src/page/locItem/LocItemEdit.jsx
+++ b/rsf-admin/src/page/locItem/LocItemEdit.jsx
@@ -10,6 +10,7 @@
DateInput,
SelectInput,
ReferenceInput,
+ SelectArrayInput,
ReferenceArrayInput,
AutocompleteInput,
SaveButton,
@@ -19,6 +20,7 @@
required,
useRecordContext,
DeleteButton,
+ useNotify,
} from 'react-admin';
import { useWatch, useFormContext } from "react-hook-form";
import { Stack, Grid, Box, Typography } from '@mui/material';
@@ -28,153 +30,175 @@
import CustomerTopToolBar from "../components/EditTopToolBar";
import MemoInput from "../components/MemoInput";
import StatusSelectInput from "../components/StatusSelectInput";
+import request from '@/utils/request';
+import DictionarySelect from "../components/DictionarySelect";
+import LocQueryList from "./LocQueryList";
const FormToolbar = () => {
const { getValues } = useFormContext();
return (
<Toolbar sx={{ justifyContent: 'end' }}>
- <SaveButton />
- {/* <DeleteButton mutationMode="optimistic" /> */}
</Toolbar>
)
}
const LocItemEdit = () => {
const translate = useTranslate();
+ const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || [];
+ const [warehouseId, setWrehouseId] = useState();
+
+ const warehouseChange = (val) => {
+ setWrehouseId(val)
+ }
return (
- <Edit
- redirect="list"
- mutationMode={EDIT_MODE}
- actions={<CustomerTopToolBar />}
- aside={<EditBaseAside />}
- >
- <SimpleForm
- shouldUnregister
- warnWhenUnsavedChanges
- toolbar={<FormToolbar />}
- mode="onTouched"
- defaultValues={{}}
- // validate={(values) => { }}
+ <>
+ <Edit
+ redirect="list"
+ mutationMode={EDIT_MODE}
+ actions={<CustomerTopToolBar />}
+ aside={<EditBaseAside />}
+ title={"menu.loc"}
>
- <Grid container width={{ xs: '100%', xl: '100%' }} rowSpacing={3} columnSpacing={3}>
- <Grid item xs={14} md={10}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.main')}
- </Typography>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.locItem.locId"
- source="locId"
- autoFocus
- />
- <TextInput
- label="table.field.locItem.locCode"
- source="locCode"
- parse={v => v}
- />
- <NumberInput
- label="table.field.locItem.orderId"
- source="orderId"
- />
- <TextInput
- label="table.field.locItem.type"
- source="type$"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.locItem.orderItemId"
- source="orderItemId"
- />
- <NumberInput
- label="table.field.locItem.wkType"
- source="wkType"
- />
- <NumberInput
- label="table.field.locItem.matnrId"
- source="matnrId"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.locItem.maktx"
- source="maktx"
- parse={v => v}
- />
+ <SimpleForm
+ shouldUnregister
+ warnWhenUnsavedChanges
+ toolbar={false}
+ mode="onTouched"
+ defaultValues={{}}
+ // validate={(values) => { }}
+ >
+ <Grid container width={{ xs: '100%', xl: '90%' }} rowSpacing={3} columnSpacing={3}
+ sx={{
+ "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": {
+ bgcolor: 'white',
+ WebkitTextFillColor: "rgba(0, 0, 0)"
+ },
- <TextInput
- label="table.field.locItem.matnrCode"
- source="matnrCode"
- parse={v => v}
- />
- <TextInput
- label="table.field.locItem.trackCode"
- source="trackCode"
- parse={v => v}
- />
- <TextInput
- label="table.field.locItem.unit"
- source="unit"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.locItem.anfme"
- source="anfme"
- />
- <NumberInput
- label="table.field.locItem.qty"
- source="qty"
- />
- <NumberInput
- label="table.field.locItem.workQty"
- source="workQty"
- />
- <TextInput
- label="table.field.locItem.batch"
- source="batch"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.locItem.splrBatch"
- source="splrBatch"
- parse={v => v}
- />
- <TextInput
- label="table.field.locItem.spec"
- source="spec"
- parse={v => v}
- />
- <TextInput
- label="table.field.locItem.model"
- source="model"
- parse={v => v}
- />
- <TextInput
- label="table.field.locItem.fieldsIndex"
- source="fieldsIndex"
- parse={v => v}
- />
- </Stack>
+ "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": {
+ bgcolor: 'white',
+ WebkitTextFillColor: "rgba(0, 0, 0)"
+ },
+ "& .MuiFilledInput-root.MuiInputBase-sizeSmall": {
+ bgcolor: 'white',
+ }
+ }}
+ >
+ <Grid item xs={12} md={10}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.main')}
+ </Typography>
+ <Grid container rowSpacing={2} columnSpacing={2}>
+ <Grid item display="flex" gap={2}>
+ <ReferenceInput
+ source="warehouseId"
+ reference="warehouse"
+ >
+ <AutocompleteInput
+ label="table.field.loc.warehouseId"
+ optionText="name"
+ readOnly
+ validate={[required()]}
+ onChange={warehouseChange}
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
+ <ReferenceInput
+ source="areaId"
+ reference="warehouseAreas"
+ filter={{ warehouseId }}
+ >
+ <AutocompleteInput
+ label="table.field.loc.areaId"
+ optionText="name"
+ readOnly
+ validate={[required()]}
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
+ <TextInput
+ label="table.field.loc.code"
+ source="code"
+ parse={v => v}
+ readOnly
+ validate={required()}
+ />
+ <NumberInput
+ label="table.field.loc.length"
+ source="length"
+ readOnly
+ validate={required()}
+ />
+ <NumberInput
+ label="table.field.loc.width"
+ source="width"
+ readOnly
+ validate={required()}
+ />
+
+ <NumberInput
+ label="table.field.loc.height"
+ source="height"
+ readOnly
+ validate={required()}
+ />
+ </Grid>
+ <Grid item display="flex" gap={1}>
+ <ReferenceArrayInput source="typeIds" reference="locType" >
+ <SelectArrayInput label="table.field.loc.type" readOnly validate={[required()]} />
+ </ReferenceArrayInput>
+ <TextInput
+ label="table.field.loc.unit"
+ source="unit"
+ readOnly
+ parse={v => v}
+ />
+ <DictionarySelect
+ label={translate("table.field.loc.useStatus")}
+ name="useStatus"
+ validate={[required()]}
+ readOnly
+ size="small"
+ dictTypeCode="sys_loc_use_stas"
+ />
+ <NumberInput
+ label="table.field.loc.row"
+ source="row"
+ readOnly
+ validate={required()}
+ />
+
+ <NumberInput
+ label="table.field.loc.col"
+ source="col"
+ readOnly
+ validate={required()}
+ />
+
+ <NumberInput
+ label="table.field.loc.lev"
+ source="lev"
+ readOnly
+ validate={required()}
+ />
+ </Grid>
+ </Grid>
+ </Grid>
+ <Grid item xs={12} md={2}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.common')}
+ </Typography>
+ <StatusSelectInput readOnly />
+ <Box mt="2em" />
+ <MemoInput />
+ </Grid>
</Grid>
- <Grid item xs={10} md={2}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.common')}
- </Typography>
- <StatusSelectInput />
- <Box mt="2em" />
- <MemoInput />
- </Grid>
- </Grid>
- </SimpleForm>
- </Edit >
+ </SimpleForm>
+ </Edit >
+ <LocQueryList />
+ </>
)
}
diff --git a/rsf-admin/src/page/locItem/LocItemList.jsx b/rsf-admin/src/page/locItem/LocItemList.jsx
index 2a39802..a07bb72 100644
--- a/rsf-admin/src/page/locItem/LocItemList.jsx
+++ b/rsf-admin/src/page/locItem/LocItemList.jsx
@@ -29,22 +29,18 @@
NumberInput,
ReferenceInput,
ReferenceArrayInput,
- useRefresh,
AutocompleteInput,
DeleteButton,
+ useRefresh,
+ Button,
+ useList,
} from 'react-admin';
-import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material';
+import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
-import LocItemCreate from "./LocItemCreate";
-import LocItemPanel from "./LocItemPanel";
-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 request from '@/utils/request';
+import LocListAside from "./LocListAside";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -56,49 +52,97 @@
'& .column-name': {
},
'& .opt': {
- width: 100
+ width: 180
+ },
+ '& .type .MuiTypography-root': {
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: 'block',
+ width: 'auto',
},
}));
-const filters = [
- <SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" />,
- <DateInput label='common.time.before' source="timeEnd" />,
- <NumberInput source="locId" label="table.field.locItem.locId" />,
- <TextInput source="locCode" label="table.field.locItem.locCode" />,
- <NumberInput source="orderId" label="table.field.locItem.orderId" />,
- <TextInput source="type" label="table.field.locItem.type" />,
- <NumberInput source="orderItemId" label="table.field.locItem.orderItemId" />,
- <NumberInput source="wkType" label="table.field.locItem.wkType" />,
- <NumberInput source="matnrId" label="table.field.locItem.matnrId" />,
- <TextInput source="maktx" label="table.field.locItem.maktx" />,
- <TextInput source="matnrCode" label="table.field.locItem.matnrCode" />,
- <TextInput source="trackCode" label="table.field.locItem.trackCode" />,
- <TextInput source="unit" label="table.field.locItem.unit" />,
- <NumberInput source="anfme" label="table.field.locItem.anfme" />,
- <NumberInput source="qty" label="table.field.locItem.qty" />,
- <NumberInput source="workQty" label="table.field.locItem.workQty" />,
- <TextInput source="batch" label="table.field.locItem.batch" />,
- <TextInput source="splrBatch" label="table.field.locItem.splrBatch" />,
- <TextInput source="spec" label="table.field.locItem.spec" />,
- <TextInput source="model" label="table.field.locItem.model" />,
- <TextInput source="fieldsIndex" label="table.field.locItem.fieldsIndex" />,
- <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 LocItemList = () => {
const translate = useTranslate();
+ const notify = useNotify();
+ const refresh = useRefresh();
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
+ const [initDialog, setInitDialog] = useState(false);
+ const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_use_stas')) || [];
+ const locType = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_type')) || [];
+
+
+ const filters = [
+ <SearchInput source="condition" alwaysOn />,
+ <ReferenceInput
+ source="warehouseId"
+ label="table.field.loc.warehouseId"
+ reference="warehouse"
+ >
+ <AutocompleteInput
+ label="table.field.loc.warehouseId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>,
+ <ReferenceInput
+ source="areaId"
+ label="table.field.loc.areaId"
+ reference="warehouseAreas"
+ >
+ <AutocompleteInput
+ label="table.field.loc.areaId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>,
+ <AutocompleteInput
+ choices={dicts}
+ optionText="label"
+ label="table.field.loc.useStatus"
+ source="useStatus"
+ optionValue="value"
+ parse={v => v}
+ />,
+ <TextInput source="code" label="table.field.loc.code" />,
+ <AutocompleteInput
+ choices={locType}
+ optionText="label"
+ label="table.field.loc.type"
+ source="type"
+ optionValue="value"
+ parse={v => v}
+ />, <TextInput source="name" label="table.field.loc.name" />,
+ <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />,
+ <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />,
+ <TextInput source="barcode" label="table.field.loc.barcode" />,
+ <TextInput source="unit" label="table.field.loc.unit" />,
+ <TextInput source="size" label="table.field.loc.size" />,
+ <NumberInput source="row" label="table.field.loc.row" />,
+ <NumberInput source="col" label="table.field.loc.col" />,
+ <NumberInput source="lev" label="table.field.loc.lev" />,
+ <NumberInput source="channel" label="table.field.loc.channel" />,
+ <NumberInput source="maxParts" label="table.field.loc.maxParts" />,
+ <NumberInput source="maxPack" label="table.field.loc.maxPack" />,
+ <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />,
+ <TextInput source="locAttrs" label="table.field.loc.locAttrs" />,
+ <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
+ />,
+ ]
+
+
return (
<Box display="flex">
@@ -109,8 +153,10 @@
theme.transitions.create(['all'], {
duration: theme.transitions.duration.enteringScreen,
}),
- marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+ marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
}}
+ storeKey="locItem"
+ resource="loc"
title={"menu.locItem"}
empty={false}
filters={filters}
@@ -118,107 +164,46 @@
actions={(
<TopToolbar>
<FilterButton />
- {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */}
- <SelectColumnsButton preferenceKey='locItem' />
- {/* <MyExportButton /> */}
+ <SelectColumnsButton preferenceKey='loc' />
</TopToolbar>
)}
perPage={DEFAULT_PAGE_SIZE}
+ aside={<LocListAside />}
>
- <DynamicFields />
+ <StyledDatagrid
+ preferenceKey='locItem'
+ align="left"
+ bulkActionButtons={false}
+ rowClick={() => false}
+ omit={['id', 'createTime', 'createBy', 'memo', 'updateTime', 'updateBy']}
+ >
+ <NumberField source="id" />
+ <NumberField source="warehouseId$" label="table.field.loc.warehouseId" />
+ <NumberField source="areaId$" label="table.field.loc.areaId" />
+ <TextField source="code" label="table.field.loc.code" />
+ <TextField source="typeIds$" label="table.field.loc.type" cellClassName="type" />
+ <TextField source="barcode" label="table.field.loc.barcode" />
+ <TextField source="length" label="table.field.loc.length" />
+ <TextField source="width" label="table.field.loc.width" />
+ <TextField source="height" label="table.field.loc.height" />
+ <NumberField source="row" label="table.field.loc.row" />
+ <NumberField source="col" label="table.field.loc.col" />
+ <NumberField source="lev" label="table.field.loc.lev" />
+ <NumberField source="channel" label="table.field.loc.channel" />
+ <TextField source="useStatus$" label="table.field.loc.useStatus" />
+ <TextField source="updateBy$" label="common.field.updateBy" />
+ <DateField source="updateTime" label="common.field.updateTime" showTime align="left" />
+ <TextField source="createBy$" label="common.field.createBy" />
+ <DateField source="createTime" label="common.field.createTime" showTime align="left" />
+ <BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" />
+ <TextField source="memo" label="common.field.memo" sortable={false} />
+ <WrapperField cellClassName="opt" label="common.field.opt">
+ <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} resource="locItem" label="toolbar.detail" />
+ </WrapperField>
+ </StyledDatagrid>
</List>
- <LocItemCreate
- open={createDialog}
- setOpen={setCreateDialog}
- />
- <PageDrawer
- title='LocItem Detail'
- drawerVal={drawerVal}
- setDrawerVal={setDrawerVal}
- >
- </PageDrawer>
</Box>
)
}
-export default LocItemList;
-
-
-const DynamicFields = (props) => {
- const translate = useTranslate();
- const notify = useNotify();
- const [columns, setColumns] = useState([]);
- const { isLoading } = useListContext();
- const refresh = useRefresh();
- useEffect(() => {
- getDynamicFields();
- }, []);
-
- const getDynamicFields = async () => {
- const { data: { code, data, msg }, } = await request.get("/fields/enable/list");
- if (code == 200) {
- const arr = [
- <NumberField source="id" />,
- <NumberField source="locId" label="table.field.locItem.locId" />,
- <TextField source="wareArea" label="table.field.locItem.wareArea" />,
- <TextField source="locCode" label="table.field.locItem.locCode" />,
- <NumberField source="orderId" label="table.field.locItem.orderId" />,
- <TextField source="type$" label="table.field.locItem.type" />,
- <NumberField source="orderItemId" label="table.field.locItem.orderItemId" />,
- <NumberField source="wkType$" label="table.field.locItem.wkType" />,
- <NumberField source="matnrId" label="table.field.locItem.matnrId" />,
- <TextField source="matnrCode" label="table.field.locItem.matnrCode" />,
- <TextField source="maktx" label="table.field.locItem.maktx" />,
- <TextField source="spec" label="table.field.locItem.spec" />,
- <TextField source="model" label="table.field.locItem.model" />,
- <TextField source="batch" label="table.field.locItem.batch" />,
- <TextField source="trackCode" label="table.field.locItem.trackCode" />,
- <TextField source="unit" label="table.field.locItem.unit" />,
- <NumberField source="anfme" label="table.field.locItem.anfme" />,
- <NumberField source="workQty" label="table.field.locItem.workQty" />,
- <NumberField source="qty" label="table.field.locItem.qty" />,
- <TextField source="splrBatch" label="table.field.locItem.splrBatch" />,
- <TextField source="fieldsIndex" label="table.field.locItem.fieldsIndex" />,
- ]
- const fields = data.map(el => <TextField key={el.fields} source={`extendFields.[${el.fields}]`} label={el.fieldsAlise} />)
- const lastArr = [
- <TextField source="updateBy$" label="common.field.updateBy" />,
- <DateField source="updateTime" label="common.field.updateTime" showTime />,
- <TextField source="createBy$" label="common.field.createBy" />,
- <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} />,
- ]
- setColumns([...arr, ...fields, ...lastArr]);
- } else {
- notify(msg);
- }
- }
-
- return (
- <Box sx={{ position: 'relative', minHeight: "60vh", }}>
- {isLoading && (
- <LinearProgress
- sx={{
- height: "2px",
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- }}
- />
- )}
- {columns.length > 0 &&
- <StyledDatagrid
- preferenceKey='locItem'
- bulkActionButtons={false}
- rowClick={false}
- expand={false}
- expandSingle={true}
- omit={['id', 'createTime','spec', 'model', 'locId', 'orderId', 'trackCode', 'orderItemId', 'matnrId', 'splrBatch','createBy', 'memo', 'fieldsIndex']}
- >
- {columns.map((column) => column)}
- </StyledDatagrid>}
- </Box>
- )
-}
\ No newline at end of file
+export default LocItemList;
\ No newline at end of file
diff --git a/rsf-admin/src/page/locItem/LocItemPanel.jsx b/rsf-admin/src/page/locItem/LocItemPanel.jsx
deleted file mode 100644
index 585ec5a..0000000
--- a/rsf-admin/src/page/locItem/LocItemPanel.jsx
+++ /dev/null
@@ -1,165 +0,0 @@
-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 LocItemPanel = () => {
- 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.locItem.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.locItem.locId"
- property={record.locId}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.locCode"
- property={record.locCode}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.orderId"
- property={record.orderId}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.type"
- property={record.type}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.orderItemId"
- property={record.orderItemId}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.wkType"
- property={record.wkType}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.matnrId"
- property={record.matnrId}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.maktx"
- property={record.maktx}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.matnrCode"
- property={record.matnrCode}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.trackCode"
- property={record.trackCode}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.unit"
- property={record.unit}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.anfme"
- property={record.anfme}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.qty"
- property={record.qty}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.workQty"
- property={record.workQty}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.batch"
- property={record.batch}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.splrBatch"
- property={record.splrBatch}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.spec"
- property={record.spec}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.model"
- property={record.model}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.locItem.fieldsIndex"
- property={record.fieldsIndex}
- />
- </Grid>
-
- </Grid>
- </CardContent>
- </Card >
- </>
- );
-};
-
-export default LocItemPanel;
diff --git a/rsf-admin/src/page/orders/stock/OrderItemList.jsx b/rsf-admin/src/page/orders/stock/OrderItemList.jsx
index 03f5658..94e07d1 100644
--- a/rsf-admin/src/page/orders/stock/OrderItemList.jsx
+++ b/rsf-admin/src/page/orders/stock/OrderItemList.jsx
@@ -68,8 +68,6 @@
<TextInput source="matnrId" label="table.field.stockItem.matnrId" />,
<TextInput source="matnrCode" label="table.field.stockItem.matnrCode" />,
<TextInput source="maktx" label="table.field.stockItem.maktx" />,
- <TextInput source="locCode" label="table.field.loc.code" />,
- <TextInput source="barcode" label="table.field.task.barcode" />,
<NumberInput source="anfme" label="table.field.stockItem.anfme" />,
<TextInput source="stockUnit" label="table.field.stockItem.stockUnit" />,
<NumberInput source="workQty" label="table.field.stockItem.workQty" />,
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java
index c10934b..46ba486 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java
@@ -115,20 +115,6 @@
if (Objects.isNull(companys.getType())) {
throw new CoolException("绫诲瀷涓嶈兘涓虹┖锛侊紒");
}
-// Companys companys1 = companysService.getById(companys.getId());
- List<Companys> warehouses = companysService.list(new LambdaQueryWrapper<Companys>()
- .eq(Companys::getName, companys.getName())
- .eq(Companys::getType, companys.getType())
- .eq(Companys::getBreifCode, companys.getBreifCode()));
- if (!warehouses.isEmpty()) {
- throw new CoolException("浼佷笟宸插瓨鍦紒锛�");
- }
- if (!companysService.list(new LambdaQueryWrapper<Companys>()
- .eq(Companys::getType, companys.getType())
- .eq(Companys::getName, companys.getName())
- .eq(Companys::getCode, companys.getBreifCode())).isEmpty()) {
- throw new CoolException("浼佷笟缂栫爜閲嶅锛侊紒");
- }
if (!companysService.updateById(companys)) {
return R.error("Update Fail");
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
index 5390de7..59adfb7 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
@@ -13,6 +13,7 @@
import com.vincent.rsf.server.common.utils.FieldsUtils;
import com.vincent.rsf.server.manager.entity.LocItem;
import com.vincent.rsf.server.manager.service.LocItemService;
+import com.vincent.rsf.server.manager.service.LocService;
import com.vincent.rsf.server.system.controller.BaseController;
import com.vincent.rsf.server.manager.enums.LocStsType;
import io.swagger.annotations.ApiOperation;
@@ -28,6 +29,8 @@
@Autowired
private LocItemService locItemService;
+ @Autowired
+ private LocService locService;
@PreAuthorize("hasAuthority('manager:locItem:list')")
@PostMapping("/locItem/page")
@@ -138,7 +141,7 @@
@PreAuthorize("hasAuthority('manager:locItem:list')")
@GetMapping("/locItem/{id}")
public R get(@PathVariable("id") Long id) {
- return R.ok().add(locItemService.getById(id));
+ return R.ok().add(locService.getById(id));
}
@PreAuthorize("hasAuthority('manager:locItem:save')")
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
index 72a17c9..6ee04b1 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -5,17 +5,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
-import com.vincent.rsf.server.manager.entity.Loc;
-import com.vincent.rsf.server.manager.entity.Task;
-import com.vincent.rsf.server.manager.entity.TaskItem;
+import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.*;
import com.vincent.rsf.server.manager.mapper.LocItemMapper;
-import com.vincent.rsf.server.manager.entity.LocItem;
-import com.vincent.rsf.server.manager.service.LocItemService;
+import com.vincent.rsf.server.manager.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.vincent.rsf.server.manager.service.LocService;
-import com.vincent.rsf.server.manager.service.TaskItemService;
-import com.vincent.rsf.server.manager.service.TaskService;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import lombok.Synchronized;
@@ -25,10 +19,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.lang.reflect.Array;
+import java.util.*;
import java.util.stream.Collectors;
@Service("locItemService")
@@ -42,6 +34,8 @@
private TaskItemService taskItemService;
@Autowired
private LocItemService locItemService;
+ @Autowired
+ private DeviceSiteService deviceSiteService;
/**
@@ -104,20 +98,38 @@
throw new CoolException("鎵樼洏浠诲姟鎵ц涓紝涓嶈兘閲嶅鍒涘缓锛�");
}
+ List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type);
+
if (type.equals("stock")) {
Double useQty = Math.round((outQty + workQty) * 10000) / 10000.0;
if (orgQty.compareTo(useQty) > 0) {
//鎷f枡鍑哄簱
task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type);
+
+ DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+ .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) );
+ if (Objects.isNull(deviceSite)) {
+ throw new CoolException("绔欑偣鏀寔鎷f枡鍑哄簱锛侊紒");
+ }
} else {
//鍏ㄦ澘鍑哄簱
task.setTaskType(TaskType.TASK_TYPE_OUT.type);
+ DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+ .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type) );
+ if (Objects.isNull(deviceSite)) {
+ throw new CoolException("绔欑偣鏀寔鍏ㄦ澘鍑哄簱锛侊紒");
+ }
}
} else if (type.equals("check")) {
//鐩樼偣鍑哄簱
task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type);
+ DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+ .eq(DeviceSite::getSite, loc.getCode()).eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type) );
+ if (Objects.isNull(deviceSite)) {
+ throw new CoolException("绔欑偣鏀寔鐩樼偣鍑哄簱锛侊紒");
+ }
}
-
+
if (!taskService.save(task)) {
throw new CoolException("浠诲姟鍒涘缓澶辫触锛侊紒");
}
@@ -138,7 +150,7 @@
throw new CoolException("搴撳瓨淇℃伅涓嶅瓨鍦紒");
}
- if (locItem.getOutQty().compareTo(0.0) < 0) {
+ if (item.getOutQty().compareTo(0.0) < 0) {
throw new CoolException("鍑哄簱鏁伴噷涓嶈兘灏忎簬0锛侊紒");
}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index e6bbb8a..ff45705 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -687,6 +687,38 @@
throw new CoolException("浠诲姟鐘舵�佹洿鏂板け璐ワ紒锛�");
}
+ List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
+ for (int i = 0; i < taskItems.size(); i++) {
+ TaskItem taskItem = taskItems.get(i);
+ LocItemWorking locWorking = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
+ .eq(LocItemWorking::getTaskId, taskItem.getTaskId())
+ .eq(StringUtils.isNotBlank(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch())
+ .eq(StringUtils.isNotBlank(taskItem.getFieldsIndex()), LocItemWorking::getFieldsIndex, taskItem.getFieldsIndex())
+ .eq(LocItemWorking::getMatnrId, taskItem.getMatnrId()));
+ if (Objects.isNull(locWorking)) {
+ throw new CoolException("鏁版嵁閿欒锛屼綔涓氫腑搴撳瓨鏁版嵁涓㈠け锛侊紒");
+ }
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
+ locWorking.setWorkQty(0.0);
+ locWorking.setAnfme(taskItem.getAnfme());
+ } else {
+ if (locWorking.getAnfme().compareTo(taskItem.getAnfme()) >= 0) {
+ locWorking.setWorkQty(0.0);
+ locWorking.setAnfme(Math.round((locWorking.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0);
+ } else {
+ continue;
+ }
+ }
+ if (!locItemWorkingService.updateById(locWorking)) {
+ throw new CoolException("涓存椂搴撳瓨鏇存柊澶辫触锛侊紒");
+ }
+ taskItems.get(i).setAnfme(locWorking.getAnfme());
+ }
+
+ if (!taskItemService.updateBatchById(taskItems)) {
+ throw new CoolException("浠诲姟鏄庣粏鏇存柊澶辫触锛侊紒");
+ }
+
Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
if (Objects.isNull(one)) {
throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦紒锛�");
@@ -798,6 +830,11 @@
throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
}
+ //鍏ㄦ澘鍑哄簱锛屽垹闄や复鏃跺簱瀛�
+ if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) {
+ throw new CoolException("涓存椂搴撳瓨娓呴櫎澶辫触锛侊紒");
+ }
+
}
}
--
Gitblit v1.9.1