docs: 添加 Metabase 模块使用文档

This commit is contained in:
2026-03-03 02:18:33 +08:00
parent 95aaf9bed0
commit cc989a8ddb

View File

@@ -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()
```
## 班次时间
| 类型 | 时间范围 |