Skip to content

order_fulfillment / shipment ​

Trang sinh tự động

Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.

3 bảng. Quay lại order_fulfillment.

shipments ​

P2-17. Shipment of LOCKED orders/cycles with one schedule source and one delivery snapshot; state CREATED -> PACKING -> SHIPPING -> DELIVERED|DELIVERY_FAILED|RETURNED, written only by fulfillment.* functions.

public.shipments · 46 cột · 18 check · 2 unique · 10 index · 1 policy · 6 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
carrier_codetextNOT NULL
carrier_reftextNOT NULL
schedule_kindtextNOT NULL
campaign_iduuidFK → campaigns
milestone_iduuidFK → delivery_milestones
recurring_cycle_iduuidFK → recurring_cycles
cycle_nointeger
delivers_fromtimestamptzNOT NULL
delivers_totimestamptzNOT NULL
delivers_from_vndate
delivers_to_vndate
expected_ondateNOT NULL
ship_recipient_nametextNOT NULL
ship_recipient_phonephone_e164NOT NULL
ship_provincetextNOT NULL
ship_districttextNOT NULL
ship_wardtextNOT NULL
ship_address_linetextNOT NULL
ship_address_typetextNOT NULL
handed_over_attimestamptzNOT NULL
handover_evidence_media_iduuidFK → media
statetextNOT NULLU19-P1-08 machine (ASSUME-04): CREATED -> PACKING -> [PACKED ->] SHIPPING -> WAITING_REDELIVERY -> SHIPPING ... -> DELIVERED [-> RETURNED] | DELIVERY_FAILED; written only by fulfillment.* functions.
state_changed_attimestamptzNOT NULL
last_event_attimestamptzNOT NULL
delivered_attimestamptz
created_byuuidNOT NULLFK → accounts
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL
packed_attimestamptzU13-P1-04d. Ngày đóng gói: when packing completed; NULL until then, distinct from handed_over_at.
weight_valuenumeric(12,3)
weight_unittext
length_valuenumeric(12,3)
width_valuenumeric(12,3)
height_valuenumeric(12,3)
dimension_unittext
delivery_requesttext
shipment_notetext
fee_vndbigint
fee_payertextU13-P1-04d. SHOP only in phase 1 (Khách trả disabled); the fee never enters the COD total.
cod_total_snapshot_vndbigintU13-P1-04d. COD total frozen at handover (immutable once written by the guard); NULL for older shipments.
shipment_codetext
driver_nametextG2I-P3-03 (O8). Driver name typed by Operations; null = not given.
driver_phonephone_e164G2I-P3-03 (O8). Driver phone (operations contact, E.164). Staff read it in full; the buyer read selects it masked only.
delivery_slot_texttextG2I-P3-03 (O8). Delivery time slot as typed (e.g. 8h-12h); null = not given.

Khoá chính: id

Trỏ ra (5):

  • campaign_id → campaigns · ON DELETE RESTRICT
  • created_by → accounts · ON DELETE RESTRICT
  • handover_evidence_media_id → media · ON DELETE RESTRICT
  • milestone_id → delivery_milestones · ON DELETE RESTRICT
  • recurring_cycle_id → recurring_cycles · ON DELETE RESTRICT

Được trỏ tới (8): cod_collections, cod_reconciliation_items, fulfillment_events, fulfillment_exceptions, order_cycle_failed_deliveries, order_return_cases, shipment_link_resolutions, shipment_order_links

P2-17. Immutable order/cycle -> shipment mapping with the goods snapshot; one shipment per order/cycle.

public.shipment_order_links · 9 cột · 3 check · 2 unique · 4 index · 1 policy · 5 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
shipment_iduuidNOT NULLFK → shipments
order_iduuidNOT NULLFK → orders
order_cycle_iduuidFK → order_cycles
cycle_nointeger
linesjsonbNOT NULL
created_attimestamptzNOT NULL
locked_payment_modetext
locked_cod_due_vndbigintU13-P2-09d. OPEN COD obligations of the unit at handover (0 for an Online-paid unit); NULL for links made before.

Khoá chính: id

Trỏ ra (3):

  • order_cycle_id → order_cycles · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • shipment_id → shipments · ON DELETE RESTRICT

Được trỏ tới (2): fulfillment_exceptions, shipment_link_resolutions

FU-AC-TRIAGE L6. Append-only: an operator removed the line of a cancelled order from a shipment before handover.

public.shipment_link_resolutions · 7 cột · 2 check · 1 unique · 2 index · 1 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
link_iduuidNOT NULLFK → shipment_order_links
shipment_iduuidNOT NULLFK → shipments
resolved_byuuidNOT NULLFK → accounts
reasontextNOT NULL
source_event_idtextNOT NULL
resolved_attimestamptzNOT NULL

Khoá chính: id

Trỏ ra (3):

  • link_id → shipment_order_links · ON DELETE RESTRICT
  • resolved_by → accounts · ON DELETE RESTRICT
  • shipment_id → shipments · ON DELETE RESTRICT

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17