feat(warehouseReceipt): 采购入库查询供应商统计列表添加入库单 ID 字段

- 在查询供应商统计列表的 SQL 中添加了入库单 ID 字段
- 该字段通过子查询获取,包含多个筛选条件以满足不同查询需求
- 新增的入库单 ID 字段为数组形式,包含所有符合条件的入库单 ID
This commit is contained in:
2025-02-23 15:32:00 +08:00
parent 51213e4eec
commit 59599d193b

View File

@@ -1008,6 +1008,58 @@ from (
</#if>
) as "入库单数量",
(select array_agg(distinct re.id)
from t_warehouse_receipt re
inner join t_warehouse_receipt_detail d
on re.id = d.receipt_id
inner join t_warehouse_goods gs on d.goods_id = gs.id
where re.organization_id = s.organization_id
and re.receipt_type = '0'
and d.supplier_id = s.id
<#if startTime??>
and re.receipt_date >= :startTime
</#if>
<#if endTime??>
and re.receipt_date <= :endTime
</#if>
<#if reason??>
and re.reason like '%' || :reason || '%'
</#if>
<#if goodsIds?has_content>
and gs.id in :goodsIds
</#if>
<#if barCode??>
and gs.bar_code like '%' || :barCode || '%'
</#if>
<#if code??>
and gs.code like '%' || :code || '%'
</#if>
<#if goodsName??>
and gs.name like '%' || :goodsName || '%'
</#if>
<#if categoryIds?has_content>
and gs.category_id in :categoryIds
</#if>
<#if brandIds?has_content>
and gs.brand_id in :brandIds
</#if>
<#if unitIds?has_content>
and gs.unit_id in :unitIds
</#if>
<#if warehouseIds?has_content>
and d.warehouse_id in :warehouseIds
</#if>
) as "入库单ID",
(select COALESCE(count(d.id),0)
from t_warehouse_receipt re