| | |
| | | check: 'Check', |
| | | confirm: 'confirm', |
| | | cancel: "cancel", |
| | | delete: 'Delete', |
| | | query: "Query", |
| | | bulkExport: "Bulk Export", |
| | | continue: 'Continue Receipt', |
| | |
| | | selectSite: '选择站点', |
| | | confirmSelect: '确认选择', |
| | | cancel: "取消", |
| | | delete: '删除', |
| | | query: "查询", |
| | | top: "置顶", |
| | | resort: "排序", |
| | |
| | | ReferenceInput, |
| | | AutocompleteInput, |
| | | Button, |
| | | BulkDeleteButton, |
| | | BulkDeleteButton, |
| | | useRedirect, |
| | | } from 'react-admin'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | <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" />, |
| | |
| | | > |
| | | <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" /> |
| | |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal} /> |
| | | </PageEditDrawer> |
| | | <CheckOrderPub record={select} open={drawerVal} setOpen={setDrawerVal} /> |
| | | </PageEditDrawer> |
| | | </Box > |
| | | ) |
| | | } |
| | |
| | | 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, |
| | |
| | | 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'; |
| | |
| | | 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': { |
| | |
| | | '& .column-maktx': { |
| | | width: 200 |
| | | }, |
| | | |
| | | mt: '60px' |
| | | // '& .RaBulkActionsToolbar-toolbar': { |
| | | // display: 'none' |
| | | // } |
| | | |
| | | })); |
| | | |
| | | const CheckOrderPub = (props) => { |
| | |
| | | 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) |
| | |
| | | <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} |
| | |
| | | </> |
| | | ); |
| | | } |
| | | |
| | | 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 }) => { |
New file |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | type: '', |
| | | wkType: '', |
| | | wkType: '7', |
| | | checkType: '0', |
| | | poCode: '', |
| | | logisNo: '', |
| | | arrTime: '' |
| | |
| | | const resetData = () => { |
| | | setFormData({ |
| | | type: '', |
| | | wkType: '', |
| | | wkType: '7', |
| | | checkType: '0', |
| | | poCode: '', |
| | | logisNo: '', |
| | | arrTime: '' |
| | |
| | | <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> |
| | |
| | | </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 }}> |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | |
| | | 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"; |
| | | } |