skyouc
19 小时以前 3e36f73770677e756826df1b5824c8e89769659c
盘点功能优化
8个文件已修改
1个文件已添加
451 ■■■■ 已修改文件
rsf-admin/src/i18n/en.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/zh.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/CheckOrderList.jsx 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/CheckOrderModal.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/CheckOrderPub.jsx 192 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/CheckPreviewTable.jsx 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/SelectMatnrModal.jsx 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WkOrder.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/system/constant/DictTypeCode.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/en.js
@@ -1207,6 +1207,7 @@
        check: 'Check',
        confirm: 'confirm',
        cancel: "cancel",
        delete: 'Delete',
        query: "Query",
        bulkExport: "Bulk Export",
        continue: 'Continue Receipt',
rsf-admin/src/i18n/zh.js
@@ -1221,6 +1221,7 @@
        selectSite: '选择站点',
        confirmSelect: '确认选择',
        cancel: "取消",
        delete: '删除',
        query: "查询",
        top: "置顶",
        resort: "排序",
rsf-admin/src/page/orders/check/CheckOrderList.jsx
@@ -24,7 +24,7 @@
  ReferenceInput,
  AutocompleteInput,
  Button,
  BulkDeleteButton,
  BulkDeleteButton,
  useRedirect,
} from 'react-admin';
import { styled } from '@mui/material/styles';
@@ -73,7 +73,7 @@
    <AutocompleteInput label="table.field.checkOrder.type" optionValue="value" />
  </ReferenceInput>,
  <ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_check_order_type' }} label="table.field.checkOrder.checkType" alwaysOn>
    <AutocompleteInput label="table.field.checkOrder.checkType" optionValue="value"/>
    <AutocompleteInput label="table.field.checkOrder.checkType" optionValue="value" />
  </ReferenceInput>,
  <TextInput source="logisNo" label="table.field.checkOrder.logisNo" />,
  <DateInput source="arrTime" label="table.field.checkOrder.arrTime" />,
@@ -141,15 +141,16 @@
      >
        <StyledDatagrid
          preferenceKey='check'
          bulkActionButtons={() => <BulkDeleteButton mutationMode="pessimistic"/>}
          bulkActionButtons={() => <BulkDeleteButton mutationMode="pessimistic" />}
          rowClick={false}
          expandSingle={true}
          omit={['id', 'createTime', 'createBy', 'memo', 'rleStatus$']}
        >
          <NumberField source="id" />
          <TextField source="code" label="table.field.checkOrder.code" />
          <TextField source="type$" label="table.field.checkOrder.type" />
          <TextField cellClassName="wkType" source="checkType$" label="table.field.checkOrder.checkType" />
          {/* <TextField source="type$" label="table.field.checkOrder.type" /> */}
          <TextField cellClassName="wkType" source="wkType$" label="table.field.checkOrder.type" />
          <TextField  source="checkType$" label="table.field.checkOrder.checkType" />
          <NumberField source="anfme" label="table.field.checkOrder.anfme" />
          <NumberField source="workQty" label="table.field.checkOrder.workQty" />
          <NumberField source="qty" label="table.field.checkOrder.qty" />
@@ -181,8 +182,8 @@
        drawerVal={drawerVal}
        setDrawerVal={setDrawerVal}
      >
        <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal}  />
      </PageEditDrawer>
        <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal} />
      </PageEditDrawer>
    </Box >
  )
}
rsf-admin/src/page/orders/check/CheckOrderModal.jsx
@@ -1,4 +1,4 @@
import { Dialog, DialogActions, DialogContent, DialogTitle, Box, LinearProgress } from "@mui/material";
import { Dialog, DialogActions, DialogContent, DialogTitle, Box, TextField ,LinearProgress } from "@mui/material";
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    List,
rsf-admin/src/page/orders/check/CheckOrderPub.jsx
@@ -15,6 +15,7 @@
    Form,
    useRefresh,
    useRedirect,
    TextInput,
} from 'react-admin';
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_TYPE } from '@/config/setting';
import { styled } from '@mui/material/styles';
@@ -25,7 +26,7 @@
import ConfirmButton from '../../components/ConfirmButton';
import { Delete, Edit, Add } from '@mui/icons-material';
import CheckOrderSiteDialog from "./CheckOrderSiteDialog";
import { map } from "lodash";
import CheckPreviewTable from "./CheckPreviewTable";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
@@ -37,12 +38,7 @@
    '& .column-maktx': {
        width: 200
    },
    mt: '60px'
    // '& .RaBulkActionsToolbar-toolbar': {
    //     display: 'none'
    // }
}));
const CheckOrderPub = (props) => {
@@ -73,8 +69,6 @@
    const getLocs = async (ids) => {
        const { data: { code, data, msg } } = await request.post('/check/locs/' + ids);
        if (code === 200) {
            console.log('----->');
            console.log(data);
            setRows(data)
            const matnrs = selectedMatnr.filter(item => data.some(bigData => bigData.matnrCode === item));
            // setSelectedMatnr(matnrs)
@@ -213,7 +207,7 @@
                    <Grid item xl={6.3} gap={2}>
                        <Card sx={{ minHeight: 1050, height: 'calc(100% - 10px)', width: '100%' }}>
                            <Box>
                                <PreviewTable
                                <CheckPreviewTable
                                    rows={rows}
                                    gridRef={gridRef}
                                    setRows={setRows}
@@ -242,186 +236,6 @@
        </>
    );
}
const PreviewTable = ({ rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog, formData }) => {
    gridRef.current = useGridApiRef();
    const translate = useTranslate();
    useEffect(() => {
        if (selectedIds.length > 0) {
            console.log(selectedIds);
        }
    }, [selectedIds])
    const baseColumns = [
        { field: 'locCode', headerName: '库位', width: 110 },
        { field: 'barcode', headerName: '容器', width: 120 },
        { field: 'matnrCode', headerName: '物料编码', width: 120 },
        { field: 'batch', headerName: '批次', width: 90 },
        { field: 'unit', headerName: '单位', width: 60 },
        {
            field: 'anfme', headerName: '库存数量', width: 110,
            renderCell: (params) => (
                <OutStockAnfme value={params.value} />
            )
        },
        {
            field: 'siteNo',
            headerName: '出库口',
            width: 90,
            type: 'singleSelect',
            editable: true,
            renderCell: (params) => (
                <OutStockSiteNo value={params.value} />
            ),
            renderEditCell: (params) => (
                <OutStockSite {...params} />
            ),
        },
    ]
    const optAction = {
        field: 'actions',
        type: 'actions',
        headerName: translate('common.field.opt'),
        with: 120,
        getActions: (params) => [
            <GridActionsCellItem
                icon={<Delete />}
                label="Delete"
                onClick={() => handleDelete(params.row, rows, setRows)}
            />,
        ]
    }
    const columns = (formData.waveId == 15 || formData.waveId == 16) ? [...baseColumns] : [...baseColumns, optAction];
    /**
     * 删除事件
     * @param {*} params
     */
    const handleDelete = (params, rows, setRows) => {
        const outRows = rows.filter(row => {
            return row.id !== params.id
        })
        setRows(outRows)
    }
    const OutStockAnfme = React.memo(function OutStockAnfme(props) {
        const { value } = props;
        return (
            value > 0 ?
                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                    <span>{value}</span>
                </Box>
                :
                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                    <span style={{ color: 'red' }}>{translate('common.edit.title.insuffInventory')}</span>
                </Box>
        );
    });
    const OutStockSiteNo = React.memo(function OutStockSiteNo(props) {
        const { value } = props;
        if (!value) {
            return null;
        }
        return (
            <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                <span>{value}</span>
            </Box>
        );
    });
    const CustomToolBar = () => {
        const selectSiteNo = () => {
            setDialog(true)
        }
        return (
            <Box sx={{
                p: 1,
                display: 'flex',
                justifyContent: 'flex-end',
                borderTop: '1px solid rgba(224, 224, 224, 1)'
            }}>
                <Button
                    onClick={selectSiteNo}
                    variant="outlined"
                    label="toolbar.modiftySite"
                    size="medium"
                    sx={{ mr: 1 }} />
            </Box>
        );
    }
    const OutStockSite = (params) => {
        const { id, field, siteNo, row: { staNos } } = params;
        const apiRef = useGridApiContext();
        const handleChange = async (event) => {
            await apiRef.current.setEditCellValue(
                { id, field, value: event.target.value },
                event,
            );
            apiRef.current.stopCellEditMode({ id, field });
        };
        const handleClose = (event, reason) => {
            if (reason === 'backdropClick') {
                apiRef.current.stopCellEditMode({ id, field });
            }
        };
        return (
            <Select
                value={siteNo}
                onChange={handleChange}
                MenuProps={{
                    onClose: handleClose,
                }}
                sx={{
                    height: '100%',
                    '& .MuiSelect-select': {
                        display: 'flex',
                        alignItems: 'center',
                        pl: 1,
                    },
                }}
                autoFocus
                fullWidth
                open
            >
                {staNos.map((option) => {
                    return (
                        <MenuItem
                            key={option}
                            value={option.staNo}
                        >
                            <ListItemText sx={{ overflow: 'hidden' }} primary={option.staNo} />
                        </MenuItem>
                    );
                })}
            </Select >
        )
    }
    return (
        <DataGrid
            storeKey={"locItemPreview"}
            rows={rows}
            columns={columns}
            slots={{ toolbar: CustomToolBar }}
            apiRef={gridRef}
            checkboxSelection
            disableRowSelectionOnClick
            hideFooterPagination={true}  // 隐藏分页控件
            hideFooter={false}
            onRowSelectionModelChange={(ids) => {
                setSelectedIds(ids)
            }}
        />
    )
}
//提交按钮
const SubmitButton = ({ selectedIds, setSelectedIds, rowSelectedIds, gridRef, record, setOpen, selectedMatnr }) => {
rsf-admin/src/page/orders/check/CheckPreviewTable.jsx
New file
@@ -0,0 +1,204 @@
import { Box, Card, Grid, LinearProgress, Select, MenuItem, ListItemText } from "@mui/material";
import React, { useState, useRef, useEffect, useMemo } from "react";
import { DataGrid, useGridApiContext, GridActionsCellItem, useGridApiRef } from '@mui/x-data-grid';
import {
    List,
    Button,
    useTranslate,
    useNotify,
    useListContext,
    NumberField,
    ReferenceInput,
    AutocompleteInput,
    required,
    Form,
    useRefresh,
    useRedirect,
    TextInput,
} from 'react-admin';
const CheckPreviewTable = (props) => {
    const { rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog, formData } = props;
    // const translate = useTranslate();
    // const refresh = useRefresh();
    // const notify = useNotify();
    gridRef.current = useGridApiRef();
    const translate = useTranslate();
    useEffect(() => {
        if (selectedIds.length > 0) {
            console.log(selectedIds);
        }
    }, [selectedIds])
    const baseColumns = [
        { field: 'locCode', headerName: '库位', width: 110 },
        { field: 'barcode', headerName: '容器', width: 120 },
        { field: 'matnrCode', headerName: '物料编码', width: 120 },
        { field: 'batch', headerName: '批次', width: 90 },
        { field: 'unit', headerName: '单位', width: 60 },
        {
            field: 'anfme', headerName: '库存数量', width: 110,
            renderCell: (params) => (
                <OutStockAnfme value={params.value} />
            )
        },
        {
            field: 'siteNo',
            headerName: '出库口',
            width: 90,
            type: 'singleSelect',
            editable: true,
            renderCell: (params) => (
                <OutStockSiteNo value={params.value} />
            ),
            renderEditCell: (params) => (
                <OutStockSite {...params} />
            ),
        },
    ]
    const optAction = {
        field: 'actions',
        type: 'actions',
        headerName: translate('common.field.opt'),
        with: 120,
        getActions: (params) => [
            <GridActionsCellItem
                icon={<Delete />}
                label="Delete"
                onClick={() => handleDelete(params.row, rows, setRows)}
            />,
        ]
    }
    const columns = (formData.waveId == 15 || formData.waveId == 16) ? [...baseColumns] : [...baseColumns, optAction];
    /**
     * 删除事件
     * @param {*} params
     */
    const handleDelete = (params, rows, setRows) => {
        const outRows = rows.filter(row => {
            return row.id !== params.id
        })
        setRows(outRows)
    }
    const OutStockAnfme = React.memo(function OutStockAnfme(props) {
        const { value } = props;
        return (
            value > 0 ?
                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                    <span>{value}</span>
                </Box>
                :
                <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                    <span style={{ color: 'red' }}>{translate('common.edit.title.insuffInventory')}</span>
                </Box>
        );
    });
    const OutStockSiteNo = React.memo(function OutStockSiteNo(props) {
        const { value } = props;
        if (!value) {
            return null;
        }
        return (
            <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                <span>{value}</span>
            </Box>
        );
    });
    const CustomToolBar = () => {
        const selectSiteNo = () => {
            setDialog(true)
        }
        return (
            <Box sx={{
                p: 1,
                display: 'flex',
                justifyContent: 'flex-end',
                borderTop: '1px solid rgba(224, 224, 224, 1)'
            }}>
                <Button
                    onClick={selectSiteNo}
                    variant="outlined"
                    label="toolbar.modiftySite"
                    size="medium"
                    sx={{ mr: 1 }} />
            </Box>
        );
    }
    const OutStockSite = (params) => {
        const { id, field, siteNo, row: { staNos } } = params;
        const apiRef = useGridApiContext();
        const handleChange = async (event) => {
            await apiRef.current.setEditCellValue(
                { id, field, value: event.target.value },
                event,
            );
            apiRef.current.stopCellEditMode({ id, field });
        };
        const handleClose = (event, reason) => {
            if (reason === 'backdropClick') {
                apiRef.current.stopCellEditMode({ id, field });
            }
        };
        return (
            <Select
                value={siteNo}
                onChange={handleChange}
                MenuProps={{
                    onClose: handleClose,
                }}
                sx={{
                    height: '100%',
                    '& .MuiSelect-select': {
                        display: 'flex',
                        alignItems: 'center',
                        pl: 1,
                    },
                }}
                autoFocus
                fullWidth
                open
            >
                {staNos.map((option) => {
                    return (
                        <MenuItem
                            key={option}
                            value={option.staNo}
                        >
                            <ListItemText sx={{ overflow: 'hidden' }} primary={option.staNo} />
                        </MenuItem>
                    );
                })}
            </Select >
        )
    }
    return (
        <DataGrid
            storeKey={"locItemPreview"}
            rows={rows}
            columns={columns}
            slots={{ toolbar: CustomToolBar }}
            apiRef={gridRef}
            checkboxSelection
            disableRowSelectionOnClick
            hideFooterPagination={true}  // 隐藏分页控件
            hideFooter={false}
            onRowSelectionModelChange={(ids) => {
                setSelectedIds(ids)
            }}
        />
    )
}
export default CheckPreviewTable;
rsf-admin/src/page/orders/check/SelectMatnrModal.jsx
@@ -83,7 +83,8 @@
    const [formData, setFormData] = useState({
        type: '',
        wkType: '',
        wkType: '7',
        checkType: '0',
        poCode: '',
        logisNo: '',
        arrTime: ''
@@ -101,7 +102,8 @@
    const resetData = () => {
        setFormData({
            type: '',
            wkType: '',
            wkType: '7',
            checkType: '0',
            poCode: '',
            logisNo: '',
            arrTime: ''
@@ -217,11 +219,21 @@
                            <Grid container spacing={2}>
                                <Grid item md={2}>
                                    <DictSelect
                                        label={translate("table.field.checkOrder.checkType")}
                                        label={translate("table.field.checkOrder.type")}
                                        value={formData.wkType}
                                        variant="filled"
                                        onChange={(e) => handleChange(e.target.value, 'wkType')}
                                        dictTypeCode="sys_check_order_type"
                                        required
                                    />
                                </Grid>
                                <Grid item md={2}>
                                    <DictSelect
                                        label={translate("table.field.checkOrder.checkType")}
                                        value={formData.checkType}
                                        variant="filled"
                                        onChange={(e) => handleChange(e.target.value, 'checkType')}
                                        dictTypeCode="sys_check_type"
                                        required
                                    />
                                </Grid>
@@ -240,8 +252,10 @@
                    </Box>
                    <Box sx={{ mt: 2 }}>
                        <Stack direction="row" spacing={2}>
                            <Button variant="contained" onClick={() => setCreateDialog(true)}>新增物料</Button>
                            <ConfirmButton label={'删除'} variant="outlined" color="error" onConfirm={handleDeleteItem} />
                            <Button variant="contained" onClick={() => setCreateDialog(true)} >
                                {translate('common.action.newAddMats')}
                            </Button>
                            <ConfirmButton label={"toolbar.delete"} variant="outlined" color="error" onConfirm={handleDeleteItem} />
                        </Stack>
                    </Box>
                    <Box sx={{ mt: 2 }}>
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WkOrder.java
@@ -231,11 +231,15 @@
    }
    public String getWkType$(){
        String typeCode = DictTypeCode.DICT_SYS_BUSINESS_TYPE;
        if (type.equals(OrderType.ORDER_CHECK.type)) {
            typeCode = DictTypeCode.SYS_CHECK_ORDER_TYPE;
        }
        if (Cools.isEmpty(this.wkType)){
            return "";
        }
        DictDataService dictDataService = SpringUtils.getBean(DictDataService.class);
        DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_BUSINESS_TYPE).eq(DictData::getValue, this.wkType));
        DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, typeCode).eq(DictData::getValue, this.wkType));
        if (Objects.isNull(dictData)) {
            return null;
        }
@@ -243,11 +247,11 @@
    }
    public String getCheckType$(){
        if (Cools.isEmpty(this.wkType)){
        if (Cools.isEmpty(this.checkType)){
            return "";
        }
        DictDataService dictDataService = SpringUtils.getBean(DictDataService.class);
        DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.SYS_CHECK_ORDER_TYPE).eq(DictData::getValue, this.wkType));
        DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.SYS_CHECK_TYPE).eq(DictData::getValue, this.checkType));
        if (Objects.isNull(dictData)) {
            return null;
        }
rsf-server/src/main/java/com/vincent/rsf/server/system/constant/DictTypeCode.java
@@ -89,4 +89,6 @@
    public final static String SYS_CHECK_DIFF_EXCE_STATUS =  "sys_check_diff_exce_status";
    public final static String SYS_CHECK_DIFF_REASON =  "sys_check_diff_reason";
    public final static String SYS_CHECK_TYPE = "sys_check_type";
}