| | |
| | | useRefresh, |
| | | useRedirect, |
| | | } from 'react-admin'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_TYPE } from '@/config/setting'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { DataGrid, useGridApiContext, GridActionsCellItem, useGridApiRef } from '@mui/x-data-grid'; |
| | | import request from '@/utils/request'; |
| | |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import { Delete, Edit, Add } from '@mui/icons-material'; |
| | | import OutStockSiteDialog from "./OutStockSiteDialog"; |
| | | import { color } from "framer-motion"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | } |
| | | })); |
| | | |
| | | |
| | | const OutStockPublic = (props) => { |
| | | const { record, open, setOpen } = props; |
| | | const notify = useNotify(); |
| | | const gridRef = useGridApiRef(); |
| | | const [rows, setRows] = useState({}); |
| | | const translate = useTranslate(); |
| | | const [selectedIds, setSelectedIds] = React.useState([]); |
| | | const [selectedIds, setSelectedIds] = useState([]); |
| | | const [formData, setFormData] = useState({ |
| | | orderId: record?.id |
| | | orderId: record?.id, |
| | | waveId: DEFAULT_TYPE |
| | | }); |
| | | const [dialog, setDialog] = useState(false); |
| | | const [selectedValue, setSelectedValue] = useState({}); |
| | |
| | | const handleClose = (value) => { |
| | | setDialog(false); |
| | | setSelectedValue(value); |
| | | console.log(rows); |
| | | console.log(value); |
| | | const newRows = rows.map(item => { |
| | | return { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } |
| | | }) |
| | | setRows(newRows); |
| | | const newRows = rows.map(item => { |
| | | return { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } |
| | | }) |
| | | setRows(newRows); |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | getWaveRule() |
| | | }, [formData, open]) |
| | | |
| | | if (open) { |
| | | getWaveRule() |
| | | } |
| | | }, [open, formData]) |
| | | |
| | | const getWaveRule = async () => { |
| | | if (formData.waveId == null && formData.waveId == undefined) { |
| | | return |
| | | } |
| | | const { data: { code, data, msg } } = await request.post('/outStock/order/getOutTaskItems', { ...formData }); |
| | | |
| | | if (code === 200) { |
| | | setRows(data) |
| | | } else { |
| | |
| | | <AutocompleteInput |
| | | label="table.field.waveRule.type" |
| | | onChange={(e) => handleChange(e, 'waveId')} |
| | | defaultValue={15} |
| | | value={formData.type} |
| | | validate={required()} |
| | | /> |
| | |
| | | |
| | | const PreviewTable = ({ rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog }) => { |
| | | gridRef.current = useGridApiRef(); |
| | | const translate = useTranslate(); |
| | | |
| | | const columns = [ |
| | | { field: 'id', headerName: 'ID', width: 40 }, |
| | | // { field: 'id', headerName: 'ID', width: 40 }, |
| | | { field: 'locCode', headerName: '库位', width: 110 }, |
| | | { field: 'barcode', headerName: '容器', width: 120 }, |
| | | { field: 'matnrCode', headerName: '物料编码', width: 120 }, |
| | | { field: 'batch', headerName: '批次', width: 90 }, |
| | | { field: 'unit', headerName: '单位', width: 90 }, |
| | | { field: 'outQty', headerName: '本次出库数量', width: 110 }, |
| | | { field: 'unit', headerName: '单位', width: 60 }, |
| | | { field: 'outQty', headerName: '出库数量', width: 110, }, |
| | | { |
| | | field: 'anfme', headerName: '库存数量', width: 110, |
| | | renderCell: (params) => ( |
| | | <OutStockAnfme value={params.value} /> |
| | | ) |
| | | }, |
| | | { |
| | | field: 'siteNo', |
| | | headerName: '出库口', |
| | |
| | | }) |
| | | 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; |
| | |
| | | }, |
| | | }} |
| | | checkboxSelection |
| | | disableRowSelectionOnClick |
| | | pageSizeOptions={[15, 25, 35, 45]} |
| | | onRowSelectionModelChange={(ids) => { |
| | | setSelectedIds(ids) |
| | |
| | | const refresh = useRefresh(); |
| | | const redirect = useRedirect(); |
| | | const submit = async () => { |
| | | console.log(record); |
| | | const items = gridRef.current?.getSortedRows(); |
| | | const { data: { code, data, msg } } = await request.post('/outStock/generate/tasks', { items, outId: record?.id }); |
| | | if (code == 200) { |