feat: 库存查询接口

This commit is contained in:
2024-11-12 23:10:06 +08:00
parent 4ee0396578
commit 6cd141c343

View File

@@ -51,14 +51,14 @@ select
d.warehouse_id as warehouse_id,
count(d.id) over (partition by g.id) as detail_count,
round((sum(d.number) filter ( where d.receipt_type = '0' ) over (partition by g.id, d.warehouse_id))::numeric,
2) as type0_number,
2) as type0number,
round((sum(d.number) filter ( where d.receipt_type = '1' ) over (partition by g.id, d.warehouse_id))::numeric,
2) as type1_number,
2) as type1number,
round((sum(d.amount) filter ( where d.receipt_type = '0' ) over (partition by g.id, d.warehouse_id))::numeric,
2) as type0_amount,
2) as type0amount,
round((sum(d.amount) filter ( where d.receipt_type = '1' ) over (partition by g.id, d.warehouse_id))::numeric,
2) as type1_amount
2) as type1amount
from t_warehouse_goods g
inner join t_warehouse_receipt_detail d on d.goods_id = g.id and d.organization_id = g.organization_id