Skip to content

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ặc client_id|product_id (SKU-level)
  • had_discount hỗ trợ tính discount_ratio feature trong ML

warehouses

Cấu hình kho — UPH, headcount, table setup.

CộtTypeMô tả
codetextMã kho (SGN01, SGN02, SGN03, HAN01)
standard_tablesintSố bàn chính
max_field_tablesintSố bàn phụ tối đa
shifts_configjsonbCấu hình ca làm
staff_configjsonbCấu hình nhân sự

customers

CộtTypeMô tả
customer_codetextMã khách hàng
primary_warehouse_iduuidFK → warehouses
tiertextEnterprise / Diamond / Gold / Silver / Bronze / Starter
ohl_limitintOrder Handling Limit

operational_settings

Cấu hình vận hành toàn cục:

CộtTypeMô tả
target_pick_uphintUPH mục tiêu picking
target_pack_uphintUPH mục tiêu packing
shift_hoursnumericGiờ làm việc/ca
max_overtime_hoursnumericGiờ OT tối đa/ngày
shrinkage_buffernumericHệ 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ộtTypeMô tả
warehouse_iduuidFK → warehouses
work_typetextPICK / PACK
staff_leveltextL1 / L2 / L3
uphintUnits Per Hour

Tài liệu liên quan

BoxMe Forecast — Tài liệu kỹ thuật nội bộ