成品库存过期
parent
3ad2ca23c8
commit
4e13e7b5f3
@ -0,0 +1,117 @@
|
||||
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.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.wms.domain.bo.WmsPsmAreaBo;
|
||||
import org.dromara.wms.domain.vo.WmsPsmAreaVo;
|
||||
import org.dromara.wms.service.IWmsPsmAreaService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 成品库区
|
||||
* 前端访问路由地址为:/system/psmArea
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/psmArea")
|
||||
public class WmsPsmAreaController extends BaseController {
|
||||
|
||||
private final IWmsPsmAreaService wmsPsmAreaService;
|
||||
|
||||
/**
|
||||
* 查询成品库区列表
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsPsmAreaVo> list(WmsPsmAreaBo bo, PageQuery pageQuery) {
|
||||
return wmsPsmAreaService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出成品库区列表
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:export")
|
||||
@Log(title = "成品库区", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsPsmAreaBo bo, HttpServletResponse response) {
|
||||
List<WmsPsmAreaVo> list = wmsPsmAreaService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "成品库区", WmsPsmAreaVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成品库区详细信息
|
||||
*
|
||||
* @param areaId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:query")
|
||||
@GetMapping("/{areaId}")
|
||||
public R<WmsPsmAreaVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long areaId) {
|
||||
return R.ok(wmsPsmAreaService.queryById(areaId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成品库区
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:add")
|
||||
@Log(title = "成品库区", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsPsmAreaBo bo) {
|
||||
return toAjax(wmsPsmAreaService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成品库区
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:edit")
|
||||
@Log(title = "成品库区", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsPsmAreaBo bo) {
|
||||
return toAjax(wmsPsmAreaService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成品库区
|
||||
*
|
||||
* @param areaIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:psmArea:remove")
|
||||
@Log(title = "成品库区", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{areaIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] areaIds) {
|
||||
return toAjax(wmsPsmAreaService.deleteWithValidByIds(List.of(areaIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询成品库区列表
|
||||
*/
|
||||
|
||||
@GetMapping("/getWmsPsmAreaList")
|
||||
public R<List<WmsPsmAreaVo>> getWmsPsmAreaList(WmsPsmAreaBo bo) {
|
||||
List<WmsPsmAreaVo> list = wmsPsmAreaService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
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.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 成品库区对象 wms_psm_area
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("wms_psm_area")
|
||||
public class WmsPsmArea {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "area_id", type = IdType.AUTO)
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 库区代码
|
||||
*/
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private Long warehouseId;
|
||||
/**
|
||||
* 租户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(fill = FieldFill.INSERT)
|
||||
private String createDept;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
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 org.dromara.wms.domain.WmsPsmArea;
|
||||
|
||||
/**
|
||||
* 成品库区业务对象 wms_psm_area
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = WmsPsmArea.class, reverseConvertGenerate = false)
|
||||
public class WmsPsmAreaBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
@NotBlank(message = "库区名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 库区代码
|
||||
*/
|
||||
@NotBlank(message = "库区代码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
@NotNull(message = "仓库不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long warehouseId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package org.dromara.wms.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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.WmsPsmArea;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 成品库区视图对象 wms_psm_area
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = WmsPsmArea.class)
|
||||
public class WmsPsmAreaVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
@ExcelProperty(value = "库区名称")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 库区代码
|
||||
*/
|
||||
@ExcelProperty(value = "库区代码")
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
@ExcelProperty(value = "仓库")
|
||||
private Long warehouseId;
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
|
||||
private String createDept;
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,15 +1,22 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsAllocateOrderDetail;
|
||||
import org.dromara.wms.domain.vo.WmsAllocateOrderDetailVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 调拨子Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface WmsAllocateOrderDetailMapper extends BaseMapperPlus<WmsAllocateOrderDetail, WmsAllocateOrderDetailVo> {
|
||||
|
||||
public interface WmsAllocateOrderDetailMapper extends BaseMapperPlus<WmsAllocateOrderDetail, WmsAllocateOrderDetailVo>{
|
||||
@Options(useGeneratedKeys = false)
|
||||
int insertDetails(@Param("list") ArrayList<WmsAllocateOrderDetail> list);
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsPsmArea;
|
||||
import org.dromara.wms.domain.vo.WmsPsmAreaVo;
|
||||
|
||||
/**
|
||||
* 成品库区Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
public interface WmsPsmAreaMapper extends BaseMapperPlus<WmsPsmArea, WmsPsmAreaVo> {
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
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.WmsPsmAreaBo;
|
||||
import org.dromara.wms.domain.vo.WmsPsmAreaVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 成品库区Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
public interface IWmsPsmAreaService {
|
||||
|
||||
/**
|
||||
* 查询成品库区
|
||||
*
|
||||
* @param areaId 主键
|
||||
* @return 成品库区
|
||||
*/
|
||||
WmsPsmAreaVo queryById(Long areaId);
|
||||
|
||||
/**
|
||||
* 分页查询成品库区列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 成品库区分页列表
|
||||
*/
|
||||
TableDataInfo<WmsPsmAreaVo> queryPageList(WmsPsmAreaBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的成品库区列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 成品库区列表
|
||||
*/
|
||||
List<WmsPsmAreaVo> queryList(WmsPsmAreaBo bo);
|
||||
|
||||
/**
|
||||
* 新增成品库区
|
||||
*
|
||||
* @param bo 成品库区
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsPsmAreaBo bo);
|
||||
|
||||
/**
|
||||
* 修改成品库区
|
||||
*
|
||||
* @param bo 成品库区
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsPsmAreaBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除成品库区信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
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.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.wms.domain.WmsPsmArea;
|
||||
import org.dromara.wms.domain.bo.WmsPsmAreaBo;
|
||||
import org.dromara.wms.domain.vo.WmsPsmAreaVo;
|
||||
import org.dromara.wms.mapper.WmsPsmAreaMapper;
|
||||
import org.dromara.wms.service.IWmsPsmAreaService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 成品库区Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-02-27
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsPsmAreaServiceImpl implements IWmsPsmAreaService {
|
||||
|
||||
private final WmsPsmAreaMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询成品库区
|
||||
*
|
||||
* @param areaId 主键
|
||||
* @return 成品库区
|
||||
*/
|
||||
@Override
|
||||
public WmsPsmAreaVo queryById(Long areaId){
|
||||
return baseMapper.selectVoById(areaId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询成品库区列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 成品库区分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsPsmAreaVo> queryPageList(WmsPsmAreaBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsPsmArea> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsPsmAreaVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的成品库区列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 成品库区列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsPsmAreaVo> queryList(WmsPsmAreaBo bo) {
|
||||
MPJLambdaWrapper<WmsPsmArea> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsPsmArea> buildQueryWrapper(WmsPsmAreaBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsPsmArea> lqw = JoinWrappers.lambda(WmsPsmArea.class)
|
||||
.selectAll(WmsPsmArea.class)
|
||||
.eq(bo.getAreaId() != null, WmsPsmArea::getAreaId, bo.getAreaId())
|
||||
.like(StringUtils.isNotBlank(bo.getAreaName()), WmsPsmArea::getAreaName, bo.getAreaName())
|
||||
.like(StringUtils.isNotBlank(bo.getAreaCode()), WmsPsmArea::getAreaCode, bo.getAreaCode())
|
||||
.eq(bo.getWarehouseId() != null, WmsPsmArea::getWarehouseId, bo.getWarehouseId())
|
||||
.orderByDesc(WmsPsmArea::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成品库区
|
||||
*
|
||||
* @param bo 成品库区
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsPsmAreaBo bo) {
|
||||
WmsPsmArea add = MapstructUtils.convert(bo, WmsPsmArea.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setAreaId(add.getAreaId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成品库区
|
||||
*
|
||||
* @param bo 成品库区
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsPsmAreaBo bo) {
|
||||
WmsPsmArea update = MapstructUtils.convert(bo, WmsPsmArea.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsPsmArea entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除成品库区信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsPsmAreaMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue