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>
94 lines
3.3 KiB
Python
94 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
驗證新增欄位的資料
|
|
"""
|
|
|
|
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 verify_new_fields():
|
|
"""驗證新增欄位"""
|
|
|
|
db = VendorDatabaseManager()
|
|
session = db.get_session()
|
|
|
|
try:
|
|
# 查詢第一筆記錄
|
|
record = session.query(VendorStockout).first()
|
|
|
|
if not record:
|
|
print("❌ 沒有資料!")
|
|
return
|
|
|
|
print("=" * 80)
|
|
print("完整資料檢查")
|
|
print("=" * 80)
|
|
|
|
print(f"\n📅 日期欄位:")
|
|
print(f" 當前日期 (import_date): {record.import_date}")
|
|
print(f" 缺貨日期 (stockout_date): {record.stockout_date}")
|
|
|
|
print(f"\n👤 組織欄位:")
|
|
print(f" 處別 (department): {record.department}")
|
|
print(f" 科別 (section): {record.section}")
|
|
print(f" PM姓名 (pm_name): {record.pm_name}")
|
|
print(f" 區ID (zone_id): {record.zone_id}")
|
|
print(f" 區名稱 (zone_name): {record.zone_name}")
|
|
|
|
print(f"\n📦 商品欄位:")
|
|
print(f" 商品ID (product_code): {record.product_code}")
|
|
print(f" 商品名稱 (product_name): {record.product_name[:50]}...")
|
|
print(f" 單品/組合商品 (product_spec): {record.product_spec}")
|
|
print(f" 借採轉 (borrow_transfer): {record.borrow_transfer}")
|
|
|
|
print(f"\n🏢 廠商欄位:")
|
|
print(f" 來源供應商編號 (vendor_code): {record.vendor_code}")
|
|
print(f" 來源供應商名稱 (vendor_name): {record.vendor_name}")
|
|
|
|
print(f"\n📊 數量欄位:")
|
|
print(f" 商品可賣量 (current_stock): {record.current_stock}")
|
|
print(f" 缺貨天數 (stockout_days): {record.stockout_days}")
|
|
print(f" 缺貨商品前30天業績 (monthly_sales_amount): {record.monthly_sales_amount}")
|
|
print(f" 最近30天銷售量 (monthly_sales_qty): {record.monthly_sales_qty}")
|
|
print(f" 庫存水位 (safe_stock_days): {record.safe_stock_days}")
|
|
|
|
print(f"\n📝 其他:")
|
|
print(f" notes: {record.notes}")
|
|
|
|
# 檢查所有記錄
|
|
print("\n" + "=" * 80)
|
|
print("檢查所有記錄")
|
|
print("=" * 80)
|
|
|
|
all_records = session.query(VendorStockout).all()
|
|
for i, r in enumerate(all_records, 1):
|
|
print(f"\n記錄 {i}:")
|
|
print(f" 當前日期: {r.import_date}")
|
|
print(f" 區ID: {r.zone_id}")
|
|
print(f" 區名稱: {r.zone_name}")
|
|
print(f" 商品ID: {r.product_code}")
|
|
print(f" 借採轉: {r.borrow_transfer}")
|
|
print(f" 商品可賣量: {r.current_stock}")
|
|
print(f" 缺貨日期: {r.stockout_date}")
|
|
print(f" 缺貨天數: {r.stockout_days}")
|
|
print(f" 前30天業績: {r.monthly_sales_amount}")
|
|
print(f" 最近30天銷量: {r.monthly_sales_qty}")
|
|
print(f" 庫存水位: {r.safe_stock_days}")
|
|
|
|
print("\n" + "=" * 80)
|
|
|
|
except Exception as e:
|
|
print(f"\n❌ 錯誤: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
finally:
|
|
session.close()
|
|
|
|
if __name__ == '__main__':
|
|
verify_new_fields()
|