| | |
| | | before: 'Time Before' |
| | | }, |
| | | action: { |
| | | search: 'Search', |
| | | reset: 'Reset', |
| | | expand: 'Expand', |
| | | expandAll: 'Expand All', |
| | |
| | | batch: 'batch', |
| | | confirm: 'confirm', |
| | | cancel: "cancel", |
| | | query: "Query", |
| | | bulkExport: "Bulk Export", |
| | | continue: 'Continue Receipt', |
| | | confirmSelect: 'Confirm Select', |
| | |
| | | before: '结束时间' |
| | | }, |
| | | action: { |
| | | search: '搜索', |
| | | reset: '重置', |
| | | expand: '展开', |
| | | expandAll: '全部展开', |
| | |
| | | selectSite: '选择站点', |
| | | confirmSelect: '确认选择', |
| | | cancel: "取消", |
| | | query: "查询", |
| | | top: "置顶", |
| | | resort: "排序", |
| | | subzone: '绑定分区', |
| | |
| | | source="type" |
| | | optionValue="value" |
| | | parse={v => v} |
| | | validate={required()} |
| | | |
| | | /> |
| | | <AutocompleteInput |
| | | choices={business} |
| | |
| | | label="table.field.asnOrder.wkType" |
| | | source="wkType" |
| | | optionValue="value" |
| | | validate={required()} |
| | | parse={v => v} |
| | | /> |
| | | <TextInput |
| | |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <Stack direction='row' gap={2} sx={{ display: 'none' }}> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.deliveryId" |
| | | source="deliveryId" |
| | | autoFocus |
| | | readOnly |
| | | /> |
| | | <TextInput |
| | | label="table.field.deliveryItem.platItemId" |
| | | source="platItemId" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.matnrCode" |
| | | source="matnrCode" |
| | |
| | | source="matnrName" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.fieldsIndex" |
| | | source="fieldsIndex" |
| | | parse={v => v} |
| | | /> |
| | | |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.deliveryItem.unit" |
| | | source="unit" |
| | |
| | | <NumberInput |
| | | label="table.field.deliveryItem.qty" |
| | | source="qty" |
| | | validate={required()} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.deliveryItem.nromQty" |
| | | source="nromQty" |
| | | validate={required()} |
| | | /> |
| | | </Stack> |
| | |
| | | DeleteButton, |
| | | useGetOne, |
| | | useGetRecordId, |
| | | SimpleForm, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import DeliveryItemCreate from "./DeliveryItemCreate"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | 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 { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import DeliveryItemEdit from "./DeliveryItemEdit"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | width: 150 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <NumberInput source="deliveryId" label="table.field.deliveryItem.deliveryId" />, |
| | | <DateInput label='common.time.after' source="timeStart" />, |
| | | <DateInput label='common.time.before' source="timeEnd" />, |
| | | <TextInput source="platItemId" label="table.field.deliveryItem.platItemId" />, |
| | | <TextInput source="matnrCode" label="table.field.deliveryItem.matnrCode" />, |
| | | <TextInput source="matnrName" label="table.field.deliveryItem.matnrName" />, |
| | | <TextInput source="fieldsIndex" label="table.field.deliveryItem.fieldsIndex" />, |
| | | <TextInput source="unit" label="table.field.deliveryItem.unit" />, |
| | | <NumberInput source="anfme" label="table.field.deliveryItem.anfme" />, |
| | | <NumberInput source="qty" label="table.field.deliveryItem.qty" />, |
| | | <NumberInput source="nromQty" label="table.field.deliveryItem.nromQty" />, |
| | | <NumberInput source="printQty" label="table.field.deliveryItem.printQty" />, |
| | | <TextInput source="splrName" label="table.field.deliveryItem.splrName" />, |
| | | <TextInput source="splrCode" label="table.field.deliveryItem.splrCode" />, |
| | | <TextInput source="splrBatch" label="table.field.deliveryItem.splrBatch" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | |
| | | title={"menu.deliveryItem"} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{deliveryId: doId}} |
| | | filter={{ deliveryId: doId }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='deliveryItem' /> |
| | | <MyExportButton /> |
| | | {/* <MyExportButton /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='deliveryItem' |
| | |
| | | }} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime','deliveryId','fieldsIndex','qty', 'printQty', 'nromQty', 'createBy', 'memo']} |
| | | omit={['id', 'createTime', 'deliveryId', 'fieldsIndex', 'qty', 'printQty', 'nromQty', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="deliveryId" label="table.field.deliveryItem.deliveryId" /> |
| | |
| | | <TextField source="splrName" label="table.field.deliveryItem.splrName" /> |
| | | <TextField source="splrCode" label="table.field.deliveryItem.splrCode" /> |
| | | <TextField source="splrBatch" label="table.field.deliveryItem.splrBatch" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <DeliveryItemEdit |
| | | <DeliveryItemEdit |
| | | open={editDialog} |
| | | setOpen={setEditDialog} |
| | | record={select} |
| | |
| | | <Box display="flex"> |
| | | <List |
| | | resource="outStock" |
| | | storeKey='outStock' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog}/> |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='outStock' /> |
| | | <ImportButton value={'asnOrderItem'} /> |
| | |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <OutOrderCreate open={manualDialog} setOpen={setManualDialog} /> |
| | | <OutOrderCreate |
| | | open={manualDialog} |
| | | setOpen={setManualDialog} |
| | | /> |
| | | <OutOrderModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | |
| | | ) |
| | | } |
| | | |
| | | const CreateByOrderButton = ({setCreateDialog}) => { |
| | | const CreateByOrderButton = ({ setCreateDialog }) => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Form, |
| | | SaveButton, |
| | | useRefresh, |
| | | useGetList, |
| | | } from 'react-admin'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import { Grid, Stack, width } from "@mui/system"; |
| | | import request from '@/utils/request'; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import debounce from "lodash/debounce"; |
| | | import CheckCircleIcon from '@mui/icons-material/CheckCircle'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | |
| | | const OutOrderModal = (props) => { |
| | | const { open, setOpen, record } = props; |
| | | const translate = useTranslate(); |
| | | const [params, setParams] = useState({}); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const refresh = useRefresh(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | const CustomFilter = () => { |
| | | const { filterValues, setFilters, refetch } = useListContext('deliveryItem'); |
| | | const [formValues, setFormValues] = useState(filterValues); |
| | | const handleChange = (event) => { |
| | | setFormValues(formValues => ({ |
| | | ...formValues, |
| | | [event.target.name]: event.target.value |
| | | })); |
| | | }; |
| | | |
| | | const handleSubmit = (event) => { |
| | | setParams(formValues) |
| | | }; |
| | | |
| | | return ( |
| | | <Form> |
| | | <Grid container rowSpacing={2} columnSpacing={2} > |
| | | <Stack> |
| | | <TextInput |
| | | source="condition" |
| | | label="common.action.search" |
| | | resettable |
| | | defaultValue={params?.condition} |
| | | onChange={handleChange} /> |
| | | </Stack> |
| | | <Stack> |
| | | <TextInput |
| | | source="matnrName" |
| | | label="table.field.deliveryItem.matnrName" |
| | | defaultValue={params?.matnrName} |
| | | onChange={handleChange} |
| | | /> |
| | | </Stack> |
| | | <Stack> |
| | | <TextInput |
| | | source="matnrCode" |
| | | label="table.field.deliveryItem.matnrCode" |
| | | defaultValue={params?.matnrCode} |
| | | onChange={handleChange} /> |
| | | </Stack> |
| | | <Stack> |
| | | <TextInput |
| | | source="splrName" |
| | | label="table.field.deliveryItem.splrName" |
| | | defaultValue={params?.splrName} |
| | | onChange={handleChange} /> |
| | | </Stack> |
| | | </Grid> |
| | | <DialogActions> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'end' }} > |
| | | <SaveButton onClick={handleSubmit} label={"toolbar.query"} /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | ); |
| | | }; |
| | | return ( |
| | | <Dialog |
| | |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent> |
| | | <List |
| | | resource="deliveryItem" |
| | | storeKey='selectDelivery' |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.delivery"} |
| | | empty={false} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <></> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='deliveryItem' |
| | | bulkActionButtons={() => <></>} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'workQty', 'startTime', 'endTime', 'updateBy', 'createTime']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="matnrCode" label="table.field.deliveryItem.matnrCode" /> |
| | | <TextField source="matnrName" label="table.field.deliveryItem.matnrName" /> |
| | | <TextField source="unit" label="table.field.deliveryItem.unit" /> |
| | | <NumberField source="anfme" label="table.field.deliveryItem.anfme" /> |
| | | <TextField source="splrName" label="table.field.deliveryItem.splrName" /> |
| | | <TextField source="splrBatch" label="table.field.deliveryItem.splrBatch" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | {/* <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <Button disabled={disabled} onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Toolbar> */} |
| | | </DialogActions> |
| | | </Dialog> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <DialogContent> |
| | | <Grid item sx={24}> |
| | | <List |
| | | resource="deliveryItem" |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | filters={<CustomFilter />} |
| | | queryOptions={{ meta: { ...params } }} |
| | | empty={false} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <></> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='deliveryItem' |
| | | bulkActionButtons={<AddOutStockButton setOpen={setOpen}/>} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'workQty', 'startTime', 'endTime', 'updateBy', 'createTime']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="matnrCode" label="table.field.deliveryItem.matnrCode" /> |
| | | <TextField source="matnrName" label="table.field.deliveryItem.matnrName" /> |
| | | <TextField source="unit" label="table.field.deliveryItem.unit" /> |
| | | <NumberField source="anfme" label="table.field.deliveryItem.anfme" /> |
| | | <TextField source="splrName" label="table.field.deliveryItem.splrName" /> |
| | | <TextField source="splrBatch" label="table.field.deliveryItem.splrBatch" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </Grid> |
| | | </DialogContent> |
| | | </Grid> |
| | | </Dialog > |
| | | ) |
| | | } |
| | | |
| | | export default OutOrderModal; |
| | | |
| | | const AddOutStockButton = (props) => { |
| | | const { setOpen } = props; |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | | const notify = useNotify(); |
| | | const confirm = async (event) => { |
| | | console.log(selectedIds); |
| | | const res = await request.post(`/outStock/generate/orders`, {ids: selectedIds}); |
| | | if (res?.data?.code === 200) { |
| | | notify(res.data.msg); |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | onUnselectItems(); |
| | | setOpen(false); |
| | | } |
| | | |
| | | return ( |
| | | <Button label={"toolbar.confirmSelect"} onClick={confirm}> |
| | | <CheckCircleIcon /> |
| | | </Button> |
| | | ) |
| | | } |
| | |
| | | } |
| | | |
| | | public QueryWrapper<T> buildWrapper(boolean like, List<String> fields) { |
| | | return this.buildWrapper(like, null,"create_time", fields); |
| | | return this.buildWrapper(like, null, "create_time", fields); |
| | | } |
| | | |
| | | @SuppressWarnings("all") |
| | |
| | | |
| | | if (!Cools.isEmpty(where.getCondition()) && !Cools.isEmpty(cls)) { |
| | | List<String> columns = new ArrayList<>(); |
| | | for (Field field : Cools.getAllFields(cls)){ |
| | | for (Field field : Cools.getAllFields(cls)) { |
| | | if (Modifier.isFinal(field.getModifiers()) |
| | | || Modifier.isStatic(field.getModifiers()) |
| | | || Modifier.isTransient(field.getModifiers())){ |
| | | || Modifier.isTransient(field.getModifiers())) { |
| | | continue; |
| | | } |
| | | |
| | | if (field.isAnnotationPresent(TableField.class)){ |
| | | if (field.isAnnotationPresent(TableField.class)) { |
| | | TableField annotation = field.getAnnotation(TableField.class); |
| | | if (!annotation.exist()) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | String column = Utils.toSymbolCase(field.getName(), '_'); |
| | | String column = Utils.toSymbolCase(field.getName(), '_'); |
| | | columns.add(column); |
| | | } |
| | | if (!columns.isEmpty()) { |
| | | queryWrapper.and(wrapper -> { |
| | | for (int i=0;i<columns.size();i++){ |
| | | for (int i = 0; i < columns.size(); i++) { |
| | | String column = columns.get(i); |
| | | String condition = where.getCondition(); |
| | | if (i == 0) { |
| | |
| | | } |
| | | |
| | | @SuppressWarnings("all") |
| | | public QueryWrapper<T> buildWrapper(boolean like, Consumer<QueryWrapper<T>> consumer,String timeField, List<String> fields) { |
| | | public QueryWrapper<T> buildWrapper(boolean like, Consumer<QueryWrapper<T>> consumer, String timeField, List<String> fields) { |
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = where.getMap(); |
| | | for (String key : map.keySet()) { |
| | |
| | | key = Utils.toSymbolCase(key, '_'); |
| | | } |
| | | if (like && !fields.contains(key)) { |
| | | queryWrapper.like("`" + key + "`", val); |
| | | queryWrapper.like("`" + key + "`", val); |
| | | } else { |
| | | queryWrapper.eq("`" + key + "`", val); |
| | | queryWrapper.eq("`" + key + "`", val); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (!Cools.isEmpty(where.getCondition()) && !Cools.isEmpty(cls)) { |
| | | List<String> columns = new ArrayList<>(); |
| | | for (Field field : Cools.getAllFields(cls)){ |
| | | for (Field field : Cools.getAllFields(cls)) { |
| | | if (Modifier.isFinal(field.getModifiers()) |
| | | || Modifier.isStatic(field.getModifiers()) |
| | | || Modifier.isTransient(field.getModifiers())){ |
| | | || Modifier.isTransient(field.getModifiers())) { |
| | | continue; |
| | | } |
| | | |
| | | if (field.isAnnotationPresent(TableField.class)){ |
| | | if (field.isAnnotationPresent(TableField.class)) { |
| | | TableField annotation = field.getAnnotation(TableField.class); |
| | | if (!annotation.exist()) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | String column = Utils.toSymbolCase(field.getName(), '_'); |
| | | String column = Utils.toSymbolCase(field.getName(), '_'); |
| | | columns.add(column); |
| | | } |
| | | // if (!columns.isEmpty()) { |
| | |
| | | // } |
| | | if (!columns.isEmpty()) { |
| | | queryWrapper.and(wrapper -> { |
| | | for (int i=0;i<columns.size();i++){ |
| | | for (int i = 0; i < columns.size(); i++) { |
| | | String column = columns.get(i); |
| | | String condition = where.getCondition(); |
| | | if (i == 0) { |
| | |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, AsnOrderTemplate.class), response); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | | @ApiOperation("通过DO单生成出库单") |
| | | @PostMapping("/outStock/generate/orders") |
| | | public R genOutStock(@RequestBody Map<String, Object> params) { |
| | | if (Objects.isNull(params.get("ids"))) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | List<Long> ids = (List<Long>) params.get("ids"); |
| | | return outStockService.genOutStock(ids); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public interface OutStockService extends IService<AsnOrder> { |
| | | |
| | | R cancelOutOrder(String id); |
| | | |
| | | R genOutStock(List<Long> ids); |
| | | } |
| | |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | 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.AsnOrderItemLog; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; |
| | |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.mapper.SerialRuleMapper; |
| | | 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; |
| | |
| | | public class OutStockServiceImpl extends ServiceImpl<AsnOrderMapper, AsnOrder> implements OutStockService { |
| | | |
| | | @Autowired |
| | | private ReceiveMsgService receiveMsgService; |
| | | @Autowired |
| | | private ReportMsgService reportMsgService; |
| | | @Resource |
| | | private PurchaseMapper purchaseMapper; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private AsnOrderLogService asnOrderLogService; |
| | | @Autowired |
| | | private AsnOrderItemLogService asnOrderItemLogService; |
| | | @Resource |
| | | private SerialRuleMapper serialRuleMapper; |
| | | |
| | | @Autowired |
| | | private DeliveryItemService deliveryItemService; |
| | | |
| | | @Autowired |
| | | private DeliveryService deliveryService; |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 更新或保存明细 |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 更新或保存明细 |
| | | * @time 2025/4/7 13:28 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | private void svaeOrUpdateOrderItem(AsnOrderAndItemsParams params, Long loginUserId) throws Exception{ |
| | | private void svaeOrUpdateOrderItem(AsnOrderAndItemsParams params, Long loginUserId) throws Exception { |
| | | AsnOrder orders = params.getOrders(); |
| | | |
| | | params.getItems().forEach(item -> { |
| | |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 删除原主单及明细,加入历史档 |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 删除原主单及明细,加入历史档 |
| | | * @time 2025/3/19 19:53 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | private void operateOrderLogs(AsnOrder asrder) throws Exception{ |
| | | private void operateOrderLogs(AsnOrder asrder) throws Exception { |
| | | if (Objects.isNull(asrder) || Objects.isNull(asrder.getId())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 取消出库单据 |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 取消出库单据 |
| | | * @time 2025/4/22 10:40 |
| | | */ |
| | | @Override |
| | |
| | | } |
| | | return R.ok("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 通过DO单生成出库单 |
| | | * @time 2025/4/23 16:24 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R genOutStock(List<Long> ids) { |
| | | if (Objects.isNull(ids) || ids.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<DeliveryItem> items = deliveryItemService.list(new LambdaQueryWrapper<DeliveryItem>().in(DeliveryItem::getId, ids)); |
| | | if (items.isEmpty()) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | Map<Long, List<DeliveryItem>> listMap = items.stream().collect(Collectors.groupingBy(DeliveryItem::getDeliveryId)); |
| | | listMap.keySet().forEach(key -> { |
| | | //TODO 判断单据是否已经存在,如存在则累加修改子表,不存在才新建 |
| | | Delivery delivery = deliveryService.getById(key); |
| | | if (Objects.isNull(delivery)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | BeanUtils.copyProperties(delivery, order); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_OUT_STOCK_CODE, order); |
| | | if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("编码规则错误:请检查 「SYS_OUT_STOCK_CODE」编码是否设置成功"); |
| | | } |
| | | order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val) |
| | | .setCode(ruleCode) |
| | | .setPoId(delivery.getId()) |
| | | .setId(null) |
| | | .setPoCode(delivery.getCode()); |
| | | if (!this.save(order)) { |
| | | throw new CoolException("主单保存失败!!"); |
| | | } |
| | | List<AsnOrderItem> orderItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | BeanUtils.copyProperties(item, orderItem); |
| | | orderItem.setId(null) |
| | | .setPoCode(order.getPoCode()) |
| | | .setAsnId(order.getId()) |
| | | .setAsnCode(order.getCode()) |
| | | .setPlatItemId(item.getPlatItemId()) |
| | | .setPoDetlId(item.getId()); |
| | | orderItems.add(orderItem); |
| | | }); |
| | | |
| | | double sum = orderItems.stream().mapToDouble(AsnOrderItem::getAnfme).sum(); |
| | | //修改计划数量 |
| | | order.setAnfme(sum); |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("主单数量修改失败!!"); |
| | | } |
| | | if (!asnOrderItemService.saveBatch(orderItems)) { |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * Created by vincent on 1/30/2024 |
| | |
| | | } |
| | | |
| | | public <T extends BaseParam> T buildParam(Map<String, Object> map, Class<T> clz) { |
| | | if (!Objects.isNull(map.get("meta"))) { |
| | | Map<String, Object> meta = (Map<String, Object>) map.get("meta"); |
| | | meta.keySet().forEach(key -> { |
| | | map.put(key, meta.get(key)); |
| | | }); |
| | | map.remove("meta"); |
| | | } |
| | | T t = null; |
| | | try { |
| | | t = clz.getDeclaredConstructor().newInstance(); |