01 — Quick Reference

Group Models
Reference Data Supplier · ContractRef
Procurement PurchaseRequirement · SourcingCase · Quote · PurchaseOrder
Delivery & Expediting DeliveryMilestone · ExpeditingRecord · ReceiptReference
Supply Risk SupplyRisk
Integration ExternalRecordLink · EventOutbox

Every model (12) — one line each

Model It records Key foreign keys
Supplier A supply source (shared master) —
ContractRef A framework / standing agreement Supplier
PurchaseRequirement A demand to buy (shared canonical entity) — (source via source_canonical_ref)
SourcingCase How a requirement is being sourced PurchaseRequirement, Supplier (selected), ContractRef
Quote A supplier's priced response SourcingCase, Supplier
PurchaseOrder The committed order (local / external-ERP) PurchaseRequirement, Supplier
DeliveryMilestone A delivery checkpoint on an order PurchaseOrder
ExpeditingRecord A logged supplier chase PurchaseOrder
ReceiptReference A goods-receipt pointer PurchaseOrder
SupplyRisk A risk to a requirement/order PurchaseRequirement, PurchaseOrder
ExternalRecordLink Local ↔ external system record map — (by canonical_ref strings)
EventOutbox Outbound cross-app event log —

Status vocabularies

  • Supplier status: PROSPECTIVE · APPROVED · RESTRICTED · SUSPENDED · INACTIVE
  • Contract status: DRAFT · ACTIVE · EXPIRED · SUSPENDED · CLOSED
  • Requirement status: NEW → APPROVED → SOURCING → ORDER_REQUESTED → ORDERED → EXPEDITING → DELIVERED · plus CANCELLED
  • Requirement source_type: MATERIAL_SHORTAGE · WORK_PACKAGE · SHUTDOWN · PROJECT · REPLENISHMENT · MANUAL
  • Requirement strategy: STOCK_REPLENISHMENT · WORK_SPECIFIC · JIT · FRAMEWORK_CALL_OFF · CONSIGNMENT · VMI · EMERGENCY · REPAIR_EXCHANGE · LONG_LEAD
  • Priority: ROUTINE · HIGH · CRITICAL · EMERGENCY
  • Sourcing method: DIRECT · RFQ · TENDER · FRAMEWORK · CALL_OFF · EMERGENCY
  • Sourcing status: OPEN · QUOTING · EVALUATION · SELECTED · CANCELLED · CLOSED
  • Quote evaluation: RECEIVED · COMPLIANT · NON_COMPLIANT · SHORTLISTED · SELECTED · REJECTED
  • PO authority_mode: LOCAL · EXTERNAL_ERP
  • PO status: DRAFT · SUBMITTED · APPROVED · ORDERED · PARTIALLY_RECEIVED · RECEIVED · CANCELLED · CLOSED
  • Milestone status: PLANNED · AT_RISK · DELAYED · COMPLETE · WAIVED
  • Risk type: LATE_DELIVERY · SUPPLIER_CAPACITY · QUALITY · LOGISTICS · COMMERCIAL · SINGLE_SOURCE · OTHER
  • Risk severity: LOW · MEDIUM · HIGH · CRITICAL
  • Risk status: OPEN · MITIGATING · ACCEPTED · RESOLVED · CLOSED
  • Receipt status: EXPECTED · PARTIAL · COMPLETE · REJECTED

Cross-app canonical_ref conventions

PSAM is a procurement member of the Work & Supply network. Records link across apps by shared canonical_ref strings, not database foreign keys:

  • supplier:* — supplier masters PSAM owns, also read by scrm for mobilisation.
  • preq:* — PurchaseRequirement, exposed as a canonical entity (Upsert target).
  • material:* — materials owned by msam (e.g. material:brg-6208).
  • demand:* — a msam MaterialDemand a requirement was raised from (PurchaseRequirement.source_canonical_ref).
  • workpkg:* — an mwem work package a SupplyRisk impacts (SupplyRisk.impact_canonical_ref).
  • campaign:* — an scrm shutdown campaign a requirement supports.

A shortage in msam raises material.procurement_required; the orchestrator Upserts a PurchaseRequirement here (see networks/work_supply_00/system.manifest.yaml, route WS-MATERIALS-PROC).

Common commands

python server/run.py psam                     # http://localhost:5084
python -m codegen.cli seed psam               # load sample data (skips if present)
python -m codegen.cli seed psam --reset       # wipe and reload sample data
python -m codegen.cli all psam                # regenerate models/controllers/config
python scripts/build_diagram_viewer.py psam   # rebuild the interactive ERD viewer