03 — Integration

Purchasing is a member of the Work & Supply network (message protocol v1). Its contract is schema/purchasing.integration.dsl (authoring spec docs/implementation/integration_authoring_spec.md), generated with python -m codegen.cli integration purchasing --network work_supply; the handlers are in integration/handlers.py. The whole network is in networks/work_supply/NETWORK_MAP.md.

What it owns

Network entity Model Business reference
purchasing.purchase_requirement PurchaseRequirement requirement_number (PR-{sequence:04})
purchasing.purchase_order PurchaseOrder purchase_order_number (PO-{sequence:06})
purchasing.purchase_order_line PurchaseOrderLine —
purchasing.delivery_commitment DeliveryCommitment —
purchasing.shipment Shipment shipment_number (SH-{sequence:04})

Messages (all implemented)

Kind Message What
publishes purchasing.requirement_created a new purchase requirement (Work records its number)
publishes purchasing.order_placed / order_acknowledged / order_cancelled the order is issued / acknowledged by the supplier / cancelled
publishes purchasing.delivery_commitment_changed a new commitment revision; carries the line's material requirement so Work can match it
publishes purchasing.delivery_delayed a revision that is at_risk or missed, with the reason
publishes purchasing.shipment_dispatched / shipment_delayed goods on their way / late
consumes finance.purchase_commitment_posted record the SAP PO number on the order (External ERP Reference)
consumes inventory.item_unavailable raise a purchase requirement (once per material requirement)
consumes inventory.goods_arrived the shipment is marked arrived
consumes inventory.receipt_accepted the order and its requirement are received (also on part acceptance); an arrived shipment becomes complete. For each line bought for a work order, one work.record_job_cost command goes to Work at the order price (contractor for a service contract, otherwise purchased), keyed by the line so a resend costs the job once
consumes inventory.receipt_rejected / receipt_quarantined open a Procurement Exception
accepts purchasing.create_requirement from Work, Inventory or the orchestrator; returns the open one if it exists
accepts purchasing.create_purchase_order order for a requirement (lines default to the requirement's item and quantity)
accepts purchasing.record_supplier_commitment add a commitment revision for an order line
accepts purchasing.dispatch_shipment record a dispatched shipment (lines default to every open line)
accepts purchasing.cancel_purchase_order refused once shipped or received
answers purchasing.requirement_status a requirement and its orders
answers purchasing.purchase_order_status an order, its lines and current commitments
answers purchasing.delivery_status an order's shipments, current commitments and open exceptions

Who refers to it

work_management holds purchase_requirement_cid + _ref on material requirements; inventory holds purchase_order_cid + _ref on goods receipts and transactions. Both link ↗ to the record here (/resolve/<cid>).

Supplier references (supplier_cid + supplier_ref) link ↗ to the Supplier application and are chosen with its supplier search (R10.4b); delivery_delayed carries the order's supplier so Supplier can count a missed delivery.

Not yet

Invoice and payment status on the order (SAP AP publishes them; nothing consumes them yet), warnings when ordering from a supplier that is not approved, and matching received quantities line by line. purchase_order_status answers line prices so SAP AP can match invoices (R10.4c). (Goods arrival itself is Inventory's — inventory.record_goods_arrival / inspect_receipt, R10.4a.)