| | |
| | | orderPrint: 'Orders Print', |
| | | quality: "quality", |
| | | complete: "complete", |
| | | confirmTransfer: "Comfirm Transfer", |
| | | allComfirm: 'All Comfirm', |
| | | createTransfer: 'Create Transfer Order', |
| | | createLocRevise: 'Create Stock Revise Order', |
| | |
| | | allComfirm: '全部提交', |
| | | quality: "质检", |
| | | complete: "完结", |
| | | confirmTransfer: "确认调整", |
| | | close: "关闭", |
| | | createTransfer: '创建调拔单', |
| | | createLocRevise: '创建库存调整单', |
| | |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "@/page/components/EditBaseAside"; |
| | | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; |
| | | import MemoInput from "@/page/components/MemoInput"; |
| | | import StatusSelectInput from "@/page/components/StatusSelectInput"; |
| | | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import EditBaseAside from "@/page/components/EditBaseAside"; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import MemoInput from "@/page/components/MemoInput"; |
| | | import ReviseLogList from "./ReviseLogList"; |
| | | import * as Common from '@/utils/common'; |
| | | import request from '@/utils/request'; |
| | | |
| | | |
| | | const LocReviseEdit = () => { |
| | |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | useRefresh, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | |
| | | import MyExportButton from '@/page/components/MyExportButton'; |
| | | import PageEditDrawer from "@/page/components/PageEditDrawer"; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import LocReviseCreate from "./LocReviseCreate"; |
| | | import TaskIcon from '@mui/icons-material/Task'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | <TextField source="areaName" label="table.field.locRevise.areaName" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <DateField 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"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | <CompleteButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | |
| | | ) |
| | | } |
| | | |
| | | |
| | | //完成单据 |
| | | const CompleteButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const requestComplete = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/reviseLog/complete/${record.id}`); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | record.exceStatus == 1 ? <ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskIcon />} onConfirm={requestComplete} /> : <></> |
| | | ) |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | export default LocReviseList; |
| | |
| | | import SelectMatnrInfo from "./SelectMatnrInfo"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import request from '@/utils/request'; |
| | | import "./asnOrder.css"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | </Grid> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, justifyContent: 'flex-end' }}> |
| | | <Grid item md={8} sx={{ justifyContent: 'flex-end', display: 'flex' }}> |
| | | <Button variant="text" onClick={handleAdd}>{translate("page.whMat.title.add")}</Button> |
| | | <Button variant="contained" onClick={handleAdd} >{translate("page.whMat.title.add")}</Button> |
| | | </Grid> |
| | | </Box> |
| | | </Box> |
| | |
| | | editable: false, |
| | | }, |
| | | { |
| | | field: 'batch', |
| | | headerName: translate('table.field.locItem.batch'), |
| | | minWidth: 100, |
| | | flex: 1, |
| | | editable: true, |
| | | }, |
| | | { |
| | | field: 'anfme', |
| | | headerName: translate('table.field.locItem.anfme') + "*", |
| | | minWidth: 100, |
| | |
| | | type: 'number', |
| | | flex: 1, |
| | | editable: true, |
| | | headerClassName: "custom", |
| | | }, |
| | | { |
| | | field: 'batch', |
| | | headerName: translate('table.field.locItem.batch'), |
| | | minWidth: 100, |
| | | flex: 1, |
| | | editable: true, |
| | | headerClassName: "custom", |
| | | }, |
| | | { |
| | | field: 'spec', |
| | |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | }} |
| | | title={"menu.reviseLogItem"} |
| | | title={false} |
| | | empty={false} |
| | | filters={false} |
| | | pagination={false} |
| | |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | }} |
| | | title={"menu.reviseLog"} |
| | | title={false} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ reviseId: orderId }} |
New file |
| | |
| | | |
| | | .custom { |
| | | color: rgb(0, 195, 255) !important; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.erp.params.BaseMatParms; |
| | | import com.vincent.rsf.server.api.controller.erp.params.OrderParams; |
| | | import com.vincent.rsf.server.api.controller.erp.params.QueryOrderParam; |
| | | import com.vincent.rsf.server.api.controller.erp.params.SyncLocsParams; |
| | | import com.vincent.rsf.server.api.controller.erp.params.*; |
| | | import com.vincent.rsf.server.api.service.ReceiveMsgService; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | |
| | | return receiveMsgService.syncLocs(locs); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 物料分组信息同步 |
| | | * @version 1.0 |
| | | */ |
| | | @PostMapping("/sync/matGroups") |
| | | @ApiOperation(value = "物料分组信息同步", tags = "基础信息同步") |
| | | public R syncMatGroup(@RequestBody List<SyncMatGroupsParams> matGroupsParams) { |
| | | if (matGroupsParams.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return receiveMsgService.syncMatGroups(matGroupsParams); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.api.controller.erp.params; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "SyncMatGroupsParams", description = "同步物料分信息参数") |
| | | public class SyncMatGroupsParams implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @ApiModelProperty(value= "名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 分组编码 |
| | | */ |
| | | @ApiModelProperty("上级分组编码") |
| | | private String parCode; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 分类编码 |
| | | * @version 1.0 |
| | | */ |
| | | @ApiModelProperty("分类编码") |
| | | private String code; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.api.controller.erp.params.BaseMatParms; |
| | | import com.vincent.rsf.server.api.controller.erp.params.OrderParams; |
| | | import com.vincent.rsf.server.api.controller.erp.params.QueryOrderParam; |
| | | import com.vincent.rsf.server.api.controller.erp.params.SyncLocsParams; |
| | | import com.vincent.rsf.server.api.controller.erp.params.*; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | |
| | | * @version 1.0 |
| | | */ |
| | | R syncLocs(List<SyncLocsParams> locs); |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 物料分组信息同步 |
| | | * @version 1.0 |
| | | */ |
| | | R syncMatGroups(List<SyncMatGroupsParams> matGroupsParams); |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 物料信息同步 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(timeout = 30, rollbackFor = Exception.class) |
| | | public R syncMatGroups(List<SyncMatGroupsParams> matGroupsParams) { |
| | | List<MatnrGroup> syncMatGroups = new ArrayList<>(); |
| | | matGroupsParams.forEach(matGroupsParam -> { |
| | | MatnrGroup matnrGroup = new MatnrGroup(); |
| | | BeanUtils.copyProperties(matGroupsParam, matnrGroup); |
| | | if (Objects.isNull(matGroupsParam.getCode())) { |
| | | throw new CoolException("物料分组编码不能为空!!"); |
| | | } |
| | | if (Objects.isNull(matGroupsParam.getName())) { |
| | | throw new CoolException("分组名称不能为空!!"); |
| | | } |
| | | if (Objects.isNull(matGroupsParam.getParCode())) { |
| | | throw new CoolException("上级物料分组编码不能为空!!"); |
| | | } |
| | | syncMatGroups.add(matnrGroup); |
| | | }); |
| | | if (!matnrGroupService.saveBatch(syncMatGroups)) { |
| | | throw new CoolException("物料分组保存失败!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import com.vincent.rsf.server.manager.entity.ReviseLog; |
| | | import com.vincent.rsf.server.manager.service.ReviseLogService; |
| | | 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.*; |
| | |
| | | return R.ok("Save Success").add(reviseLog); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:update')") |
| | | @OperationLog("Update 库位调整历史") |
| | | @PostMapping("/reviseLog/update") |
| | |
| | | return R.ok().add(reviseLogService.reviseLoc(reviseLog, getLoginUserId())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:update')") |
| | | @PostMapping("/reviseLog/complete/{id}") |
| | | @ApiOperation("确认调整库存") |
| | | public R completeTran(@PathVariable("id") Long id) { |
| | | if (Objects.isNull(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return reviseLogService.complete(id, getLoginUserId()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:remove')") |
| | | @OperationLog("Delete 库位调整历史") |
| | | @PostMapping("/reviseLog/remove/{ids}") |
New file |
| | |
| | | package com.vincent.rsf.server.manager.enums; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 通用单据执行状态 |
| | | * @version 1.0 |
| | | */ |
| | | public enum CommonExceStatus { |
| | | //通用执行状态 |
| | | COMMON_EXCE_STATUS_UN_EXCE("0", "未执行"), |
| | | COMMON_EXCE_STATUS_EXCE_ING("1", "执行中"), |
| | | COMMON_EXCE_STATUS_TASK_DONE("2", "已完成") |
| | | ; |
| | | CommonExceStatus(String val, String desc) { |
| | | this.val = Integer.parseInt(val); |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public Integer val; |
| | | public String desc; |
| | | } |
| | |
| | | ORDER_OUT("out", "出库单"), |
| | | ORDER_IN("in", "入库单"), |
| | | ORDER_TRANSFER("transfer", "调拔单"), |
| | | ORDER_REVISE("revise", "库存调整"), |
| | | ORDER_CHECK("check", "盘点单"); |
| | | |
| | | |
| | |
| | | return OrderType.ORDER_CHECK.type; |
| | | } else if (desc.equals(OrderType.ORDER_TRANSFER.desc)) { |
| | | return OrderType.ORDER_TRANSFER.type; |
| | | } else if (desc.equals(OrderType.ORDER_REVISE.desc)) { |
| | | return OrderType.ORDER_REVISE.type; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | return OrderType.ORDER_CHECK.desc; |
| | | } else if (type.equals(OrderType.ORDER_TRANSFER.type)) { |
| | | return OrderType.ORDER_TRANSFER.desc; |
| | | } else if (type.equals(OrderType.ORDER_REVISE.type)) { |
| | | return OrderType.ORDER_REVISE.desc; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | 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.controller.params.ReviseLogParams; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLog; |
| | | |
| | |
| | | public interface ReviseLogService extends IService<ReviseLog> { |
| | | |
| | | List<ReviseLog> reviseLoc(ReviseLogParams reviseLog, Long loginUserId); |
| | | |
| | | R complete(Long params, Long loginUserId); |
| | | } |
| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.ReviseLogItemParams; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.CommonExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.ReviseLogItemMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | throw new RuntimeException("库存明细调整失败"); |
| | | } |
| | | |
| | | LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | if (Objects.isNull(one)) { |
| | | LocItem locDetl = new LocItem(); |
| | | BeanUtils.copyProperties(logItem, locDetl); |
| | | locDetl.setLocId(loc.getId()) |
| | | .setLocCode(loc.getCode()) |
| | | .setAnfme(logItem.getReviseQty()) |
| | | .setUpdateBy(userId) |
| | | .setId(null) |
| | | .setCreateBy(userId); |
| | | if (!locItemService.save(locDetl)) { |
| | | throw new CoolException("库存明细保存失败!!"); |
| | | } |
| | | } else { |
| | | one.setAnfme(logItem.getReviseQty()); |
| | | if (!locItemService.updateById(one)) { |
| | | throw new RuntimeException("库存明细修改失败!!"); |
| | | } |
| | | } |
| | | // LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | // .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | // .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | // .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | // .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | // if (Objects.isNull(one)) { |
| | | // LocItem locDetl = new LocItem(); |
| | | // BeanUtils.copyProperties(logItem, locDetl); |
| | | // locDetl.setLocId(loc.getId()) |
| | | // .setLocCode(loc.getCode()) |
| | | // .setAnfme(logItem.getReviseQty()) |
| | | // .setUpdateBy(userId) |
| | | // .setId(null) |
| | | // .setCreateBy(userId); |
| | | // if (!locItemService.save(locDetl)) { |
| | | // throw new CoolException("库存明细保存失败!!"); |
| | | // } |
| | | // } else { |
| | | // one.setAnfme(logItem.getReviseQty()); |
| | | // if (!locItemService.updateById(one)) { |
| | | // throw new RuntimeException("库存明细修改失败!!"); |
| | | // } |
| | | // } |
| | | }); |
| | | |
| | | List<ReviseLog> list = reviseLogService.list(new LambdaQueryWrapper<ReviseLog>().eq(ReviseLog::getReviseId, reviseLog.getReviseId())); |
| | |
| | | if (!locReviseService.update(new LambdaUpdateWrapper<LocRevise>() |
| | | .eq(LocRevise::getId, reviseLog.getReviseId()) |
| | | .set(LocRevise::getAnfme, anfems) |
| | | .set(LocRevise::getExceStatus, CommonExceStatus.COMMON_EXCE_STATUS_EXCE_ING.val) |
| | | .set(LocRevise::getReviseQty, reviseQty))) { |
| | | throw new RuntimeException("库存调整单修改失败!!"); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.ReviseLogParams; |
| | | import com.vincent.rsf.server.manager.entity.LocRevise; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLogItem; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.CommonExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.mapper.ReviseLogMapper; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLog; |
| | | import com.vincent.rsf.server.manager.service.LocReviseService; |
| | | import com.vincent.rsf.server.manager.service.ReviseLogService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("reviseLogService") |
| | | public class ReviseLogServiceImpl extends ServiceImpl<ReviseLogMapper, ReviseLog> implements ReviseLogService { |
| | |
| | | |
| | | @Autowired |
| | | private ReviseLogService reviseLogService; |
| | | |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private ReviseLogItemService reviseLogItemService; |
| | | |
| | | /** |
| | | * 库存调整单明细添加 |
| | |
| | | public List<ReviseLog> reviseLoc(ReviseLogParams revise, Long loginUserId) { |
| | | LocRevise locRevise = locReviseService.getById(revise.getReviseId()); |
| | | if (Objects.isNull(locRevise)) { |
| | | throw new RuntimeException("调整单据不存在!!"); |
| | | throw new CoolException("调整单据不存在!!"); |
| | | } |
| | | List<ReviseLog> items = revise.getItems(); |
| | | if (items.isEmpty()) { |
| | | throw new RuntimeException("调整单明细参数为空!!"); |
| | | throw new CoolException("调整单明细参数为空!!"); |
| | | } |
| | | items.forEach(item -> { |
| | | ReviseLog reviseLog = new ReviseLog(); |
| | |
| | | .setUpdateBy(loginUserId) |
| | | .setReviseCode(locRevise.getCode()) ; |
| | | if (!reviseLogService.save(reviseLog)) { |
| | | throw new RuntimeException("调整单明细保存失败!!"); |
| | | throw new CoolException("调整单明细保存失败!!"); |
| | | } |
| | | }); |
| | | locRevise.setExceStatus(CommonExceStatus.COMMON_EXCE_STATUS_UN_EXCE.val); |
| | | |
| | | if (!locReviseService.updateById(locRevise)) { |
| | | throw new CoolException("状态更新失败!!"); |
| | | } |
| | | return items; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 确认调整库存 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R complete(Long id, Long loginUserId) { |
| | | LocRevise revise = locReviseService.getById(id); |
| | | if (Objects.isNull(revise)) { |
| | | throw new CoolException("调整单不存在!!"); |
| | | } |
| | | if (!revise.getExceStatus().equals(CommonExceStatus.COMMON_EXCE_STATUS_EXCE_ING.val)) { |
| | | throw new CoolException("单据状态未执行或已完成,无法执行完成操作!!"); |
| | | } |
| | | ReviseLog logs = reviseLogService.getOne(new LambdaQueryWrapper<ReviseLog>().eq(ReviseLog::getReviseId, revise.getId())); |
| | | if (Objects.isNull(logs)) { |
| | | throw new CoolException("库存日志不存在!!"); |
| | | } |
| | | List<ReviseLogItem> logItems = reviseLogItemService.list(new LambdaQueryWrapper<ReviseLogItem>().eq(ReviseLogItem::getReviseLogId, logs.getId())); |
| | | Map<Long, List<ReviseLogItem>> listMap = logItems.stream().collect(Collectors.groupingBy(ReviseLogItem::getLocId)); |
| | | listMap.keySet().forEach(items -> { |
| | | Loc loc = locService.getById(items); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("库位不存在!!"); |
| | | } |
| | | listMap.get(items).forEach(logItem -> { |
| | | LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | if (Objects.isNull(one)) { |
| | | LocItem locDetl = new LocItem(); |
| | | BeanUtils.copyProperties(logItem, locDetl); |
| | | locDetl.setLocId(loc.getId()) |
| | | .setType(OrderType.ORDER_REVISE.type) |
| | | .setLocCode(loc.getCode()) |
| | | .setAnfme(logItem.getReviseQty()) |
| | | .setUpdateBy(loginUserId) |
| | | .setId(null) |
| | | .setCreateBy(loginUserId); |
| | | if (!locItemService.save(locDetl)) { |
| | | throw new CoolException("库存明细保存失败!!"); |
| | | } |
| | | } else { |
| | | one.setAnfme(logItem.getReviseQty()); |
| | | if (!locItemService.updateById(one)) { |
| | | throw new CoolException("库存明细修改失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | revise.setExceStatus(CommonExceStatus.COMMON_EXCE_STATUS_TASK_DONE.val); |
| | | if (!locReviseService.updateById(revise)) { |
| | | throw new CoolException("调整单修改失败!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |