feat(purchase): 采购相关 BO 和 DTO 中增加供应商信息

- 在多个采购相关的 BO 和 DTO 中添加供应商 ID 和名称字段
- 更新数据库查询以包含供应商信息- 优化采购订单和收货单的查询 SQL,加入供应商筛选条件
This commit is contained in:
lijiaqi 2024-11-21 11:20:13 +08:00
parent 3870e1a483
commit a318a1f4a6
12 changed files with 139 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService;
import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService;
import com.lframework.xingyun.sc.service.stock.ProductStockService;
import com.lframework.xingyun.template.core.service.UserService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDate;
@ -330,6 +331,18 @@ public class GetPurchaseOrderBo extends BaseBo<PurchaseOrderFullDto> {
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty("供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty("供应商名称")
private String supplierName;
public OrderDetailBo(String scId, PurchaseOrderFullDto.OrderDetailDto dto) {
this.scId = scId;
@ -361,6 +374,8 @@ public class GetPurchaseOrderBo extends BaseBo<PurchaseOrderFullDto> {
this.spec = product.getSpec();
this.categoryName = product.getCategoryName();
this.brandName = product.getBrandName();
this.supplierId = product.getSupplierId();
this.supplierName = product.getSupplierName();
ProductStockService productStockService = ApplicationUtil.getBean(
ProductStockService.class);

View File

@ -233,6 +233,18 @@ public class PurchaseOrderWithReceiveBo extends BaseBo<PurchaseOrderWithReceiveD
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty("供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty("供应商名称")
private String supplierName;
public DetailBo() {
}

View File

@ -105,6 +105,18 @@ public class PurchaseProductBo extends BaseBo<PurchaseProductDto> {
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty(value = "供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
public PurchaseProductBo(String scId, PurchaseProductDto dto) {
this.scId = scId;

View File

@ -374,6 +374,18 @@ public class GetReceiveSheetBo extends BaseBo<ReceiveSheetFullDto> {
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty(value = "供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
public OrderDetailBo(String scId, ReceiveSheetFullDto.OrderDetailDto dto) {
this.scId = scId;
@ -405,6 +417,8 @@ public class GetReceiveSheetBo extends BaseBo<ReceiveSheetFullDto> {
this.spec = product.getSpec();
this.categoryName = product.getCategoryName();
this.brandName = product.getBrandName();
this.supplierId = product.getSupplierId();
this.supplierName = product.getSupplierName();
if (!StringUtil.isBlank(dto.getPurchaseOrderDetailId())) {
PurchaseOrderDetailService purchaseOrderDetailService = ApplicationUtil.getBean(

View File

@ -234,6 +234,18 @@ public class ReceiveSheetWithReturnBo extends BaseBo<ReceiveSheetWithReturnDto>
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty(value = "供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
public DetailBo(String scId, ReceiveSheetWithReturnDto.DetailDto dto) {
this.scId = scId;
@ -273,6 +285,8 @@ public class ReceiveSheetWithReturnBo extends BaseBo<ReceiveSheetWithReturnDto>
this.spec = product.getSpec();
this.categoryName = product.getCategoryName();
this.brandName = product.getBrandName();
this.supplierId = product.getSupplierId();
this.supplierName = product.getSupplierName();
this.receiveNum = dto.getOrderNum();
this.purchasePrice = dto.getTaxPrice();

View File

@ -364,6 +364,18 @@ public class GetPurchaseReturnBo extends BaseBo<PurchaseReturnFullDto> {
@JsonIgnore
private String scId;
/**
* 供应商id
*/
@ApiModelProperty(value = "供应商id")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
public ReturnDetailBo(String scId, PurchaseReturnFullDto.ReturnDetailDto dto) {
this.scId = scId;
@ -395,6 +407,8 @@ public class GetPurchaseReturnBo extends BaseBo<PurchaseReturnFullDto> {
this.spec = product.getSpec();
this.categoryName = product.getCategoryName();
this.brandName = product.getBrandName();
this.supplierId = product.getSupplierId();
this.supplierName = product.getSupplierName();
if (!StringUtil.isBlank(dto.getReceiveSheetDetailId())) {
ReceiveSheetDetailService receiveSheetDetailService = ApplicationUtil.getBean(

View File

@ -88,5 +88,15 @@ public class PurchaseOrderWithReceiveDto implements BaseDto, Serializable {
* 已收货数量
*/
private Integer receiveNum;
/**
* 供应商id
*/
private String supplierId;
/**
* 供应商名称
*/
private String supplierName;
}
}

View File

@ -79,4 +79,14 @@ public class PurchaseProductDto implements BaseDto, Serializable {
* 状态
*/
private Boolean available;
/**
* 供应商id
*/
private String supplierId;
/**
* 供应商名称
*/
private String supplierName;
}

View File

@ -4,6 +4,8 @@ import com.lframework.starter.web.dto.BaseDto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -88,5 +90,15 @@ public class ReceiveSheetWithReturnDto implements BaseDto, Serializable {
* 已退货数量
*/
private Integer returnNum;
/**
* 供应商id
*/
private String supplierId;
/**
* 供应商名称
*/
private String supplierName;
}
}

View File

@ -34,4 +34,11 @@ public class QueryPurchaseProductVo extends PageVo {
*/
@ApiModelProperty("品牌ID")
private String brandId;
/**
* 供应商ID
*/
@ApiModelProperty("供应商ID")
@NotBlank(message = "供应商ID不能为空")
private String supplierId;
}

View File

@ -70,6 +70,8 @@
<result column="detail_description" property="description"/>
<result column="detail_order_no" property="orderNo"/>
<result column="detail_receive_num" property="receiveNum"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
</collection>
</resultMap>
@ -88,6 +90,8 @@
<result column="purchase_price" property="purchasePrice"/>
<result column="tax_rate" property="taxRate"/>
<result column="available" property="available"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
</resultMap>
<sql id="PurchaseOrderDto_sql">
@ -161,12 +165,15 @@
g.unit,
purchase.price AS purchase_price,
g.tax_rate,
g.available
g.available,
g.supplier_id,
s.name AS supplier_name
FROM base_data_product AS g
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 s ON s.id = g.supplier_id
</sql>
<select id="query" resultMap="PurchaseOrder">
@ -256,9 +263,11 @@
o.id, o.sc_id, o.supplier_id, o.purchaser_id, d.id AS detail_id, d.product_id AS detail_product_id,
d.order_num AS detail_order_num, d.tax_price AS detail_tax_price, d.is_gift AS detail_is_gift,
d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no,
d.receive_num AS detail_receive_num
d.receive_num AS detail_receive_num,g.p.supplier_id, s.name AS supplier_name
FROM tbl_purchase_order AS o
LEFT JOIN tbl_purchase_order_detail AS d ON d.order_id = o.id
LEFT JOIN base_data_product AS p ON p.id = d.product_id
LEFT JOIN base_data_supplier AS s ON s.id = p.supplier_id
<if test="requirePurchase">AND d.order_num > d.receive_num</if>
WHERE o.id = #{id}
</select>
@ -326,6 +335,9 @@
<if test="vo.categoryId != null and vo.categoryId != ''">
AND (c.id = #{vo.categoryId} OR FIND_IN_SET(#{vo.categoryId}, rm.path))
</if>
<if test="vo.supplierId != null and vo.supplierId != ''">
AND g.supplier_id = #{vo.supplierId}
</if>
</if>
AND g.product_type = 1
AND g.available = TRUE

View File

@ -76,6 +76,8 @@
<result column="detail_description" property="description"/>
<result column="detail_order_no" property="orderNo"/>
<result column="detail_return_num" property="returnNum"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
</collection>
</resultMap>
@ -250,9 +252,11 @@
s.id, s.sc_id, s.supplier_id, s.purchaser_id, d.id AS detail_id, d.product_id AS detail_product_id,
d.order_num AS detail_order_num, d.tax_price AS detail_tax_price, d.is_gift AS detail_is_gift,
d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no,
d.return_num AS detail_return_num
d.return_num AS detail_return_num,p.supplier_id,s.name AS supplier_name
FROM tbl_receive_sheet AS s
LEFT JOIN tbl_receive_sheet_detail AS d ON d.sheet_id = s.id
LEFT JOIN base_data_product AS p ON p.id = d.product_id
LEFT JOIN base_data_supplier AS s ON s.id = p.supplier_id
<if test="requireReceive">AND d.order_num > d.return_num</if>
WHERE s.id = #{id}
AND s.status = 3