修正
This commit is contained in:
73
compare_cancel_entries.py
Normal file
73
compare_cancel_entries.py
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, 'backend')
|
||||
|
||||
os.environ['DB_HOST'] = '192.168.0.61'
|
||||
os.environ['DB_NAME'] = 'njts_acct'
|
||||
os.environ['DB_USER'] = 'njts_app'
|
||||
os.environ['DB_PASSWORD'] = 'njts_app2025'
|
||||
os.environ['DB_PORT'] = '55432'
|
||||
|
||||
from app.core.database import get_connection
|
||||
|
||||
with get_connection() as conn:
|
||||
with conn.cursor() as cur:
|
||||
print('\n【 对比两个「取消」交易 】\n')
|
||||
|
||||
# Entry#360: 原始的取消交易
|
||||
print('Entry#360(原始的取消交易):')
|
||||
cur.execute("""
|
||||
SELECT
|
||||
journal_entry_id,
|
||||
entry_date,
|
||||
description,
|
||||
parent_entry_id,
|
||||
is_deleted
|
||||
FROM journal_entries
|
||||
WHERE journal_entry_id = 360
|
||||
""")
|
||||
row = cur.fetchone()
|
||||
print(f" 日期: {row['entry_date']}")
|
||||
print(f" 描述: {row['description']}")
|
||||
print(f" Parent: {row['parent_entry_id']}")
|
||||
print(f" 已删除: {row['is_deleted']}")
|
||||
|
||||
# Entry#371: 新添加的取消交易
|
||||
print('\nEntry#371(新添加的取消交易):')
|
||||
cur.execute("""
|
||||
SELECT
|
||||
journal_entry_id,
|
||||
entry_date,
|
||||
description,
|
||||
parent_entry_id,
|
||||
is_deleted
|
||||
FROM journal_entries
|
||||
WHERE journal_entry_id = 371
|
||||
""")
|
||||
row = cur.fetchone()
|
||||
print(f" 日期: {row['entry_date']}")
|
||||
print(f" 描述: {row['description']}")
|
||||
print(f" Parent: {row['parent_entry_id']}")
|
||||
print(f" 已删除: {row['is_deleted']}")
|
||||
|
||||
print('\n【 分析 】\n')
|
||||
print('两个交易的描述都是【未計上のため取消】遠達株式会社...')
|
||||
print('金额都是1,400,000')
|
||||
print('日期都是2025年6月1日')
|
||||
print('')
|
||||
print('⚠️ 这看起来像是重复的!')
|
||||
print('')
|
||||
print('关键区别:')
|
||||
print(' Entry#360: parent_entry_id=357(正确的链接)')
|
||||
print(' Entry#371: parent_entry_id=None(未链接!)')
|
||||
print('')
|
||||
print('可能的解释:')
|
||||
print(' 1. Entry#371是误操作创建的重复交易,应该被删除(is_deleted=true)')
|
||||
print(' 2. 或者Entry#371应该被更正为parent_entry_id=None(保持为独立的取消)')
|
||||
print(' 但这样会导致有两个「取消」交易')
|
||||
print('')
|
||||
print('建议:')
|
||||
print(' 将Entry#371标记为已删除(is_deleted=true)或实际删除它')
|
||||
Reference in New Issue
Block a user