Build one netted inventory position across plants, warehouses, 3PLs, and in-transit stock — lot and expiry aware, quality-status aware, and fresh enough to promise against — so planning and order management stop guessing what is actually available to sell.
Tags: life-sciences, pharma, medtech, inventory-management, supply-chain, wms, sap, event-driven
Supply Chain and Inventory Management: MES, WMS, and Logistics
Objective: Produce a single, trustworthy inventory position across manufacturing output, warehouse stock, third-party logistics, and goods in transit. The number is harder than it looks in pharma because quantity alone is meaningless: stock has a lot, an expiry, a quality status, and sometimes a market restriction, and only some combinations are actually sellable. The integration's job is to net all of it and publish availability that order promising can rely on.
What's Getting Built
- Per-node connectivity (System API) — one API per node applying the same quantity vocabulary to MES, WMS, and 3PL sources ·
GET /nodes/{nodeId}/positions, SUBSCRIBE movement-events, GET /nodes/{nodeId}/snapshot
- Netting and availability (Process API) — nets on-hand against allocated, blocked, and quality-held stock and publishes availability to promise ·
GET /availability/{productId}, PUBLISH availability-position event, POST /atp/recalculate
- Position reconciliation (Scheduler) — reconciles the netted position against each node's own count on a fixed cycle and raises variance exceptions ·
SCHEDULER fixed cycle, GET /nodes/{nodeId}/count, POST /exceptions/variance
- Node freshness monitor (Object Store) — holds last-received timestamp per node so a silent feed is marked stale rather than read as zero ·
PUT /{nodeId}, GET /{nodeId}
- Planning and order promising (target) — consumes the netted availability position for promising, replenishment, and allocation ·
CONSUME availability-position event, GET /availability/{productId}
Value chain phase
Phase 05 — Supply Chain & Logistics. Distribution, secure cold-chain tracking, and warehouse management.
- Scope of this plan: Netting inventory across plants, warehouses, 3PLs, and in-transit stock into a published availability position, with lot, expiry, and quality status intact.
- Data in this phase: ERP systems, real-time freight-tracking data, and partner EDI feeds.
- Receives from: Phase 04 — Manufacturing & QC.
- Hands off to: Phase 06 — Commercial & Patient Services.
Prerequisites
- Anypoint Platform org with API Manager and a non-production deployment target.
- Secrets Manager or secure properties configured for every system credential.
- Named owner for each source system — integration stalls on access, not on code.
- MES or plant system access for production output and quality disposition, at least at lot granularity.
- WMS access for on-hand, allocated, and blocked stock — SAP EWM, Blue Yonder, Manhattan, or the 3PL's system.
- 3PL and carrier feeds for stock held externally and goods in transit, with an agreed file or API cadence.
- Agreed definition of available to promise, signed off by supply planning and commercial before implementation.
Choose your path
- Aggregated visibility — Choose when the immediate need is one view across nodes for planning and service — read-only, lower risk, and fast to prove.
- Position of record — Choose when the netted position will drive order promising and replenishment — the freshness and reconciliation bar rises, because being wrong now costs a shipment.
Platform notes
WMS platforms
- On-hand, allocated, blocked, and quality-hold are different quantities — collapsing them into one number is the most common cause of a position nobody trusts.
- Most WMS platforms emit movement events; subscribe to them and reserve full snapshots for periodic reconciliation.
3PL partners
- External nodes usually send scheduled files rather than events — publish the position with an explicit freshness timestamp so consumers know what they are trusting.
- Reconcile 3PL stock against your own book weekly, and treat unexplained variance as an operational incident rather than a rounding issue.
ERP and planning
- ERP holds the financial view of inventory and the operational systems hold the physical one; publish both and label which is which.
- Planning consumes projected availability, not on-hand — include confirmed inbound receipts and expected production with their dates.
Pharma and MedTech differences
The architecture below is shared. These are the points where the two diverge, and they are the only places an implementation should read differently.
| Aspect |
Pharma |
MedTech |
| Where stock sits |
Plants, distribution centers, 3PLs, and goods in transit. |
All of those, plus consignment at hospitals, loaner kits in circulation, and trunk stock in a rep's car. |
| Unit of the position |
Lot and expiry against a product. |
UDI down to serial for implantables, because the customer scans the device, not the SKU. |
| What removes stock from availability |
Quality hold, expiry, and cold chain excursion. |
The same, plus sterility barrier integrity and a kit that is out on loan. |
| Who counts it |
Warehouse and 3PL systems on a known cadence. |
Often a rep with a phone in a stock room — field-counted inventory needs its own confidence rating. |
Architecture
1. Business requirements
- One netted availability position across every node, refreshed within the window order promising needs.
- Lot and expiry visibility so short-dated stock is allocated first and write-offs shrink.
- Quality status respected — released, quarantined, and rejected stock never blend into one available number.
- Projected availability for planning, including confirmed inbound and scheduled production.
2. Node connectivity
- Expose a System API per node with the same quantity vocabulary applied to every source.
- Subscribe to movement events where available and fall back to scheduled snapshots where it is not.
- Timestamp each node's contribution and carry it into the published position as freshness.
- Track node health explicitly — a silent feed reads as zero stock, which is worse than a stale number.
3. Netting and availability
- Net on-hand against allocated, blocked, and quality-held quantities using the agreed available-to-promise definition.
- Apply expiry rules so stock inside the customer's minimum remaining shelf life is excluded from availability.
- Include in-transit stock only where it is legitimately promisable, and label it distinctly.
- Publish availability as an event and a queryable API, both derived from the same calculation.
4. Lot, expiry, and quality status
- Carry lot and expiry through every movement rather than aggregating them away at the boundary.
- Propagate quality disposition changes immediately — a lot moved to hold must leave availability in the same cycle.
- Support first-expiry-first-out allocation guidance and surface short-dated exposure before it becomes write-off.
- Keep market and license restrictions on the lot so stock is not offered where it cannot legally be sold.
5. Reconciliation and exceptions
- Reconcile the netted position against each node's own count on a fixed cycle, and alert on variance thresholds.
- Route unexplained variance as an operational exception with the movement history attached.
- Monitor feed latency per node and degrade gracefully by marking a node stale rather than dropping it.
- Keep an auditable history of position changes, because supply decisions get questioned after the fact.
6. Security and GxP compliance
- Validate the integration under GAMP 5 — requirements, design, IQ/OQ/PQ evidence, and a traceability matrix retained for inspection.
- Meet 21 CFR Part 11 and EU Annex 11 for electronic records and signatures on every GxP-relevant flow.
- Preserve ALCOA+ data integrity — attributable, legible, contemporaneous, original, and accurate — with audit trails no operator can edit.
- Encrypt regulated data in transit and at rest, and keep production payload visibility to validated support roles only.
- Treat a mapping change on a GxP flow as a controlled change under change management, never as a hotfix.
- Quality disposition is a GxP decision — the integration reflects the status the quality system sets and never infers or overrides it.
- Temperature excursion handling belongs to the cold chain flow; this flow must honor the resulting hold immediately rather than on the next cycle.
For pre-built API specifications, implementation templates, and reference architecture, see the MuleSoft Accelerator for Life Sciences on Anypoint Exchange.
Sample payload — Netted availability position for one product
{
"productCanonicalId": "PROD-00931",
"calculatedAt": "2026-07-31T11:00:04Z",
"nodes": [
{ "nodeId": "DC-US-EAST", "type": "wms", "onHand": 18400, "allocated": 4200, "qualityHold": 0, "freshnessSeconds": 45 },
{ "nodeId": "3PL-EU-01", "type": "3pl", "onHand": 9600, "allocated": 1100, "qualityHold": 800, "freshnessSeconds": 43200 }
],
"inTransit": [{ "fromNode": "PLANT-IE-01", "toNode": "DC-US-EAST", "qty": 6000, "etaDate": "2026-08-05" }],
"lots": [
{ "lotId": "LOT-2026-0412", "qty": 5200, "expiryDate": "2026-11-30", "status": "released" },
{ "lotId": "LOT-2026-0518", "qty": 12400, "expiryDate": "2027-06-30", "status": "released" }
],
"availableToPromise": 21900,
"excludedFromAtp": { "qualityHold": 800, "belowMinShelfLife": 5200 }
}
Testing and validation
- Move a lot to quality hold and confirm it leaves the published availability within the agreed refresh window.
- Stop one node's feed and confirm the position marks it stale rather than reporting zero.
- Run reconciliation against a node's physical count and confirm variance above threshold raises an exception with movement history.
- Verify short-dated stock is excluded from availability for a customer whose minimum shelf life it fails.
- Confirm the availability API and the availability event return the same number for the same instant.
Phased rollout
Phase 1 — Connect
- Connect the highest-volume warehouse and the plant, and publish a read-only position for observation.
- Agree the available-to-promise definition in writing and validate it against last quarter's actual shipments.
Phase 2 — Map and validate
- Add 3PL and in-transit sources, and run daily reconciliation until variance is understood rather than merely reported.
- Layer lot, expiry, and quality status, and validate against a known short-dated situation.
Phase 3 — Production
- Let order promising consume the position once reconciliation has been clean for a full cycle.
- Hand feed health, variance, and short-dated exposure monitoring to supply operations.
Success metrics
- Position freshness against the window order promising requires, measured on the slowest node.
- Inventory variance between the netted position and physical counts trending down.
- Write-offs from expiry reduced as short-dated exposure becomes visible earlier.
- Stockouts and emergency transfers reduced against the pre-visibility baseline.
Troubleshooting
- Availability higher than what can actually ship — Likely cause: allocated and quality-held quantities not subtracted from on-hand. Fix: Apply the agreed netting formula centrally and reject node feeds that cannot supply the component quantities.
- Position swings wildly at night — Likely cause: snapshot loads and movement events both applied without a reconciliation point. Fix: Treat the snapshot as the authoritative baseline at a defined instant and replay only events after it.
- A node silently drops out of the position — Likely cause: missing feed interpreted as zero inventory. Fix: Track last-received timestamps per node and mark stale rather than defaulting to zero.
- Short-dated stock keeps expiring in the warehouse — Likely cause: expiry carried but not used in allocation guidance. Fix: Publish first-expiry-first-out guidance and surface short-dated exposure as a standing operational report.
Deliverable: A netted, lot-aware inventory position across plants, warehouses, 3PLs, and in-transit stock, published as both an event and an API with explicit freshness, reconciliation, and quality status honored.