From c60cbf2d9adc1f7f09529184ae9f4a438e5f1de8 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 7 Feb 2026 20:04:42 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DIAGNOSIS.md | 79 ++ backend/app/modules/trial_balance/router.py | 3 - backend/app/modules/trial_balance/service.py | 7 +- backend/app/static/cash.html | 4 +- backend/app/static/payroll-calculation.html | 795 ++++++++++-------- backend/app/static/payroll-employees.html | 553 ++++++------ .../app/static/payroll-salary-settings.html | 519 +++++++----- backend/app/static/payroll-settings.html | 570 +++++++------ backend/app/static/payroll.html | 210 +++-- docker/nginx/default.conf | 23 +- frontend/journal-edit.html | 2 +- frontend/journal-entry.html | 22 +- frontend/journal-list.html | 2 +- frontend/journal-view.html | 19 +- frontend/journal.html | 17 +- frontend/js/api.js | 2 +- frontend/js/journal.js | 2 +- frontend/js/opening_balance.js | 18 +- frontend/js/trial-balance.js | 58 +- frontend/ledger.html | 17 +- frontend/opening_balance.html | 17 +- frontend/pages/cash.html | 8 +- frontend/payroll-calculation.html | 17 +- frontend/payroll-employees.html | 17 +- frontend/payroll-salary-settings.html | 17 +- frontend/payroll-settings.html | 17 +- frontend/payroll.html | 16 +- frontend/trial-balance.html | 64 +- frontend/voucher-export-test.html | 2 +- 29 files changed, 1851 insertions(+), 1246 deletions(-) create mode 100644 DIAGNOSIS.md diff --git a/DIAGNOSIS.md b/DIAGNOSIS.md new file mode 100644 index 0000000..2cfe990 --- /dev/null +++ b/DIAGNOSIS.md @@ -0,0 +1,79 @@ +# NAS上数据库连接问题诊断 + +## 当前配置 + +- **数据库地址**: 192.168.0.61:55432 +- **数据库名**: njts_acct +- **用户**: njts_app + +## 可能的原因 + +### 1. 网络连接问题 + +- [ ] 确认NAS是否在同一网络中 +- [ ] 检查NAS是否能ping通数据库服务器 (192.168.0.61) +- [ ] 检查防火墙是否允许5432/55432端口访问 + +### 2. .env 文件缺失或配置不同 + +- [ ] 确认NAS上有 `.env` 文件 +- [ ] 检查NAS上的 `.env` 文件配置是否正确 +- [ ] 确认数据库服务器的IP地址在NAS所在网络中仍然有效 + +### 3. 容器网络问题 + +- [ ] 如果使用Docker,确保容器网络配置正确 +- [ ] 检查容器是否能解析数据库主机名/IP + +## 排查命令 + +### 在NAS上执行以下命令: + +```bash +# 1. 测试网络连接 +ping 192.168.0.61 + +# 2. 测试端口连接 (需要 psql 或 telnet) +psql -h 192.168.0.61 -p 55432 -U njts_app -d njts_acct + +# 或使用 telnet(如果可用) +telnet 192.168.0.61 55432 + +# 3. 查看应用日志 +docker logs njts_backend + +# 4. 检查容器网络 +docker network ls +docker network inspect njts_net +``` + +## 推荐解决方案 + +### 选项A: 使用主机名而不是IP(推荐) + +编辑 `.env` 文件,将IP地址改为主机名: + +``` +DB_HOST=db-server # 或具体的主机名 +DB_PORT=55432 +``` + +需要确保DNS能解析该主机名。 + +### 选项B: 确认NAS网络配置 + +- 检查NAS的IP地址范围是否允许与数据库所在网络通信 +- 可能需要调整网络路由或防火墙规则 + +### 选项C: 数据库服务器地址变化 + +- 如果数据库服务器的IP地址在NAS访问时不同,需要更新 `.env` +- 例如:可能需要用内网IP或DNS名称 + +## 立即检查 + +请告诉我: + +1. NAS上是否能访问 192.168.0.61:55432? +2. 应用在NAS上产生的错误日志是什么? +3. 数据库服务器和NAS是否在同一网络中? diff --git a/backend/app/modules/trial_balance/router.py b/backend/app/modules/trial_balance/router.py index 9eecdb9..9f8798a 100644 --- a/backend/app/modules/trial_balance/router.py +++ b/backend/app/modules/trial_balance/router.py @@ -11,8 +11,6 @@ def get_trial_balance( date_from: Optional[str] = Query(None, description="YYYY-MM-DD"), date_to: Optional[str] = Query(None, description="YYYY-MM-DD"), ): - print("trial-balance NEW VERSION (optional params)") - # 👉 没传参数时,给默认值(开发期非常推荐) if fiscal_year is None: fiscal_year = 2025 @@ -25,5 +23,4 @@ def get_trial_balance( raise HTTPException(status_code=400, detail="期間指定が不正です。") result = fetch_trial_balance(date_from, date_to) - return result diff --git a/backend/app/modules/trial_balance/service.py b/backend/app/modules/trial_balance/service.py index 6562346..6d8bd50 100644 --- a/backend/app/modules/trial_balance/service.py +++ b/backend/app/modules/trial_balance/service.py @@ -41,6 +41,7 @@ def fetch_trial_balance(date_from: str, date_to: str): """) accounts = cur.fetchall() + # 科目データを格納 account_data: Dict[str, Dict[str, Any]] = {} @@ -99,7 +100,7 @@ def fetch_trial_balance(date_from: str, date_to: str): row = cur.fetchone() debit = D(row["debit"]) credit = D(row["credit"]) - + closing = opening + debit - credit # 負債・資本は絶対値で表示(見やすくするため) @@ -295,7 +296,7 @@ def fetch_trial_balance(date_from: str, date_to: str): total_credit = sum(data["credit"] for data in account_data.values()) total_closing = sum(data["closing_balance"] for data in account_data.values()) - return { + result = { "totals": { "opening_balance": str(total_opening), "debit": str(total_debit), @@ -306,3 +307,5 @@ def fetch_trial_balance(date_from: str, date_to: str): "accounts": result_accounts, "grand_total_closing": str(grand_total_closing) } + + return result diff --git a/backend/app/static/cash.html b/backend/app/static/cash.html index a3e055e..149b5bb 100644 --- a/backend/app/static/cash.html +++ b/backend/app/static/cash.html @@ -1,4 +1,4 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/backend/app/static/payroll-employees.html b/backend/app/static/payroll-employees.html index ae63b17..02c8cdf 100644 --- a/backend/app/static/payroll-employees.html +++ b/backend/app/static/payroll-employees.html @@ -1,302 +1,341 @@ - + - - - + + + 給与管理 - 従業員管理 - + - - + +
-

給与管理 - 従業員管理

+

給与管理 - 従業員管理

- + - -
-
- -
-
+ +
+
+
+
+
- -
-

従業員の新規登録

-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
-
+ +
+

従業員の新規登録

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+
- -
-
-
+ +
+
+
- + diff --git a/backend/app/static/payroll-salary-settings.html b/backend/app/static/payroll-salary-settings.html index 0f9d7de..a182ccf 100644 --- a/backend/app/static/payroll-salary-settings.html +++ b/backend/app/static/payroll-salary-settings.html @@ -1,171 +1,218 @@ - + - - - + + + 給与管理 - 給与設定 - + - - + +
-

給与管理 - 給与設定

+

給与管理 - 給与設定

-
- - +
+ + +
+ + - + diff --git a/backend/app/static/payroll-settings.html b/backend/app/static/payroll-settings.html index 3c4cc4f..7f29300 100644 --- a/backend/app/static/payroll-settings.html +++ b/backend/app/static/payroll-settings.html @@ -1,186 +1,236 @@ - + - - - + + + 給与管理 - 設定 - + - - + +
-

給与管理 - 設定

+

給与管理 - 設定

- + - -
-

社会保険料率設定

- -
+ +
+

社会保険料率設定

+ +
- - + diff --git a/backend/app/static/payroll.html b/backend/app/static/payroll.html index f09ae88..2b8f490 100644 --- a/backend/app/static/payroll.html +++ b/backend/app/static/payroll.html @@ -1,99 +1,135 @@ - + - - - + + + 給与管理システム - + - - + +
- ← メインメニューに戻る - -

給与管理システム

-

従業員の給与計算、扶養管理、保険料・税金の管理を行います

+ -