| | |
| | | remove: "移除", |
| | | save: "保存", |
| | | search: "搜索", |
| | | select_all: "全部选中", |
| | | select_all_button: "全部选中", |
| | | select_row: "选中一行", |
| | | show: "显示", |
| | | sort: "排序", |
| | |
| | | batch: 'batch', |
| | | confirm: 'confirm', |
| | | cancel: "cancel", |
| | | bulkExport: "Bulk Export", |
| | | continue: 'Continue Receipt', |
| | | selectSite: 'Select Site', |
| | | top: "top", |
| | | resort: "sort", |
| | |
| | | unenable: '禁用', |
| | | locInit: '库位初始化', |
| | | siteInit: '站点初始化', |
| | | continue: '继续收货', |
| | | batch: '批量操作', |
| | | confirm: '确认', |
| | | bulkExport: "批量导出", |
| | | selectSite: '选择站点', |
| | | cancel: "取消", |
| | | top: "置顶", |
| | |
| | | setOpen(false); |
| | | }; |
| | | |
| | | const handleConfirm = (event) => { |
| | | const handleConfirm = (event) => { |
| | | handleClose(event); |
| | | onConfirm(); |
| | | }; |
| | |
| | | useDataProvider, |
| | | useNotify, |
| | | useListContext, |
| | | useUnselectAll, |
| | | } from "react-admin"; |
| | | |
| | | const MyExportButton = (props) => { |
| | | const { |
| | | maxResults = 1000, |
| | | onClick, |
| | | ids, |
| | | label = "ra.action.export", |
| | | icon = defaultIcon, |
| | | exporter: customExporter, |
| | |
| | | ...rest |
| | | } = props; |
| | | |
| | | const { filter, filterValues, resource, sort, total } = useListContext(); |
| | | |
| | | const { filter, selectedIds, filterValues, resource, sort, total } = useListContext(); |
| | | const unSelect = useUnselectAll(resource); |
| | | console.log(selectedIds); |
| | | const dataProvider = useDataProvider(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClick = useCallback( |
| | | const handleClick = |
| | | // useCallback( |
| | | (event) => { |
| | | dataProvider |
| | | .export(resource, { |
| | | sort, |
| | | ids: selectedIds, |
| | | filter: filter ? { ...filterValues, ...filter } : filterValues, |
| | | pagination: { page: 1, perPage: maxResults }, |
| | | meta, |
| | |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | link.remove(); |
| | | unSelect(); |
| | | }) |
| | | .catch((error) => { |
| | | console.error(error); |
| | |
| | | if (typeof onClick === "function") { |
| | | onClick(event); |
| | | } |
| | | }, |
| | | [ |
| | | dataProvider, |
| | | filter, |
| | | filterValues, |
| | | maxResults, |
| | | notify, |
| | | onClick, |
| | | resource, |
| | | sort, |
| | | meta, |
| | | ], |
| | | ); |
| | | } |
| | | // [ |
| | | // dataProvider, |
| | | // filter, |
| | | // filterValues, |
| | | // maxResults, |
| | | // notify, |
| | | // onClick, |
| | | // resource, |
| | | // sort, |
| | | // meta, |
| | | // ], |
| | | // ); |
| | | |
| | | return ( |
| | | <Button |
| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Button, |
| | | useRecordSelection, |
| | | useRefresh, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | 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 request from '@/utils/request'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import CachedIcon from '@mui/icons-material/Cached'; |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | width: 150 |
| | | }, |
| | | })); |
| | | |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='asnOrderLog' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='asnOrderLog' |
| | | bulkActionButtons={false} |
| | | bulkActionButtons={ |
| | | <> |
| | | <MyExportButton /> |
| | | </> |
| | | } |
| | | rowClick={'edit'} |
| | | expand={false} |
| | | expandSingle={true} |
| | |
| | | <DateField source="arrTime" label="table.field.asnOrderLog.arrTime" showTime /> |
| | | <TextField source="rleStatus$" label="table.field.asnOrderLog.rleStatus" sortable={false} /> |
| | | <TextField source="ntyStatus$" label="table.field.asnOrderLog.ntyStatus" sortable={false} /> |
| | | <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 cellClassName="opt" label="common.field.opt"> |
| | | <ContinueButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <AsnOrderLogCreate |
| | |
| | | } |
| | | |
| | | export default AsnOrderLogList; |
| | | |
| | | |
| | | const ContinueButton = () => { |
| | | const refresh = useRefresh(); |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const continueReceipt = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/asnOrderLog/continue/${record.id}`); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | refresh(); |
| | | } |
| | | |
| | | return ( |
| | | <ConfirmButton label={"toolbar.continue"} startIcon={<CachedIcon />} onConfirm={continueReceipt} /> |
| | | ) |
| | | } |
| | |
| | | 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 />} |
| | |
| | | }} |
| | | title={"menu.asnOrderItem"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filter={{ asnId: asnId }} |
| | | filter={{ asnId: asnId, deleted: 0 }} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | useDataProvider, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | |
| | | DeleteButton, |
| | | Button, |
| | | useRedirect, |
| | | useUnselectAll, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | import BillStatusField from '../../components/BillStatusField'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | 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 ConstructionIcon from "@mui/icons-material/Construction"; |
| | | import FileDownloadIcon from '@mui/icons-material/FileDownload'; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import TaskIcon from '@mui/icons-material/Task'; |
| | | import CloseIcon from '@mui/icons-material/Close'; |
| | | import request from '@/utils/request'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import ExitToAppIcon from '@mui/icons-material/ExitToApp'; |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | ] |
| | | |
| | | const AsnOrderList = () => { |
| | | const AsnOrderList = (props) => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [select, setSelect] = useState(0); |
| | | const billReload = useRef(); |
| | | const location = useLocation(); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | resource="asnOrder" |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | |
| | | title={"menu.asnOrder"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />} |
| | | filters={filters} |
| | | filter={{deleted: 0}} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | |
| | | <StyledDatagrid |
| | | sx={{ width: '100%' }} |
| | | preferenceKey='asnOrder' |
| | | bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} |
| | | bulkActionButtons={ |
| | | <> |
| | | <InspectionsButton /> |
| | | <MyExportButton /> |
| | | {/* <BtnBulkExport></BtnBulkExport> */} |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} |
| | | /> |
| | | </>} |
| | | rowClick={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']} |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <Button onClick={inspection} label={"toolbar.inspection"}> |
| | | <ConstructionIcon /> |
| | | </Button> |
| | | ) |
| | | } |
| | | |
| | | const BtnBulkExport = () => { |
| | | const { filter, selectedIds, filterValues, resource, sort, total } = useListContext(); |
| | | const refresh = useRefresh(); |
| | | const dataProvider = useDataProvider(); |
| | | const notify = useNotify(); |
| | | const unSelect = useUnselectAll(resource); |
| | | |
| | | const bulkExport = () => { |
| | | getExport() |
| | | unSelect(); |
| | | } |
| | | const getExport = () => { |
| | | dataProvider |
| | | .export(resource, { |
| | | ids: selectedIds, |
| | | pagination: { page: 1, perPage: 1000 }, |
| | | }) |
| | | .then((res) => { |
| | | const url = window.URL.createObjectURL( |
| | | new Blob([res.data], { type: res.headers["content-type"] }), |
| | | ); |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.setAttribute("download", `${resource}.xlsx`); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | link.remove(); |
| | | }) |
| | | .catch((error) => { |
| | | console.error(error); |
| | | notify("ra.notification.http_error", { type: "error" }); |
| | | }); |
| | | if (typeof onClick === "function") { |
| | | onClick(event); |
| | | } |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <Button label="toolbar.bulkExport" onClick={bulkExport}> |
| | | <ExitToAppIcon /> |
| | | </Button> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="success"> |
| | |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import QlyInspectCreate from "./QlyInspectCreate"; |
| | | import QlyInspectPanel from "./QlyInspectPanel"; |
| | | 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 ConstructionIcon from "@mui/icons-material/Construction"; |
| | | import CloseIcon from "@mui/icons-material/Close"; |
| | | import TaskIcon from '@mui/icons-material/Task'; |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <ReferenceInput source="isptStatus" label="table.field.qlyInspect.isptStatus" reference="dictData" filter={{ dictTypeCode: 'sys_qly_inspect_status' }} alwaysOn> |
| | | <AutocompleteInput source="value" optionText='label' optionValue="value" label="table.field.qlyInspect.isptStatus"></AutocompleteInput> |
| | | </ReferenceInput>, |
| | | <TextInput source="code" label="table.field.qlyInspect.code" />, |
| | | <TextInput source="wkType" label="table.field.qlyInspect.wkType" />, |
| | | <NumberInput source="safeQty" label="table.field.qlyInspect.safeQty" />, |
| | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | resource="qlyInspect" |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | |
| | | <InspectionButton /> |
| | | <CompleteButton /> |
| | | <CloseButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | {/* <QlyInspectCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | record.isptStatus != 1 && record.isptStatus != 3 ? (<> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.quality"}> |
| | | <ConstructionIcon /> |
| | | </Button> |
| | | |
| | | <InspectModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | ispectId={record.id} |
| | | /> |
| | | </> |
| | | </>) : (<></>) |
| | | ) |
| | | } |
| | | |
| | |
| | | const refresh = useRefresh(); |
| | | const requestComplete = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '1' }); |
| | | |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <Button onClick={requestComplete} label={"toolbar.complete"} mutationMode={OPERATE_MODE}> |
| | | record.isptStatus != 1 && record.isptStatus != 3 ? (<Button onClick={requestComplete} label={"toolbar.complete"} mutationMode={OPERATE_MODE}> |
| | | <TaskIcon /> |
| | | </Button> |
| | | </Button>) : (<></>) |
| | | ) |
| | | } |
| | | |
| | |
| | | <AddIcon /> |
| | | </Button> |
| | | } |
| | | |
| | | |
| | | <AsnSelModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | |
| | | 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 />} |
| | | toolbar={<></>} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | > |
| | |
| | | } |
| | | //TODO /**收货数量累加,1. 会出超收情况 2. 会有收货不足情况*/ |
| | | Double rcptedQty = asnOrder.getQty() + receiptQty; |
| | | asnOrder.setQty(rcptedQty).setExceStatus(Short.parseShort(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val)); |
| | | asnOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); |
| | | |
| | | if (!asnOrderMapper.updateById(asnOrder)) { |
| | | throw new CoolException("已收货数量修改失败!!"); |
| | |
| | | String column = Utils.toSymbolCase(field.getName(), '_'); |
| | | columns.add(column); |
| | | } |
| | | // if (!columns.isEmpty()) { |
| | | // for (int i=0;i<columns.size();i++){ |
| | | // String column = columns.get(i); |
| | | // String condition = where.getCondition(); |
| | | // |
| | | // if (i == 0) { |
| | | // queryWrapper.and(wrapper -> wrapper.like("`" + column + "`", condition)); |
| | | // } else { |
| | | // queryWrapper.or().like("`" + column + "`", condition); |
| | | // } |
| | | // } |
| | | // } |
| | | if (!columns.isEmpty()) { |
| | | for (int i=0;i<columns.size();i++){ |
| | | String column = columns.get(i); |
| | | String condition = where.getCondition(); |
| | | |
| | | if (i == 0) { |
| | | queryWrapper.and(wrapper -> wrapper.like("`" + column + "`", condition)); |
| | | } else { |
| | | queryWrapper.or().like("`" + column + "`", condition); |
| | | queryWrapper.and(wrapper -> { |
| | | for (int i=0;i<columns.size();i++){ |
| | | String column = columns.get(i); |
| | | String condition = where.getCondition(); |
| | | if (i == 0) { |
| | | wrapper.or().like("`" + column + "`", condition); |
| | | } else { |
| | | wrapper.or().like("`" + column + "`", condition); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | return queryWrapper; |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | List<AsnOrder> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, map.get("ids")).eq(AsnOrder::getStatus, 1)); |
| | | List<Long> ids = JSONArray.parseArray(JSONObject.toJSONString(map.get("ids")), Long.class); |
| | | if (!ids.isEmpty()) { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, ids)); |
| | | } else { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>()); |
| | | } |
| | | } else { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().last("limit 1")); |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>()); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrder.class), response); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderLogService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @PreAuthorize("hasAuthority('manager:asnOrderLog:list')") |
| | | @PostMapping("/asnOrderLog/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(asnOrderLogService.list(), AsnOrderLog.class), response); |
| | | List<AsnOrderLog> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | List<Long> ids = JSONArray.parseArray(JSONObject.toJSONString(map.get("ids")), Long.class); |
| | | if (!ids.isEmpty()) { |
| | | orders = asnOrderLogService.list(new LambdaQueryWrapper<AsnOrderLog>().in(AsnOrderLog::getId, ids)); |
| | | } else { |
| | | orders = asnOrderLogService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | } else { |
| | | orders = asnOrderLogService.list(new LambdaQueryWrapper<>()); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrderLog.class), response); |
| | | } |
| | | |
| | | @ApiOperation("继续收货") |
| | | @PreAuthorize("hasAuthority('manager:asnOrderLog:update')") |
| | | @PostMapping("/asnOrderLog/continue/{id}") |
| | | public R continuRcpt(@PathVariable Long id) { |
| | | if (Objects.isNull(id)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderLogService.continueRecipt(id); |
| | | } |
| | | |
| | | } |
| | |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | |
| | | @ApiModelProperty("主单ID") |
| | | private Long asnId; |
| | | |
| | |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | |
| | | ASN_EXCE_STATUS_TASK_CLOSE("4", "已关闭") |
| | | ; |
| | | AsnExceStatus(String val, String desc) { |
| | | this.val = val; |
| | | this.val = Short.parseShort(val); |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String val; |
| | | public Short val; |
| | | public String desc; |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | |
| | | public interface AsnOrderLogService extends IService<AsnOrderLog> { |
| | | |
| | | R continueRecipt(Long id); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | 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.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderLogMapper; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemLogService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderLogService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service("asnOrderLogService") |
| | | public class AsnOrderLogServiceImpl extends ServiceImpl<AsnOrderLogMapper, AsnOrderLog> implements AsnOrderLogService { |
| | | |
| | | @Autowired |
| | | private AsnOrderItemLogService asnOrderItemLogService; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private AsnOrderService asnOrderService; |
| | | /** |
| | | * @author Ryan |
| | | * @description 继续收货 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/17 15:08 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R continueRecipt(Long id) { |
| | | AsnOrderLog orderLog = this.getOne(new LambdaQueryWrapper<AsnOrderLog>().eq(AsnOrderLog::getId, id)); |
| | | if (Objects.isNull(orderLog)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | BeanUtils.copyProperties(orderLog, order); |
| | | order.setId(orderLog.getAsnId()) |
| | | .setDeleted(0) |
| | | .setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); |
| | | if (!asnOrderService.saveOrUpdate(order)) { |
| | | throw new CoolException("单据保存失败!!"); |
| | | } |
| | | List<AsnOrderItemLog> itemLogs = asnOrderItemLogService |
| | | .list(new LambdaQueryWrapper<AsnOrderItemLog>() |
| | | .eq(AsnOrderItemLog::getLogId, id)); |
| | | List<AsnOrderItem> orderItems = new ArrayList<>(); |
| | | if (!Objects.isNull(itemLogs) || !itemLogs.isEmpty()) { |
| | | for (AsnOrderItemLog itemLog : itemLogs) { |
| | | AsnOrderItem item = new AsnOrderItem(); |
| | | BeanUtils.copyProperties(itemLog, item); |
| | | item.setId(itemLog.getAsnItemId()) |
| | | .setAsnId(order.getId()) |
| | | .setDeleted(0); |
| | | orderItems.add(item); |
| | | } |
| | | if (!asnOrderItemService.saveOrUpdateBatch(orderItems)) { |
| | | throw new CoolException("明细保存失败"); |
| | | } |
| | | } |
| | | if (!this.removeById(orderLog.getId())) { |
| | | throw new CoolException("历史单据删除失败!!"); |
| | | } |
| | | if (!asnOrderItemLogService.remove(new LambdaQueryWrapper<AsnOrderItemLog>() |
| | | .eq(AsnOrderItemLog::getLogId, orderLog.getId()))) { |
| | | throw new CoolException("历史单据明细删除失败!!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | if (Objects.isNull(asrder) || Objects.isNull(asrder.getId())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | asrder.setExceStatus(Short.parseShort(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val)); |
| | | asrder.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val); |
| | | |
| | | if (!this.updateById(asrder)) { |
| | | throw new CoolException("单据关闭失败!!"); |
| | |
| | | // } |
| | | AsnOrder order = this.getById(asrder.getId()); |
| | | AsnOrderLog orderLog = new AsnOrderLog(); |
| | | order.setExceStatus(Short.parseShort(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val)); |
| | | order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val); |
| | | BeanUtils.copyProperties(order, orderLog); |
| | | orderLog.setId(null); |
| | | orderLog.setAsnId(order.getId()); |
| | |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("状态修改失败!!"); |
| | | } |
| | | orderLog.setExceStatus(Short.parseShort(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val)); |
| | | orderLog.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE.val); |
| | | if (!asnOrderLogService.save(orderLog)) { |
| | | throw new CoolException("主单历史档添加失败!!"); |
| | | } |