From 2ff0f92f946fc8ba418c257998cf9127583a6f52 Mon Sep 17 00:00:00 2001 From: yueli Date: Fri, 28 Aug 2026 15:53:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(stocktake):=20=E4=BF=AE=E5=A4=8D=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E6=8A=A5=E5=91=8A=E5=AF=BC=E5=87=BA=20500=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 导出盘点报告时第1126行使用了 func.sum()/func.coalesce() 但文件未导入 sqlalchemy 的 func - 改为 db.func.sum()/db.func.coalesce(),与文件内其他用法一致 --- inventory-backend/app/api/v1/inbound/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory-backend/app/api/v1/inbound/stock.py b/inventory-backend/app/api/v1/inbound/stock.py index 6c71caa..d1f27f7 100644 --- a/inventory-backend/app/api/v1/inbound/stock.py +++ b/inventory-backend/app/api/v1/inbound/stock.py @@ -1123,7 +1123,7 @@ def export_stocktake(): borrow_rows = db.session.query( TransBorrow.source_table, TransBorrow.stock_id, - func.sum(func.coalesce(TransBorrow.quantity, 0) - func.coalesce(TransBorrow.returned_quantity, 0)).label('pending') + db.func.sum(db.func.coalesce(TransBorrow.quantity, 0) - db.func.coalesce(TransBorrow.returned_quantity, 0)).label('pending') ).filter( TransBorrow.is_returned == False ).group_by(