Sourcing and Procurement Flows - magicplatforms/ai-workflows GitHub Wiki

sequenceDiagram
    %% actors
    participant DH  as "Department Heads"
    participant PM  as "Procurement Manager"
    participant SM  as "Sourcing Manager / Buyer"
    participant SUP as Supplier
    participant WH  as "Warehouse / Receiving"
    participant AP  as "Accounts Payable"
    participant FIN as "Finance / ERP"
    participant EX  as "Executive Leadership"

    %% procure-to-pay flow
    DH  ->> PM  : Submit forecasts & requisitions
    PM  ->> PM  : Aggregate demand & update strategy
    PM  ->> SM  : Delegate sourcing project
    SM  ->> SUP : Issue RFQ / RFP
    SUP -->> SM : Return quotes & proposals
    SM -->> PM  : Bid analysis & recommendation
    PM  ->> SUP : Negotiate contract & issue PO
    SUP -->> WH : Deliver goods / services
    WH  -->> FIN: Record receipt (start 3-way match)
    SUP ->> AP  : Send invoice
    WH  -->> AP : Confirm receipt data
    AP  ->> FIN : Validate & schedule payment
    FIN ->> SUP : Remit payment
    PM  ->> EX  : Report KPIs, savings, risks
    PM  ->> SUP : Quarterly business review

sequenceDiagram
    participant ENG as "Engineering / Production"
    participant SSM as "Strategic Sourcing Mgr."
    participant QUAL as "Quality"
    participant FIN as "Finance / Legal"
    participant SUP as "Supplier"
    participant BUY as "Buyer / Purchasing"
    participant SRM as "Supplier Rel. Mgr."

    ENG  ->> SSM : Provide specs & forecasts
    SSM  ->> SSM : Define requirements & strategy
    SSM  ->> SSM : Market research & supplier list
    SSM  ->> SUP : Send RFI
    SUP -->> SSM : RFI responses
    SSM  ->> QUAL: Request supplier audit
    QUAL -->> SSM : Audit results
    SSM  ->> SUP : Issue RFQ / RFP
    SUP -->> SSM : Submit quotations
    SSM  ->> FIN : Cost analysis & approval
    FIN -->> SSM : Budget / legal OK
    SSM  ->> SUP : Negotiate & award
    SSM  ->> BUY : Handoff contract & pricing
    BUY  ->> SUP : Place purchase orders
    SUP -->> BUY : Deliver goods
    BUY -->> SSM : Delivery & performance data
    SSM  ->> SRM : Transition for ongoing mgmt.
    SRM  ->> SUP : Quarterly review

sequenceDiagram
    %% ---------- Participants ----------
    participant MRP as MRP / Planner
    participant Buyer as Procurement Buyer
    participant Approver
    participant Supplier
    participant Receiving
    participant QA as Quality
    participant AP as Accounts Payable

    %% ---------- Demand Trigger ----------
    MRP->>Buyer: Purchase requisition / planned order

    %% ---------- Order Planning ----------
    Buyer->>Buyer: Consolidate & schedule orders

    %% ---------- PO Creation & Approval ----------
    alt PO requires approval
        Buyer->>Approver: Submit PO for approval
        Approver-->>Buyer: Approved
    else Auto-approval within threshold
        Buyer->>Buyer: System auto-approves PO
    end

    %% ---------- Transmit PO ----------
    Buyer->>Supplier: Issue purchase order (EDI / e-mail)
    Supplier-->>Buyer: Order acknowledgement

    %% ---------- Order Monitoring ----------
    loop Daily follow-up
        Buyer->>Supplier: Expedite / reschedule request
        Supplier-->>Buyer: Status update
    end

    %% ---------- Delivery ----------
    Supplier-->>Receiving: Ship goods + ASN
    Receiving-->>Buyer: Receipt confirmation / discrepancies

    %% ---------- Quality Check (if required) ----------
    opt Inspection required
        Receiving->>QA: Forward goods for inspection
        QA-->>Buyer: Report defects / acceptance
        alt Defects found
            Buyer->>Supplier: Arrange return / replacement
            Supplier-->>Buyer: Corrective action
        end
    end

    %% ---------- Invoice & Payment ----------
    Supplier-->>AP: Invoice
    AP->>AP: 3-way match (PO + Receipt + Invoice)
    alt Mismatch detected
        AP-->>Buyer: Price / qty discrepancy
        Buyer->>Supplier: Resolve & request credit memo
        Supplier-->>AP: Corrected invoice
    end
    AP-->>Supplier: Payment issued

    %% ---------- Close-out ----------
    Buyer->>MRP: Update status & close PO
    Buyer->>Buyer: Record supplier-performance data

Step-by-step explanation (for reference):

  1. MRP / Planner โ†’ Buyer: Material-requirements planning or an internal requisition signals the need to purchase a part.
  2. Buyer โ€“ Order Planning: The buyer consolidates, schedules, and checks contract terms/minimum quantities.
  3. Create & Approve PO:
    • If the order value is above the threshold, itโ€™s routed to an approver; otherwise itโ€™s auto-approved.
  4. Transmit PO to Supplier: Electronic data interchange (EDI) or e-mail sends the official order; supplier acknowledges.
  5. Order Monitoring (loop): Daily expediting or rescheduling keeps delivery on track.
  6. Delivery โ†’ Receiving: Supplier ships goods with an advance-shipping notice; receiving confirms or flags discrepancies.
  7. Quality Inspection (optional): QA inspects; defects trigger a return or replacement loop with the supplier.
  8. Invoice & 3-Way Match: Supplier invoices; accounts-payable matches against PO and receipt. Discrepancies loop back to buyer and supplier until resolved, then payment is released.
  9. Close-out & Recordkeeping: Buyer updates ERP/MRP, closes the PO, and logs supplier-performance data for future evaluations.