| | |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | DatagridConfigurable, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | TextField, |
| | | NumberField, |
| | | ReferenceField, |
| | | BooleanField, |
| | | useNotify, |
| | | useSelectAll, |
| | | Form, |
| | | useCreateController, |
| | | useListContext, |
| | | useRefresh, |
| | | List, |
| | | SelectArrayInput |
| | | } from 'react-admin'; |
| | | import { |
| | |
| | | DialogContent, |
| | | DialogTitle, |
| | | Grid, |
| | | TextField, |
| | | Box, |
| | | Button, |
| | | Paper, |
| | |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | })); |
| | | |
| | | const MatnrModal = ({ open, setOpen }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | | |
| | | const notify = useNotify(); |
| | | const [options, setOptions] = useState({ |
| | | condition: null |
| | | }); |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | areaMatId: null, |
| | |
| | | matnrId: null, |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | | |
| | | const { selectedIds, onUnselectItems, onSelectAll } = useListContext(); |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | |
| | | ...prevData, |
| | | [name]: value |
| | | })); |
| | | refresh() |
| | | refresh(); |
| | | }; |
| | | |
| | | const removeEmptyKeys = (obj) => { |
| | |
| | | groupId: formData.groupId, |
| | | matnrId: formData.matnrId, |
| | | } |
| | | |
| | | 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> |
| | | <Dialog open={open} maxWidth="xl" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.bindmatnr')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, height: 700 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <ReferenceInput |
| | |
| | | filterToQuery={(val) => ({ code: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TreeSelectInput |
| | | label="table.field.locAreaMatRela.groupId" |
| | |
| | | /> |
| | | </Grid> |
| | | |
| | | |
| | | <Grid item xs={4}> |
| | | <ReferenceArrayInput source="matnrId" reference="matnr" filter={{ groupId: formData.groupId }}> |
| | | <SelectArrayInput |
| | | label="table.field.locAreaMatRela.matnrId" |
| | | // validate={required()} |
| | | value={formData.matnrId} |
| | | onChange={(e) => handleChange(e.target.value, 'matnrId')} |
| | | /> |
| | | </ReferenceArrayInput> |
| | | |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <List |
| | | resource="matnr" |
| | | filter={{ groupId: formData.groupId }} |
| | | empty={false} |
| | | queryOptions={{options}} |
| | | actions={<></>} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<></>} |
| | | rowClick={false} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poDetlId', 'matnrId', 'asnId']} |
| | | > |
| | | <NumberField key="id" source="id" />, |
| | | <TextField key="name" source="name" label="table.field.matnr.name" />, |
| | | <TextField key="code" source="code" label="table.field.matnr.code" />, |
| | | <ReferenceField key="groupId" source="groupId" label="table.field.matnr.groupId" reference="matnrGroup" link={false} sortable={false}> |
| | | <TextField source="name" /> |
| | | </ReferenceField>, |
| | | <TextField key="spec" source="spec" label="table.field.matnr.spec" />, |
| | | <TextField key="model" source="model" label="table.field.matnr.model" />, |
| | | <NumberField key="nromNum" source="nromNum" label="table.field.matnr.nromNum" />, |
| | | <TextField key="stockLeval$" source="stockLeval$" label="table.field.matnr.stockLevel" sortable={false} />, |
| | | <TextField key="flagLabelMange$" source="flagLabelMange$" label="table.field.matnr.isLabelMange" sortable={false} />, |
| | | <NumberField key="safeQty" source="safeQty" label="table.field.matnr.safeQty" />, |
| | | <NumberField key="minQty" source="minQty" label="table.field.matnr.minQty" />, |
| | | <NumberField key="maxQty" source="maxQty" label="table.field.matnr.maxQty" />, |
| | | <NumberField key="validWarn" source="validWarn" label="table.field.matnr.validWarn" />, |
| | | <BooleanField key="flagCheck" source="flagCheck" label="table.field.matnr.flagCheck" sortable={false} />, |
| | | <BooleanField key="statusBool" source="statusBool" label="common.field.status" sortable={false} />, |
| | | <TextField key="memo" source="memo" label="common.field.memo" sortable={false} />, |
| | | </StyledDatagrid> |
| | | </List> |
| | | {/* <ReferenceArrayInput source="matnrId" reference="matnr" filter={{ groupId: formData.groupId }}> |
| | | <SelectArrayInput |
| | | label="table.field.locAreaMatRela.matnrId" |
| | | value={formData.matnrId} |
| | | onChange={(e) => handleChange(e.target.value, 'matnrId')} |
| | | /> |
| | | </ReferenceArrayInput> */} |
| | | </Grid> |
| | | </Box> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'end' }}> |
| | | <Button type="submit" variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | |
| | | const InitModal = ({ open, setOpen }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | | const {filterValues} = useListContext(); // 获取列表上下文 |
| | | |
| | | |
| | | const notify = useNotify(); |
| | | const [disabled, setDisabled] = useState(false) |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | "warehouseId": null, |
| | | "areaId": undefined, |
| | | "warehouseId": filterValues.warehouseId, |
| | | "areaId": filterValues.areaId, |
| | | "endBay": undefined, |
| | | "endLev": undefined, |
| | | "endRow": undefined, |
| | |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <Form onSubmit={handleSubmit} defaultValues={filterValues}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.locInit')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | |
| | | reference="warehouse" |
| | | > |
| | | <AutocompleteInput |
| | | debounce |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | onChange={(value) => handleChange(value, 'warehouseId')} |
| | |
| | | import BatchModal from './BatchModal'; |
| | | import SubzoneModal from './SubzoneModal'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import MyField from "../../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import DashboardIcon from '@mui/icons-material/Dashboard'; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import request from '@/utils/request'; |
| | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [initDialog, setInitDialog] = useState(false); |
| | |
| | | </WrapperField> |
| | | |
| | | </StyledDatagrid> |
| | | <InitModal |
| | | open={initDialog} |
| | | setOpen={setInitDialog} |
| | | /> |
| | | </List> |
| | | <LocCreate |
| | | open={createDialog} |
| | |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | |
| | | <InitModal |
| | | open={initDialog} |
| | | setOpen={setInitDialog} |
| | | /> |
| | | |
| | | |
| | | </Box> |
| | | ) |
| | | } |
| | |
| | | if (row.flagWare === 1) { |
| | | setFilters({ warehouseId: row.id, areaId: '' }); |
| | | } else if (row.flagWare === 0) { |
| | | setFilters({ areaId: row.id, warehouseId: '' }); |
| | | setFilters({ areaId: row.id, warehouseId: row.warehouseId }); |
| | | } |
| | | |
| | | }; |
| | |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .RaList-content': { |
| | | '& .RaList-content': { |
| | | width: '200px' |
| | | }, |
| | | '& .RaList-main': { |
| | |
| | | <NumberInput source="valid" label="table.field.matnr.valid" />, |
| | | <NumberInput source="validWarn" label="table.field.matnr.validWarn" />, |
| | | <NumberInput source="flagCheck" label="table.field.matnr.flagCheck" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const { isLoading } = useListContext(); |
| | | |
| | | const [columns, setColumns] = useState([]); |
| | | const refresh = useRefresh(); |
| | | |
| | | useEffect(() => { |
| | | getDynamicFields(); |
| | | }, []); |
| | |
| | | <PrintButton /> |
| | | </WrapperField> |
| | | setColumns([...arr, ...fields, opt]); |
| | | |
| | | //filters添加过滤字段 |
| | | data.map(el => { |
| | | var i =0; |
| | | filters.map((item) =>{ |
| | | if(item.key === el.fields){ |
| | | i = 1; |
| | | } |
| | | }) |
| | | i===0 && filters.push(<TextInput key={el.fields} source={el.fields} label={el.fieldsAlise} />) |
| | | }) |
| | | |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | const { getValues } = useFormContext(); |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'end' }}> |
| | | <SaveButton /> |
| | | <></> |
| | | {/* <SaveButton /> */} |
| | | {/* <DeleteButton mutationMode="optimistic" /> */} |
| | | </Toolbar> |
| | | ) |
| | |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | sx={{ |
| | | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | |
| | | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | } |
| | | }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={24} md={16}> |
| | |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'end' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | <></> |
| | | {/* <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> */} |
| | | </Toolbar> |
| | | ) |
| | | } |
| | |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | sx={{ |
| | | '& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled': { |
| | | bgcolor: "white", |
| | | color: "black", |
| | | '-webkit-text-fill-color': "rgba(0, 0, 0)" |
| | | }, |
| | | '& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled': { |
| | | color: 'rgba(0, 0, 0, 0.77)' |
| | | } |
| | | }} |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={24} md={12}> |
| | | <Grid item xs={24} md={12} sx={{ |
| | | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | |
| | | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | } |
| | | }}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | |
| | | <NumberInput |
| | | label="table.field.waitPakinLog.pakinId" |
| | | source="pakinId" |
| | | readOnly |
| | | autoFocus |
| | | /> |
| | | <TextInput |
| | | label="table.field.waitPakinLog.code" |
| | | source="code" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | | label="table.field.waitPakinLog.barcode" |
| | | source="barcode" |
| | | readOnly |
| | | parse={v => v} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.waitPakinLog.anfme" |
| | | readOnly |
| | | source="anfme" |
| | | /> |
| | | <SelectInput |
| | | label="table.field.waitPakinLog.ioStatus" |
| | | source="ioStatus" |
| | | readOnly |
| | | choices={[ |
| | | { id: 0, name: '待入库' }, |
| | | { id: 1, name: ' 入库中' }, |
| | |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import AsnOrderItemEdit from "./AsnOrderItemEdit"; |
| | | import QrCodeIcon from "@mui/icons-material/QrCode"; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | |
| | | <NumberInput source="asnId" label="table.field.asnOrderItem.asnId" />, |
| | | <TextInput source="asnCode" label="table.field.asnOrderItem.asnCode" />, |
| | | <TextInput source="poDetlId" label="table.field.asnOrderItem.poDetlId" />, |
| | |
| | | <TextInput source="qrcode" label="table.field.asnOrderItem.qrcode" />, |
| | | <TextInput source="trackCode" label="table.field.asnOrderItem.barcode" />, |
| | | <TextInput source="packName" label="table.field.asnOrderItem.packName" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='asnOrderItem' /> |
| | | <ImportButton value={'asnOrder'} parmas={{ asnId: asnId }} /> |
| | | <MyExportButton /> |
| | | {/* <MyExportButton /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | |
| | | <TextField source="poDetlId" label="table.field.asnOrderItem.poDetlId" /> |
| | | <TextField source="poDetlCode" label="table.field.asnOrderItem.poDetlCode" /> |
| | | <TextField source="matnrId" label="table.field.asnOrderItem.matnrId" /> |
| | | <TextField source="matnrCode" label="table.field.asnOrderItem.matnrCode" /> |
| | | <TextField source="maktx" label="table.field.asnOrderItem.maktx" /> |
| | | <NumberField source="anfme" label="table.field.asnOrderItem.anfme" /> |
| | | <TextField source="stockUnit" label="table.field.asnOrderItem.stockUnit" /> |
| | |
| | | import request from '@/utils/request'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import ExitToAppIcon from '@mui/icons-material/ExitToApp'; |
| | | |
| | | import ImportButton from "../../components/ImportButton"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} /> |
| | | <SelectColumnsButton preferenceKey='asnOrder' /> |
| | | <ImportButton value={'asnOrderItem'} /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | |
| | | getOptions(); |
| | | }, []); |
| | | const getOptions = async () => { |
| | | const parmas = { |
| | | const parmas = { |
| | | "type": "supplier" |
| | | } |
| | | const { |
| | | data: { code, data, msg }, |
| | |
| | | getOptions(); |
| | | }, []); |
| | | const getOptions = async () => { |
| | | const parmas = { |
| | | const parmas = { |
| | | "type": "supplier" |
| | | } |
| | | const { |
| | | data: { code, data, msg }, |
| | |
| | | const { getValues } = useFormContext(); |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'end' }}> |
| | | <SaveButton /> |
| | | <></> |
| | | {/* <SaveButton /> */} |
| | | {/* <DeleteButton mutationMode="optimistic" /> */} |
| | | </Toolbar> |
| | | ) |
| | |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | sx={{ |
| | | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | |
| | | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | } |
| | | }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={24} md={16}> |
| | |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | </> |
| | | } |
| | | rowClick={false} |
| | | rowClick={'edit'} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status', 'sort']} |
| | |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickComplete = () => { |
| | | console.log('------->'); |
| | | const clickComplete = (event) => { |
| | | event.stopPropagation(); |
| | | completeTask([record]) |
| | | }; |
| | | //完成任务 |
| | |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.waitPakin.ansId" |
| | | source="ansId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.waitPakin.asnCode" |
| | | source="asnCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.waitPakin.barcode" |
| | | source="barcode" |
| | |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | <NumberInput |
| | | label="table.field.waitPakin.ansId" |
| | | readOnly |
| | | source="ansId" |
| | | /> |
| | | <TextInput |
| | | label="table.field.waitPakin.asnCode" |
| | | readOnly |
| | | source="asnCode" |
| | | parse={v => v} |
| | | /> |
| | | <SelectInput |
| | | label="table.field.waitPakin.flagDefect" |
| | | readOnly |
| | | source="flagDefect" |
| | | parse={v => v} |
| | | choices={[ |
| | | { id: 0, name: '否' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <TextInput source="code" label="table.field.waitPakin.code" />, |
| | | <NumberInput source="ansId" label="table.field.waitPakin.ansId" />, |
| | | <TextInput source="asnCode" label="table.field.waitPakin.asnCode" />, |
| | | <TextInput source="barcode" label="table.field.waitPakin.barcode" />, |
| | | <NumberInput source="anfme" label="table.field.waitPakin.anfme" />, |
| | | <SelectInput source="ioStatus" label="table.field.waitPakin.ioStatus" |
| | |
| | | const BulkActionButtons = () => { |
| | | |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.waitPakin.code" /> |
| | | {/* <NumberField source="ansId" label="table.field.waitPakin.ansId" /> */} |
| | | {/* <TextField source="asnCode" label="table.field.waitPakin.asnCode" /> */} |
| | | <TextField source="barcode" label="table.field.waitPakin.barcode" /> |
| | | <NumberField source="anfme" label="table.field.waitPakin.anfme" /> |
| | | <TextField source="ioStatus$" label="table.field.waitPakin.ioStatus" sortable={false} /> |
| | |
| | | public String type; |
| | | public String desc; |
| | | |
| | | public static String getTypeVal(String desc) { |
| | | if (desc.equals(OrderType.ORDER_IN.desc)) { |
| | | return OrderType.ORDER_IN.type; |
| | | } else if (desc.equals(OrderType.ORDER_OUT.desc)) { |
| | | return OrderType.ORDER_OUT.type; |
| | | } else if (desc.equals(OrderType.ORDER_PLAT_IN.desc)) { |
| | | return OrderType.ORDER_PLAT_IN.type; |
| | | } else if (desc.equals(OrderType.ORDER_RECEIPT.desc)) { |
| | | return OrderType.ORDER_RECEIPT.type; |
| | | } else if (desc.equals(OrderType.ORDER_PURCHASE_IN.desc)) { |
| | | return OrderType.ORDER_PURCHASE_IN.type; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getValType(String type) { |
| | | if (type.equals(OrderType.ORDER_IN.type)) { |
| | | return OrderType.ORDER_IN.desc; |
| | | } else if (type.equals(OrderType.ORDER_OUT.type)) { |
| | | return OrderType.ORDER_OUT.desc; |
| | | } else if (type.equals(OrderType.ORDER_PLAT_IN.type)) { |
| | | return OrderType.ORDER_PLAT_IN.desc; |
| | | } else if (type.equals(OrderType.ORDER_RECEIPT.type)) { |
| | | return OrderType.ORDER_RECEIPT.desc; |
| | | } else if (type.equals(OrderType.ORDER_PURCHASE_IN.type)) { |
| | | return OrderType.ORDER_PURCHASE_IN.desc; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public enum OrderWorkType { |
| | | //订单类型 |
| | | ORDER_PURCHASE_IN("purchase", "采购单"), |
| | | ORDER_PROD_IN("prod", "生产领料单"), |
| | | ORDER_DONE_IN("done", "完工入料单"), |
| | | ORDER_SALE_IN("sale", "销售订单"), |
| | | ORDER_PROD_BACK_IN("prod back", "生产退料单"), |
| | | ORDER_SPLR_BACK_OUT("supplier back", "供应商出货单"), |
| | | ORDER_SALE_BACK_IN("sale back", "销售退货单") |
| | | ORDER_WORK_TYPE_DONE_IN("1", "完工入库单"), |
| | | ORDER_WORK_TYPE_PROD("2", "生产领料单"), |
| | | ORDER_WORK_TYPE_PURCHASE("3", "外购收货"), |
| | | ORDER_WORK_TYPE_SALE("4", "销售订单"), |
| | | ORDER_WORK_TYPE_RETURN("5", "生产退料单"), |
| | | ORDER_WORK_TYPE_SUPPLIER("6", "退货供应商出货单"), |
| | | ORDER_WORK_TYPE_RETURN_ORDER("7", "销售退货入库单") |
| | | ; |
| | | |
| | | OrderWorkType(String type, String desc) { |
| | |
| | | public String type; |
| | | public String desc; |
| | | |
| | | public static String getWorkType(String desc) { |
| | | if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_DONE_IN.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_DONE_IN.type; |
| | | } else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_PROD.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_PROD.type; |
| | | } else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_PURCHASE.type; |
| | | } else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_SALE.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_SALE.type; |
| | | } else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_RETURN.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_RETURN.type; |
| | | } else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_SUPPLIER.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_SUPPLIER.type; |
| | | }else if (desc.equals(OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.desc)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.type; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getWorkDesc(String type) { |
| | | if (type.equals(OrderWorkType.ORDER_WORK_TYPE_DONE_IN.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_DONE_IN.desc; |
| | | } else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_PROD.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_PROD.desc; |
| | | } else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_PURCHASE.desc; |
| | | } else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_SALE.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_SALE.desc; |
| | | } else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_RETURN.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_RETURN.desc; |
| | | } else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_SUPPLIER.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_SUPPLIER.desc; |
| | | }else if (type.equals(OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.type)) { |
| | | return OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.desc; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public List<AsnOrder> getAllAsnOrders() { |
| | | List<AsnOrder> asnOrders = asnOrderMapper.list(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getWkType, OrderWorkType.ORDER_PURCHASE_IN.type)); |
| | | List<AsnOrder> asnOrders = asnOrderMapper.list(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getWkType, OrderWorkType.ORDER_WORK_TYPE_PURCHASE.type)); |
| | | return asnOrders; |
| | | } |
| | | |
| | |
| | | .eq(AsnOrder::getId, OrderId) |
| | | .eq(AsnOrder::getType, OrderType.ORDER_PLAT_IN.type)); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | throw new CoolException("非平库单据不可执行人工上架!!"); |
| | | } |
| | | Stock stock = new Stock(); |
| | | // if (!Objects.isNull(order.getPoCode()) && StringUtils.isNotBlank(order.getPoCode())) { |
| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderType; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | import javax.mail.Multipart; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @Api(tags = "ASN入库通知单") |
| | |
| | | |
| | | @Autowired |
| | | private AsnOrderService asnOrderService; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | @PostMapping("/asnOrder/page") |
| | |
| | | if (!ids.isEmpty()) { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, ids)); |
| | | } else { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>()); |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | } else { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>()); |
| | | orders = asnOrderService.list(); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrder.class), response); |
| | | List<AsnOrderTemplate> orderTemplates = new ArrayList<>(); |
| | | for (AsnOrder order : orders) { |
| | | List<AsnOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId())); |
| | | for (AsnOrderItem item : orderItems) { |
| | | if (Objects.isNull(item)) { |
| | | continue; |
| | | } |
| | | AsnOrderTemplate template = new AsnOrderTemplate(); |
| | | template.setCode(order.getCode()) |
| | | .setType(OrderType.getValType(order.getType())) |
| | | .setWkType(OrderWorkType.getWorkDesc(order.getWkType())) |
| | | .setExceStatus(AsnExceStatus.getExceStatus(order.getExceStatus())) |
| | | .setAnfme(item.getAnfme() + "") |
| | | .setMaktx(item.getMaktx()) |
| | | .setMemo(item.getMemo()) |
| | | .setMatnrCode(item.getMatnrCode()) |
| | | .setPoCode(item.getPoCode()) |
| | | .setSplrName(item.getSplrName()) |
| | | .setPoId(order.getPoId() + "") |
| | | .setTrackCode(item.getTrackCode()) |
| | | .setBarcode(item.getBarcode()) |
| | | .setPackName(item.getPackName()) |
| | | .setPlatItemId(item.getPlatItemId()) |
| | | .setSplrBatch(item.getSplrBatch()) |
| | | .setSplrCode(item.getSplrCode()) |
| | | .setStockUnit(item.getStockUnit()) |
| | | .setPurQty(item.getPurQty() + "") |
| | | .setPurUnit(item.getPurUnit()); |
| | | orderTemplates.add(template); |
| | | } |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, AsnOrderTemplate.class), response); |
| | | } |
| | | |
| | | /** |
| | | * 质检上报 |
| | | * |
| | | * @param orders |
| | | * @return |
| | | */ |
| | |
| | | @PostMapping("/asnOrder/matnr/list") |
| | | @ApiOperation("物料获取订单") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | public R getListByMatnr(@RequestBody Map<String, String> params){ |
| | | public R getListByMatnr(@RequestBody Map<String, String> params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("查询条件不能为空!!"); |
| | | } |
| | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:save')") |
| | | public R orderAndItem(@RequestBody AsnOrderAndItemsParams params) throws Exception { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.saveOrderAndItems(params, getLoginUserId()); |
| | | } |
| | |
| | | R.error("文件不能为空!!"); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | if (!Objects.isNull(asnId)) { |
| | | hashMap.put("asnId", asnId); |
| | | } |
| | | |
| | | return asnOrderItemService.excelImport(file, hashMap); |
| | | return asnOrderItemService.excelImport(file, hashMap, getLoginUserId()); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/asnOrderItem/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:asnOrderItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class); |
| | | List<AsnOrderTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class, true), response); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | |
| | | @PreAuthorize("hasAuthority('manager:asnOrderItemLog:list')") |
| | | @PostMapping("/asnOrderItemLog/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(asnOrderItemLogService.list(), AsnOrderItemLog.class), response); |
| | | LambdaQueryWrapper<AsnOrderItemLog> itemLogLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | itemLogLambdaQueryWrapper.eq(AsnOrderItemLog::getLogId, map.get("logId")); |
| | | List<AsnOrderItemLog> list = asnOrderItemLogService.list(itemLogLambdaQueryWrapper); |
| | | ExcelUtil.build(ExcelUtil.create(list, AsnOrderItemLog.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | @Excel(name = "PO单据标识") |
| | | @ApiModelProperty(value= "PO单据标识") |
| | | @ExcelComment(value = "poId", example = "123456698") |
| | | private Long poId; |
| | | private String poId; |
| | | |
| | | /** |
| | | * 单据类型 |
| | |
| | | * 业务类型 |
| | | */ |
| | | @Excel(name = "业务类型") |
| | | @ApiModelProperty("业务类型") |
| | | @ApiModelProperty(value= "业务类型") |
| | | @ExcelComment(value = "wkType", example = "生产入库") |
| | | private String wkType; |
| | | |
| | | |
| | | @Excel(name = "执行状态") |
| | | @ApiModelProperty("执行状态") |
| | | @ExcelComment(value = "exceStatus", example = "未执行") |
| | | private Short exceStatus; |
| | | @ApiModelProperty(value= "执行状态") |
| | | @ExcelComment(value = "exceStatus", example = "1") |
| | | private String exceStatus; |
| | | |
| | | @Excel(name = "行号") |
| | | @ExcelComment(value = "platItemId", example = "1357564255478") |
| | | @ApiModelProperty("行号") |
| | | @ExcelComment(value = "platItemId", example = "1357564255478") |
| | | private String platItemId; |
| | | |
| | | @Excel(name = "物料名称") |
| | | @ApiModelProperty("物料名称") |
| | | @ExcelComment(value = "matnk",example = "物料名称") |
| | | private String matnk; |
| | | @ExcelComment(value = "maktx",example = "物料名称") |
| | | private String maktx; |
| | | |
| | | @Excel(name = "物料编码") |
| | | @ApiModelProperty("物料编码") |
| | | @ExcelComment(value = "matnrCode",example = "物料编码") |
| | | private String matnrCode; |
| | | |
| | | @Excel(name = "数量") |
| | | @ApiModelProperty("数量") |
| | | @ExcelComment(value = "anfme",example = "25") |
| | | private Double anfme; |
| | | private String anfme; |
| | | |
| | | @Excel(name = "库存单位") |
| | | @ApiModelProperty("库存单位") |
| | |
| | | @Excel(name = "采购数量") |
| | | @ApiModelProperty("采购数量") |
| | | @ExcelComment(value = "purQty",example = "25") |
| | | private Double purQty; |
| | | private String purQty; |
| | | |
| | | @Excel(name = "采购单位") |
| | | @ApiModelProperty("采购单位") |
| | |
| | | @Excel(name = "已完成数量") |
| | | @ApiModelProperty("已完成数量") |
| | | @ExcelComment(value = "qty",example = "25") |
| | | private Double qty; |
| | | private String qty; |
| | | |
| | | @Excel(name = "供应商编码") |
| | | @ApiModelProperty("供应商编码") |
| | |
| | | @ExcelComment(value = "barcode",example = "2354788") |
| | | private String barcode; |
| | | |
| | | @Excel(name = "跟踪码") |
| | | @ApiModelProperty("跟踪码") |
| | | @ExcelComment(value = "trackCode",example = "2354788") |
| | | private String trackCode; |
| | | |
| | | @Excel(name = "包装名称") |
| | | @ApiModelProperty("包装名称") |
| | | @ExcelComment(value = "packName",example = "箱") |
| | |
| | | public Short val; |
| | | public String desc; |
| | | |
| | | public static String getExceStatus(Short val) { |
| | | if (val.equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.desc; |
| | | } else if (val.equals(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.desc; |
| | | } else if (val.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.desc; |
| | | } else if (val.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.val)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.desc; |
| | | } else if (val.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.desc; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static Short getExcelStatusDesc(String desc) { |
| | | if (desc.equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.desc)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val; |
| | | } else if (desc.equals(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.desc)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val; |
| | | } else if (desc.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.desc)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val; |
| | | } else if (desc.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.desc)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.val; |
| | | } else if (desc.equals(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.desc)) { |
| | | return AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | public interface AsnOrderItemService extends IService<AsnOrderItem> { |
| | | |
| | | |
| | | R excelImport(MultipartFile file, HashMap<String, Object> hashMap) throws Exception; |
| | | R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception; |
| | | |
| | | boolean fieldsSave(Map<String, Object> params); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.dto.PoItemsDto; |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderType; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.PurchaseService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.utils.ExtendFieldsUtils; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Service("asnOrderItemService") |
| | | public class AsnOrderItemServiceImpl extends ServiceImpl<AsnOrderItemMapper, AsnOrderItem> implements AsnOrderItemService { |
| | | |
| | | @Resource |
| | | private AsnOrderMapper asnOrderMapper; |
| | | @Autowired |
| | | private AsnOrderService asnOrderMapper; |
| | | |
| | | @Autowired |
| | | private FieldsService fieldsService; |
| | | |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | |
| | | @Override |
| | | public R generateBarcode(List<Long> orders) { |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap) throws Exception { |
| | | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), AsnOrderTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | if (!Objects.isNull(hashMap.get("asnId"))) { |
| | | throw new CoolException("主单ID为空,无法操作!!"); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | AsnOrder order = asnOrderMapper.selectOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getId, hashMap.get("asnId"))); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("ASN单据不存在!!"); |
| | | List<AsnOrderTemplate> resultList = result.getList(); |
| | | Map<String, List<AsnOrderTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(AsnOrderTemplate::getCode)); |
| | | for (String key : listMap.keySet()) { |
| | | AsnOrderTemplate template = listMap.get(key).stream().findFirst().get(); |
| | | AsnOrder asnOrder = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, template.getCode())); |
| | | if (Objects.isNull(asnOrder)) { |
| | | continue; |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | order.setCode(template.getCode()) |
| | | .setPoCode(template.getPoCode()) |
| | | .setMemo(template.getMemo()) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setPoId(Long.parseLong(template.getPoId())) |
| | | .setType(OrderType.getTypeVal(template.getType())) |
| | | .setWkType(OrderWorkType.getWorkType(template.getWkType())); |
| | | if (!asnOrderMapper.save(order)) { |
| | | throw new CoolException("单据保存失败!!"); |
| | | } |
| | | List<AsnOrderItem> items = new ArrayList<>(); |
| | | for (AsnOrderTemplate orderTemplate : listMap.get(key)) { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | Matnr matnr = null; |
| | | if (!Objects.isNull(orderTemplate.getMatnrCode()) || StringUtils.isNotBlank(orderTemplate.getMatnrCode())) { |
| | | matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>() |
| | | .eq(Matnr::getCode, orderTemplate.getMatnrCode())); |
| | | } |
| | | orderItem.setAsnId(order.getId()) |
| | | .setAsnCode(order.getCode()) |
| | | .setSplrBatch(orderTemplate.getSplrBatch()) |
| | | .setAnfme(Double.parseDouble(orderTemplate.getAnfme())) |
| | | .setQty(Double.parseDouble(orderTemplate.getQty())) |
| | | .setSplrName(orderTemplate.getSplrName()) |
| | | .setBarcode(orderTemplate.getBarcode()) |
| | | .setTrackCode(orderTemplate.getTrackCode()) |
| | | .setSplrCode(orderTemplate.getSplrCode()) |
| | | .setPoCode(orderTemplate.getPoCode()) |
| | | .setMaktx(orderTemplate.getMaktx()) |
| | | .setMatnrCode(orderTemplate.getMatnrCode()) |
| | | .setPurUnit(orderTemplate.getPurUnit()) |
| | | .setPurQty(Double.parseDouble(orderTemplate.getPurQty())); |
| | | if (!Objects.isNull(matnr)) { |
| | | orderItem.setMaktx(matnr.getName()).setMatnrCode(matnr.getCode()).setMatnrId(matnr.getId()); |
| | | } |
| | | items.add(orderItem); |
| | | if (!asnOrderItemService.saveBatch(items)) { |
| | | throw new CoolException("单据明细保存失败!!"); |
| | | } |
| | | } |
| | | if (!items.isEmpty()) { |
| | | double qty = items.stream().mapToDouble(AsnOrderItem::getQty).sum(); |
| | | double purQty = items.stream().mapToDouble(AsnOrderItem::getPurQty).sum(); |
| | | if (!asnOrderMapper.update(new LambdaUpdateWrapper<AsnOrder>().set(AsnOrder::getQty, qty).set(AsnOrder::getAnfme, purQty).eq(AsnOrder::getId, order.getId()))) { |
| | | throw new CoolException("单据数量修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | List<AsnOrderItem> itemList = new ArrayList<>(); |
| | | result.getList().forEach(template -> { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | BeanUtils.copyProperties(template, orderItem); |
| | | orderItem.setAsnId(order.getId()) |
| | | .setAsnCode(order.getCode()); |
| | | itemList.add(orderItem); |
| | | }); |
| | | if (!this.saveBatch(itemList)) { |
| | | throw new CoolException("保存失败!!"); |
| | | } |
| | | |
| | | return R.ok("操作成功!!"); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description ASN明细单据保存,及扩展字段保存 |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description ASN明细单据保存,及扩展字段保存 |
| | | * @time 2025/4/7 09:59 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean fieldsSave(Map<String, Object> params){ |
| | | public boolean fieldsSave(Map<String, Object> params) { |
| | | AsnOrderItem asnOrderItem = JSONObject.parseObject(JSONObject.toJSONString(params), AsnOrderItem.class); |
| | | if (StringUtils.isBlank(asnOrderItem.getTrackCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, asnOrderItem); |
| | | asnOrderItem.setTrackCode(ruleCode).setBarcode(ruleCode);; |
| | | asnOrderItem.setTrackCode(ruleCode).setBarcode(ruleCode); |
| | | ; |
| | | } |
| | | if (Objects.isNull(asnOrderItem.getAnfme()) || Double.compare(asnOrderItem.getAnfme(), 0.0) <= 0) { |
| | | throw new CoolException("计划收货数不能为空!!"); |
| | |
| | | order.setId(orderLog.getAsnId()) |
| | | .setDeleted(0) |
| | | .setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); |
| | | |
| | | AsnOrder asnOrder = asnOrderService.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, orderLog.getCode())); |
| | | if (Objects.isNull(asnOrder)) { |
| | | throw new CoolException("收货单据已添加,刷新后再操作!!"); |
| | | } |
| | | |
| | | if (!asnOrderService.saveOrUpdate(order)) { |
| | | throw new CoolException("单据保存失败!!"); |
| | | } |
| | |
| | | BeanUtils.copyProperties(itemLog, item); |
| | | item.setId(itemLog.getAsnItemId()) |
| | | .setAsnId(order.getId()) |
| | | .setMatnrId(Long.parseLong(itemLog.getMatnrId())) |
| | | .setDeleted(0); |
| | | orderItems.add(item); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | |
| | | public String getWkType$(){ |
| | | if (null == this.wkType){ return null; } |
| | | switch (this.wkType){ |
| | | case "1": |
| | | return " 常量"; |
| | | case "2": |
| | | return " 流水号"; |
| | | case "3": |
| | | return " 日期"; |
| | | case "4": |
| | | return " 业务字段 "; |
| | | default: |
| | | return String.valueOf(this.wkType); |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>() |
| | | .eq(DictData::getDictTypeCode,"sys_rule_item_type").eq(DictData::getValue, this.wkType)); |
| | | if (null != dictData){ |
| | | return dictData.getLabel(); |
| | | } |
| | | return String.valueOf(this.wkType); |
| | | } |
| | | |
| | | public String getStatus$(){ |