Work Order Integration
This guide walks you through the most common Pico API integration pattern: a bidirectional work order flow with your ERP system. You'll learn how to synchronize product definitions from Pico to your ERP, create work orders when you're ready to manufacture, and receive real-time completion notifications to update your inventory and material consumption. By the end of this guide, you'll understand the complete lifecycle of a work order from creation through completion, with practical examples for each step.
Integration Flow
Overview
Our most common integration is a 2-way work order integration with three key steps:
1. Fetch Operations and Map to ERP
What are operations? Operations represent the products, subassemblies, and manufacturing processes defined in Pico. Each operation contains:
id- Pico's internal identifierexternalId- The part number (e.g., "PROD-101")externalRevision- The revision (e.g., "A", "B")name- Human-readable nameconsumedSerials- List of required serialized materials/components
Why fetch operations? Your ERP needs to know what products exist in Pico so you can create work orders for them. This is typically a one-time sync, with periodic updates when products change.
How it works: Query the operations field to retrieve all products and processes. You can also query subOperations to understand product structures (which components are used in which products).
2. Create Work Orders for Products
What is a work order? A work order tells Pico to build a specific product for a specific order (like a sales order or manufacturing order in your ERP).
When to create work orders: When your ERP determines a product needs to be built - for example, when a sales order is released or when inventory reaches a reorder point.
How it works: Use the operationOrderSave mutation with:
operationId- The product to build (from step 1)externalOrderId- Your ERP's order identifier (e.g., "SALES-123")
See the OperationOrderSaveInput type for all available options.
Once created, the work order appears on the shop floor and operators can begin building.
3. Subscribe to Work Order Completions
What are completions? When an operator finishes building a product on the shop floor, Pico generates a completion event containing:
- What was built (product and serial number)
- When it was built (timestamps)
- Who built it (operator and station)
- What materials were consumed (component serial numbers)
Why subscribe? Your ERP needs to know when products are completed so it can:
- Update inventory (add the produced item)
- Consume materials (deduct components used)
- Update order status
- Trigger billing or shipping processes
How it works: Establish a WebSocket subscription to operationOrderCompletesStream. Pico pushes a message to you immediately when any work order completes, without you having to poll. See the OperationSummary type for details on the completion data structure.
Subscribe to changes to deployed operations and suboperations
subscription ops {
operationsStream {
partNo: externalId
name
consumedSerials: {
id
name
partNo: externalId
}
updatedAt
}
}
subscription subOps {
subOperationsStream {
parentId
subId
updatedAt
}
}
Save work order for a product
This is what the example graphql payload may look like when you want to build a PROD-101 for sales order SALES-123.
mutation saveOperation($opId: String!, $order: String!) {
operationOrderSave(input: {operationId: $opId, externalOrderId: $order}) {
message
}
}
variables {
"opId": "def123",
"order": "SALES-123"
}
Subscribe to work order completion for all products
This is the payload used to subscribe to all future work order completions.
Note: we use graphql aliases to rename fields so they may match any domain (e.g. externalOrderId -> order)
subscription NewOpCompletions {
operationOrderCompletesStream {
order: externalOrderId
operation {
id
partNo: externalId
name
}
operationSummary {
endState {
producedSerial
at
}
consumedSerials {
id
partNo: externalId
serial: value
}
}
}
}
See Also
- Subscriptions Guide - Learn more about GraphQL subscriptions, WebSocket connections, and all available subscription types
- Operation Type - Complete reference for the Operation type
- OperationOrderSave Mutation - Detailed documentation for creating work orders