verou
2025-03-31 3438712e24fc1641f8941b17aa572ed1bce72b40
feat:质检选单
4个文件已修改
1个文件已添加
265 ■■■■■ 已修改文件
rsf-admin/src/i18n/en.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/zh.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/asnOrder/AsnWareModal.jsx 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/qlyInspect/AsnSelModal.jsx 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/qlyInspect/QlyInspectList.jsx 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/en.js
@@ -410,13 +410,15 @@
                projectName: "ProjectName",
            },
            qlyInspect: {
                asnItemId: "asnItemId",
                asnId: "asnId",
                asnCode: "asnCode",
                code: "code",
                wkType: "wkType",
                safeQty: "safeQty",
                dlyQty: "dlyQty",
                rcptQty: "rcptQty",
                isptQty: "isptQty",
                isptStatus: "isptStatus",
            },
            qlyIsptItem: {
                ispectId: "ispectId",
@@ -759,6 +761,7 @@
        quality: "quality",
        complete: "complete",
        close: "close",
        asnCreate: "asnCreate",
    },
};
rsf-admin/src/i18n/zh.js
@@ -418,13 +418,15 @@
                projectName: "项目名称",
            },
            qlyInspect: {
                asnItemId: "通知单明细ID",
                asnId: "收货通知单号",
                asnCode: "收货通知单编码",
                code: "编码",
                wkType: "业务类型",
                safeQty: "合格数量",
                dlyQty: "送货数量",
                rcptQty: "收货数量    ",
                isptQty: "质检数量",
                isptStatus: "质检状态",
            },
            qlyIsptItem: {
                ispectId: "主单ID",
@@ -495,7 +497,7 @@
                maxWeight: "最大重量",
            },
            asnOrder: {
                code: "编码",
                code: "ASN单号",
                poCode: "PO编码",
                poId: "PO标识",
                type: "单据类型",
@@ -772,6 +774,7 @@
        quality: "质检",
        complete: "完成",
        close: "关闭",
        asnCreate: "通过ASN创建",
    },
};
rsf-admin/src/page/asnOrder/AsnWareModal.jsx
@@ -36,7 +36,8 @@
    const [formData, setFormData] = useState({
        name: '',
        code: ''
        code: '',
        groupId: ''
    });
    const [tableData, setTableData] = useState([]);
@@ -54,7 +55,8 @@
    const reset = () => {
        setFormData({
            name: '',
            code: ''
            code: '',
            groupId: ''
        })
    }
@@ -84,7 +86,7 @@
        const res = await request.post(`/matnr/page`, {
            ...formData,
            current: 1,
            pageSize: 199,
            pageSize: 100,
            orderBy: "create_time desc"
        });
        if (res?.data?.code === 200) {
rsf-admin/src/page/qlyInspect/AsnSelModal.jsx
New file
@@ -0,0 +1,207 @@
import React, { useState, useEffect, useCallback } from "react";
import {
    Dialog,
    DialogActions,
    DialogContent,
    DialogTitle,
    Stack,
    Grid,
    TextField,
    Box,
    Button,
    Paper,
    styled,
    RadioGroup,
    Radio,
    FormControlLabel,
} from '@mui/material';
import DialogCloseButton from "../components/DialogCloseButton";
import ConfirmButton from "../components/ConfirmButton";
import { useTranslate, useNotify, useRefresh } from 'react-admin';
import request from '@/utils/request';
import { DataGrid, useGridApiRef } from '@mui/x-data-grid';
import SaveIcon from '@mui/icons-material/Save';
import TreeSelectInput from "@/page/components/TreeSelectInput";
import { throttle } from 'lodash';
const AsnSelModal = (props) => {
    const { open, setOpen } = props;
    const translate = useTranslate();
    const notify = useNotify();
    const refresh = useRefresh();
    const handleClose = (event, reason) => {
        if (reason !== "backdropClick") {
            setOpen(false);
        }
    };
    const [formData, setFormData] = useState({
        code: ''
    });
    const [tableData, setTableData] = useState([]);
    const [selectedRow, setSelectedRow] = useState(null);
    const handleChange = (e) => {
        const { name, value } = e.target;
        setFormData((prevData) => ({
            ...prevData,
            [name]: value
        }));
    };
    const reset = () => {
        setFormData({
            code: ''
        })
    }
    const handleSubmit = () => {
        console.log(selectedRow);
        setOpen(false);
        reset();
    };
    const getData = async () => {
        const res = await request.post(`/asnOrder/page`, {
            ...formData,
            current: 1,
            pageSize: 100,
            orderBy: "create_time desc"
        });
        if (res?.data?.code === 200) {
            setTableData(res.data.data.records);
        } else {
            notify(res.data.msg);
        }
    };
    useEffect(() => {
        getData();
    }, [open]);
    const handleSearch = () => {
        getData()
    };
    return (
        <Dialog
            open={open}
            onClose={handleClose}
            aria-labelledby="form-dialog-title"
            fullWidth
            disableRestoreFocus
            maxWidth="lg"
        >
            <DialogTitle id="form-dialog-title" sx={{
                position: 'sticky',
                top: 0,
                backgroundColor: 'background.paper',
                zIndex: 1000
            }}>
                选择asn单
                <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}>
                    <DialogCloseButton onClose={handleClose} />
                </Box>
            </DialogTitle>
            <DialogContent sx={{ mt: 2 }}>
                <Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
                    <Grid container spacing={2}>
                        <Grid item md={4}>
                            <TextField
                                label={translate('table.field.asnOrder.code')}
                                name="code"
                                value={formData.code}
                                onChange={handleChange}
                                size="small"
                            />
                        </Grid>
                    </Grid>
                </Box>
                <Box sx={{ mt: 2 }}>
                    <Stack direction="row" spacing={2}>
                        <Button variant="contained" onClick={handleSearch}>搜索</Button>
                    </Stack>
                </Box>
                <Box sx={{ mt: 2, height: 400, width: '100%' }}>
                    <AsnSelModalTable
                        tableData={tableData}
                        setTableData={setTableData}
                        selectedRow={selectedRow}
                        setSelectedRow={setSelectedRow}
                    />
                </Box>
            </DialogContent>
            <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
                <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
                    <Button onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}>
                        {translate('toolbar.confirm')}
                    </Button>
                </Box>
            </DialogActions>
        </Dialog>
    );
};
export default AsnSelModal;
const AsnSelModalTable = ({ tableData, setTableData, selectedRow, setSelectedRow }) => {
    const translate = useTranslate();
    const notify = useNotify();
    const apiRef = useGridApiRef();
    const handleRadioChange = (event, id) => {
        setSelectedRow(id);
    };
    const [columns, setColumns] = useState([
        // { field: 'id', headerName: 'ID', width: 100 },
        {
            field: 'radio',
            headerName: '',
            width: 55,
            renderCell: (params) => {
                return (
                    <FormControlLabel
                        value={params.row.id}
                        control={<Radio />}
                        onChange={(event) => handleRadioChange(event, params.row.id)}
                    />
                );
            },
        },
        { field: 'code', headerName: translate('table.field.asnOrder.code'), width: 200 },
        { field: 'type$', headerName: translate('table.field.asnOrder.type') },
        { field: 'wkType$', headerName: translate('table.field.asnOrder.wkType') },
        { field: 'anfme', headerName: translate('table.field.asnOrder.anfme') },
        { field: 'qty', headerName: translate('table.field.asnOrder.qty') },
        { field: 'logisNo', headerName: translate('table.field.asnOrder.logisNo') },
    ])
    const onRowClick = (e) => {
        setSelectedRow(e.id)
    }
    return (
        <div style={{ height: 400, width: '100%' }}>
            <RadioGroup value={selectedRow} onChange={handleRadioChange}>
                <DataGrid
                    size="small"
                    rows={tableData}
                    columns={columns}
                    onRowClick={onRowClick}
                    apiRef={apiRef}
                    disableColumnMenu={true}
                    disableColumnSorting
                    disableMultipleColumnsSorting
                />
            </RadioGroup>
        </div>
    );
};
rsf-admin/src/page/qlyInspect/QlyInspectList.jsx
@@ -48,7 +48,9 @@
import ConstructionIcon from "@mui/icons-material/Construction";
import CloseIcon from "@mui/icons-material/Close";
import TaskIcon from '@mui/icons-material/Task';
import AddIcon from '@mui/icons-material/Add';
import request from '@/utils/request';
import AsnSelModal from "./AsnSelModal";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
@@ -67,7 +69,6 @@
const filters = [
    <SearchInput source="condition" alwaysOn />,
    <NumberInput source="asnItemId" label="table.field.qlyInspect.asnItemId" />,
    <TextInput source="code" label="table.field.qlyInspect.code" />,
    <TextInput source="wkType" label="table.field.qlyInspect.wkType" />,
    <NumberInput source="safeQty" label="table.field.qlyInspect.safeQty" />,
@@ -110,6 +111,7 @@
                sort={{ field: "create_time", order: "desc" }}
                actions={(
                    <TopToolbar>
                        <AsnCreatButton />
                        <FilterButton />
                        <SelectColumnsButton preferenceKey='qlyInspect' />
                        <MyExportButton />
@@ -123,11 +125,13 @@
                    rowClick={(id, resource, record) => false}
                    expand={() => <QlyInspectPanel />}
                    expandSingle={true}
                    omit={['id', 'createTime', 'createBy', 'memo']}
                    omit={['id', 'createTime', 'createBy', 'memo', 'asnId']}
                >
                    <NumberField source="id" />
                    <NumberField source="asnItemId$" label="table.field.qlyInspect.asnItemId" />
                    <NumberField source="asnId" label="table.field.qlyInspect.asnId" />
                    <NumberField source="asnCode" label="table.field.qlyInspect.asnCode" />
                    <TextField source="code" label="table.field.qlyInspect.code" />
                    <TextField source="isptStatus$" label="table.field.qlyInspect.isptStatus" />
                    <TextField source="wkType" label="table.field.qlyInspect.wkType" />
                    <NumberField source="safeQty" label="table.field.qlyInspect.safeQty" />
                    <NumberField source="dlyQty" label="table.field.qlyInspect.dlyQty" />
@@ -162,6 +166,8 @@
                setDrawerVal={setDrawerVal}
            >
            </PageDrawer>
        </Box>
    )
}
@@ -200,7 +206,7 @@
    const notify = useNotify();
    const refresh = useRefresh();
    const requestComplete = async () => {
        const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' });
        const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '1' });
        if (code === 200) {
            notify(msg);
@@ -224,7 +230,7 @@
    const refresh = useRefresh();
    const requestClose = async () => {
        const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, code: '222222' });
        const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '3' });
        if (code === 200) {
            notify(msg);
@@ -241,3 +247,25 @@
        </Button>
    )
}
const AsnCreatButton = () => {
    const record = useRecordContext();
    const notify = useNotify();
    const refresh = useRefresh();
    const [createDialog, setCreateDialog] = useState(false);
    return (
        <>
            <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"}>
                <AddIcon />
            </Button>
            <AsnSelModal
                open={createDialog}
                setOpen={setCreateDialog}
            />
        </>
    )
}