feat(stock): 增加库存调整相关 BO 和 DTO 中的供应商信息
- 在 StockCostAdjustProductBo、StockCostAdjustSheetFullBo、StockAdjustProductBo 和 StockAdjustSheetFullBo 中添加供应商 ID、编号和名称字段 - 在 StockCostAdjustProductDto 和 StockAdjustProductDto 中添加供应商 ID、编号和名称字段 - 更新数据库查询语句,加入供应商信息的查询
This commit is contained in:
parent
3ff9f82a49
commit
78c509f50f
|
@ -81,6 +81,24 @@ public class StockCostAdjustProductBo extends BaseBo<StockCostAdjustProductDto>
|
|||
@ApiModelProperty("调价前成本价")
|
||||
private BigDecimal oriPrice;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public StockCostAdjustProductBo() {
|
||||
|
||||
}
|
||||
|
@ -96,5 +114,8 @@ public class StockCostAdjustProductBo extends BaseBo<StockCostAdjustProductDto>
|
|||
this.productId = dto.getId();
|
||||
this.productCode = dto.getCode();
|
||||
this.productName = dto.getName();
|
||||
this.supplierId = dto.getSupplierId();
|
||||
this.supplierCode = dto.getSupplierCode();
|
||||
this.supplierName = dto.getSupplierName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,17 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.lframework.starter.common.constants.StringPool;
|
||||
import com.lframework.starter.common.utils.NumberUtil;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.common.utils.StringUtil;
|
||||
import com.lframework.starter.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
import com.lframework.starter.web.utils.EnumUtil;
|
||||
import com.lframework.xingyun.basedata.entity.Product;
|
||||
import com.lframework.xingyun.basedata.entity.ProductBrand;
|
||||
import com.lframework.xingyun.basedata.entity.ProductCategory;
|
||||
import com.lframework.xingyun.basedata.entity.StoreCenter;
|
||||
import com.lframework.xingyun.basedata.entity.*;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductBrandService;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductCategoryService;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductService;
|
||||
import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService;
|
||||
import com.lframework.xingyun.basedata.service.supplier.SupplierService;
|
||||
import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto;
|
||||
import com.lframework.xingyun.sc.entity.ProductStock;
|
||||
import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus;
|
||||
|
@ -266,6 +265,24 @@ public class StockCostAdjustSheetFullBo extends BaseBo<StockCostAdjustSheetFullD
|
|||
@ApiModelProperty(hidden = true)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public DetailBo(StockCostAdjustSheetFullDto.DetailDto dto, String scId, Integer status) {
|
||||
|
||||
this.scId = scId;
|
||||
|
@ -316,6 +333,15 @@ public class StockCostAdjustSheetFullBo extends BaseBo<StockCostAdjustSheetFullD
|
|||
this.diffAmount = NumberUtil.getNumber(
|
||||
NumberUtil.mul(NumberUtil.sub(this.price, this.oriPrice), this.stockNum), 2);
|
||||
}
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
this.supplierId = supplier.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,24 @@ public class StockAdjustProductBo extends BaseBo<StockAdjustProductDto> {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private String scId;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public StockAdjustProductBo() {
|
||||
|
||||
}
|
||||
|
@ -101,5 +119,9 @@ public class StockAdjustProductBo extends BaseBo<StockAdjustProductDto> {
|
|||
ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(),
|
||||
this.scId);
|
||||
this.curStockNum = productStock == null ? 0 : productStock.getStockNum();
|
||||
|
||||
this.supplierId = dto.getSupplierId();
|
||||
this.supplierCode = dto.getSupplierCode();
|
||||
this.supplierName = dto.getSupplierName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,18 @@ package com.lframework.xingyun.sc.bo.stock.adjust.stock;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.lframework.starter.common.constants.StringPool;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.common.utils.StringUtil;
|
||||
import com.lframework.starter.web.annotations.convert.EnumConvert;
|
||||
import com.lframework.starter.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
import com.lframework.starter.web.utils.EnumUtil;
|
||||
import com.lframework.xingyun.basedata.entity.Product;
|
||||
import com.lframework.xingyun.basedata.entity.ProductBrand;
|
||||
import com.lframework.xingyun.basedata.entity.ProductCategory;
|
||||
import com.lframework.xingyun.basedata.entity.StoreCenter;
|
||||
import com.lframework.xingyun.basedata.entity.*;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductBrandService;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductCategoryService;
|
||||
import com.lframework.xingyun.basedata.service.product.ProductService;
|
||||
import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService;
|
||||
import com.lframework.xingyun.basedata.service.supplier.SupplierService;
|
||||
import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto;
|
||||
import com.lframework.xingyun.sc.entity.ProductStock;
|
||||
import com.lframework.xingyun.sc.entity.StockAdjustReason;
|
||||
|
@ -269,6 +268,24 @@ public class StockAdjustSheetFullBo extends BaseBo<StockAdjustSheetFullDto> {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public DetailBo(StockAdjustSheetFullDto.DetailDto dto, String scId, Integer status) {
|
||||
|
||||
this.scId = scId;
|
||||
|
@ -315,6 +332,16 @@ public class StockAdjustSheetFullBo extends BaseBo<StockAdjustSheetFullDto> {
|
|||
this.scId);
|
||||
this.curStockNum = productStock == null ? 0 : productStock.getStockNum();
|
||||
}
|
||||
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
this.supplierId = supplier.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,4 +79,18 @@ public class StockCostAdjustProductDto implements BaseDto, Serializable {
|
|||
* 调价前成本价
|
||||
*/
|
||||
private BigDecimal oriPrice;
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.lframework.xingyun.sc.dto.stock.adjust.stock;
|
|||
|
||||
import com.lframework.starter.web.dto.BaseDto;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
@ -68,4 +70,19 @@ public class StockAdjustProductDto implements BaseDto, Serializable {
|
|||
* 当前库存数量
|
||||
*/
|
||||
private Integer curStockNum;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
<result column="external_code" property="externalCode"/>
|
||||
<result column="spec" property="spec"/>
|
||||
<result column="unit" property="unit"/>
|
||||
<result column="supplier_id" property="supplierId"/>
|
||||
<result column="supplier_code" property="supplierCode"/>
|
||||
<result column="supplier_name" property="supplierName"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="StockAdjustSheetDto_sql">
|
||||
|
@ -81,11 +84,15 @@
|
|||
g.sku_code,
|
||||
g.external_code,
|
||||
g.spec,
|
||||
g.unit
|
||||
g.unit,
|
||||
g.supplier_id,
|
||||
s.code AS supplier_code,
|
||||
s.name AS supplier_name
|
||||
FROM base_data_product AS g
|
||||
LEFT JOIN base_data_product_category AS c ON c.id = g.category_id
|
||||
LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id
|
||||
LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2
|
||||
LEFT JOIN base_data_supplier AS s ON s.id = g.supplier_id
|
||||
</sql>
|
||||
|
||||
<select id="query" resultType="com.lframework.xingyun.sc.entity.StockAdjustSheet">
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
<result column="purchase_price" property="purchasePrice"/>
|
||||
<result column="stock_num" property="stockNum"/>
|
||||
<result column="ori_price" property="oriPrice"/>
|
||||
<result column="supplier_id" property="supplierId"/>
|
||||
<result column="supplier_code" property="supplierCode"/>
|
||||
<result column="supplier_name" property="supplierName"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="StockCostAdjustSheetDto_sql">
|
||||
|
@ -123,13 +126,17 @@
|
|||
g.unit,
|
||||
purchase.price AS purchase_price,
|
||||
s.tax_price AS ori_price,
|
||||
s.stock_num
|
||||
s.stock_num,
|
||||
g.supplier_id,
|
||||
sa.code AS supplier_code,
|
||||
sa.name AS supplier_name
|
||||
FROM tbl_product_stock AS s
|
||||
INNER JOIN base_data_product AS g ON g.id = s.product_id AND g.product_type = 1
|
||||
INNER JOIN base_data_product_purchase AS purchase ON purchase.id = g.id
|
||||
LEFT JOIN base_data_product_category AS c ON c.id = g.category_id
|
||||
LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id
|
||||
LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2
|
||||
LEFT JOIN base_data_supplier AS sa ON sa.id = g.supplier_id
|
||||
</sql>
|
||||
|
||||
<select id="query" resultMap="StockCostAdjustSheet">
|
||||
|
|
Loading…
Reference in New Issue