From e80184f5d053bff9d0f7fdaade6c800bee84c7dd Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 15 四月 2025 12:49:57 +0800 Subject: [PATCH] #修改 1. 新增综合订单管理 2. 新增综合明细订单管理 --- rsf-admin/src/page/orderItem/index.jsx | 18 rsf-server/src/main/resources/mapper/manager/OrderMapper.xml | 5 rsf-admin/src/page/orderItem/OrderItemCreate.jsx | 249 ++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Order.java | 218 ++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java | 6 rsf-admin/src/page/orderItem/OrderItemEdit.jsx | 221 ++++ rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java | 4 rsf-admin/src/page/order/OrderItemEdit.jsx | 221 ++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderService.java | 8 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 16 rsf-admin/src/page/order/OrderPanel.jsx | 87 + rsf-admin/src/page/waitPakin/SelectSiteModel.jsx | 29 rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/OrderItem.java | 330 ++++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderItemService.java | 8 rsf-server/src/main/resources/mapper/manager/OrderItemMapper.xml | 5 rsf-admin/src/page/order/index.jsx | 18 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderItemController.java | 110 ++ rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderItemMapper.java | 12 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/GenerateTaskParams.java | 29 rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderMapper.java | 12 rsf-server/src/main/java/orderItem.sql | 41 rsf-admin/src/page/order/OrderCreate.jsx | 154 ++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderItemServiceImpl.java | 12 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java | 4 rsf-admin/src/page/order/OrderItemCreate.jsx | 249 ++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderController.java | 110 ++ rsf-admin/src/page/order/OrderEdit.jsx | 126 ++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaitPakinController.java | 10 rsf-admin/src/page/orders/asnOrder/AsnOrderItemEdit.jsx | 4 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderServiceImpl.java | 12 rsf-server/src/main/java/order.sql | 27 rsf-admin/src/page/orderItem/OrderItemList.jsx | 190 +++ rsf-admin/src/page/waitPakin/WaitPakinList.jsx | 69 rsf-admin/src/page/orderItem/OrderItemPanel.jsx | 171 +++ rsf-admin/src/page/order/OrderItemList.jsx | 182 +++ rsf-admin/src/page/order/OrderList.jsx | 162 +++ 36 files changed, 3,067 insertions(+), 62 deletions(-) diff --git a/rsf-admin/src/page/order/OrderCreate.jsx b/rsf-admin/src/page/order/OrderCreate.jsx new file mode 100644 index 0000000..b0372f2 --- /dev/null +++ b/rsf-admin/src/page/order/OrderCreate.jsx @@ -0,0 +1,154 @@ +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 OrderCreate = (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}> + <TextInput + label="table.field.order.code" + source="code" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.order.sourceCode" + source="sourceCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.order.sourceId" + source="sourceId" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.order.type" + source="type" + parse={v => v} + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.order.wkType" + source="wkType" + parse={v => v} + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.order.anfme" + source="anfme" + validate={required()} + /> + </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 OrderCreate; diff --git a/rsf-admin/src/page/order/OrderEdit.jsx b/rsf-admin/src/page/order/OrderEdit.jsx new file mode 100644 index 0000000..3300582 --- /dev/null +++ b/rsf-admin/src/page/order/OrderEdit.jsx @@ -0,0 +1,126 @@ +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 OrderEdit = () => { + 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.order.code" + source="code" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.order.sourceCode" + source="sourceCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.order.sourceId" + source="sourceId" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.order.type" + source="type" + parse={v => v} + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.order.wkType" + source="wkType" + parse={v => v} + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.order.anfme" + source="anfme" + validate={required()} + /> + </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 OrderEdit; diff --git a/rsf-admin/src/page/order/OrderItemCreate.jsx b/rsf-admin/src/page/order/OrderItemCreate.jsx new file mode 100644 index 0000000..71904b9 --- /dev/null +++ b/rsf-admin/src/page/order/OrderItemCreate.jsx @@ -0,0 +1,249 @@ +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 OrderItemCreate = (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.orderItem.orderId" + source="orderId" + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.orderCode" + source="orderCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.sourceItemId" + source="sourceItemId" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.matnrId" + source="matnrId" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.maktx" + source="maktx" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.anfme" + source="anfme" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.stockUnit" + source="stockUnit" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.workQty" + source="workQty" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.purQty" + source="purQty" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.purUnit" + source="purUnit" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.qty" + source="qty" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrCode" + source="splrCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.batch" + source="batch" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrBatch" + source="splrBatch" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrName" + source="splrName" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.trackCode" + source="trackCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.barcode" + source="barcode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.prodTime" + source="prodTime" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.packName" + source="packName" + 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 OrderItemCreate; diff --git a/rsf-admin/src/page/order/OrderItemEdit.jsx b/rsf-admin/src/page/order/OrderItemEdit.jsx new file mode 100644 index 0000000..2133716 --- /dev/null +++ b/rsf-admin/src/page/order/OrderItemEdit.jsx @@ -0,0 +1,221 @@ +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 OrderItemEdit = () => { + 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}> + <NumberInput + label="table.field.orderItem.orderId" + source="orderId" + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.orderCode" + source="orderCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.sourceItemId" + source="sourceItemId" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.matnrId" + source="matnrId" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.maktx" + source="maktx" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.anfme" + source="anfme" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.stockUnit" + source="stockUnit" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.workQty" + source="workQty" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.purQty" + source="purQty" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.purUnit" + source="purUnit" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.qty" + source="qty" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrCode" + source="splrCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.batch" + source="batch" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrBatch" + source="splrBatch" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrName" + source="splrName" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.trackCode" + source="trackCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.barcode" + source="barcode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.prodTime" + source="prodTime" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.packName" + source="packName" + parse={v => v} + /> + </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 OrderItemEdit; diff --git a/rsf-admin/src/page/order/OrderItemList.jsx b/rsf-admin/src/page/order/OrderItemList.jsx new file mode 100644 index 0000000..0fe52ac --- /dev/null +++ b/rsf-admin/src/page/order/OrderItemList.jsx @@ -0,0 +1,182 @@ +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 OrderItemCreate from "./OrderItemCreate"; +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'; + +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="orderId" label="table.field.orderItem.orderId" />, + <TextInput source="orderCode" label="table.field.orderItem.orderCode" />, + <TextInput source="sourceItemId" label="table.field.orderItem.sourceItemId" />, + <TextInput source="matnrId" label="table.field.orderItem.matnrId" />, + <TextInput source="matnrCode" label="table.field.orderItem.matnrCode" />, + <TextInput source="maktx" label="table.field.orderItem.maktx" />, + <NumberInput source="anfme" label="table.field.orderItem.anfme" />, + <TextInput source="stockUnit" label="table.field.orderItem.stockUnit" />, + <NumberInput source="workQty" label="table.field.orderItem.workQty" />, + <NumberInput source="purQty" label="table.field.orderItem.purQty" />, + <TextInput source="purUnit" label="table.field.orderItem.purUnit" />, + <NumberInput source="qty" label="table.field.orderItem.qty" />, + <TextInput source="splrCode" label="table.field.orderItem.splrCode" />, + <TextInput source="batch" label="table.field.orderItem.batch" />, + <TextInput source="splrBatch" label="table.field.orderItem.splrBatch" />, + <TextInput source="splrName" label="table.field.orderItem.splrName" />, + <TextInput source="trackCode" label="table.field.orderItem.trackCode" />, + <TextInput source="barcode" label="table.field.orderItem.barcode" />, + <TextInput source="prodTime" label="table.field.orderItem.prodTime" />, + <TextInput source="packName" label="table.field.orderItem.packName" />, + <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 OrderItemList = () => { + 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.orderItem"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='orderItem' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='orderItem' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={false} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <NumberField source="orderId" label="table.field.orderItem.orderId" /> + <TextField source="orderCode" label="table.field.orderItem.orderCode" /> + <TextField source="sourceItemId" label="table.field.orderItem.sourceItemId" /> + <TextField source="matnrId" label="table.field.orderItem.matnrId" /> + <TextField source="matnrCode" label="table.field.orderItem.matnrCode" /> + <TextField source="maktx" label="table.field.orderItem.maktx" /> + <NumberField source="anfme" label="table.field.orderItem.anfme" /> + <TextField source="stockUnit" label="table.field.orderItem.stockUnit" /> + <NumberField source="workQty" label="table.field.orderItem.workQty" /> + <NumberField source="purQty" label="table.field.orderItem.purQty" /> + <TextField source="purUnit" label="table.field.orderItem.purUnit" /> + <NumberField source="qty" label="table.field.orderItem.qty" /> + <TextField source="splrCode" label="table.field.orderItem.splrCode" /> + <TextField source="batch" label="table.field.orderItem.batch" /> + <TextField source="splrBatch" label="table.field.orderItem.splrBatch" /> + <TextField source="splrName" label="table.field.orderItem.splrName" /> + <TextField source="trackCode" label="table.field.orderItem.trackCode" /> + <TextField source="barcode" label="table.field.orderItem.barcode" /> + <TextField source="prodTime" label="table.field.orderItem.prodTime" /> + <TextField source="packName" label="table.field.orderItem.packName" /> + <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} /> + <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> + <OrderItemCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='OrderItem Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default OrderItemList; diff --git a/rsf-admin/src/page/order/OrderList.jsx b/rsf-admin/src/page/order/OrderList.jsx new file mode 100644 index 0000000..2a5e126 --- /dev/null +++ b/rsf-admin/src/page/order/OrderList.jsx @@ -0,0 +1,162 @@ +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 OrderCreate from "./OrderCreate"; +import OrderPanel from "./OrderPanel"; +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'; + +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="code" label="table.field.order.code" />, + <TextInput source="sourceCode" label="table.field.order.sourceCode" />, + <NumberInput source="sourceId" label="table.field.order.sourceId" />, + <TextInput source="type" label="table.field.order.type" />, + <TextInput source="wkType" label="table.field.order.wkType" />, + <NumberInput source="anfme" label="table.field.order.anfme" />, + + <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 OrderList = () => { + 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.order"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='order' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='order' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <OrderPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="code" label="table.field.order.code" /> + <TextField source="sourceCode" label="table.field.order.sourceCode" /> + <NumberField source="sourceId" label="table.field.order.sourceId" /> + <TextField source="type" label="table.field.order.type" /> + <TextField source="wkType" label="table.field.order.wkType" /> + <NumberField source="anfme" label="table.field.order.anfme" /> + + <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> + <OrderCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='Order Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default OrderList; diff --git a/rsf-admin/src/page/order/OrderPanel.jsx b/rsf-admin/src/page/order/OrderPanel.jsx new file mode 100644 index 0000000..5a18f22 --- /dev/null +++ b/rsf-admin/src/page/order/OrderPanel.jsx @@ -0,0 +1,87 @@ +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 OrderPanel = () => { + 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.order.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.order.code" + property={record.code} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.order.sourceCode" + property={record.sourceCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.order.sourceId" + property={record.sourceId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.order.type" + property={record.type} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.order.wkType" + property={record.wkType} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.order.anfme" + property={record.anfme} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default OrderPanel; diff --git a/rsf-admin/src/page/order/index.jsx b/rsf-admin/src/page/order/index.jsx new file mode 100644 index 0000000..634ab4c --- /dev/null +++ b/rsf-admin/src/page/order/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import OrderList from "./OrderList"; +import OrderEdit from "./OrderEdit"; + +export default { + list: OrderList, + edit: OrderEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.id}` + } +}; diff --git a/rsf-admin/src/page/orderItem/OrderItemCreate.jsx b/rsf-admin/src/page/orderItem/OrderItemCreate.jsx new file mode 100644 index 0000000..71904b9 --- /dev/null +++ b/rsf-admin/src/page/orderItem/OrderItemCreate.jsx @@ -0,0 +1,249 @@ +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 OrderItemCreate = (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.orderItem.orderId" + source="orderId" + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.orderCode" + source="orderCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.sourceItemId" + source="sourceItemId" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.matnrId" + source="matnrId" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.maktx" + source="maktx" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.anfme" + source="anfme" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.stockUnit" + source="stockUnit" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.workQty" + source="workQty" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.purQty" + source="purQty" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.purUnit" + source="purUnit" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.orderItem.qty" + source="qty" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrCode" + source="splrCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.batch" + source="batch" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrBatch" + source="splrBatch" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.splrName" + source="splrName" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.trackCode" + source="trackCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.barcode" + source="barcode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.prodTime" + source="prodTime" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.orderItem.packName" + source="packName" + 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 OrderItemCreate; diff --git a/rsf-admin/src/page/orderItem/OrderItemEdit.jsx b/rsf-admin/src/page/orderItem/OrderItemEdit.jsx new file mode 100644 index 0000000..2133716 --- /dev/null +++ b/rsf-admin/src/page/orderItem/OrderItemEdit.jsx @@ -0,0 +1,221 @@ +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 OrderItemEdit = () => { + 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}> + <NumberInput + label="table.field.orderItem.orderId" + source="orderId" + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.orderCode" + source="orderCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.sourceItemId" + source="sourceItemId" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.matnrId" + source="matnrId" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.maktx" + source="maktx" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.anfme" + source="anfme" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.stockUnit" + source="stockUnit" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.workQty" + source="workQty" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.purQty" + source="purQty" + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.purUnit" + source="purUnit" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.orderItem.qty" + source="qty" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrCode" + source="splrCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.batch" + source="batch" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrBatch" + source="splrBatch" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.splrName" + source="splrName" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.trackCode" + source="trackCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.barcode" + source="barcode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.prodTime" + source="prodTime" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.orderItem.packName" + source="packName" + parse={v => v} + /> + </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 OrderItemEdit; diff --git a/rsf-admin/src/page/orderItem/OrderItemList.jsx b/rsf-admin/src/page/orderItem/OrderItemList.jsx new file mode 100644 index 0000000..f90bde9 --- /dev/null +++ b/rsf-admin/src/page/orderItem/OrderItemList.jsx @@ -0,0 +1,190 @@ +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 OrderItemCreate from "./OrderItemCreate"; +import OrderItemPanel from "./OrderItemPanel"; +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'; + +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="orderId" label="table.field.orderItem.orderId" />, + <TextInput source="orderCode" label="table.field.orderItem.orderCode" />, + <TextInput source="sourceItemId" label="table.field.orderItem.sourceItemId" />, + <TextInput source="matnrId" label="table.field.orderItem.matnrId" />, + <TextInput source="matnrCode" label="table.field.orderItem.matnrCode" />, + <TextInput source="maktx" label="table.field.orderItem.maktx" />, + <NumberInput source="anfme" label="table.field.orderItem.anfme" />, + <TextInput source="stockUnit" label="table.field.orderItem.stockUnit" />, + <NumberInput source="workQty" label="table.field.orderItem.workQty" />, + <NumberInput source="purQty" label="table.field.orderItem.purQty" />, + <TextInput source="purUnit" label="table.field.orderItem.purUnit" />, + <NumberInput source="qty" label="table.field.orderItem.qty" />, + <TextInput source="splrCode" label="table.field.orderItem.splrCode" />, + <TextInput source="batch" label="table.field.orderItem.batch" />, + <TextInput source="splrBatch" label="table.field.orderItem.splrBatch" />, + <TextInput source="splrName" label="table.field.orderItem.splrName" />, + <TextInput source="trackCode" label="table.field.orderItem.trackCode" />, + <TextInput source="barcode" label="table.field.orderItem.barcode" />, + <TextInput source="prodTime" label="table.field.orderItem.prodTime" />, + <TextInput source="packName" label="table.field.orderItem.packName" />, + + <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 OrderItemList = () => { + 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.orderItem"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='orderItem' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='orderItem' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <OrderItemPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <NumberField source="orderId" label="table.field.orderItem.orderId" /> + <TextField source="orderCode" label="table.field.orderItem.orderCode" /> + <TextField source="sourceItemId" label="table.field.orderItem.sourceItemId" /> + <TextField source="matnrId" label="table.field.orderItem.matnrId" /> + <TextField source="matnrCode" label="table.field.orderItem.matnrCode" /> + <TextField source="maktx" label="table.field.orderItem.maktx" /> + <NumberField source="anfme" label="table.field.orderItem.anfme" /> + <TextField source="stockUnit" label="table.field.orderItem.stockUnit" /> + <NumberField source="workQty" label="table.field.orderItem.workQty" /> + <NumberField source="purQty" label="table.field.orderItem.purQty" /> + <TextField source="purUnit" label="table.field.orderItem.purUnit" /> + <NumberField source="qty" label="table.field.orderItem.qty" /> + <TextField source="splrCode" label="table.field.orderItem.splrCode" /> + <TextField source="batch" label="table.field.orderItem.batch" /> + <TextField source="splrBatch" label="table.field.orderItem.splrBatch" /> + <TextField source="splrName" label="table.field.orderItem.splrName" /> + <TextField source="trackCode" label="table.field.orderItem.trackCode" /> + <TextField source="barcode" label="table.field.orderItem.barcode" /> + <TextField source="prodTime" label="table.field.orderItem.prodTime" /> + <TextField source="packName" label="table.field.orderItem.packName" /> + + <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> + <TextField source="nickname" /> + </ReferenceField> + <DateField source="updateTime" label="common.field.updateTime" showTime /> + <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> + <TextField source="nickname" /> + </ReferenceField> + <DateField source="createTime" label="common.field.createTime" showTime /> + <BooleanField source="statusBool" label="common.field.status" sortable={false} /> + <TextField source="memo" label="common.field.memo" sortable={false} /> + <WrapperField cellClassName="opt" label="common.field.opt"> + <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> + <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> + </WrapperField> + </StyledDatagrid> + </List> + <OrderItemCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='OrderItem Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default OrderItemList; diff --git a/rsf-admin/src/page/orderItem/OrderItemPanel.jsx b/rsf-admin/src/page/orderItem/OrderItemPanel.jsx new file mode 100644 index 0000000..43a4681 --- /dev/null +++ b/rsf-admin/src/page/orderItem/OrderItemPanel.jsx @@ -0,0 +1,171 @@ +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 OrderItemPanel = () => { + 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.orderItem.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.orderItem.orderId" + property={record.orderId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.orderCode" + property={record.orderCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.sourceItemId" + property={record.sourceItemId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.matnrId" + property={record.matnrId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.matnrCode" + property={record.matnrCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.maktx" + property={record.maktx} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.anfme" + property={record.anfme} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.stockUnit" + property={record.stockUnit} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.workQty" + property={record.workQty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.purQty" + property={record.purQty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.purUnit" + property={record.purUnit} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.qty" + property={record.qty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.splrCode" + property={record.splrCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.batch" + property={record.batch} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.splrBatch" + property={record.splrBatch} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.splrName" + property={record.splrName} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.trackCode" + property={record.trackCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.barcode" + property={record.barcode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.prodTime" + property={record.prodTime} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.orderItem.packName" + property={record.packName} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default OrderItemPanel; diff --git a/rsf-admin/src/page/orderItem/index.jsx b/rsf-admin/src/page/orderItem/index.jsx new file mode 100644 index 0000000..0382eef --- /dev/null +++ b/rsf-admin/src/page/orderItem/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import OrderItemList from "./OrderItemList"; +import OrderItemEdit from "./OrderItemEdit"; + +export default { + list: OrderItemList, + edit: OrderItemEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.id}` + } +}; diff --git a/rsf-admin/src/page/orders/asnOrder/AsnOrderItemEdit.jsx b/rsf-admin/src/page/orders/asnOrder/AsnOrderItemEdit.jsx index 0ed7504..1dfd40c 100644 --- a/rsf-admin/src/page/orders/asnOrder/AsnOrderItemEdit.jsx +++ b/rsf-admin/src/page/orders/asnOrder/AsnOrderItemEdit.jsx @@ -149,6 +149,7 @@ <NumberInput label="table.field.asnOrderItem.qty" source="qty" + readOnly /> <TextInput label="table.field.asnOrderItem.splrCode" @@ -169,8 +170,9 @@ /> <TextInput label="table.field.asnOrderItem.barcode" - source="barcode" + source="trackCode" parse={v => v} + readOnly /> <TextInput label="table.field.asnOrderItem.packName" diff --git a/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx b/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx index 9dca697..26ed4ed 100644 --- a/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx +++ b/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx @@ -1,10 +1,10 @@ import { Dialog, DialogTitle, Box, DialogActions, DialogContent } from "@mui/material"; import React, { useState, useRef, useEffect, useMemo, useCallback, Form } from "react"; import { styled } from '@mui/material/styles'; -import { FilterButton, TopToolbar, Toolbar, useTranslate, SaveButton, List, SelectInput, NumberField, WrapperField, EditButton, DeleteButton, TextField, DateField, TextInput, BooleanField, NumberInput, ReferenceField, SearchInput, SelectColumnsButton, DatagridConfigurable, Button, useRefresh } from "react-admin"; +import { FilterButton, TopToolbar, Toolbar, useTranslate, SaveButton, List, useRecordSelection, SelectInput, NumberField, WrapperField, EditButton, DeleteButton, TextField, DateField, TextInput, BooleanField, NumberInput, ReferenceField, SearchInput, SelectColumnsButton, DatagridConfigurable, Button, useRefresh, useRecordContext, useNotify } from "react-admin"; import DialogCloseButton from "../components/DialogCloseButton"; import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; - +import request from '@/utils/request'; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { height: '.9em' @@ -20,19 +20,21 @@ })); const SelectSiteModel = (props) => { - const { open, setOpen, record } = props; + const { open, setOpen, source } = props; const translate = useTranslate(); const [drawerVal, setDrawerVal] = useState(false); const refresh = useRefresh(); + const notify = useNotify(); const handleClose = (event, reason) => { if (reason !== "backdropClick") { setOpen(false); } }; - + console.log(source); return ( <Box> <Dialog + sx={{width: '90%'}} open={open} onClose={handleClose} fullWidth @@ -67,12 +69,17 @@ preferenceKey='deviceSite' bulkActionButtons={false} rowClick='toggleSelection' - onToggleItem={(id, resource, record)=>{ - console.log(id); + onToggleItem={async (id)=>{ setOpen(false); - refresh(); + const res = await request.post(`/waitPakin/merge`, {waitPakins: source, siteId: id}); + if (res?.data?.code === 200) { + refresh(); + notify(res.data.msg); + } else { + notify(res.data.msg); + } }} - omit={['id', 'createTime', 'createBy', 'memo', 'updateBy$', 'createBy$', 'createTime', 'updateTime']} + omit={['id','name', 'createTime','label', 'createBy', 'memo', 'updateBy$', 'createBy$', 'createTime', 'updateTime']} > <NumberField source="id" /> <TextField source="name" label="table.field.deviceSite.name" /> @@ -89,11 +96,9 @@ <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> - <Button label="toolbar.selectSite" onClick={(id, resource, record)=>{ - console.log(id); + <WrapperField cellClassName="opt" label="common.field.opt"> + <Button label="toolbar.selectSite" onClick={(event)=>{ setOpen(false) - refresh(); }}/> </WrapperField> </StyledDatagrid> diff --git a/rsf-admin/src/page/waitPakin/WaitPakinList.jsx b/rsf-admin/src/page/waitPakin/WaitPakinList.jsx index 6b8f102..c306d20 100644 --- a/rsf-admin/src/page/waitPakin/WaitPakinList.jsx +++ b/rsf-admin/src/page/waitPakin/WaitPakinList.jsx @@ -91,7 +91,34 @@ const translate = useTranslate(); const [createDialog, setCreateDialog] = useState(false); const [siteDialog, setSiteDialog] = useState(false); + const [source, setSource] = useState(false); const [drawerVal, setDrawerVal] = useState(false); + + const CreateTaskButton = () => { + const record = useRecordContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const { selectedIds, onUnselectItems, data } = useListContext(); + const rows = data.filter(map => selectedIds.includes(map.id)); + const createTask = () => { + setSiteDialog(true) + setSource(rows) + refresh() + } + + return ( + <> + <Button onClick={() => createTask()} label={"toolbar.createTask"}> + <AddIcon /> + </Button> + </> + ) + } + + const BulkActionButtons = () => { + + } + return ( <Box display="flex"> @@ -120,12 +147,12 @@ > <StyledDatagrid preferenceKey='waitPakin' - bulkActionButtons={<Box> <Button label="ra.action.edit" onClick={() => { - setSiteDialog(true) - }} /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></Box>} + bulkActionButtons={ + <> + <CreateTaskButton /> + <BulkDeleteButton mutationMode={OPERATE_MODE} /> + </>} rowClick='edit' - expand={false} - expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > <NumberField source="id" /> @@ -146,7 +173,7 @@ </WrapperField> </StyledDatagrid> </List> - <SelectSiteModel open={siteDialog} setOpen={setSiteDialog} /> + <SelectSiteModel open={siteDialog} setOpen={setSiteDialog} source={source} /> <WaitPakinCreate open={createDialog} setOpen={setCreateDialog} @@ -163,34 +190,4 @@ export default WaitPakinList; -const CreateTaskButton = () => { - const record = useRecordContext(); - const [siteDialog, setSiteDialog] = useState(false); - const notify = useNotify(); - const refresh = useRefresh(); - const { selectedIds, onUnselectItems, data } = useListContext(); - const createTask = () => { - // const rows = data.filter((item) => selectedIds.includes(item.id)) || []; - // const res = await request.post(`/waitPakin/merge`, rows); - // if (res?.data?.code === 200) { - // refresh(); - // notify(res.data.msg); - // } else { - // notify(res.data.msg); - // } - console.log('-------->'); - setSiteDialog(true) - - } - // return ( - // <ConfirmButton label={"toolbar.createTask"} startIcon={<TaskIcon />} onConfirm={createTask} /> - // ) - return ( - <> - <Button onClick={() => createTask()} label={"toolbar.createTask"}> - <AddIcon /> - </Button> - </> - ) -} 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 fd4f57b..bf648fa 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 @@ -22,8 +22,8 @@ // generator.username="sa"; // generator.password="Zoneyung@zy56$"; - generator.table="man_task_item_log"; - generator.tableDesc="浠诲姟宸ヤ綔妗�"; + generator.table="man_order_item"; + 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/OrderController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderController.java new file mode 100644 index 0000000..e026ce2 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderController.java @@ -0,0 +1,110 @@ +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.Order; +import com.vincent.rsf.server.manager.service.OrderService; +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 OrderController extends BaseController { + + @Autowired + private OrderService orderService; + + @PreAuthorize("hasAuthority('manager:order:list')") + @PostMapping("/order/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<Order, BaseParam> pageParam = new PageParam<>(baseParam, Order.class); + return R.ok().add(orderService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:order:list')") + @PostMapping("/order/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(orderService.list()); + } + + @PreAuthorize("hasAuthority('manager:order:list')") + @PostMapping({"/order/many/{ids}", "/orders/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(orderService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:order:list')") + @GetMapping("/order/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(orderService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:order:save')") + @OperationLog("Create 缁煎悎璁㈠崟绠$悊") + @PostMapping("/order/save") + public R save(@RequestBody Order order) { + order.setCreateBy(getLoginUserId()); + order.setCreateTime(new Date()); + order.setUpdateBy(getLoginUserId()); + order.setUpdateTime(new Date()); + if (!orderService.save(order)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(order); + } + + @PreAuthorize("hasAuthority('manager:order:update')") + @OperationLog("Update 缁煎悎璁㈠崟绠$悊") + @PostMapping("/order/update") + public R update(@RequestBody Order order) { + order.setUpdateBy(getLoginUserId()); + order.setUpdateTime(new Date()); + if (!orderService.updateById(order)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(order); + } + + @PreAuthorize("hasAuthority('manager:order:remove')") + @OperationLog("Delete 缁煎悎璁㈠崟绠$悊") + @PostMapping("/order/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!orderService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:order:list')") + @PostMapping("/order/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<Order> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(Order::getId, condition); + } + orderService.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:order:list')") + @PostMapping("/order/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(orderService.list(), Order.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderItemController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderItemController.java new file mode 100644 index 0000000..01ad696 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/OrderItemController.java @@ -0,0 +1,110 @@ +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.OrderItem; +import com.vincent.rsf.server.manager.service.OrderItemService; +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 OrderItemController extends BaseController { + + @Autowired + private OrderItemService orderItemService; + + @PreAuthorize("hasAuthority('manager:orderItem:list')") + @PostMapping("/orderItem/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<OrderItem, BaseParam> pageParam = new PageParam<>(baseParam, OrderItem.class); + return R.ok().add(orderItemService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:orderItem:list')") + @PostMapping("/orderItem/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(orderItemService.list()); + } + + @PreAuthorize("hasAuthority('manager:orderItem:list')") + @PostMapping({"/orderItem/many/{ids}", "/orderItems/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(orderItemService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:orderItem:list')") + @GetMapping("/orderItem/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(orderItemService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:orderItem:save')") + @OperationLog("Create 缁煎悎璁㈠崟鏄庣粏绠$悊") + @PostMapping("/orderItem/save") + public R save(@RequestBody OrderItem orderItem) { + orderItem.setCreateBy(getLoginUserId()); + orderItem.setCreateTime(new Date()); + orderItem.setUpdateBy(getLoginUserId()); + orderItem.setUpdateTime(new Date()); + if (!orderItemService.save(orderItem)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(orderItem); + } + + @PreAuthorize("hasAuthority('manager:orderItem:update')") + @OperationLog("Update 缁煎悎璁㈠崟鏄庣粏绠$悊") + @PostMapping("/orderItem/update") + public R update(@RequestBody OrderItem orderItem) { + orderItem.setUpdateBy(getLoginUserId()); + orderItem.setUpdateTime(new Date()); + if (!orderItemService.updateById(orderItem)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(orderItem); + } + + @PreAuthorize("hasAuthority('manager:orderItem:remove')") + @OperationLog("Delete 缁煎悎璁㈠崟鏄庣粏绠$悊") + @PostMapping("/orderItem/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!orderItemService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:orderItem:list')") + @PostMapping("/orderItem/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<OrderItem> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(OrderItem::getId, condition); + } + orderItemService.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:orderItem:list')") + @PostMapping("/orderItem/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(orderItemService.list(), OrderItem.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaitPakinController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaitPakinController.java index 4a674b5..ceea18d 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaitPakinController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WaitPakinController.java @@ -10,6 +10,7 @@ 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.controller.params.GenerateTaskParams; import com.vincent.rsf.server.manager.controller.params.WaitPakinParam; import com.vincent.rsf.server.manager.entity.TaskItem; import com.vincent.rsf.server.manager.entity.WaitPakin; @@ -150,11 +151,14 @@ @PreAuthorize("hasAuthority('manager:waitPakin:update')") @ApiOperation("鐢熸垚浠诲姟鍒楄〃") @PostMapping("/waitPakin/merge") - public R generateTask(@RequestBody List<WaitPakin> waitPakin) { - if (Objects.isNull(waitPakin) || waitPakin.isEmpty()) { + public R generateTask(@RequestBody GenerateTaskParams taskParams) { + if (Objects.isNull(taskParams)) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒"); } - return taskService.generateTasks(waitPakin, getLoginUserId()); + if (Objects.isNull(taskParams.getWaitPakins()) || taskParams.getWaitPakins().isEmpty()) { + throw new CoolException("缁勬嫋妗d笉鑳戒负绌猴紒锛�"); + } + return taskService.generateTasks(taskParams, getLoginUserId()); } } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/GenerateTaskParams.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/GenerateTaskParams.java new file mode 100644 index 0000000..3172a32 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/GenerateTaskParams.java @@ -0,0 +1,29 @@ +package com.vincent.rsf.server.manager.controller.params; + +import com.vincent.rsf.server.manager.entity.WaitPakin; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Ryan + * @version 1.0 + * @title GenerateTaskParams + * @description + * @create 2025/4/15 09:54 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "GenerateTaskParams", description = "鐢熸垚浠诲姟鍙傛暟") +public class GenerateTaskParams implements Serializable { + + @ApiModelProperty("缁勬嫋妗�") + public List<WaitPakin> waitPakins; + + @ApiModelProperty("绔欑偣ID") + public Long siteId; +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Order.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Order.java new file mode 100644 index 0000000..c5b6cb7 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Order.java @@ -0,0 +1,218 @@ +package com.vincent.rsf.server.manager.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.text.SimpleDateFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +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_order") +public class Order implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 缂栧彿 + */ + @ApiModelProperty(value= "缂栧彿") + private String code; + + /** + * 婧愬崟鎹紪鐮� + */ + @ApiModelProperty(value= "婧愬崟鎹紪鐮�") + private String sourceCode; + + /** + * 婧愬崟鎹甀D + */ + @ApiModelProperty(value= "婧愬崟鎹甀D") + private Long sourceId; + + /** + * 鍗曟嵁绫诲瀷 + */ + @ApiModelProperty(value= "鍗曟嵁绫诲瀷") + private String type; + + /** + * 涓氬姟绫诲瀷 + */ + @ApiModelProperty(value= "涓氬姟绫诲瀷") + private String wkType; + + /** + * 搴撳瓨鏁伴噺 + */ + @ApiModelProperty(value= "搴撳瓨鏁伴噺") + private Double anfme; + + /** + * 鐘舵�� 1: 姝e父 0: 鍐荤粨 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 鍐荤粨 ") + private Integer status; + + /** + * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ") + @TableLogic + private Integer deleted; + + /** + * 绉熸埛 + */ + @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; + + public Order() {} + + public Order(String code,String sourceCode,Long sourceId,String type,String wkType,Double anfme,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.code = code; + this.sourceCode = sourceCode; + this.sourceId = sourceId; + this.type = type; + this.wkType = wkType; + this.anfme = anfme; + this.status = status; + this.deleted = deleted; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// Order order = new Order( +// null, // 缂栧彿 +// null, // 婧愬崟鎹紪鐮� +// null, // 婧愬崟鎹甀D +// null, // 鍗曟嵁绫诲瀷[闈炵┖] +// null, // 涓氬姟绫诲瀷[闈炵┖] +// null, // 搴撳瓨鏁伴噺[闈炵┖] +// null, // 鐘舵�乕闈炵┖] +// null, // 鏄惁鍒犻櫎[闈炵┖] +// null, // 绉熸埛 +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿[闈炵┖] +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿[闈炵┖] +// null // 澶囨敞 +// ); + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "鍐荤粨"; + default: + return String.valueOf(this.status); + } + } + + 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/OrderItem.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/OrderItem.java new file mode 100644 index 0000000..fd261ff --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/OrderItem.java @@ -0,0 +1,330 @@ +package com.vincent.rsf.server.manager.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.text.SimpleDateFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +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_order_item") +public class OrderItem implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 涓诲崟ID + */ + @ApiModelProperty(value= "涓诲崟ID") + private Long orderId; + + /** + * 涓诲崟缂栧彿 + */ + @ApiModelProperty(value= "涓诲崟缂栧彿") + private String orderCode; + + /** + * 缂栧彿 + */ + @ApiModelProperty(value= "缂栧彿") + private String sourceItemId; + + /** + * 鐗╂枡ID + */ + @ApiModelProperty(value= "鐗╂枡ID") + private String matnrId; + + /** + * 鐗╂枡缂栫爜 + */ + @ApiModelProperty(value= "鐗╂枡缂栫爜") + private String matnrCode; + + /** + * 鐗╂枡鍚嶇О + */ + @ApiModelProperty(value= "鐗╂枡鍚嶇О") + private String maktx; + + /** + * 閫佽揣鏁伴噺 + */ + @ApiModelProperty(value= "閫佽揣鏁伴噺") + private Double anfme; + + /** + * 搴撳瓨鍗曚綅 + */ + @ApiModelProperty(value= "搴撳瓨鍗曚綅") + private String stockUnit; + + /** + * 鎵ц涓暟閲� + */ + @ApiModelProperty(value= "鎵ц涓暟閲�") + private Double workQty; + + /** + * 閲囪喘鏁伴噺 + */ + @ApiModelProperty(value= "閲囪喘鏁伴噺") + private Double purQty; + + /** + * 閲囪喘鍗曚綅 + */ + @ApiModelProperty(value= "閲囪喘鍗曚綅") + private String purUnit; + + /** + * 宸叉敹鏁伴噺 + */ + @ApiModelProperty(value= "宸叉敹鏁伴噺") + private Double qty; + + /** + * 渚涘簲鍟嗙紪鐮� + */ + @ApiModelProperty(value= "渚涘簲鍟嗙紪鐮�") + private String splrCode; + + /** + * 搴撳瓨鎵规 + */ + @ApiModelProperty(value= "搴撳瓨鎵规") + private String batch; + + /** + * 渚涘簲鍟嗘壒娆� + */ + @ApiModelProperty(value= "渚涘簲鍟嗘壒娆�") + private String splrBatch; + + /** + * 渚涘簲鍟嗗悕绉� + */ + @ApiModelProperty(value= "渚涘簲鍟嗗悕绉�") + private String splrName; + + /** + * 璺熻釜鐮� + */ + @ApiModelProperty(value= "璺熻釜鐮�") + private String trackCode; + + /** + * 鏉″舰鐮� + */ + @ApiModelProperty(value= "鏉″舰鐮�") + private String barcode; + + /** + * 鐢熶骇鏃ユ湡 + */ + @ApiModelProperty(value= "鐢熶骇鏃ユ湡") + private String prodTime; + + /** + * 鍖呰鍚嶇О + */ + @ApiModelProperty(value= "鍖呰鍚嶇О") + private String packName; + + /** + * 鐘舵�� 1: 姝e父 0: 鍐荤粨 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 鍐荤粨 ") + private Integer status; + + /** + * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ") + @TableLogic + private Integer deleted; + + /** + * 绉熸埛 + */ + @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; + + public OrderItem() {} + + public OrderItem(Long orderId,String orderCode,String sourceItemId,String matnrId,String matnrCode,String maktx,Double anfme,String stockUnit,Double workQty,Double purQty,String purUnit,Double qty,String splrCode,String batch,String splrBatch,String splrName,String trackCode,String barcode,String prodTime,String packName,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.orderId = orderId; + this.orderCode = orderCode; + this.sourceItemId = sourceItemId; + this.matnrId = matnrId; + this.matnrCode = matnrCode; + this.maktx = maktx; + this.anfme = anfme; + this.stockUnit = stockUnit; + this.workQty = workQty; + this.purQty = purQty; + this.purUnit = purUnit; + this.qty = qty; + this.splrCode = splrCode; + this.batch = batch; + this.splrBatch = splrBatch; + this.splrName = splrName; + this.trackCode = trackCode; + this.barcode = barcode; + this.prodTime = prodTime; + this.packName = packName; + this.status = status; + this.deleted = deleted; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// OrderItem orderItem = new OrderItem( +// null, // 涓诲崟ID +// null, // 涓诲崟缂栧彿 +// null, // 缂栧彿 +// null, // 鐗╂枡ID +// null, // 鐗╂枡缂栫爜 +// null, // 鐗╂枡鍚嶇О +// null, // 閫佽揣鏁伴噺[闈炵┖] +// null, // 搴撳瓨鍗曚綅 +// null, // 鎵ц涓暟閲廩闈炵┖] +// null, // 閲囪喘鏁伴噺[闈炵┖] +// null, // 閲囪喘鍗曚綅 +// null, // 宸叉敹鏁伴噺 +// null, // 渚涘簲鍟嗙紪鐮� +// null, // 搴撳瓨鎵规 +// null, // 渚涘簲鍟嗘壒娆� +// null, // 渚涘簲鍟嗗悕绉� +// null, // 璺熻釜鐮� +// null, // 鏉″舰鐮� +// null, // 鐢熶骇鏃ユ湡 +// null, // 鍖呰鍚嶇О +// null, // 鐘舵�乕闈炵┖] +// null, // 鏄惁鍒犻櫎[闈炵┖] +// null, // 绉熸埛 +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿[闈炵┖] +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿[闈炵┖] +// null // 澶囨敞 +// ); + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "鍐荤粨"; + default: + return String.valueOf(this.status); + } + } + + 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/mapper/OrderItemMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderItemMapper.java new file mode 100644 index 0000000..7833525 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderItemMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.mapper; + +import com.vincent.rsf.server.manager.entity.OrderItem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface OrderItemMapper extends BaseMapper<OrderItem> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderMapper.java new file mode 100644 index 0000000..69fdd58 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/OrderMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.mapper; + +import com.vincent.rsf.server.manager.entity.Order; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface OrderMapper extends BaseMapper<Order> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderItemService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderItemService.java new file mode 100644 index 0000000..99b4dcd --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderItemService.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.OrderItem; + +public interface OrderItemService extends IService<OrderItem> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderService.java new file mode 100644 index 0000000..772088d --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/OrderService.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.Order; + +public interface OrderService extends IService<Order> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java index 1b77afd..77ce80e 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java @@ -2,14 +2,14 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams; import com.vincent.rsf.server.manager.entity.Task; -import com.vincent.rsf.server.manager.entity.WaitPakin; import java.util.List; public interface TaskService extends IService<Task> { - R generateTasks(List<WaitPakin> waitPakin, Long loginUserId); + R generateTasks(GenerateTaskParams waitPakin, Long loginUserId); // R completeTask(String id); diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderItemServiceImpl.java new file mode 100644 index 0000000..897ef9d --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderItemServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.service.impl; + +import com.vincent.rsf.server.manager.mapper.OrderItemMapper; +import com.vincent.rsf.server.manager.entity.OrderItem; +import com.vincent.rsf.server.manager.service.OrderItemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("orderItemService") +public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem> implements OrderItemService { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderServiceImpl.java new file mode 100644 index 0000000..f523ebe --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OrderServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.service.impl; + +import com.vincent.rsf.server.manager.mapper.OrderMapper; +import com.vincent.rsf.server.manager.entity.Order; +import com.vincent.rsf.server.manager.service.OrderService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("orderService") +public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { + +} 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 cc757b4..cca988c 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 @@ -7,6 +7,7 @@ import com.vincent.rsf.framework.common.R; import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.api.entity.enums.TaskType; +import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams; import com.vincent.rsf.server.manager.entity.*; import com.vincent.rsf.server.manager.enums.PakinIOStatus; import com.vincent.rsf.server.manager.mapper.TaskMapper; @@ -49,6 +50,8 @@ private StockService stockService; @Autowired private StockItemService stockItemService; + @Autowired + private DeviceSiteService deviceSiteService; @@ -62,12 +65,17 @@ */ @Override @Transactional(rollbackFor = Exception.class) - public synchronized R generateTasks(List<WaitPakin> waitPakin, Long loginUserId) { - if (Objects.isNull(waitPakin) || waitPakin.isEmpty()) { + public synchronized R generateTasks(GenerateTaskParams waitPakin, Long loginUserId) { + if (Objects.isNull(waitPakin) || waitPakin.getWaitPakins().isEmpty()) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒"); } + + DeviceSite deviceSite = deviceSiteService.getById(waitPakin.getSiteId()); + if (Objects.isNull(deviceSite)) { + throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�"); + } /**鑾峰彇缁勬嫋*/ - List<Long> ids = waitPakin.stream().map(WaitPakin::getId).collect(Collectors.toList()); + List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList()); List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() .in(WaitPakin::getId, ids) .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); @@ -86,10 +94,10 @@ .setTaskType(TaskType.TASK_TYPE_IN.type.shortValue()) .setTargLoc(LocManageUtil.getTargetLoc()) .setBarcode(pakin.getBarcode()) + .setTargSite(deviceSite.getDeviceCode()) .setCreateBy(loginUserId) .setUpdateBy(loginUserId) .setTargSite(LocManageUtil.getTargetSite()); - if (!this.save(task)) { throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒"); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java index f2bd034..7687195 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java @@ -83,6 +83,8 @@ //鐘舵�佷慨鏀逛负鍏ュ簱涓� .setIoStatus(Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)) .setAnfme(sum) + .setUpdateBy(userId) + .setCreateBy(userId) .setBarcode(waitPakin.getBarcode()); if (!this.save(waitPakin1)) { throw new CoolException("涓诲崟淇濆瓨澶辫触锛侊紒"); @@ -129,7 +131,7 @@ .setMatnrCode(item.getMatnrCode()); for (PakinItem waitPakinItem : waitPakin.getItems()) { if (waitPakinItem.getTrackCode().equals(item.getTrackCode())) { - if (waitPakinItem.getReceiptQty() > item.getAnfme() && waitPakinItem.getReceiptQty().compareTo(0.0) >= 0) { + if (waitPakinItem.getReceiptQty() > item.getAnfme() || waitPakinItem.getReceiptQty().compareTo(0.0) >= 0) { throw new CoolException("缁勬嫋鏁伴噺涓嶈兘澶т簬鏀惰揣鏁伴噺锛侊紒"); } pakinItem.setAnfme(waitPakinItem.getReceiptQty()).setTrackCode(waitPakinItem.getTrackCode()); @@ -165,7 +167,7 @@ .setMatnrCode(item.getMatnrCode()); for (PakinItem waitPakinItem : waitPakin.getItems()) { if (waitPakinItem.getTrackCode().equals(item.getTrackCode())) { - if (waitPakinItem.getReceiptQty() > item.getAnfme() && waitPakinItem.getReceiptQty().compareTo(0.0) >= 0) { + if (waitPakinItem.getReceiptQty() > item.getAnfme() || waitPakinItem.getReceiptQty().compareTo(0.0) <= 0) { throw new CoolException("缁勬嫋鏁伴噺涓嶈兘澶т簬鏀惰揣鏁伴噺涓斾笉鑳藉皬浜庨浂锛侊紒"); } pakinItem.setAnfme(waitPakinItem.getReceiptQty()).setTrackCode(waitPakinItem.getTrackCode()); diff --git a/rsf-server/src/main/java/order.sql b/rsf-server/src/main/java/order.sql new file mode 100644 index 0000000..b2b71e1 --- /dev/null +++ b/rsf-server/src/main/java/order.sql @@ -0,0 +1,27 @@ +-- save order record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.order', '0', '/manager/order', 'order', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 缁煎悎璁㈠崟绠$悊', '', '1', 'manager:order:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 缁煎悎璁㈠崟绠$悊', '', '1', 'manager:order:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 缁煎悎璁㈠崟绠$悊', '', '1', 'manager:order:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 缁煎悎璁㈠崟绠$悊', '', '1', 'manager:order:remove', '3', '1', '1'); + +-- locale menu name +order: 'Order', + +-- locale field +order: { + code: "code", + sourceCode: "sourceCode", + sourceId: "sourceId", + type: "type", + wkType: "wkType", + anfme: "anfme", +}, + +-- ResourceContent +import order from './order'; + +case 'order': + return order; diff --git a/rsf-server/src/main/java/orderItem.sql b/rsf-server/src/main/java/orderItem.sql new file mode 100644 index 0000000..caba6ce --- /dev/null +++ b/rsf-server/src/main/java/orderItem.sql @@ -0,0 +1,41 @@ +-- save orderItem record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.orderItem', '0', '/manager/orderItem', 'orderItem', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 缁煎悎璁㈠崟鏄庣粏绠$悊', '', '1', 'manager:orderItem:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 缁煎悎璁㈠崟鏄庣粏绠$悊', '', '1', 'manager:orderItem:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 缁煎悎璁㈠崟鏄庣粏绠$悊', '', '1', 'manager:orderItem:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 缁煎悎璁㈠崟鏄庣粏绠$悊', '', '1', 'manager:orderItem:remove', '3', '1', '1'); + +-- locale menu name +orderItem: 'OrderItem', + +-- locale field +orderItem: { + orderId: "orderId", + orderCode: "orderCode", + sourceItemId: "sourceItemId", + matnrId: "matnrId", + matnrCode: "matnrCode", + maktx: "maktx", + anfme: "anfme", + stockUnit: "stockUnit", + workQty: "workQty", + purQty: "purQty", + purUnit: "purUnit", + qty: "qty", + splrCode: "splrCode", + batch: "batch", + splrBatch: "splrBatch", + splrName: "splrName", + trackCode: "trackCode", + barcode: "barcode", + prodTime: "prodTime", + packName: "packName", +}, + +-- ResourceContent +import orderItem from './orderItem'; + +case 'orderItem': + return orderItem; diff --git a/rsf-server/src/main/resources/mapper/manager/OrderItemMapper.xml b/rsf-server/src/main/resources/mapper/manager/OrderItemMapper.xml new file mode 100644 index 0000000..47ea752 --- /dev/null +++ b/rsf-server/src/main/resources/mapper/manager/OrderItemMapper.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.OrderItemMapper"> + +</mapper> diff --git a/rsf-server/src/main/resources/mapper/manager/OrderMapper.xml b/rsf-server/src/main/resources/mapper/manager/OrderMapper.xml new file mode 100644 index 0000000..04879be --- /dev/null +++ b/rsf-server/src/main/resources/mapper/manager/OrderMapper.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.OrderMapper"> + +</mapper> -- Gitblit v1.9.1