Giao diện
Bảng nghiệp vụ
TÓM TẮT
5 bảng nghiệp vụ cốt lõi lưu trữ dữ liệu đơn hàng, cấu hình kho, khách hàng, và tiêu chuẩn năng suất.
transactions
Bảng lưu trữ dữ liệu đơn hàng gốc — là input chính cho ML pipeline.
sql
CREATE TABLE transactions (
id bigserial PRIMARY KEY,
client_id text NOT NULL,
user_id bigint,
ff_center_code text, -- Warehouse code
product_id bigint,
quantity numeric,
purchased_at timestamptz,
had_discount boolean,
transaction_id text,
created_at timestamptz DEFAULT now()
);Indexes: client_id, purchased_at, product_id
Notes:
series_keyđược tính runtime:client_id|user_id|warehouse|product_id(order-level) hoặcclient_id|product_id(SKU-level)had_discounthỗ trợ tínhdiscount_ratiofeature trong ML
warehouses
Cấu hình kho — UPH, headcount, table setup.
| Cột | Type | Mô tả |
|---|---|---|
code | text | Mã kho (SGN01, SGN02, SGN03, HAN01) |
standard_tables | int | Số bàn chính |
max_field_tables | int | Số bàn phụ tối đa |
shifts_config | jsonb | Cấu hình ca làm |
staff_config | jsonb | Cấu hình nhân sự |
customers
| Cột | Type | Mô tả |
|---|---|---|
customer_code | text | Mã khách hàng |
primary_warehouse_id | uuid | FK → warehouses |
tier | text | Enterprise / Diamond / Gold / Silver / Bronze / Starter |
ohl_limit | int | Order Handling Limit |
operational_settings
Cấu hình vận hành toàn cục:
| Cột | Type | Mô tả |
|---|---|---|
target_pick_uph | int | UPH mục tiêu picking |
target_pack_uph | int | UPH mục tiêu packing |
shift_hours | numeric | Giờ làm việc/ca |
max_overtime_hours | numeric | Giờ OT tối đa/ngày |
shrinkage_buffer | numeric | Hệ số dự phòng |
productivity_standards
Tiêu chuẩn UPH theo warehouse, loại công việc, level nhân viên:
| Cột | Type | Mô tả |
|---|---|---|
warehouse_id | uuid | FK → warehouses |
work_type | text | PICK / PACK |
staff_level | text | L1 / L2 / L3 |
uph | int | Units Per Hour |
Tài liệu liên quan
- Schema tổng quan — ER diagram
- Bảng ML Pipeline — Bảng ML-specific