| | |
| | | loc: '库位', |
| | | locType: '库位类型', |
| | | locArea: '逻辑分区', |
| | | locAreaMatRela: '物料绑定', |
| | | locAreaMatRela: '库区物料关系', |
| | | container: '容器管理', |
| | | contract: '合同信息', |
| | | qlyInspect: '质检信息', |
| | |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import LocCreate from "./LocCreate"; |
| | | import MatnrModal from "./MatnrModal"; |
| | | import BindModal from "./BindModal"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import DynamicField from "../../components/DynamicField"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | |
| | | bulkActionButtons={ |
| | | <> |
| | | <BatchButton /> |
| | | <MatnrButton /> |
| | | <BindButton /> |
| | | <SubzoneButton /> |
| | | <BulkDeleteButton /> |
| | | </> |
| | |
| | | ) |
| | | } |
| | | |
| | | const MatnrButton = () => { |
| | | const BindButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | <LinkIcon /> |
| | | </Button> |
| | | |
| | | <MatnrModal |
| | | <BindModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="areaId" label="table.field.locAreaMatRela.areaId" /> |
| | | <NumberField source="areaId$" label="table.field.locAreaMatRela.areaId" /> |
| | | <TextField source="code" label="table.field.locAreaMatRela.code" /> |
| | | <NumberField source="matnrId" label="table.field.locAreaMatRela.matnrId" /> |
| | | <NumberField source="groupId" label="table.field.locAreaMatRela.groupId" /> |
| | | <NumberField source="locTypeId" label="table.field.locAreaMatRela.locTypeId" /> |
| | | <NumberField source="locId" label="table.field.locAreaMatRela.locId" /> |
| | | <NumberField source="matnrId$" label="table.field.locAreaMatRela.matnrId" /> |
| | | <NumberField source="groupId$" label="table.field.locAreaMatRela.groupId" /> |
| | | <NumberField source="locTypeId$" label="table.field.locAreaMatRela.locTypeId" /> |
| | | <NumberField source="locId$" label="table.field.locAreaMatRela.locId" /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import MatnrModal from "./MatnrModal"; |
| | | import BindModal from "./BindModal"; |
| | | import LinkIcon from '@mui/icons-material/Link'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='locType' |
| | | bulkActionButtons={<> |
| | | <MatnrButton /> |
| | | <BindButton /> |
| | | <BulkDeleteButton /> |
| | | </>} |
| | | rowClick={(id, resource, record) => false} |
| | |
| | | |
| | | export default LocTypeList; |
| | | |
| | | const MatnrButton = () => { |
| | | const BindButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | <LinkIcon /> |
| | | </Button> |
| | | |
| | | <MatnrModal |
| | | <BindModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
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, |
| | | useListContext, |
| | | useRefresh, |
| | | SelectArrayInput |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Grid, |
| | | TextField, |
| | | Box, |
| | | Button, |
| | | Paper, |
| | | TableContainer, |
| | | Table, |
| | | TableHead, |
| | | TableBody, |
| | | TableRow, |
| | | TableCell, |
| | | Tooltip, |
| | | IconButton, |
| | | styled, |
| | | |
| | | } 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 { Add, Edit, Delete } from '@mui/icons-material'; |
| | | import _ from 'lodash'; |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | const MatnrModal = ({ open, setOpen }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | | |
| | | const notify = useNotify(); |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | areaId: null, |
| | | locId: null, |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | reset() |
| | | refresh(); |
| | | onUnselectItems() |
| | | } |
| | | }; |
| | | |
| | | const reset = () => { |
| | | setFormData({ |
| | | areaId: null, |
| | | locId: null, |
| | | }) |
| | | } |
| | | |
| | | const handleReset = (e) => { |
| | | e.preventDefault(); |
| | | }; |
| | | |
| | | const handleChange = (value, name) => { |
| | | setFormData((prevData) => ({ |
| | | ...prevData, |
| | | [name]: value |
| | | })); |
| | | refresh() |
| | | }; |
| | | |
| | | const removeEmptyKeys = (obj) => { |
| | | return _.pickBy(obj, (value) => { |
| | | if (_.isObject(value)) { |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | }); |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | matnrId: selectedIds, |
| | | areaId: formData.areaId, |
| | | locId: formData.locId, |
| | | } |
| | | |
| | | const res = await request.post(`/locAreaMatRela/matnr/bind`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | const [groupId, setGroupId] = useState(); |
| | | |
| | | const warehouseChange = (e) => { |
| | | setGroupId(e.target.value) |
| | | } |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.bindloc')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <ReferenceInput |
| | | source="areaId" |
| | | reference="warehouseAreas" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | | optionText="name" |
| | | onChange={(value) => handleChange(value, 'areaId')} |
| | | value={formData.areaId} |
| | | validate={required()} |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | |
| | | </Grid> |
| | | |
| | | |
| | | <Grid item xs={4}> |
| | | <ReferenceArrayInput source="locId" reference="loc" > |
| | | <SelectArrayInput |
| | | label="table.field.locAreaMatRela.locId" |
| | | validate={required()} |
| | | optionText={'code'} |
| | | value={formData.locId} |
| | | onChange={(e) => handleChange(e.target.value, 'locId')} |
| | | /> |
| | | </ReferenceArrayInput> |
| | | |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | |
| | | </Box> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> |
| | | <Button type="submit" variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Box> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | ); |
| | | } |
| | | |
| | | export default MatnrModal; |
| | |
| | | import request from '@/utils/request'; |
| | | import BatchModal from './BatchModal'; |
| | | import PrintModal from './PrintModal'; |
| | | import LinkIcon from '@mui/icons-material/Link'; |
| | | import BindModal from './BindModal'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<> |
| | | <BatchButton /> |
| | | <BindButton /> |
| | | <PrintButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | </>} |
| | |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BindButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.bindloc"}> |
| | | <LinkIcon /> |
| | | </Button> |
| | | |
| | | <BindModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |