mirror of
https://devops.liangqichi.top/qichi.liang/Orbitin.git
synced 2026-02-10 15:41:31 +08:00
数据库统计增加当月每艘船的作业量
This commit is contained in:
20
src/gui.py
20
src/gui.py
@@ -86,7 +86,7 @@ class OrbitInGUI:
|
||||
|
||||
btn_report_today = ttk.Button(
|
||||
left_frame,
|
||||
text="昨日日报",
|
||||
text="今日日报",
|
||||
command=self.generate_today_report,
|
||||
width=20
|
||||
)
|
||||
@@ -422,17 +422,27 @@ class OrbitInGUI:
|
||||
try:
|
||||
db = DailyLogsDatabase()
|
||||
stats = db.get_stats()
|
||||
|
||||
# 获取当月船次统计
|
||||
current_month = datetime.now().strftime('%Y-%m')
|
||||
ships_monthly = db.get_ships_with_monthly_teu(current_month)
|
||||
|
||||
db.close()
|
||||
|
||||
self.log_message(f"总记录数: {stats['total']}")
|
||||
self.log_message(f"船次数量: {len(stats['ships'])}")
|
||||
self.log_message(f"日期范围: {stats['date_range']['start']} ~ {stats['date_range']['end']}")
|
||||
|
||||
if stats['ships']:
|
||||
if ships_monthly:
|
||||
self.log_message("")
|
||||
self.log_message("船次列表:")
|
||||
for ship in sorted(stats['ships']):
|
||||
self.log_message(f" - {ship}")
|
||||
self.log_message(f"{current_month}月船次统计:")
|
||||
total_monthly_teu = 0
|
||||
for ship in ships_monthly:
|
||||
monthly_teu = ship['monthly_teu'] or 0
|
||||
total_monthly_teu += monthly_teu
|
||||
self.log_message(f" {ship['ship_name']}: {monthly_teu}TEU")
|
||||
self.log_message(f" ---")
|
||||
self.log_message(f" 本月合计: {total_monthly_teu}TEU")
|
||||
|
||||
self.set_status("完成")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user