diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java new file mode 100644 index 00000000..79db5ef0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java @@ -0,0 +1,106 @@ +package org.dromara.wms.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.wms.domain.bo.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; +import org.dromara.wms.service.IWmsReturnOrderService; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 退库工单 + * 前端访问路由地址为:/system/returnOrder + * + * @author LionLi + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/returnOrder") +public class WmsReturnOrderController extends BaseController { + + private final IWmsReturnOrderService wmsReturnOrderService; + + /** + * 查询退库工单列表 + */ + @SaCheckPermission("system:returnOrder:list") + @GetMapping("/list") + public TableDataInfo list(WmsReturnOrderBo bo, PageQuery pageQuery) { + return wmsReturnOrderService.queryPageList(bo, pageQuery); + } + + /** + * 导出退库工单列表 + */ + @SaCheckPermission("system:returnOrder:export") + @Log(title = "退库工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsReturnOrderBo bo, HttpServletResponse response) { + List list = wmsReturnOrderService.queryList(bo); + ExcelUtil.exportExcel(list, "退库工单", WmsReturnOrderVo.class, response); + } + + /** + * 获取退库工单详细信息 + * + * @param roId 主键 + */ + @SaCheckPermission("system:returnOrder:query") + @GetMapping("/{roId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long roId) { + return R.ok(wmsReturnOrderService.queryById(roId)); + } + + /** + * 新增退库工单 + */ + @SaCheckPermission("system:returnOrder:add") + @Log(title = "退库工单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody WmsReturnOrderBo bo) { + return toAjax(wmsReturnOrderService.insertByBo(bo)); + } + + /** + * 修改退库工单 + */ + @SaCheckPermission("system:returnOrder:edit") + @Log(title = "退库工单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsReturnOrderBo bo) { + return toAjax(wmsReturnOrderService.updateByBo(bo)); + } + + /** + * 删除退库工单 + * + * @param roIds 主键串 + */ + @SaCheckPermission("system:returnOrder:remove") + @Log(title = "退库工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{roIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] roIds) { + return toAjax(wmsReturnOrderService.deleteWithValidByIds(List.of(roIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java new file mode 100644 index 00000000..7c24b1e7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java @@ -0,0 +1,131 @@ +package org.dromara.wms.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 退库工单对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@TableName("wms_return_order") +public class WmsReturnOrder { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + private Long roId; + + /** + * 物料ID + */ + private Long materialId; + + /** + * 物料大类 + */ + private String materialCategories; + + /** + * 批次条码 + */ + private String batchCode; + + /** + * 计划数量 + */ + private Long planAmount; + + /** + * 仓库ID + */ + private Long warehouseId; + + /** + * 计划退库库位 + */ + private String planLocationCode; + + /** + * 退库工单状态 + */ + private String orderStatus; + + /** + * 实际数量 + */ + private Long returnAmount; + + /** + * 实际退库库位 + */ + private String returnLocationCode; + + /** + * 审核人 + */ + private String auditBy; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + private String auditStatus; + + /** + * 审核意见 + */ + private String auditComments; + + /** + * erp同步状态 + */ + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ + private Long erpSynchronousQty; + /** + * 租户id + */ + private String tenantId; + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + @TableField(exist = false) + private String warehouseCode;//字段映射 + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java new file mode 100644 index 00000000..3bb0946b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java @@ -0,0 +1,122 @@ +package org.dromara.wms.domain.bo; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.WmsReturnOrder; + +/** + * 退库工单业务对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@AutoMapper(target = WmsReturnOrder.class, reverseConvertGenerate = false) +public class WmsReturnOrderBo extends BaseEntity{ + + /** + * 表主键 + */ +// @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long roId; + + /** + * 物料ID + */ +// @NotNull(message = "物料ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 物料大类 + */ +// @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCategories; + + /** + * 批次条码 + */ +// @NotBlank(message = "批次条码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String batchCode; + + /** + * 计划数量 + */ +// @NotNull(message = "计划数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long planAmount; + + /** + * 仓库ID + */ +// @NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long warehouseId; + + /** + * 计划退库库位 + */ +// @NotBlank(message = "计划退库库位不能为空", groups = { AddGroup.class, EditGroup.class }) + private String planLocationCode; + + /** + * 退库工单状态 + */ +// @NotBlank(message = "退库工单状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String orderStatus; + + /** + * 实际数量 + */ +// @NotNull(message = "实际数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long returnAmount; + + /** + * 实际退库库位 + */ +// @NotBlank(message = "实际退库库位不能为空", groups = { AddGroup.class, EditGroup.class }) + private String returnLocationCode; + + /** + * 审核人 + */ +// @NotBlank(message = "审核人不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditBy; + + /** + * 审核时间 + */ +// @NotNull(message = "审核时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ +// @NotBlank(message = "审核状态(0待审核,1审核通过,2审核未通过)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditStatus; + + /** + * 审核意见 + */ +// @NotBlank(message = "审核意见不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditComments; + + /** + * erp同步状态 + */ +// @NotBlank(message = "erp同步状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ +// @NotNull(message = "erp同步数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long erpSynchronousQty; + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java new file mode 100644 index 00000000..eed0f0dc --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java @@ -0,0 +1,157 @@ +package org.dromara.wms.domain.vo; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.wms.domain.WmsReturnOrder; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 退库工单视图对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsReturnOrder.class) +public class WmsReturnOrderVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long roId; + + /** + * 物料ID + */ + @ExcelProperty(value = "物料ID") + private Long materialId; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private String materialCategories; + + /** + * 批次条码 + */ + @ExcelProperty(value = "批次条码") + private String batchCode; + + /** + * 计划数量 + */ + @ExcelProperty(value = "计划数量") + private Long planAmount; + + /** + * 仓库ID + */ + @ExcelProperty(value = "仓库ID") + private Long warehouseId; + + /** + * 计划退库库位 + */ + @ExcelProperty(value = "计划退库库位") + private String planLocationCode; + + /** + * 退库工单状态 + */ + @ExcelProperty(value = "退库工单状态") + private String orderStatus; + + /** + * 实际数量 + */ + @ExcelProperty(value = "实际数量") + private Long returnAmount; + + /** + * 实际退库库位 + */ + @ExcelProperty(value = "实际退库库位") + private String returnLocationCode; + + /** + * 审核人 + */ + @ExcelProperty(value = "审核人") + private String auditBy; + + /** + * 审核时间 + */ + @ExcelProperty(value = "审核时间") + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + @ExcelProperty(value = "审核状态(0待审核,1审核通过,2审核未通过)") + private String auditStatus; + + /** + * 审核意见 + */ + @ExcelProperty(value = "审核意见") + private String auditComments; + + /** + * erp同步状态 + */ + @ExcelProperty(value = "erp同步状态") + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ + @ExcelProperty(value = "erp同步数量") + private Long erpSynchronousQty; + + /** + * 租户id + */ + private String tenantId; + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + private String warehouseCode;//字段映射 +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java new file mode 100644 index 00000000..8600fc7a --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsReturnOrder; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; + +/** + * 退库工单Mapper接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface WmsReturnOrderMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java new file mode 100644 index 00000000..60f63544 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java @@ -0,0 +1,69 @@ +package org.dromara.wms.service; + + +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.wms.domain.bo.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; + +import java.util.Collection; +import java.util.List; + +/** + * 退库工单Service接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface IWmsReturnOrderService { + + /** + * 查询退库工单 + * + * @param roId 主键 + * @return 退库工单 + */ + WmsReturnOrderVo queryById(Long roId); + + /** + * 分页查询退库工单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 退库工单分页列表 + */ + TableDataInfo queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的退库工单列表 + * + * @param bo 查询条件 + * @return 退库工单列表 + */ + List queryList(WmsReturnOrderBo bo); + + /** + * 新增退库工单 + * + * @param bo 退库工单 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsReturnOrderBo bo); + + /** + * 修改退库工单 + * + * @param bo 退库工单 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsReturnOrderBo bo); + + /** + * 校验并批量删除退库工单信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java new file mode 100644 index 00000000..0a76dd18 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java @@ -0,0 +1,145 @@ +package org.dromara.wms.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.wms.domain.WmsReturnOrder; +import org.dromara.wms.domain.bo.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; +import org.dromara.wms.mapper.WmsReturnOrderMapper; +import org.dromara.wms.service.IWmsReturnOrderService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 退库工单Service业务层处理 + * + * @author LionLi + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class WmsReturnOrderServiceImpl implements IWmsReturnOrderService { + + private final WmsReturnOrderMapper baseMapper; + + /** + * 查询退库工单 + * + * @param roId 主键 + * @return 退库工单 + */ + @Override + public WmsReturnOrderVo queryById(Long roId){ + return baseMapper.selectVoById(roId); + } + + /** + * 分页查询退库工单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 退库工单分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(WmsReturnOrder::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的退库工单列表 + * + * @param bo 查询条件 + * @return 退库工单列表 + */ + @Override + public List queryList(WmsReturnOrderBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsReturnOrderBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getRoId() != null, WmsReturnOrder::getRoId, bo.getRoId()); + lqw.eq(bo.getMaterialId() != null, WmsReturnOrder::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsReturnOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsReturnOrder::getBatchCode, bo.getBatchCode()); + lqw.eq(bo.getPlanAmount() != null, WmsReturnOrder::getPlanAmount, bo.getPlanAmount()); + lqw.eq(bo.getWarehouseId() != null, WmsReturnOrder::getWarehouseId, bo.getWarehouseId()); + lqw.eq(StringUtils.isNotBlank(bo.getPlanLocationCode()), WmsReturnOrder::getPlanLocationCode, bo.getPlanLocationCode()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderStatus()), WmsReturnOrder::getOrderStatus, bo.getOrderStatus()); + lqw.eq(bo.getReturnAmount() != null, WmsReturnOrder::getReturnAmount, bo.getReturnAmount()); + lqw.eq(StringUtils.isNotBlank(bo.getReturnLocationCode()), WmsReturnOrder::getReturnLocationCode, bo.getReturnLocationCode()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsReturnOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsReturnOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsReturnOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsReturnOrder::getAuditComments, bo.getAuditComments()); + lqw.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsReturnOrder::getErpSynchronousStatus, bo.getErpSynchronousStatus()); + lqw.eq(bo.getErpSynchronousQty() != null, WmsReturnOrder::getErpSynchronousQty, bo.getErpSynchronousQty()); + return lqw; + } + + /** + * 新增退库工单 + * + * @param bo 退库工单 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsReturnOrderBo bo) { + WmsReturnOrder add = MapstructUtils.convert(bo, WmsReturnOrder.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setRoId(add.getRoId()); + } + return flag; + } + + /** + * 修改退库工单 + * + * @param bo 退库工单 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsReturnOrderBo bo) { + WmsReturnOrder update = MapstructUtils.convert(bo, WmsReturnOrder.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsReturnOrder entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除退库工单信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +}