1

Tables (7)

document

  • document_id — INT — Primary key — NOT NULL
  • document_no — VARCHAR(30) — NOT NULL
  • type — VARCHAR(20) — NOT NULL
  • partner_id — INT — Foreign key → partner.partner_id — NOT NULL
  • expected_at — DATETIME — NOT NULL
  • completed_at — DATETIME
  • status — VARCHAR(20) — NOT NULL

document_item

  • document_item_id — INT — Primary key — NOT NULL
  • document_id — INT — Foreign key → document.document_id — NOT NULL
  • product_id — INT — Foreign key → product.product_id — NOT NULL
  • lot_id — INT — Foreign key → lot.lot_id — NOT NULL
  • location_id — INT — Foreign key → location.location_id — NOT NULL
  • expected_qty — INT — NOT NULL
  • actual_qty — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

location

  • location_id — INT — Primary key — NOT NULL
  • location_code — VARCHAR(20) — NOT NULL
  • is_active — BOOLEAN — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

lot

  • lot_id — INT — Primary key — NOT NULL
  • product_id — INT — Foreign key → product.product_id — NOT NULL
  • lot_code — VARCHAR(50) — NOT NULL
  • expir_date — DATE — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

partner

  • partner_id — INT — Primary key — NOT NULL
  • partner_code — VARCHAR(50) — NOT NULL
  • partner_name — VARCHAR(50) — NOT NULL
  • partner_type — VARCHAR(50) — NOT NULL
  • contact — VARCHAR(50)
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

product

  • product_id — INT — Primary key — NOT NULL
  • product_code — VARCHAR(20) — NOT NULL
  • product_name — VARCHAR(50)
  • spec — VARCHAR(30)
  • unit — VARCHAR(20) — NOT NULL
  • min_ship_days — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

stock

  • stock_id — INT — Primary key — NOT NULL
  • lot_id — INT — Foreign key → lot.lot_id — NOT NULL
  • location_id — INT — Foreign key → location.location_id — NOT NULL
  • qty — INT — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL