Skip to content
Build bf98f58

EDI Pipeline

The full lifecycle of a B2B retail order — from the retailer's purchase order (850) through fulfillment, shipping, and invoicing (810).

Flow Summary

  1. 850 — Retailer sends purchase order via SPS Commerce
  2. NAV — 850 uploaded to NAV via PS SFTP
  3. EDI Docs — 850 archived in database
  4. In NAV — NAV processes the 850, generates fulfillment logic
  5. 940 — NAV drops warehouse shipping order on PS SFTP
  6. Packing — Camel fetches packing instructions from NAV, matches with 940
  7. PP Sent / PP Done — If prepack required, Cirro prepacks first
  8. B2B — Order created at Cirro (with or without prepack labels)
  9. Shipped — Cirro confirms shipment via webhook
  10. 856 — Advance Ship Notice uploaded to SPS for retailer
  11. 945 — Warehouse Shipping Advice uploaded to PS SFTP for NAV
  12. 945 OK — NAV acknowledges receipt
  13. 810 — Invoice generated

Sequence Diagram

sequenceDiagram
    participant Retailer
    participant SPS as SPS Commerce
    participant EDI as cm-edi-prc
    participant NAV
    participant DB as edi_docs (PG)
    participant SVC as cm-int-service-sys
    participant Cirro as Cirro 3PL
    participant Order as cm-order-prc
    participant Ext as cm-ext-service-exp

    Note over Retailer,SPS: 1. 850 — Purchase Order
    Retailer->>SPS: Send 850 purchase order
    SPS->>EDI: SFTP poll picks up 850

    Note over EDI,NAV: 2–3. Archive & forward to NAV
    EDI->>DB: Insert 850 record
    EDI->>NAV: Upload 850 to PS SFTP

    Note over NAV: 4. NAV processes 850
    NAV->>NAV: Validate, generate fulfillment logic

    Note over NAV,EDI: 5. 940 — Warehouse Shipping Order
    NAV->>EDI: Drop 940 XML on PS SFTP (polled)
    EDI->>DB: Insert 940 record

    Note over EDI,SVC: 6. Packing Instructions
    EDI->>SVC: Fetch packing instructions from NAV (SOAP)
    SVC-->>EDI: Packing instructions matched with 940

    alt RequiresPrepack = Yes
        Note over EDI,Cirro: 7a. PP Sent — Prepack at Cirro
        EDI->>Cirro: Create prepack order
        Cirro-->>EDI: Prepack complete (PP Done)

        Note over EDI,Cirro: 8a. B2B order with prepack labels
        EDI->>Cirro: Create B2B order with labels
    else RequiresPrepack = No
        Note over EDI,Cirro: 8b. Direct B2B order (skip prepack)
        EDI->>Cirro: Create B2B order directly
    end

    Note over Cirro,Ext: 9. Shipped — Fulfillment complete
    Cirro->>Ext: Shipment confirmation webhook
    Ext->>Order: Publish shipped event

    Note over Order,SPS: 10. 856 — Advance Ship Notice
    Order->>EDI: Trigger 856 generation
    EDI->>DB: Fetch 940 + 850 records
    EDI->>SPS: Upload 856 ASN to retailer SFTP
    EDI->>DB: Insert 856 record

    Note over EDI,NAV: 11–12. 945 — Ship Advice to NAV
    EDI->>NAV: Upload 945 to PS SFTP
    EDI->>DB: Insert 945 record
    NAV-->>EDI: 945 acknowledged

    Note over NAV,Retailer: 13. 810 — Invoice
    NAV->>Retailer: Invoice generated

Stage Reference

Stage EDI Doc Direction From To What Happens
1 850 Inbound Retailer SPS → Camel Purchase order received
2–3 Internal Camel NAV + DB 850 archived, forwarded to NAV via PS SFTP
4 Internal NAV NAV NAV validates and generates fulfillment logic
5 940 Inbound NAV Camel Warehouse shipping order via PS SFTP
6 Internal Camel NAV (SOAP) Packing instructions fetched and matched
7 Conditional Camel Cirro Prepack order (only if RequiresPrepack=Yes)
8 Outbound Camel Cirro B2B order created (with or without prepack labels)
9 Inbound Cirro Camel Shipment confirmation webhook
10 856 Outbound Camel SPS → Retailer Advance Ship Notice
11–12 945 Outbound Camel NAV via PS SFTP Warehouse shipping advice + acknowledgment
13 810 Outbound NAV Retailer Invoice

Systems Involved

Service Role in EDI Pipeline
SPS Commerce SFTP gateway — receives 850s from retailers, delivers 856s back
cm-edi-prc Core EDI processor — polls SFTP, generates documents, routes messages
cm-int-service-sys DB operations and packing instruction management
cm-order-prc Order routing — determines prepack path, triggers 856/945 generation
cm-ext-service-exp Webhook receiver for Cirro shipment confirmations
NAV (Dynamics) ERP — processes 850s, generates 940s, receives 945s, issues 810 invoices
Cirro 3PL Fulfillment — prepack, B2B orders, shipment
PostgreSQL (edi_docs) Persistent storage for all EDI documents and status tracking
PS SFTP Internal file exchange between Camel and NAV