ERP/check_reconciliations.py

32 lines
821 B
Python
Raw Normal View History

2025-11-25 02:35:02 +00:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""检查对账单数据"""
import sqlite3
conn = sqlite3.connect('server/data.db')
c = conn.cursor()
# 统计总数
c.execute('SELECT COUNT(*) FROM reconciliations')
total = c.fetchone()[0]
print(f'对账单总数: {total}')
# 查看最新10条记录
c.execute('''
SELECT id, order_date, contract_no, material_name, spec_model,
quantity, unit, unit_price, total_amount, delivery_date
FROM reconciliations
ORDER BY id DESC
LIMIT 10
''')
print('\n最新10条记录:')
print('-' * 120)
for row in c.fetchall():
print(f"ID: {row[0]}, 下单: {row[1]}, 合同: {row[2]}, 物料: {row[3]}, 规格: {row[4]}")
print(f" 数量: {row[5]} {row[6]}, 单价: {row[7]}, 金额: {row[8]}, 交货: {row[9]}")
print('-' * 120)
conn.close()