From cc989a8ddb48f1bdd600cf60f0c70d050391a71d Mon Sep 17 00:00:00 2001 From: "qichi.liang" Date: Tue, 3 Mar 2026 02:18:33 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=20Metabase=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BD=BF=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/README.md b/README.md index 4f1d7af..e658dff 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,74 @@ python shift_report.py --date 2026-03-01 --shift day python shift_report.py --date 2026-03-01 --shift night ``` +## 模块使用 + +### Metabase 数据查询 + +#### 按时间范围查询作业数据 (time_operations.py) + +```bash +# CLI 方式 +python metabase/time_operations.py --start 2026-02-01 --end 2026-03-01 +python metabase/time_operations.py -s 2026-02-01 -e 2026-03-01 + +# Python API +from metabase import TimeOperationsClient + +client = TimeOperationsClient() +data = client.get_operations_by_time("2026-03-01 08:00:00", "2026-03-01 20:00:00") +# 返回: {'cnt20': 100, 'cnt40': 50, 'teu': 200, ...} +``` + +**输出字段:** +| 字段 | 说明 | +|------|------| +| cnt20 | 20尺箱量 | +| cnt40 | 40尺箱量 | +| teu | TEU 数 | +| cntAll | 总箱数 | + +#### 按船舶查询作业数据 (vessel_operations.py) + +```bash +# CLI 方式 +python metabase/vessel_operations.py 260301-华晟67 + +# Python API +from metabase import VesselOperationsClient + +client = VesselOperationsClient() +data = client.get_vessel_operations("260301-华晟67") +# 返回: {'cnt20': 44, 'cnt40': 22, 'teu': 88, 'cycle_h_normal': 2.35, ...} +``` + +**输出字段:** +| 字段 | 说明 | +|------|------| +| cnt20 | 20尺箱量 | +| cnt40 | 40尺箱量 | +| teu | TEU 数 | +| cycle_h_normal | 无人集卡效率 (循环/车/小时) | +| cycle_h_filtered | 无人集卡效率 (剔除异常) | +| start_time | 作业开始时间 | +| end_time | 作业结束时间 | + +### 飞书排班查询 + +```python +from feishu import FeishuScheduleManager + +manager = FeishuScheduleManager() + +# 获取指定日期排班 +schedule = manager.get_schedule_for_date("2026-03-01") +# 返回: {'day_shift': '张三', 'night_shift': '李四', ...} + +# 获取今天/明天排班 +today = manager.get_schedule_for_today() +tomorrow = manager.get_schedule_for_tomorrow() +``` + ## 班次时间 | 类型 | 时间范围 |