wms新增物料wms_return_order模块

master
maxw@mesnac.com 1 week ago
parent edc2bac896
commit a70483c4e0

@ -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<WmsReturnOrderVo> 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<WmsReturnOrderVo> list = wmsReturnOrderService.queryList(bo);
ExcelUtil.exportExcel(list, "退库工单", WmsReturnOrderVo.class, response);
}
/**
* 退
*
* @param roId
*/
@SaCheckPermission("system:returnOrder:query")
@GetMapping("/{roId}")
public R<WmsReturnOrderVo> 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<Void> 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<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] roIds) {
return toAjax(wmsReturnOrderService.deleteWithValidByIds(List.of(roIds), true));
}
}

@ -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;//字段映射
}

@ -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;
}

@ -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;//字段映射
}

@ -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<WmsReturnOrder, WmsReturnOrderVo> {
}

@ -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<WmsReturnOrderVo> queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery);
/**
* 退
*
* @param bo
* @return 退
*/
List<WmsReturnOrderVo> 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<Long> ids, Boolean isValid);
}

@ -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<WmsReturnOrderVo> queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsReturnOrder> lqw = buildQueryWrapper(bo);
lqw.orderByDesc(WmsReturnOrder::getCreateTime);
Page<WmsReturnOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 退
*
* @param bo
* @return 退
*/
@Override
public List<WmsReturnOrderVo> queryList(WmsReturnOrderBo bo) {
LambdaQueryWrapper<WmsReturnOrder> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<WmsReturnOrder> buildQueryWrapper(WmsReturnOrderBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<WmsReturnOrder> 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<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}
Loading…
Cancel
Save