| | |
| | | batchStatus: 'batchStatus', |
| | | batchMix: 'batchFiexed', |
| | | batchWarehouse: 'batchWarehouse', |
| | | batchStockLevel: "batchStockLevel", |
| | | }, |
| | | }; |
| | | |
| | |
| | | minQty: "最小值", |
| | | maxQty: "最大值", |
| | | stagn: "停滞预警值", |
| | | valid: "保质期", |
| | | validWarn: "效期预警", |
| | | valid: "保质期(天)", |
| | | validWarn: "效期预警(天)", |
| | | flagCheck: "免检", |
| | | }, |
| | | matnrGroup: { |
| | |
| | | batchStatus: '批量状态', |
| | | batchMix: '批量混放', |
| | | batchWarehouse: '批量仓库', |
| | | batchStockLevel: "批量ABC分类", |
| | | }, |
| | | }; |
| | | |
| | |
| | | |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import request from '@/utils/request'; |
| | |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | |
| | | const InitModal = ({ open, setOpen }) => { |
| | | const InitModal = ({ open, setOpen, fieldType }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | |
| | | const notify = useNotify(); |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | 'status': null |
| | | 'status': null, |
| | | 'stockLevel': null, |
| | | 'validWarn': null, |
| | | 'valid': null, |
| | | 'flagCheck': null, |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | |
| | | |
| | | const reset = () => { |
| | | setFormData({ |
| | | 'status': null |
| | | 'status': null, |
| | | 'stockLevel': null, |
| | | 'validWarn': null, |
| | | 'valid': null, |
| | | 'flagCheck': null, |
| | | }) |
| | | } |
| | | |
| | |
| | | const handleChange = (value, name) => { |
| | | setFormData((prevData) => ({ |
| | | ...prevData, |
| | | [name]: ['locType', 'type'].includes(name) ? value : +value |
| | | [name]: value |
| | | })); |
| | | }; |
| | | |
| | |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | return !_.isNil(value); |
| | | }); |
| | | } |
| | | |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | id: selectedIds, |
| | | matnr: removeEmptyKeys(formData) |
| | | ids: selectedIds, |
| | | matnr: { |
| | | ...removeEmptyKeys(formData) |
| | | } |
| | | } |
| | | |
| | | const res = await request.post(`/matnr/modify`, parmas); |
| | | const res = await request.post(`/matnr/batch/update`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Dialog open={open} maxWidth="xs" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.batch')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | | </Grid> |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(+e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'stockLevel' && |
| | | <Grid item xs={6}> |
| | | <SelectInput |
| | | label="table.field.matnr.stockLevel" |
| | | source="stockLevel" |
| | | onChange={(e) => handleChange(e.target.value, 'stockLevel')} |
| | | choices={[ |
| | | { id: 0, name: ' A' }, |
| | | { id: 1, name: ' B' }, |
| | | { id: 2, name: 'C' }, |
| | | ]} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'validWarn' && |
| | | <Grid item xs={6}> |
| | | <NumberInput |
| | | onChange={(e) => handleChange(e.target.value, 'validWarn')} |
| | | label="table.field.matnr.validWarn" |
| | | source="validWarn" |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'validWarn' && |
| | | <Grid item xs={6}> |
| | | <NumberInput |
| | | onChange={(e) => handleChange(e.target.value, 'valid')} |
| | | label="table.field.matnr.valid" |
| | | source="valid" |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'flagCheck' && |
| | | <Grid item xs={6}> |
| | | <SelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'flagCheck')} |
| | | label="table.field.matnr.flagCheck" |
| | | source="flagCheck" |
| | | choices={[ |
| | | { id: 0, name: ' 否' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | } |
| | | </Grid> |
| | | |
| | | </Box> |
| | |
| | | source="valid" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.matnr.flagCheck" |
| | | source="flagCheck" |
| | | choices={[ |
| | | { id: 0, name: ' 否' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | </CustomTabPanel> |
| | | <CustomTabPanel value={value} index={2}> |
| | |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<> |
| | | <BatchGroupButton /> |
| | | <BatchButton /> |
| | | <BatchStatusButton /> |
| | | <BatchLevelButton /> |
| | | <BindButton /> |
| | | <PrintButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | |
| | | ) |
| | | } |
| | | |
| | | const BatchButton = () => { |
| | | const BatchStatusButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'status'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | const BatchLevelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStockLevel"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'stockLevel'} |
| | | /> |
| | | </> |
| | | |
| | |
| | | isTranslate |
| | | resource={resource} |
| | | onChange={(e) => pChange(e.target.value)} |
| | | required |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | {expandAll ? translate('common.action.collapseAll') : translate('common.action.expandAll')} |
| | | </Button> |
| | | <TextField |
| | | label="搜索" |
| | | label="搜索名称" |
| | | value={filter} |
| | | onChange={({ target }) => { |
| | | setFilter(target.value) |
| | |
| | | import * as Common from '@/utils/common'; |
| | | import { useFormContext } from 'react-hook-form'; |
| | | |
| | | const TreeSelectInput = ({ resource, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const TreeSelectInput = ({ resource, required, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const translate = useTranslate(); |
| | | const { setValue } = useFormContext(); |
| | | const [filter, setFilter] = React.useState(""); |
| | |
| | | }; |
| | | |
| | | return ( |
| | | <FormControl fullWidth> |
| | | <FormControl fullWidth required={required}> |
| | | <InputLabel>{translate(label)}</InputLabel> |
| | | <Select |
| | | value={proxyVal || ''} |
| | |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | return !_.isNil(value); |
| | | }); |
| | | } |
| | | |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | id: selectedIds, |
| | | ...removeEmptyKeys(formData) |
| | | ids: selectedIds, |
| | | warehouseAreas: { |
| | | ...removeEmptyKeys(formData) |
| | | } |
| | | } |
| | | |
| | | const res = await request.post(`/warehouseAreas/modify`, parmas); |
| | | const res = await request.post(`/warehouseAreas/batch/update`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | onChange={(e) => handleChange(+e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |