refactor(service):优化库存查找逻辑并移除冗余代码
- 修改 findOrCreateStock 方法返回类型为 void- 移除 warehouseId 的重复设置逻辑 - 简化库存存在时的处理流程- 删除多个与出入库及库存流水相关的实体类和业务对象- 清理无用的业务逻辑代码,提升代码可维护性
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
package com.klp.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单主对象 wms_stock_io
|
|
||||||
*
|
|
||||||
* @author Joshi
|
|
||||||
* @date 2025-07-18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("wms_stock_io")
|
|
||||||
public class WmsStockIo extends BaseEntity {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "stock_io_id")
|
|
||||||
private Long stockIoId;
|
|
||||||
/**
|
|
||||||
* 出入库单号
|
|
||||||
*/
|
|
||||||
private String stockIoCode;
|
|
||||||
/**
|
|
||||||
* 类型(in=入库,out=出库)
|
|
||||||
*/
|
|
||||||
private String ioType;
|
|
||||||
/**
|
|
||||||
* 业务类型(采购、销售、退货、调拨等)
|
|
||||||
*/
|
|
||||||
private String bizType;
|
|
||||||
/**
|
|
||||||
* 单据状态(0=草稿,1=已提交,2=已审核,3=已完成)
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
//
|
|
||||||
private Long parentId;
|
|
||||||
/**
|
|
||||||
* 删除标志(0=正常,1=已删除)
|
|
||||||
*/
|
|
||||||
@TableLogic
|
|
||||||
private Integer delFlag;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
package com.klp.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单明细对象 wms_stock_io_detail
|
|
||||||
*
|
|
||||||
* @author Joshi
|
|
||||||
* @date 2025-07-18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("wms_stock_io_detail")
|
|
||||||
public class WmsStockIoDetail extends BaseEntity {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 明细ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "detail_id")
|
|
||||||
private Long detailId;
|
|
||||||
/**
|
|
||||||
* 出入库单ID
|
|
||||||
*/
|
|
||||||
private Long stockIoId;
|
|
||||||
/**
|
|
||||||
* 库区/库位ID
|
|
||||||
*/
|
|
||||||
private Long warehouseId;
|
|
||||||
/**
|
|
||||||
* 物品类型(raw_material/product)
|
|
||||||
*/
|
|
||||||
private String itemType;
|
|
||||||
/**
|
|
||||||
* 物品ID
|
|
||||||
*/
|
|
||||||
private Long itemId;
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private BigDecimal quantity;
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
private String unit;
|
|
||||||
/**
|
|
||||||
* 批次号
|
|
||||||
*/
|
|
||||||
private String batchNo;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
|
||||||
* 删除标志(0=正常,1=已删除)
|
|
||||||
*/
|
|
||||||
@TableLogic
|
|
||||||
private Integer delFlag;
|
|
||||||
/**
|
|
||||||
* 源库位ID(移库时使用)
|
|
||||||
*/
|
|
||||||
private Long fromWarehouseId;
|
|
||||||
/**
|
|
||||||
* 记录类型,0:详情,1:扫码枪记录
|
|
||||||
*/
|
|
||||||
private Integer recordType;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
package com.klp.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库存流水对象 wms_stock_log
|
|
||||||
*
|
|
||||||
* @author JR
|
|
||||||
* @date 2025-08-11
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("wms_stock_log")
|
|
||||||
public class WmsStockLog extends BaseEntity {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "id")
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 仓库/库区/库位ID
|
|
||||||
*/
|
|
||||||
private Long warehouseId;
|
|
||||||
/**
|
|
||||||
* 物品ID(指向原材料或产品主键)
|
|
||||||
*/
|
|
||||||
private Long itemId;
|
|
||||||
/**
|
|
||||||
* 物品类型(raw_material/product)
|
|
||||||
*/
|
|
||||||
private String itemType;
|
|
||||||
/**
|
|
||||||
* 变动数量(正=入库,负=出库)
|
|
||||||
*/
|
|
||||||
private BigDecimal changeQty;
|
|
||||||
/**
|
|
||||||
* 变动后的库存数量
|
|
||||||
*/
|
|
||||||
private BigDecimal afterQty;
|
|
||||||
/**
|
|
||||||
* 变动类型(入库/出库等)
|
|
||||||
*/
|
|
||||||
private String changeType;
|
|
||||||
/**
|
|
||||||
* 实际库存变动时间
|
|
||||||
*/
|
|
||||||
private Date changeTime;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
|
||||||
* 删除标志(0=正常,1=删除)
|
|
||||||
*/
|
|
||||||
@TableLogic
|
|
||||||
private Long delFlag;
|
|
||||||
|
|
||||||
//批次号
|
|
||||||
private String batchNo;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.klp.domain.bo;
|
|
||||||
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import com.klp.common.core.validate.AddGroup;
|
|
||||||
import com.klp.common.core.validate.EditGroup;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单主业务对象 wms_stock_io
|
|
||||||
*
|
|
||||||
* @author Joshi
|
|
||||||
* @date 2025-07-18
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class WmsStockIoBo extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单ID
|
|
||||||
*/
|
|
||||||
private Long stockIoId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单号
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "出入库单号不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String stockIoCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型(in=入库,out=出库)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "类型(in=入库,out=出库)不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String ioType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务类型(采购、销售、退货、调拨等)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "业务类型(采购、销售、退货、调拨等)不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String bizType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单据状态(0=草稿,1=已提交,2=已审核,3=已完成)
|
|
||||||
*/
|
|
||||||
@NotNull(message = "单据状态(0=草稿,1=已提交,2=已审核,3=已完成)不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级ID(用于退库时关联原出库单)
|
|
||||||
*/
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package com.klp.domain.bo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库存流水业务对象 wms_stock_log
|
|
||||||
*
|
|
||||||
* @author JR
|
|
||||||
* @date 2025-08-11
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class WmsStockLogBo extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓库/库区/库位ID
|
|
||||||
*/
|
|
||||||
private Long warehouseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品ID(指向原材料或产品主键)
|
|
||||||
*/
|
|
||||||
private Long itemId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品类型(raw_material/product)
|
|
||||||
*/
|
|
||||||
private String itemType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动数量(正=入库,负=出库)
|
|
||||||
*/
|
|
||||||
private BigDecimal changeQty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动后的库存数量
|
|
||||||
*/
|
|
||||||
private BigDecimal afterQty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动类型(入库/出库等)
|
|
||||||
*/
|
|
||||||
private String changeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实际库存变动时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
private Date changeTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date startTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date endTime;
|
|
||||||
|
|
||||||
//批次号
|
|
||||||
private String batchNo;
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
package com.klp.domain.vo;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import com.klp.common.annotation.ExcelDictFormat;
|
|
||||||
import com.klp.common.convert.ExcelDictConvert;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单明细视图对象 wms_stock_io_detail
|
|
||||||
*
|
|
||||||
* @author Joshi
|
|
||||||
* @date 2025-07-18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class WmsStockIoDetailVo {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 明细ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "明细ID")
|
|
||||||
private Long detailId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "出入库单ID")
|
|
||||||
private Long stockIoId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库区/库位ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "库区/库位ID")
|
|
||||||
private Long warehouseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品类型(raw_material/product)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "物品类型", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "r=aw_material/product")
|
|
||||||
private String itemType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "物品ID")
|
|
||||||
private Long itemId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "数量")
|
|
||||||
private BigDecimal quantity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "单位")
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次号
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "批次号")
|
|
||||||
private String batchNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 记录类型,0:详情,1:扫码枪记录
|
|
||||||
*/
|
|
||||||
private Integer recordType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库区/库位名称
|
|
||||||
*/
|
|
||||||
private String warehouseName;
|
|
||||||
/**
|
|
||||||
* 源库区/库位名称(移库用)
|
|
||||||
*/
|
|
||||||
private String fromWarehouseName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 源库位ID(移库时使用)
|
|
||||||
*/
|
|
||||||
private Long fromWarehouseId;
|
|
||||||
|
|
||||||
//主表的 数据号 类型以及业务类型
|
|
||||||
private String stockIoCode;
|
|
||||||
private String ioType;
|
|
||||||
private String bizType;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.klp.domain.vo;
|
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import com.klp.common.annotation.ExcelDictFormat;
|
|
||||||
import com.klp.common.convert.ExcelDictConvert;
|
|
||||||
import com.klp.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单主视图对象 wms_stock_io
|
|
||||||
*
|
|
||||||
* @author Joshi
|
|
||||||
* @date 2025-07-18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class WmsStockIoVo extends BaseEntity {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "出入库单ID")
|
|
||||||
private Long stockIoId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出入库单号
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "出入库单号")
|
|
||||||
private String stockIoCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型(in=入库,out=出库)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "类型", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "i=n=入库,out=出库")
|
|
||||||
private String ioType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务类型(采购、销售、退货、调拨等)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "采=购、销售、退货、调拨等")
|
|
||||||
private String bizType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单据状态(0=草稿,1=已提交,2=已审核,3=已完成)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "单据状态", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "0==草稿,1=已提交,2=已审核,3=已完成")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
package com.klp.domain.vo;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import com.klp.common.annotation.ExcelDictFormat;
|
|
||||||
import com.klp.common.convert.ExcelDictConvert;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库存流水视图对象 wms_stock_log
|
|
||||||
*
|
|
||||||
* @author JR
|
|
||||||
* @date 2025-08-11
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class WmsStockLogVo {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "主键ID")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓库/库区/库位ID
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "仓库/库区/库位ID")
|
|
||||||
private Long warehouseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品ID(指向原材料或产品主键)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "物品ID", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "指=向原材料或产品主键")
|
|
||||||
private Long itemId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物品类型(raw_material/product)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "物品类型", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "r=aw_material/product")
|
|
||||||
private String itemType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动数量(正=入库,负=出库)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "变动数量", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "正==入库,负=出库")
|
|
||||||
private BigDecimal changeQty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动后的库存数量
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "变动后的库存数量")
|
|
||||||
private BigDecimal afterQty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 变动类型(入库/出库等)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "变动类型", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "入=库/出库等")
|
|
||||||
private String changeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实际库存变动时间
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "实际库存变动时间")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date changeTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓库/库区名称
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "仓库/库区名称")
|
|
||||||
private String warehouseName;
|
|
||||||
|
|
||||||
//批次号
|
|
||||||
private String batchNo;
|
|
||||||
}
|
|
||||||
@@ -182,8 +182,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
bo.setQrcodeRecordId(qrcodeRecordId);
|
bo.setQrcodeRecordId(qrcodeRecordId);
|
||||||
|
|
||||||
// 2. 查找或创建stock
|
// 2. 查找或创建stock
|
||||||
Long warehouseId = findOrCreateStock(bo);
|
findOrCreateStock(bo);
|
||||||
bo.setWarehouseId(warehouseId);
|
|
||||||
|
|
||||||
|
|
||||||
// 3. 插入钢卷数据
|
// 3. 插入钢卷数据
|
||||||
@@ -256,7 +255,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
/**
|
/**
|
||||||
* 查找或创建stock
|
* 查找或创建stock
|
||||||
*/
|
*/
|
||||||
private Long findOrCreateStock(WmsMaterialCoilBo bo) {
|
private void findOrCreateStock(WmsMaterialCoilBo bo) {
|
||||||
if (bo.getItemType() == null || bo.getItemId() == null) {
|
if (bo.getItemType() == null || bo.getItemId() == null) {
|
||||||
throw new RuntimeException("物品类型和物品ID不能为空");
|
throw new RuntimeException("物品类型和物品ID不能为空");
|
||||||
}
|
}
|
||||||
@@ -267,26 +266,20 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
stockBo.setItemId(bo.getItemId());
|
stockBo.setItemId(bo.getItemId());
|
||||||
List<WmsStockVo> stockList = stockService.queryList(stockBo);
|
List<WmsStockVo> stockList = stockService.queryList(stockBo);
|
||||||
|
|
||||||
if (!stockList.isEmpty()) {
|
if (stockList.isEmpty()) {
|
||||||
// 如果找到相同的stock,返回第一个的warehouseId
|
|
||||||
return stockList.get(0).getWarehouseId();
|
|
||||||
} else {
|
|
||||||
// 如果没有找到匹配的stock,新增一条stock记录
|
// 如果没有找到匹配的stock,新增一条stock记录
|
||||||
WmsStockBo newStockBo = new WmsStockBo();
|
WmsStockBo newStockBo = new WmsStockBo();
|
||||||
newStockBo.setItemType(bo.getItemType());
|
newStockBo.setItemType(bo.getItemType());
|
||||||
newStockBo.setItemId(bo.getItemId());
|
newStockBo.setItemId(bo.getItemId());
|
||||||
// 如果有指定warehouseId,使用指定的;否则为null
|
|
||||||
if (bo.getWarehouseId() != null) {
|
|
||||||
newStockBo.setWarehouseId(bo.getWarehouseId());
|
|
||||||
}
|
|
||||||
// 调用stockService新增stock
|
// 调用stockService新增stock
|
||||||
Boolean insertResult = stockService.insertByBo(newStockBo);
|
Boolean insertResult = stockService.insertByBo(newStockBo);
|
||||||
if (!insertResult) {
|
if (!insertResult) {
|
||||||
throw new RuntimeException("新增库存记录失败");
|
throw new RuntimeException("新增库存记录失败");
|
||||||
}
|
}
|
||||||
// 返回新创建的stock的warehouseId
|
|
||||||
return newStockBo.getWarehouseId();
|
|
||||||
}
|
}
|
||||||
|
// 如果已存在stock记录,则不需要重复创建
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user