Some checks failed
CD Pipeline / deploy (push) Failing after 59s
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml) - 部署模式: rsync Python 檔案至 188 → docker restart (volume mount) - Dockerfile/requirements 變動時自動重建 Docker image - 部署通知: Telegram (開始/成功/失敗) - 健康檢查: https://mo.wooo.work/health (最多 5 次重試) - 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
檢查 import_date 欄位的數據類型和值
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from database.vendor_manager import VendorDatabaseManager
|
|
from database.vendor_models import VendorStockout
|
|
|
|
def check_import_date():
|
|
"""檢查 import_date 欄位"""
|
|
|
|
db = VendorDatabaseManager()
|
|
session = db.get_session()
|
|
|
|
try:
|
|
# 查詢最近 5 筆記錄
|
|
records = session.query(VendorStockout).order_by(
|
|
VendorStockout.id.desc()
|
|
).limit(5).all()
|
|
|
|
print("=" * 80)
|
|
print("檢查 import_date 欄位")
|
|
print("=" * 80)
|
|
|
|
for record in records:
|
|
print(f"\nID: {record.id}")
|
|
print(f" import_date 原始值: {record.import_date}")
|
|
print(f" import_date 類型: {type(record.import_date)}")
|
|
|
|
if record.import_date:
|
|
print(f" strftime 轉換: {record.import_date.strftime('%Y-%m-%d')}")
|
|
else:
|
|
print(f" ⚠️ import_date 是 None")
|
|
|
|
print(f" product_code: {record.product_code}")
|
|
print(f" product_name: {record.product_name}")
|
|
|
|
print("\n" + "=" * 80)
|
|
|
|
except Exception as e:
|
|
print(f"❌ 錯誤: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
session.close()
|
|
|
|
if __name__ == '__main__':
|
|
check_import_date()
|