| | |
| | | VITE_BASE_IP=192.168.4.24 |
| | | VITE_BASE_IP=192.168.4.56 |
| | | # VITE_BASE_IP=47.76.147.249 |
| | | VITE_BASE_PORT=8080 |
| | |
| | | logs: 'Logs', |
| | | permissions: 'Permissions', |
| | | delivery: 'Delivery', |
| | | outStock: 'Out Stock', |
| | | outStockItem: 'Out Stock Item', |
| | | inStockPoces: 'In Stock Pocess', |
| | | outStockPoces: 'Out Stock Pocess', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | quality: "quality", |
| | | complete: "complete", |
| | | close: "close", |
| | | asnCreate: "asnCreate", |
| | | asnCreate: "Create By Order", |
| | | createTask: "createTask", |
| | | recover: "recover", |
| | | order: 'Orders', |
| | |
| | | logs: '日志', |
| | | permissions: '权限管理', |
| | | delivery: 'DO单', |
| | | |
| | | outStock: '出库单', |
| | | outStockItem: '出库单明细', |
| | | inStockPoces: '入库流程', |
| | | outStockPoces: '出库流程', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | ntyStatus: "上报状态", |
| | | exceStatus: '单据状态' |
| | | }, |
| | | outStock: { |
| | | code: "出库单号", |
| | | poCode: "平台单号", |
| | | poId: "PO标识", |
| | | type: "类型", |
| | | wkType: "业务类型", |
| | | anfme: "数量", |
| | | qty: "已出库数量", |
| | | logisNo: "物流单号", |
| | | arrTime: "预计到达时间", |
| | | rleStatus: "释放状态", |
| | | ntyStatus: "上报状态", |
| | | exceStatus: '单据状态' |
| | | }, |
| | | asnOrderItem: { |
| | | asnId: "主单标识", |
| | | asnCode: "主单编码", |
| | |
| | | stockUnit: "库存单位", |
| | | purQty: "采购量", |
| | | purUnit: "采购单位", |
| | | qty: "完成数量", |
| | | splrBatch: "供应商批次", |
| | | splrCode: "供应商编码", |
| | | splrName: "供应商名称", |
| | | qrcode: "二维码", |
| | | barcode: "条形码", |
| | | packName: "包装", |
| | | ntyStatus: "报检状态", |
| | | prodTime: "生产日期", |
| | | platItemId: '行号' |
| | | }, |
| | | outStockItem: { |
| | | asnId: "主单标识", |
| | | asnCode: "单号", |
| | | poDetlId: "平台明细ID", |
| | | matnrId: "物料标识", |
| | | maktx: "物料名称", |
| | | matnrCode: "物料编码", |
| | | anfme: "计划出库数", |
| | | stockUnit: "库存单位", |
| | | purQty: "下单数量", |
| | | purUnit: "单位", |
| | | qty: "完成数量", |
| | | splrBatch: "供应商批次", |
| | | splrCode: "供应商编码", |
| | |
| | | quality: "质检", |
| | | complete: "完成", |
| | | close: "关闭", |
| | | asnCreate: "通过ASN创建", |
| | | asnCreate: "通过单据创建", |
| | | createTask: "生成任务", |
| | | recover: "继续收货", |
| | | }, |
| | |
| | | import taskLog from './histories/taskLog'; |
| | | import stock from './orders/stock'; |
| | | import delivery from './orders/delivery'; |
| | | import outStock from './orders/outStock'; |
| | | |
| | | |
| | | const ResourceContent = (node) => { |
| | | switch (node.component) { |
| | |
| | | return stock; |
| | | case 'delivery': |
| | | return delivery; |
| | | case 'outStock': |
| | | return outStock; |
| | | default: |
| | | return { |
| | | list: ListGuesser, |
| | |
| | | <NumberInput |
| | | label="table.field.delivery.qty" |
| | | source="qty" |
| | | validate={required()} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.delivery.workQty" |
| | | source="workQty" |
| | | validate={required()} |
| | | /> |
| | | <TextInput |
| | | label="table.field.delivery.platCode" |
| | |
| | | <NumberInput |
| | | label="table.field.delivery.qty" |
| | | source="qty" |
| | | validate={required()} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.delivery.workQty" |
| | | source="workQty" |
| | | validate={required()} |
| | | /> |
| | | <TextInput |
| | | label="table.field.delivery.platCode" |
| | |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | ReferenceField, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | TextField, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | |
| | | return ( |
| | | <> |
| | | <CreateBase |
| | | resource="deliveryItem" |
| | | record={{}} |
| | | transform={(data) => { |
| | | return data; |
| | |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1} sx={{display : "none"}}> |
| | | <NumberInput |
| | | <Grid item xs={6} display="flex" gap={1} sx={{ display: "none" }}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.deliveryId" |
| | | source="deliveryId" |
| | | defaultValue={record?.id} |
| | | readOnly |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.platItemId" |
| | | source="platItemId" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.matnrCode" |
| | | source="matnrCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.matnrName" |
| | | source="matnrName" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.fieldsIndex" |
| | | source="fieldsIndex" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.unit" |
| | | source="unit" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.anfme" |
| | | source="anfme" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.qty" |
| | | source="qty" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.nromQty" |
| | | source="nromQty" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.printQty" |
| | | source="printQty" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.splrName" |
| | | source="splrName" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | <ReferenceInput source="splrName" reference="companys" label="table.field.deliveryItem.splrName" queryOptions={{ type: 'supplier' }}> |
| | | <AutocompleteInput |
| | | label="table.field.deliveryItem.splrName" |
| | | optionText="name" |
| | | source="splrCode" |
| | | /> |
| | | </ReferenceInput> |
| | | {/* <TextInput |
| | | label="table.field.deliveryItem.splrCode" |
| | | source="splrCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | /> */} |
| | | <TextInput |
| | | label="table.field.deliveryItem.splrBatch" |
| | | source="splrBatch" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { useLocation, useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [editDialog, setEditDialog] = useState(false); |
| | | const location = useLocation(); |
| | | const [select, setSelect] = useState({}); |
| | | const { data: dicts, isPending, error } = useGetOne('delivery', { id: doId }); |
| | | return ( |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.deliveryItem"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{deliveryId: doId}} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | |
| | | <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"> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} redirect={location.pathname + '/' + doId} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
New file |
| | |
| | | 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 OutOrderCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_order_type')) || []; |
| | | const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | 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 |
| | | resource="outStock" |
| | | > |
| | | <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={12} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.asnOrder.poCode" |
| | | source="poCode" |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.asnOrder.poId" |
| | | source="poId" |
| | | /> |
| | | {/* <AutocompleteInput |
| | | choices={dicts} |
| | | optionText="label" |
| | | label="table.field.asnOrder.type" |
| | | source="type" |
| | | optionValue="value" |
| | | validate={required()} |
| | | parse={v => v} |
| | | /> */} |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <AutocompleteInput |
| | | choices={business} |
| | | optionText="label" |
| | | label="table.field.asnOrder.wkType" |
| | | source="wkType" |
| | | optionValue="value" |
| | | validate={required()} |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.asnOrder.anfme" |
| | | source="anfme" |
| | | validate={required()} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.asnOrder.qty" |
| | | source="qty" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.asnOrder.logisNo" |
| | | source="logisNo" |
| | | parse={v => v} |
| | | /> |
| | | <DateInput |
| | | label="table.field.asnOrder.arrTime" |
| | | source="arrTime" |
| | | /> |
| | | <SelectInput |
| | | label="table.field.asnOrder.rleStatus" |
| | | source="rleStatus" |
| | | choices={[ |
| | | { id: 0, name: ' 正常' }, |
| | | { id: 1, name: ' 已释放' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={4} 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 OutOrderCreate; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | | useTranslate, |
| | | TextInput, |
| | | DateInput, |
| | | SelectInput, |
| | | AutocompleteInput, |
| | | SaveButton, |
| | | Toolbar, |
| | | required, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "../../components/EditBaseAside"; |
| | | import CustomerTopToolBar from "../../components/EditTopToolBar"; |
| | | import OutOrderItemList from "./OutOrderItemList"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'end' }}> |
| | | <></> |
| | | {/* <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> */} |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const OutOrderEdit = () => { |
| | | const translate = useTranslate(); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_order_type')) || []; |
| | | const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | |
| | | return ( |
| | | <> |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '100%' }} rowSpacing={3} columnSpacing={3} |
| | | sx={{ |
| | | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | |
| | | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | "& .MuiFilledInput-root.MuiInputBase-sizeSmall": { |
| | | bgcolor: 'white', |
| | | } |
| | | }} |
| | | > |
| | | <Grid item xs={24} md={12} > |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.outStock.code" |
| | | source="code" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStock.poCode" |
| | | source="poCode" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <AutocompleteInput |
| | | choices={dicts} |
| | | optionText="label" |
| | | label="table.field.outStock.type" |
| | | source="type" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | readOnly |
| | | /> |
| | | <AutocompleteInput |
| | | choices={business} |
| | | optionText="label" |
| | | label="table.field.outStock.wkType" |
| | | source="wkType" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.outStock.logisNo" |
| | | source="logisNo" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStock.anfme" |
| | | source="anfme" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStock.qty" |
| | | source="qty" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <DateInput |
| | | label="table.field.outStock.arrTime" |
| | | source="arrTime" |
| | | readOnly |
| | | /> |
| | | <SelectInput |
| | | label="table.field.outStock.rleStatus" |
| | | source="rleStatus" |
| | | readOnly |
| | | choices={[ |
| | | { id: 0, name: ' 正常' }, |
| | | { id: 1, name: ' 已释放' }, |
| | | ]} |
| | | validate={required()} |
| | | /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | <OutOrderItemList /> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default OutOrderEdit; |
New file |
| | |
| | | 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 OutOrderItemCreate = (props) => { |
| | | const { open, setOpen, record } = 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 |
| | | resource="outStockItem" |
| | | 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> |
| | | <Grid item xs={6} display="flex" gap={2}> |
| | | <NumberInput |
| | | label="table.field.outStockItem.asnId" |
| | | source="asnId" |
| | | readOnly |
| | | hidden |
| | | defaultValue={record?.id} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.asnCode" |
| | | source="asnCode" |
| | | readOnly |
| | | defaultValue={record?.code} |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.poDetlId" |
| | | source="poDetlId" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.outStockItem.matnrId" |
| | | source="matnrId" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.maktx" |
| | | source="maktx" |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.outStockItem.anfme" |
| | | source="anfme" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.outStockItem.stockUnit" |
| | | source="stockUnit" |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.outStockItem.purQty" |
| | | source="purQty" |
| | | validate={required()} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.purUnit" |
| | | source="purUnit" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.outStockItem.qty" |
| | | source="qty" |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.splrCode" |
| | | source="splrCode" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.splrName" |
| | | source="splrName" |
| | | parse={v => v} |
| | | /> |
| | | |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.outStockItem.qrcode" |
| | | source="qrcode" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.barcode" |
| | | source="barcode" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.packName" |
| | | source="packName" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | <Grid item xs={4} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1}> |
| | | <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 OutOrderItemCreate; |
New file |
| | |
| | | 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, |
| | | Form, |
| | | useRecordContext, |
| | | useGetOne, |
| | | DeleteButton, |
| | | EditBase, |
| | | ReferenceField, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | 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: 'end' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const OutOrderItemEdit = (props) => { |
| | | const { open, setOpen, record } = props; |
| | | const translate = useTranslate(); |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | const { data, isPending, } = useGetOne('outStockItem', { id: record?.id }); |
| | | if (data == null || data == undefined) { return } |
| | | |
| | | return ( |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="md" |
| | | > |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {translate('update.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <EditBase |
| | | id={record?.id} |
| | | resource="outStockItem" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | > |
| | | <Form |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '100%' }}> |
| | | <Grid item xs={24} md={14}> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.outStockItem.asnId" |
| | | source="asnId" |
| | | readOnly |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.asnCode" |
| | | source="asnCode" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.poDetlId" |
| | | source="poDetlId" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.poDetlCode" |
| | | source="poDetlCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.outStockItem.matnrId" |
| | | source="matnrId" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.maktx" |
| | | source="maktx" |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.outStockItem.anfme" |
| | | source="anfme" |
| | | validate={required()} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.stockUnit" |
| | | source="stockUnit" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.outStockItem.purQty" |
| | | source="purQty" |
| | | validate={required()} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.purUnit" |
| | | source="purUnit" |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.outStockItem.qty" |
| | | source="qty" |
| | | readOnly |
| | | /> |
| | | <ReferenceInput source="splrName" label="table.field.outStockItem.splrName" reference="companys" filter={{type: 'supplier'}}> |
| | | <AutocompleteInput optionText="name" label="table.field.outStockItem.splrName" /> |
| | | </ReferenceInput> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.outStockItem.qrcode" |
| | | source="qrcode" |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.barcode" |
| | | source="trackCode" |
| | | parse={v => v} |
| | | readOnly |
| | | /> |
| | | <TextInput |
| | | label="table.field.outStockItem.packName" |
| | | source="packName" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'end' }} > |
| | | <SaveButton type="button" mutationOptions={{ |
| | | onSuccess: () => { |
| | | setOpen(false) |
| | | } |
| | | }} /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </EditBase > |
| | | </DialogContent> |
| | | </Dialog> |
| | | ) |
| | | } |
| | | |
| | | export default OutOrderItemEdit; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate, useLocation } 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, |
| | | Button, |
| | | useEditContext, |
| | | useGetRecordId, |
| | | useGetOne |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack, Dialog, DialogActions, DialogTitle } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import OutOrderItemCreate from "./OutOrderItemCreate"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import OutOrderItemEdit from "./OutOrderItemEdit"; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | |
| | | 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 />, |
| | | <NumberInput source="asnId" label="table.field.outStockItem.asnId" />, |
| | | <TextInput source="asnCode" label="table.field.outStockItem.asnCode" alwaysOn/>, |
| | | <TextInput source="poDetlId" label="table.field.outStockItem.poDetlId" />, |
| | | <TextInput source="matnrId" label="table.field.outStockItem.matnrId" />, |
| | | <TextInput source="maktx" label="table.field.outStockItem.maktx" alwaysOn/>, |
| | | <TextInput source="matnrCode" label="table.field.outStockItem.matnrCode" alwaysOn/>, |
| | | <NumberInput source="anfme" label="table.field.outStockItem.anfme" />, |
| | | <TextInput source="stockUnit" label="table.field.outStockItem.stockUnit" />, |
| | | <NumberInput source="purQty" label="table.field.outStockItem.purQty" />, |
| | | <TextInput source="purUnit" label="table.field.outStockItem.purUnit" />, |
| | | <NumberInput source="qty" label="table.field.outStockItem.qty" />, |
| | | <TextInput source="splrCode" label="table.field.outStockItem.splrCode" />, |
| | | <TextInput source="splrName" label="table.field.outStockItem.splrName" />, |
| | | <TextInput source="qrcode" label="table.field.outStockItem.qrcode" />, |
| | | <TextInput source="trackCode" label="table.field.outStockItem.barcode" />, |
| | | <TextInput source="packName" label="table.field.outStockItem.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 OutOrderItemList = () => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [editDialog, setEditDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [select, setSelect] = useState({}); |
| | | const asnId = useGetRecordId(); |
| | | const { data: dicts, isPending, error } = useGetOne('outStock', { id: asnId }); |
| | | |
| | | return ( |
| | | <> |
| | | <Box display="flex"> |
| | | <List |
| | | resource="outStockItem" |
| | | storeKey='outStockItem' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.outStockItem"} |
| | | empty={false} |
| | | filter={{ asnId: asnId, deleted: 0 }} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='outStockItem' /> |
| | | {/* <MyExportButton /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='outStockItem' |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => { |
| | | setSelect(record) |
| | | setEditDialog(true) |
| | | }} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poDetlId', 'matnrId', 'asnId']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="asnId" label="table.field.outStockItem.asnId" /> |
| | | <TextField source="asnCode" label="table.field.outStockItem.asnCode" /> |
| | | <TextField source="poDetlId" label="table.field.outStockItem.poDetlId" /> |
| | | <TextField source="matnrId" label="table.field.outStockItem.matnrId" /> |
| | | <TextField source="matnrCode" label="table.field.outStockItem.matnrCode" /> |
| | | <TextField source="maktx" label="table.field.outStockItem.maktx" /> |
| | | <NumberField source="anfme" label="table.field.outStockItem.anfme" /> |
| | | <TextField source="stockUnit" label="table.field.outStockItem.stockUnit" /> |
| | | <NumberField source="purQty" label="table.field.outStockItem.purQty" /> |
| | | <TextField source="purUnit" label="table.field.outStockItem.purUnit" /> |
| | | <NumberField source="qty" label="table.field.outStockItem.qty" /> |
| | | <TextField source="splrCode" label="table.field.outStockItem.splrCode" /> |
| | | <TextField source="splrName" label="table.field.outStockItem.splrName" /> |
| | | <TextField source="qrcode" label="table.field.outStockItem.qrcode" /> |
| | | <TextField source="trackCode" label="table.field.outStockItem.barcode" /> |
| | | <TextField source="packName" label="table.field.outStockItem.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="status$" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <OutOrderItemCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | record={dicts} |
| | | /> |
| | | <OutOrderItemEdit |
| | | open={editDialog} |
| | | setOpen={setEditDialog} |
| | | record={select} |
| | | /> |
| | | <PageDrawer |
| | | title='OutStockItem Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | </> |
| | | ) |
| | | } |
| | | OutOrderItemList.Context = React.createContext() |
| | | |
| | | export default OutOrderItemList; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useLocation, useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | useDataProvider, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useRefresh, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Button, |
| | | useRedirect, |
| | | useUnselectAll, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import BillStatusField from '../../components/BillStatusField'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import request from '@/utils/request'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | import DetailsIcon from '@mui/icons-material/Details'; |
| | | import CancelIcon from '@mui/icons-material/Cancel'; |
| | | import OutOrderCreate from "./OutOrderCreate"; |
| | | import AddIcon from '@mui/icons-material/Add'; |
| | | import OutOrderModal from "./OutOrderModal"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 220 |
| | | }, |
| | | '& .wkType': { |
| | | width: 110 |
| | | }, |
| | | '& .status': { |
| | | width: 90 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <TextInput source="code" label="table.field.outStock.code" alwaysOn />, |
| | | <TextInput source="poCode" label="table.field.outStock.poCode" />, |
| | | <NumberInput source="poId" label="table.field.outStock.poId" />, |
| | | <ReferenceInput source="type" reference="dictData" filter={{ dictTypeCode: 'sys_business_type' }} label="table.field.outStock.type" alwaysOn> |
| | | <AutocompleteInput label="table.field.outStock.type" optionValue="value" /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_business_type' }} label="table.field.outStock.wkType" alwaysOn> |
| | | <AutocompleteInput label="table.field.outStock.wkType" optionValue="value" /> |
| | | </ReferenceInput>, |
| | | <NumberInput source="anfme" label="table.field.outStock.anfme" />, |
| | | <NumberInput source="qty" label="table.field.outStock.qty" />, |
| | | <TextInput source="logisNo" label="table.field.outStock.logisNo" />, |
| | | <DateInput source="arrTime" label="table.field.outStock.arrTime" />, |
| | | <SelectInput source="rleStatus" label="table.field.outStock.rleStatus" |
| | | choices={[ |
| | | { id: 0, name: ' 正常' }, |
| | | { id: 1, name: ' 已释放' }, |
| | | ]} |
| | | />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <DictionarySelect |
| | | label='table.field.outStock.exceStatus' |
| | | name="exceStatus" |
| | | dictTypeCode="sys_asn_exce_status" |
| | | alwaysOn |
| | | />, |
| | | |
| | | ] |
| | | |
| | | const OutOrderList = (props) => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [manualDialog, setManualDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [select, setSelect] = useState(0); |
| | | const billReload = useRef(); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | resource="outStock" |
| | | storeKey='outStock' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.outStock"} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ deleted: 0, type: 'out' }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog}/> |
| | | <MyCreateButton onClick={() => { setManualDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='outStock' /> |
| | | <ImportButton value={'asnOrderItem'} /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | sx={{ width: '100%' }} |
| | | preferenceKey='outStock' |
| | | bulkActionButtons={ |
| | | <> |
| | | <MyExportButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} |
| | | /> |
| | | </>} |
| | | rowClick={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.outStock.code" /> |
| | | <TextField source="poCode" label="table.field.outStock.poCode" /> |
| | | <NumberField source="poId" label="table.field.outStock.poId" /> |
| | | <TextField source="type$" label="table.field.outStock.type" /> |
| | | <TextField cellClassName="wkType" source="wkType$" label="table.field.outStock.wkType" /> |
| | | <NumberField source="anfme" label="table.field.outStock.anfme" /> |
| | | <NumberField source="qty" label="table.field.outStock.qty" /> |
| | | <TextField source="logisNo" label="table.field.outStock.logisNo" /> |
| | | <TextField source="rleStatus$" label="table.field.outStock.rleStatus" sortable={false} /> |
| | | <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 /> |
| | | <BillStatusField cellClassName="status" source="exceStatus" label="table.field.outStock.exceStatus" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt" > |
| | | <EditButton label="toolbar.detail" icon={(<DetailsIcon />)}></EditButton> |
| | | {/* <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} /> */} |
| | | <CancelButton></CancelButton> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <OutOrderCreate open={manualDialog} setOpen={setManualDialog} /> |
| | | <OutOrderModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='AsnOrder Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box > |
| | | ) |
| | | } |
| | | export default OutOrderList; |
| | | |
| | | const MyButton = ({ setCreateDialog, setmodalType }) => { |
| | | const record = useRecordContext(); |
| | | const handleEditClick = (btn) => { |
| | | btn.stopPropagation(); |
| | | const id = record.id; |
| | | setmodalType(id); |
| | | setCreateDialog(true); |
| | | }; |
| | | return ( |
| | | <Button |
| | | color="primary" |
| | | startIcon={<EditIcon />} |
| | | onClick={(btn) => handleEditClick(btn)} |
| | | sx={{ ml: 1 }} |
| | | label={'ra.action.edit'} |
| | | > |
| | | </Button> |
| | | ) |
| | | } |
| | | |
| | | const CreateByOrderButton = ({setCreateDialog}) => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | const createByOrder = async (event) => { |
| | | event.stopPropagation(); |
| | | setCreateDialog(true); |
| | | } |
| | | |
| | | return ( |
| | | <Button onClick={createByOrder} label={'toolbar.asnCreate'}> <AddIcon /> </Button> |
| | | ) |
| | | |
| | | } |
| | | |
| | | const CancelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | console.log(record); |
| | | |
| | | const cancelOrder = async () => { |
| | | const { data: { code, data, msg } } = await request.get(`/outStock/cancel/${record?.id}`); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelIcon />} onConfirm={cancelOrder} /> |
| | | ) |
| | | } |
New file |
| | |
| | | import { Dialog, DialogActions, DialogContent, DialogTitle, Box } from "@mui/material"; |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Button, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | Toolbar, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 220 |
| | | }, |
| | | '& .wkType': { |
| | | width: 110 |
| | | }, |
| | | '& .status': { |
| | | width: 90 |
| | | }, |
| | | })); |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" />, |
| | | <DateInput label='common.time.before' source="timeEnd" />, |
| | | <TextInput source="code" label="table.field.delivery.code" />, |
| | | <TextInput source="platId" label="table.field.delivery.platId" />, |
| | | <TextInput source="type" label="table.field.delivery.type" />, |
| | | <TextInput source="wkType" label="table.field.delivery.wkType" />, |
| | | <TextInput source="source" label="table.field.delivery.source" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | const OutOrderModal = (props) => { |
| | | const { open, setOpen, record } = props; |
| | | const translate = useTranslate(); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | return ( |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | aria-hidden |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="lg" |
| | | > |
| | | <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> |
| | | <List |
| | | resource="deliveryItem" |
| | | storeKey='selectDelivery' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.delivery"} |
| | | empty={false} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <></> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='deliveryItem' |
| | | bulkActionButtons={() => <></>} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'workQty', 'startTime', 'endTime', 'updateBy', 'createTime']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="matnrCode" label="table.field.deliveryItem.matnrCode" /> |
| | | <TextField source="matnrName" label="table.field.deliveryItem.matnrName" /> |
| | | <TextField source="unit" label="table.field.deliveryItem.unit" /> |
| | | <NumberField source="anfme" label="table.field.deliveryItem.anfme" /> |
| | | <TextField source="splrName" label="table.field.deliveryItem.splrName" /> |
| | | <TextField source="splrBatch" label="table.field.deliveryItem.splrBatch" /> |
| | | <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} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | {/* <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <Button disabled={disabled} onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Toolbar> */} |
| | | </DialogActions> |
| | | </Dialog> |
| | | ) |
| | | } |
| | | |
| | | export default OutOrderModal; |
New file |
| | |
| | | |
| | | .custom { |
| | | color: rgb(0, 195, 255) !important; |
| | | } |
| | | |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import OutOrderList from "./OutOrderList"; |
| | | import OutOrderEdit from "./OutOrderEdit"; |
| | | |
| | | export default { |
| | | list: OutOrderList, |
| | | edit: OutOrderEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.name}` |
| | | } |
| | | }; |
| | |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ dictTypeId: dictId }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "sort", order: "asc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | |
| | | setOpen(false); |
| | | notify("common.response.success"); |
| | | }; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_task_reset_type')) || []; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_rule_type')) || []; |
| | | |
| | | const handleError = async (error) => { |
| | | notify(error.message || "common.response.fail", { |
| | |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Grid container width={{ xs: '100%', xl: '90%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={16} md={10}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Grid item xs={8} md={2}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | |
| | | choices={dicts} |
| | | optionText="label" |
| | | label="table.field.serialRuleItem.wkType" |
| | | source="type" |
| | | source="wkType" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | validate={[required()]} /> |
| | |
| | | setSelect(record) |
| | | setEditDialog(true) |
| | | }} |
| | | omit={["id", "createTime", "createBy", "memo"]} |
| | | omit={["id", "ruleId", "createTime", "createBy", "memo"]} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField |
| | |
| | | /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <Button onClick={() => { |
| | | setSelect(record) |
| | | // setSelect(record) |
| | | setEditDialog(true) |
| | | }} label={'ra.action.edit'} |
| | | > </Button> |
| | |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Delivery; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | |
| | | @Autowired |
| | | private DeliveryService deliveryService; |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @PostMapping("/delivery/page") |
| | |
| | | public R update(@RequestBody Delivery delivery) { |
| | | delivery.setUpdateBy(getLoginUserId()); |
| | | delivery.setUpdateTime(new Date()); |
| | | if (Objects.isNull(delivery.getCode()) || StringUtils.isBlank(delivery.getCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_DELIVERY_RULE_CODE, delivery); |
| | | if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { |
| | | return R.error("编码规则错误:编码「SYS_DELIVERY_RULE_CODE」是未设置成功!!"); |
| | | } |
| | | delivery.setCode(ruleCode); |
| | | } |
| | | if (!deliveryService.updateById(delivery)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | |
| | | 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.Companys; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private DeliveryItemService deliveryItemService; |
| | | |
| | | |
| | | @Autowired |
| | | private CompanysService companysService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:deliveryItem:list')") |
| | | @PostMapping("/deliveryItem/page") |
| | |
| | | deliveryItem.setCreateTime(new Date()); |
| | | deliveryItem.setUpdateBy(getLoginUserId()); |
| | | deliveryItem.setUpdateTime(new Date()); |
| | | if (StringUtils.isNotBlank(deliveryItem.getSplrName())) { |
| | | Companys companys = companysService.getById(deliveryItem.getSplrName()); |
| | | deliveryItem.setSplrName(companys.getName()).setSplrCode(companys.getCode()); |
| | | } |
| | | if (!deliveryItemService.save(deliveryItem)) { |
| | | return R.error("Save Fail"); |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.api.entity.enums.OrderType; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderWorkType; |
| | | 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.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.service.OutStockItemService; |
| | | import com.vincent.rsf.server.manager.service.OutStockService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | 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 |
| | | @Api(tags = "出库单据") |
| | | public class OutStockController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private OutStockItemService outStockItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PostMapping("/outStock/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<AsnOrder, BaseParam> pageParam = new PageParam<>(baseParam, AsnOrder.class); |
| | | return R.ok().add(outStockService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PostMapping("/outStock/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(outStockService.list(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getType, OrderType.ORDER_OUT.type))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PostMapping({"/outStock/many/{ids}", "/asnOrders/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(outStockService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @OperationLog("表单查询") |
| | | @GetMapping("/outStock/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(outStockService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:save')") |
| | | @OperationLog("Create 出库单据") |
| | | @PostMapping("/outStock/save") |
| | | @ApiOperation("保存") |
| | | public R save(@RequestBody AsnOrder asnOrder) { |
| | | asnOrder.setCreateBy(getLoginUserId()) |
| | | .setUpdateBy(getLoginUserId()); |
| | | if (Objects.isNull(asnOrder.getCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, asnOrder); |
| | | if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { |
| | | return R.error("编码规则错误:编码「SYS_OUT_STOCK_CODE」是未设置成功!!"); |
| | | } |
| | | asnOrder.setCode(ruleCode); |
| | | } |
| | | if (!outStockService.save(asnOrder)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(asnOrder); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | | @OperationLog("Update ;出库单据") |
| | | @PostMapping("/outStock/update") |
| | | @ApiOperation("更新") |
| | | public R update(@RequestBody AsnOrder asnOrder) { |
| | | asnOrder.setType(OrderType.ORDER_OUT.type) |
| | | .setUpdateBy(getLoginUserId()) |
| | | .setUpdateTime(new Date()); |
| | | if (Objects.isNull(asnOrder.getCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, asnOrder); |
| | | asnOrder.setCode(ruleCode); |
| | | } |
| | | if (!outStockService.updateById(asnOrder)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(asnOrder); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:remove')") |
| | | @OperationLog("Delete 出库单据") |
| | | @PostMapping("/outStock/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!outStockService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PostMapping("/outStock/query") |
| | | @ApiOperation("查询") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<AsnOrder> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(AsnOrder::getCode, condition); |
| | | } |
| | | outStockService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getCode())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | | @ApiOperation("取消出库单据") |
| | | @GetMapping("/outStock/cancel/{id}") |
| | | public R cancel(@PathVariable String id) { |
| | | if (Objects.isNull(id)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return outStockService.cancelOutOrder(id); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PostMapping("/outStock/export") |
| | | @ApiOperation("导出") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | List<AsnOrder> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | List<Long> ids = JSONArray.parseArray(JSONObject.toJSONString(map.get("ids")), Long.class); |
| | | if (!ids.isEmpty()) { |
| | | orders = outStockService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, ids)); |
| | | } else { |
| | | orders = outStockService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | } else { |
| | | orders = outStockService.list(); |
| | | } |
| | | List<AsnOrderTemplate> orderTemplates = new ArrayList<>(); |
| | | for (AsnOrder order : orders) { |
| | | List<AsnOrderItem> orderItems = outStockItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId())); |
| | | for (AsnOrderItem item : orderItems) { |
| | | if (Objects.isNull(item)) { |
| | | continue; |
| | | } |
| | | AsnOrderTemplate template = new AsnOrderTemplate(); |
| | | template.setCode(order.getCode()) |
| | | .setType(OrderType.getValType(order.getType())) |
| | | .setWkType(OrderWorkType.getWorkDesc(order.getWkType())) |
| | | .setExceStatus(AsnExceStatus.getExceStatus(order.getExceStatus())) |
| | | .setAnfme(item.getAnfme() + "") |
| | | .setMaktx(item.getMaktx()) |
| | | .setMemo(item.getMemo()) |
| | | .setMatnrCode(item.getMatnrCode()) |
| | | .setPoCode(item.getPoCode()) |
| | | .setSplrName(item.getSplrName()) |
| | | .setPoId(order.getPoId() + "") |
| | | .setTrackCode(item.getTrackCode()) |
| | | .setBarcode(item.getBarcode()) |
| | | .setPackName(item.getPackName()) |
| | | .setPlatItemId(item.getPlatItemId()) |
| | | .setSplrBatch(item.getSplrBatch()) |
| | | .setSplrCode(item.getSplrCode()) |
| | | .setStockUnit(item.getStockUnit()) |
| | | .setPurQty(item.getPurQty() + "") |
| | | .setPurUnit(item.getPurUnit()); |
| | | orderTemplates.add(template); |
| | | } |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, AsnOrderTemplate.class), response); |
| | | } |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.framework.exception.CoolException; |
| | | 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.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.Companys; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.CompanysType; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.OutStockItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @Api(tags = "出库单明细") |
| | | @RestController |
| | | public class OutStockItemController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OutStockItemService outStockItemService; |
| | | |
| | | @Autowired |
| | | private CompanysService companysService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:list')") |
| | | @ApiOperation("分页获取列表") |
| | | @PostMapping("/outStockItem/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<AsnOrderItem, BaseParam> pageParam = new PageParam<>(baseParam, AsnOrderItem.class); |
| | | return R.ok().add(outStockItemService.listByAsnId(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:list')") |
| | | @PostMapping("/outStockItem/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(outStockItemService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:list')") |
| | | @PostMapping({"/outStockItem/many/{ids}", "/outStockItems/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(outStockItemService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:list')") |
| | | @GetMapping("/outStockItem/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(outStockItemService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:save')") |
| | | @OperationLog("Create 出库单明细") |
| | | @PostMapping("/outStockItem/save") |
| | | public R save(@RequestBody Map<String, Object> params) { |
| | | if (Objects.isNull(params)) { |
| | | throw new CoolException("信息不能为空!!"); |
| | | } |
| | | params.put("createBy", getLoginUserId()); |
| | | params.put("updateBy", getLoginUserId()); |
| | | |
| | | if (!outStockItemService.fieldsSave(params)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success"); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | @OperationLog("Update 出库单明细") |
| | | @PostMapping("/outStockItem/update") |
| | | public R update(@RequestBody AsnOrderItem asnOrderItem) { |
| | | asnOrderItem.setUpdateBy(getLoginUserId()); |
| | | asnOrderItem.setUpdateTime(new Date()); |
| | | if (!Objects.isNull(asnOrderItem.getSplrName()) && StringUtils.isNotBlank(asnOrderItem.getSplrName())) { |
| | | Companys companys = companysService.getOne(new LambdaQueryWrapper<Companys>() |
| | | .eq(Companys::getType, CompanysType.COMPANYS_TYPE_SUPPLIER.val) |
| | | .eq(Companys::getId, asnOrderItem.getSplrName())); |
| | | if (!Objects.isNull(companys)) { |
| | | asnOrderItem.setSplrCode(companys.getCode()).setSplrName(companys.getName()); |
| | | } |
| | | } |
| | | if (!outStockItemService.updateById(asnOrderItem)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(asnOrderItem); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:remove')") |
| | | @OperationLog("Delete 出库单明细") |
| | | @PostMapping("/outStockItem/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!outStockItemService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:list')") |
| | | @PostMapping("/outStockItem/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<AsnOrderItem> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(AsnOrderItem::getId, condition); |
| | | } |
| | | outStockItemService.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:outStockItem:list')") |
| | | @PostMapping("/outStockItem/export") |
| | | @ApiOperation("导出出库单明细") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | List<AsnOrderItem> orderItems = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | List<Long> ids = JSONArray.parseArray(JSONObject.toJSONString(map.get("ids")), Long.class); |
| | | if (!ids.isEmpty()) { |
| | | orderItems = outStockItemService.list(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .in(AsnOrderItem::getId, ids) |
| | | .eq(AsnOrderItem::getStatus, 1)); |
| | | } else { |
| | | orderItems = outStockItemService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | } else { |
| | | orderItems = outStockItemService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | |
| | | ExcelUtil.build(ExcelUtil.create(orderItems, AsnOrderItem.class, true), response); |
| | | } |
| | | |
| | | /** |
| | | * ASN单据明细导入 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/outStockItem/import") |
| | | @ApiOperation("ASN导入接口") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file, @RequestParam String asnId) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | R.error("文件不能为空!!"); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | return outStockItemService.excelImport(file, hashMap, getLoginUserId()); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/outStockItem/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class); |
| | | List<AsnOrderTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class, true), response); |
| | | } |
| | | |
| | | } |
| | |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // AsnOrder asnOrder = new AsnOrder( |
| | | // null, // 编号 |
| | | // null, // PO单号 |
| | | // null, // PO单据标识 |
| | | // null, // 单据类型[非空] |
| | | // null, // 业务类型[非空] |
| | | // null, // 送货数量[非空] |
| | | // null, // 已收数量[非空] |
| | | // null, // 物流单号 |
| | | // null, // 预计到达时间 |
| | | // null, // 释放状态[非空] |
| | | // null, // 名称 |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改人员 |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getExceStatus$() { |
| | | if (Cools.isEmpty(this.exceStatus)){ |
| | | return ""; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.DICT_ASN_EXCE_STATUS).eq(DictData::getValue, this.exceStatus)); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>() |
| | | .eq(DictData::getDictTypeCode, DictTypeCode.DICT_ASN_EXCE_STATUS) |
| | | .eq(DictData::getValue, this.exceStatus)); |
| | | if (Objects.isNull(dictData)) { |
| | | return null; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_delivery_item") |
| | | public class DeliveryItem implements Serializable { |
| | | |
| | |
| | | R completeOrder(Long id, Long loginUserId); |
| | | |
| | | R closeOrder(Long id); |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OutStockItemService extends IService<AsnOrderItem> { |
| | | |
| | | boolean fieldsSave(Map<String, Object> params); |
| | | |
| | | R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception; |
| | | |
| | | IPage<Map<String, Object>> listByAsnId(PageParam<AsnOrderItem, BaseParam> pageParam, QueryWrapper<AsnOrderItem> buildWrapper); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OutStockService extends IService<AsnOrder> { |
| | | |
| | | R cancelOutOrder(String id); |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderType; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderItemMapper; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.vincent.rsf.server.manager.service.OutStockItemService; |
| | | import com.vincent.rsf.server.manager.service.OutStockService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @version 1.0 |
| | | * @title OutStockItemServiceImpl |
| | | * @description |
| | | * @create 2025/4/22 11:35 |
| | | */ |
| | | @Service("outStockItemServiceImpl") |
| | | public class OutStockItemServiceImpl extends ServiceImpl<AsnOrderItemMapper, AsnOrderItem> implements OutStockItemService { |
| | | |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | @Autowired |
| | | private OutStockItemService outStockItemService; |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description ASN明细单据保存,及扩展字段保存 |
| | | * @time 2025/4/7 09:59 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean fieldsSave(Map<String, Object> params) { |
| | | AsnOrderItem asnOrderItem = JSONObject.parseObject(JSONObject.toJSONString(params), AsnOrderItem.class); |
| | | if (StringUtils.isBlank(asnOrderItem.getTrackCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, asnOrderItem); |
| | | asnOrderItem.setTrackCode(ruleCode).setBarcode(ruleCode); |
| | | ; |
| | | } |
| | | if (Objects.isNull(asnOrderItem.getAnfme()) || Double.compare(asnOrderItem.getAnfme(), 0.0) <= 0) { |
| | | throw new CoolException("计划收货数不能为空!!"); |
| | | } |
| | | //保存扩展字段 |
| | | try { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | Boolean fields = FieldsUtils.saveFields(params, uuid16); |
| | | if (fields) { |
| | | asnOrderItem.setFieldsIndex(uuid16); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (!this.saveOrUpdate(asnOrderItem)) { |
| | | throw new CoolException("收货通知单明细保存失败!!"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 出库单模板导入 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/22 12:40 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), AsnOrderTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | List<AsnOrderTemplate> resultList = result.getList(); |
| | | Map<String, List<AsnOrderTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(AsnOrderTemplate::getCode)); |
| | | for (String key : listMap.keySet()) { |
| | | AsnOrderTemplate template = listMap.get(key).stream().findFirst().get(); |
| | | AsnOrder asnOrder = outStockService.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, template.getCode())); |
| | | if (Objects.isNull(asnOrder)) { |
| | | continue; |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | order.setCode(template.getCode()) |
| | | .setPoCode(template.getPoCode()) |
| | | .setMemo(template.getMemo()) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setPoId(Long.parseLong(template.getPoId())) |
| | | .setType(OrderType.getTypeVal(template.getType())) |
| | | .setWkType(OrderWorkType.getWorkType(template.getWkType())); |
| | | if (!outStockService.save(order)) { |
| | | throw new CoolException("单据保存失败!!"); |
| | | } |
| | | List<AsnOrderItem> items = new ArrayList<>(); |
| | | for (AsnOrderTemplate orderTemplate : listMap.get(key)) { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | Matnr matnr = null; |
| | | if (!Objects.isNull(orderTemplate.getMatnrCode()) || StringUtils.isNotBlank(orderTemplate.getMatnrCode())) { |
| | | matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>() |
| | | .eq(Matnr::getCode, orderTemplate.getMatnrCode())); |
| | | } |
| | | orderItem.setAsnId(order.getId()) |
| | | .setAsnCode(order.getCode()) |
| | | .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | .setAnfme(Double.parseDouble(orderTemplate.getAnfme())) |
| | | .setQty(Double.parseDouble(orderTemplate.getQty())) |
| | | .setSplrName(orderTemplate.getSplrName()) |
| | | .setBarcode(orderTemplate.getBarcode()) |
| | | .setTrackCode(orderTemplate.getTrackCode()) |
| | | .setSplrCode(orderTemplate.getSplrCode()) |
| | | .setPoCode(orderTemplate.getPoCode()) |
| | | .setMaktx(orderTemplate.getMaktx()) |
| | | .setMatnrCode(orderTemplate.getMatnrCode()) |
| | | .setPurUnit(orderTemplate.getPurUnit()) |
| | | .setPurQty(Double.parseDouble(orderTemplate.getPurQty())); |
| | | if (!Objects.isNull(matnr)) { |
| | | orderItem.setMaktx(matnr.getName()).setMatnrCode(matnr.getCode()).setMatnrId(matnr.getId()); |
| | | } |
| | | items.add(orderItem); |
| | | if (!outStockItemService.saveBatch(items)) { |
| | | throw new CoolException("单据明细保存失败!!"); |
| | | } |
| | | } |
| | | if (!items.isEmpty()) { |
| | | double qty = items.stream().mapToDouble(AsnOrderItem::getQty).sum(); |
| | | double purQty = items.stream().mapToDouble(AsnOrderItem::getPurQty).sum(); |
| | | if (!outStockService.update(new LambdaUpdateWrapper<AsnOrder>().set(AsnOrder::getQty, qty).set(AsnOrder::getAnfme, purQty).eq(AsnOrder::getId, order.getId()))) { |
| | | throw new CoolException("单据数量修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok("操作成功!!"); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 获取Page页 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/22 12:39 |
| | | */ |
| | | @Override |
| | | public IPage<Map<String, Object>> listByAsnId(PageParam<AsnOrderItem, BaseParam> pageParam, QueryWrapper<AsnOrderItem> buildWrapper) { |
| | | IPage<Map<String, Object>> hsahMap = this.baseMapper.resultForMap(pageParam, buildWrapper); |
| | | if (hsahMap.getRecords().isEmpty()) { |
| | | return hsahMap.setRecords(new ArrayList<>()); |
| | | } |
| | | hsahMap.setRecords(FieldsUtils.getExtendFields(hsahMap.getRecords())); |
| | | return hsahMap; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.dto.PoItemsDto; |
| | | import com.vincent.rsf.server.api.service.ReceiveMsgService; |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItemLog; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.mapper.SerialRuleMapper; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description |
| | | * @throws |
| | | * @return |
| | | * @time 2025/3/7 08:02 |
| | | */ |
| | | @Service("outStockServiceImpl") |
| | | public class OutStockServiceImpl extends ServiceImpl<AsnOrderMapper, AsnOrder> implements OutStockService { |
| | | |
| | | @Autowired |
| | | private ReceiveMsgService receiveMsgService; |
| | | @Autowired |
| | | private ReportMsgService reportMsgService; |
| | | @Resource |
| | | private PurchaseMapper purchaseMapper; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private AsnOrderLogService asnOrderLogService; |
| | | @Autowired |
| | | private AsnOrderItemLogService asnOrderItemLogService; |
| | | @Resource |
| | | private SerialRuleMapper serialRuleMapper; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 更新或保存明细 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/7 13:28 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | private void svaeOrUpdateOrderItem(AsnOrderAndItemsParams params, Long loginUserId) throws Exception{ |
| | | AsnOrder orders = params.getOrders(); |
| | | |
| | | params.getItems().forEach(item -> { |
| | | item.put("asnId", orders.getId()); |
| | | item.put("asnCode", orders.getCode()); |
| | | item.put("poCode", orders.getPoCode()); |
| | | item.put("createBy", loginUserId); |
| | | item.put("updateBy", loginUserId); |
| | | if (!asnOrderItemService.fieldsSave(item)) { |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | }); |
| | | List<AsnOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnId, params.getOrders().getId())); |
| | | double sum = orderItems.stream().mapToDouble(AsnOrderItem::getAnfme).sum(); |
| | | orders.setAnfme(sum); |
| | | if (!this.updateById(orders)) { |
| | | throw new CoolException("计划收货数量修改失败!!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 删除原主单及明细,加入历史档 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/19 19:53 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | private void operateOrderLogs(AsnOrder asrder) throws Exception{ |
| | | if (Objects.isNull(asrder) || Objects.isNull(asrder.getId())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | asrder.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val); |
| | | |
| | | if (!this.updateById(asrder)) { |
| | | throw new CoolException("单据关闭失败!!"); |
| | | } |
| | | List<AsnOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, asrder.getId())); |
| | | if (orderItems.isEmpty()) { |
| | | throw new CoolException("收货明细为空!!"); |
| | | } |
| | | // if (Objects.isNull(asrder.getAnfme()) || asrder.getAnfme().compareTo(0.00) == 0) { |
| | | // throw new CoolException("收货数量不能为零!!"); |
| | | // } |
| | | AsnOrder order = this.getById(asrder.getId()); |
| | | AsnOrderLog orderLog = new AsnOrderLog(); |
| | | order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val); |
| | | BeanUtils.copyProperties(order, orderLog); |
| | | orderLog.setId(null); |
| | | orderLog.setAsnId(order.getId()); |
| | | |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("状态修改失败!!"); |
| | | } |
| | | orderLog.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val); |
| | | if (!asnOrderLogService.save(orderLog)) { |
| | | throw new CoolException("主单历史档添加失败!!"); |
| | | } |
| | | List<AsnOrderItemLog> logs = new ArrayList<>(); |
| | | List<AsnOrderItem> items = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId())); |
| | | items.forEach(item -> { |
| | | AsnOrderItemLog itemLog = new AsnOrderItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setAsnItemId(itemLog.getId()) |
| | | .setLogId(orderLog.getId()) |
| | | .setAsnId(item.getAsnId()); |
| | | logs.add(itemLog); |
| | | }); |
| | | |
| | | if (!asnOrderItemLogService.saveBatch(logs)) { |
| | | throw new CoolException("通知单明细历史档保存失败!!"); |
| | | } |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId()))) { |
| | | throw new CoolException("原单据明细删除失败!!"); |
| | | } |
| | | if (!this.removeById(asrder.getId())) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 取消出库单据 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/22 10:40 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R cancelOutOrder(String id) { |
| | | if (Cools.isEmpty(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | AsnOrder order = this.getById(id); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | if (!order.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val)) { |
| | | throw new CoolException("当前单据状态为" + AsnExceStatus.getExceStatus(order.getExceStatus()) + ", 不可执行取消操作!!"); |
| | | } |
| | | order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.val).setStatus(0); |
| | | |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("单据取消失败!!"); |
| | | } |
| | | return R.ok("操作成功"); |
| | | } |
| | | } |
| | |
| | | * DO单据编码规则 |
| | | */ |
| | | public final static String SYS_DELIVERY_RULE_CODE = "sys_delivery_rule_code"; |
| | | |
| | | /** |
| | | * 出库单据号 |
| | | */ |
| | | public final static String SYS_OUT_STOCK_CODE = "sys_out_stock_code"; |
| | | |
| | | } |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // SerialRule serialRule = new SerialRule( |
| | | // null, // 编号 |
| | | // null, // 名称 |
| | | // null, // 分隔符 |
| | | // null, // 序号重置规则[非空] |
| | | // null, // 重置依赖 |
| | | // null, // 当前值 |
| | | // null, // 最近生成编码 |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改人员 |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getReset$(){ |
| | | if (null == this.reset){ return null; } |
| | | switch (this.reset){ |
| | | case "year": |
| | | return " 年"; |
| | | case "month": |
| | | return " 月"; |
| | | case "dd": |
| | | return " 天"; |
| | | case "non": |
| | | return " 无"; |
| | | default: |
| | | return String.valueOf(this.reset); |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>() |
| | | .eq(DictData::getDictTypeCode,"sys_rule_type").eq(DictData::getValue, this.reset)); |
| | | if (null != dictData){ |
| | | return dictData.getLabel(); |
| | | } |
| | | return String.valueOf(this.reset); |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | |
| | | if (serialRule.getReset().equals(SerialRuleReset.SERIAL_REST_TYPE_YEAR.type)) { |
| | | format = DateUtils.format(new Date(), "yyyy"); |
| | | } else if (serialRule.getReset().equals(SerialRuleReset.SERIAL_REST_TYPE_MONTH.type)) { |
| | | format = DateUtils.format(new Date(), "MM"); |
| | | format = DateUtils.format(new Date(), "yyyyMM"); |
| | | } else if (serialRule.getReset().equals(SerialRuleReset.SERIAL_REST_TYPE_DAYS.type)){ |
| | | format = DateUtils.format(new Date(), "dd"); |
| | | format = DateUtils.format(new Date(), "yyyyMMdd"); |
| | | } |
| | | //当前值自动加1 |
| | | Integer curVal = serialRule.getCurrValue() + 1; |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | serialRule.setLastCode(buffer.toString()); |
| | | //修改当前规则编码号至数据库 |
| | | if (!ruleService.saveOrUpdate(serialRule)) { |