出入库接口 修改

出入库接口 修改
pull/1/head
siontion 9 months ago
parent d6ea63ec54
commit 03ecc489a4

@ -36,6 +36,6 @@ public interface ErrorCodeConstants {
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_003_001, "仓库不存在");
ErrorCode RG_NOT_EXISTS = new ErrorCode(1_003_002, "库区不存在");
ErrorCode PN_NOT_EXISTS = new ErrorCode(1_003_003, "库位不存在");
ErrorCode Storage_NOT_EXISTS = new ErrorCode(1_003_004,"库存不存在");
ErrorCode STORAGE_NOT_EXISTS = new ErrorCode(1_003_004,"库存不存在");
}

@ -4,7 +4,6 @@ import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@ -16,8 +15,14 @@ import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_Y
@ToString(callSuper = true)
public class StoragePageReqVO extends PageParam {
@Schema(description = "入库出库类型1为入库2为出库", example = "2")
private Boolean stockType;
@Schema(description = "入库出库大类型1为入库2为出库", example = "2")
private Integer stockType;
@Schema(description = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", example = "1")
private Integer stockInType;
@Schema(description = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", example = "2")
private Integer stockOutType;
@Schema(description = "入/出库单号")
private String stockNo;
@ -25,36 +30,15 @@ public class StoragePageReqVO extends PageParam {
@Schema(description = "上游单号")
private Long headerNo;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", example = "651")
private Long materialId;
@Schema(description = "备注", example = "你说的对")
private String description;
@Schema(description = "批次号")
private String lotNo;
@Schema(description = "状态1为保存2为提交3为作废", example = "1")
private Integer status;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", example = "17136")
@Schema(description = "仓库Id对应 wms_wh 表中的Id", example = "28079")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", example = "24171")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", example = "3031")
private Long pnId;
@Schema(description = "库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "库存不良品数量")
private BigDecimal storageNgQty;
@Schema(description = "库存报废数量")
private BigDecimal storageSpQty;
@Schema(description = "备注", example = "随便")
private String description;
@Schema(description = "状态1为保存2为提交3为作废", example = "2")
private Boolean status;
@Schema(description = "记录的创建人,对应员工表中的 Id")
private String creator;
@ -77,11 +61,11 @@ public class StoragePageReqVO extends PageParam {
private LocalDateTime[] keeperTime;
@Schema(description = "出库人")
private Long outer;
private Long outbound;
@Schema(description = "出库时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] outerTime;
private LocalDateTime[] outboundTime;
@Schema(description = "作废人")
private Long cancel;

@ -4,23 +4,35 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat;
import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 入/出库 Response VO")
@Data
@ExcelIgnoreUnannotated
public class StorageRespVO {
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1806")
@ExcelProperty("出库时间")
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "入库出库类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("入库出库类型1为入库2为出库")
private Boolean stockType;
@Schema(description = "入库出库大类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "入库出库大类型1为入库2为出库", converter = DictConvert.class)
@DictFormat("heli_storage_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer stockType;
@Schema(description = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", example = "1")
@ExcelProperty(value = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", converter = DictConvert.class)
@DictFormat("heli_storage_in_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer stockInType;
@Schema(description = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", example = "2")
@ExcelProperty(value = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", converter = DictConvert.class)
@DictFormat("heli_storage_out_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer stockOutType;
@Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("入/出库单号")
@ -30,45 +42,18 @@ public class StorageRespVO {
@ExcelProperty("上游单号")
private Long headerNo;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "651")
@ExcelProperty("物料 Id,对应 base_material表中的 Id 列")
private Long materialId;
@Schema(description = "批次号")
@ExcelProperty("批次号")
private String lotNo;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17136")
@ExcelProperty("仓库 Id对应 wms_wh 表中的Id")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24171")
@ExcelProperty("库区 Id对应 wms_rg 表中的Id")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3031")
@ExcelProperty("库区 Id对应 wms_rg 表中的Id")
private Long pnId;
@Schema(description = "库存良品数量")
@ExcelProperty("库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "库存不良品数量")
@ExcelProperty("库存不良品数量")
private BigDecimal storageNgQty;
@Schema(description = "库存报废数量")
@ExcelProperty("库存报废数量")
private BigDecimal storageSpQty;
@Schema(description = "备注", example = "随便")
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String description;
@Schema(description = "状态1为保存2为提交3为作废", example = "2")
@ExcelProperty("状态1为保存2为提交3为作废")
private Boolean status;
@Schema(description = "状态1为保存2为提交3为作废", example = "1")
@ExcelProperty(value = "状态1为保存2为提交3为作废", converter = DictConvert.class)
@DictFormat("heli_common_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "仓库Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079")
@ExcelProperty("仓库Id对应 wms_wh 表中的Id")
private Long whId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@ -84,11 +69,11 @@ public class StorageRespVO {
@Schema(description = "出库人")
@ExcelProperty("出库人")
private Long outer;
private Long outbound;
@Schema(description = "出库时间")
@ExcelProperty("出库时间")
private LocalDateTime outerTime;
private LocalDateTime outboundTime;
@Schema(description = "作废人")
@ExcelProperty("作废人")

@ -5,7 +5,6 @@ import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@ -13,12 +12,18 @@ import java.time.LocalDateTime;
@Data
public class StorageSaveReqVO {
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1806")
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890")
private Long id;
@Schema(description = "入库出库类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "入库出库类型1为入库2为出库不能为空")
private Boolean stockType;
@Schema(description = "入库出库大类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "入库出库大类型1为入库2为出库不能为空")
private Integer stockType;
@Schema(description = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", example = "1")
private Integer stockInType;
@Schema(description = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", example = "2")
private Integer stockOutType;
@Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入/出库单号不能为空")
@ -27,40 +32,16 @@ public class StorageSaveReqVO {
@Schema(description = "上游单号")
private Long headerNo;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "651")
@NotNull(message = "物料 Id,对应 base_material表中的 Id 列不能为空")
private Long materialId;
@Schema(description = "备注", example = "你说的对")
private String description;
@Schema(description = "批次号")
private String lotNo;
@Schema(description = "状态1为保存2为提交3为作废", example = "1")
private Integer status;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17136")
@NotNull(message = "仓库 Id对应 wms_wh 表中的Id不能为空")
@Schema(description = "仓库Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079")
@NotNull(message = "仓库Id对应 wms_wh 表中的Id不能为空")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24171")
@NotNull(message = "库区 Id对应 wms_rg 表中的Id不能为空")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3031")
@NotNull(message = "库区 Id对应 wms_rg 表中的Id不能为空")
private Long pnId;
@Schema(description = "库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "库存不良品数量")
private BigDecimal storageNgQty;
@Schema(description = "库存报废数量")
private BigDecimal storageSpQty;
@Schema(description = "备注", example = "随便")
private String description;
@Schema(description = "状态1为保存2为提交3为作废", example = "2")
private Boolean status;
@Schema(description = "入库人")
private Long keeper;
@ -68,10 +49,10 @@ public class StorageSaveReqVO {
private LocalDateTime keeperTime;
@Schema(description = "出库人")
private Long outer;
private Long outbound;
@Schema(description = "出库时间")
private LocalDateTime outerTime;
private LocalDateTime outboundTime;
@Schema(description = "作废人")
private Long cancel;

@ -2,9 +2,6 @@ package com.chanko.yunxi.mes.module.heli.dal.dataobject.storage;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
@ -29,62 +26,50 @@ import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
public class StorageDO extends BaseDO {
/**
*
* id
*/
@TableId
private Long id;
/**
* 12
* 12
*
* {@link TODO heli_storage_type }
*/
private Boolean stockType;
private Integer stockType;
/**
* /
* ()123
*
* {@link TODO heli_storage_in_type }
*/
private String stockNo;
/**
*
*/
private Long headerNo;
private Integer stockInType;
/**
* Id, base_material Id
* ()1234
*
* {@link TODO heli_storage_out_type }
*/
private Long materialId;
private Integer stockOutType;
/**
*
*/
private String lotNo;
/**
* Id wms_wh Id
*/
private Long whId;
/**
* Id wms_rg Id
*/
private Long rgId;
/**
* Id wms_rg Id
*/
private Long pnId;
/**
*
*/
private BigDecimal storageOkQty;
/**
*
* /
*/
private BigDecimal storageNgQty;
private String stockNo;
/**
*
*
*/
private BigDecimal storageSpQty;
private Long headerNo;
/**
*
*/
private String description;
/**
* 123
*
* {@link TODO heli_common_status }
*/
private Boolean status;
private Integer status;
/**
* Id wms_wh Id
*/
private Long whId;
/**
*
*/
@ -96,11 +81,11 @@ public class StorageDO extends BaseDO {
/**
*
*/
private Long outer;
private Long outbound;
/**
*
*/
private LocalDateTime outerTime;
private LocalDateTime outboundTime;
/**
*
*/

@ -20,26 +20,21 @@ public interface StorageMapper extends BaseMapperX<StorageDO> {
default PageResult<StorageDO> selectPage(StoragePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<StorageDO>()
.eqIfPresent(StorageDO::getStockType, reqVO.getStockType())
.eqIfPresent(StorageDO::getStockInType, reqVO.getStockInType())
.eqIfPresent(StorageDO::getStockOutType, reqVO.getStockOutType())
.eqIfPresent(StorageDO::getStockNo, reqVO.getStockNo())
.eqIfPresent(StorageDO::getHeaderNo, reqVO.getHeaderNo())
.eqIfPresent(StorageDO::getMaterialId, reqVO.getMaterialId())
.eqIfPresent(StorageDO::getLotNo, reqVO.getLotNo())
.eqIfPresent(StorageDO::getWhId, reqVO.getWhId())
.eqIfPresent(StorageDO::getRgId, reqVO.getRgId())
.eqIfPresent(StorageDO::getPnId, reqVO.getPnId())
.eqIfPresent(StorageDO::getStorageOkQty, reqVO.getStorageOkQty())
.eqIfPresent(StorageDO::getStorageNgQty, reqVO.getStorageNgQty())
.eqIfPresent(StorageDO::getStorageSpQty, reqVO.getStorageSpQty())
.eqIfPresent(StorageDO::getDescription, reqVO.getDescription())
.eqIfPresent(StorageDO::getStatus, reqVO.getStatus())
.eqIfPresent(StorageDO::getWhId, reqVO.getWhId())
.eqIfPresent(StorageDO::getCreator, reqVO.getCreator())
.betweenIfPresent(StorageDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(StorageDO::getUpdater, reqVO.getUpdater())
.betweenIfPresent(StorageDO::getUpdateTime, reqVO.getUpdateTime())
.eqIfPresent(StorageDO::getKeeper, reqVO.getKeeper())
.betweenIfPresent(StorageDO::getKeeperTime, reqVO.getKeeperTime())
.eqIfPresent(StorageDO::getOuter, reqVO.getOuter())
.betweenIfPresent(StorageDO::getOuterTime, reqVO.getOuterTime())
.eqIfPresent(StorageDO::getOutbound, reqVO.getOutbound())
.betweenIfPresent(StorageDO::getOutboundTime, reqVO.getOutboundTime())
.eqIfPresent(StorageDO::getCancel, reqVO.getCancel())
.betweenIfPresent(StorageDO::getCancelTime, reqVO.getCancelTime())
.orderByDesc(StorageDO::getId));

@ -1,74 +1,74 @@
package com.chanko.yunxi.mes.module.heli.service.storage;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* / Service
*
* @author
*/
@Service
@Validated
public class StorageServiceImpl implements StorageService {
@Resource
private StorageMapper storageMapper;
@Override
public Long createStorage(StorageSaveReqVO createReqVO) {
// 插入
StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class);
storageMapper.insert(storage);
// 返回
return storage.getId();
}
@Override
public void updateStorage(StorageSaveReqVO updateReqVO) {
// 校验存在
validateStorageExists(updateReqVO.getId());
// 更新
StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class);
storageMapper.updateById(updateObj);
}
@Override
public void deleteStorage(Long id) {
// 校验存在
validateStorageExists(id);
// 删除
storageMapper.deleteById(id);
}
private void validateStorageExists(Long id) {
if (storageMapper.selectById(id) == null) {
throw exception(Storage_NOT_EXISTS);
}
}
@Override
public StorageDO getStorage(Long id) {
return storageMapper.selectById(id);
}
@Override
public PageResult<StorageDO> getStoragePage(StoragePageReqVO pageReqVO) {
return storageMapper.selectPage(pageReqVO);
}
}
package com.chanko.yunxi.mes.module.heli.service.storage;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* / Service
*
* @author
*/
@Service
@Validated
public class StorageServiceImpl implements StorageService {
@Resource
private StorageMapper storageMapper;
@Override
public Long createStorage(StorageSaveReqVO createReqVO) {
// 插入
StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class);
storageMapper.insert(storage);
// 返回
return storage.getId();
}
@Override
public void updateStorage(StorageSaveReqVO updateReqVO) {
// 校验存在
validateStorageExists(updateReqVO.getId());
// 更新
StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class);
storageMapper.updateById(updateObj);
}
@Override
public void deleteStorage(Long id) {
// 校验存在
validateStorageExists(id);
// 删除
storageMapper.deleteById(id);
}
private void validateStorageExists(Long id) {
if (storageMapper.selectById(id) == null) {
throw exception(STORAGE_NOT_EXISTS);
}
}
@Override
public StorageDO getStorage(Long id) {
return storageMapper.selectById(id);
}
@Override
public PageResult<StorageDO> getStoragePage(StoragePageReqVO pageReqVO) {
return storageMapper.selectPage(pageReqVO);
}
}
Loading…
Cancel
Save