Northwind ERP Operations
Use this skill when a task asks for a Northwind Components operations JSON answer using the shared ERP API. Read the prompt, local memo/request payloads, and answer template first. Then use the API records as the source of truth; do not inspect environment source files or use any judge endpoint.
API Workflow
Use the task runner's <TASK_ENV_BASE_URL> and public endpoints only:
/orders?wave=...,/orders/<order_id>/products,/products/<sku>/customers,/customers/<customer_id>/warehouses/inventory?warehouse_id=...&sku=.../shipping/quote?warehouse_id=...&destination_zip=...&weight_lb=...&speed=.../purchase_orders?supplier_id=...&sku=...&status=.../incidents?start=...&end=...&supplier_id=...&sku=...&incident_type=...&status=.../suppliers/boms,/boms/<bom_id>
Build the final object to match the provided template exactly. Return JSON only, sorted as the template states. Round currency to 2 decimals, incident percentages to 1 decimal, and average durations to 2 decimals.
Shared Inventory Rules
For every stock decision, join inventory to product master data and compute:
effective_available = on_hand - reserved - quarantined - product.safety_stock
Treat reserved, quarantined, and safety stock as protected. Effective available may be negative. For a requested quantity, the uncovered quantity is:
gap = requested_quantity - max(0, effective_available)
A line is a shortage when effective_available < requested_quantity. A fillable line is low stock when releasing it leaves little effective stock; the training pattern uses effective_available - requested_quantity <= product.safety_stock.
Inactive products prevent automatic release for that line. Customer/account exceptions take precedence over product and inventory outcomes.
Expedite Dispatch Decisions
For each memo order ID, fetch the live order, customer, all products, inventory for the order warehouse, and a shipping quote.
Customer exception precedence:
account_status == blocked->account_blockedrisk_flag == fraud_watch->fraud_watchrisk_flag == credit_watch->credit_watchwhen allowed by the templateaccount_status == review_required->review_required- otherwise
none
Inventory status:
- any inactive SKU and any shortage ->
inactive_and_shortage - any inactive SKU ->
inactive_sku - any shortage ->
shortage - any low-stock fillable SKU ->
low_stock - otherwise
ready
Sort SKU exception lists ascending. shortage_skus contains SKUs whose effective available is below the line quantity. inactive_skus contains inactive products. low_stock_skus contains active, fillable SKUs that meet the low-stock rule.
Final decision precedence:
- blocked, fraud, or credit customer risk ->
reject_hold/hold_credit_or_fraud - customer review required ->
manual_review/send_account_review - inactive SKU without a higher customer exception ->
manual_review/escalate_product_master - shortage ->
backorder/create_backorder - low stock only ->
delayed_release/delay_and_monitor - ready ->
ship_now/release_to_pick
For shipping, compute total order weight as sum(product.weight_lb * line.quantity), call /shipping/quote with the order warehouse, destination zip, total weight, and requested speed, then copy zone_distance, service_days, and rounded total_cost into the template.
Summaries count final decisions, total shipping cost, and sorted order ID lists by final outcome or exception category.
Allocation Transfer Waves
Fetch all orders in the wave, then join each order to its customer, products, and inventory for the requested warehouse. For each line:
- If the customer blocks automatic release, set
manual_review, zero all quantities, and use the matching reason:- blocked account ->
account_blocked - review-required account ->
account_review_required - fraud watch ->
fraud_watch - credit watch, if no explicit reason exists, usually maps to
account_review_required
- blocked account ->
- Else if the product is inactive, set
manual_review, zero quantities, and useinactive_product. - Else if requested effective available covers the full quantity, set
ship,ship_quantity = quantity, and all other quantities zero. - Else calculate
ship_quantity = max(0, requested_effective_available)andtransfer_quantity = quantity - ship_quantity. Look at the other warehouses for the same SKU. If one source warehouse has effective available at leasttransfer_quantity, settransferand choose the source with the largest effective available, breaking ties by warehouse ID. - If no single source can clear the uncovered quantity, set
backorder; backorder the unfilled quantity and useinsufficient_effective_stock.
For transfer lines, create one transfer request using the selected source, requested warehouse as destination, and transfer quantity. Do not split one order line across multiple source warehouses.
Order rollup:
- all lines ship ->
ready_to_ship - all lines manual review ->
manual_review - transfer lines with all other lines ship ->
needs_transfer - any backorder and no manual-review or transfer lines ->
has_backorder - otherwise ->
mixed_actions
blocked_orders contains only orders stopped by customer/account risk, not product-only manual reviews. Summaries are counts of orders, lines by action, blocked orders, transfer units, and backorder units.
BOM Replenishment Packages
Read the production memo target builds and fetch each BOM. For every component SKU:
- Aggregate
total_required = sum(quantity_per_kit * target_build_quantity)across all target builds containing the SKU. - Use the planning site or BOM warehouse as the target warehouse.
- Compute target effective available with the shared inventory rule.
- Find same-SKU, same-target-warehouse purchase orders with status
openorconfirmedand ETA on or before the relevant component build date. Sort coverage PO IDs ascending and sum their quantities astimely_po_qty. - Let
gap = max(0, total_required - target_effective_available). Timely PO covered units aremin(gap, timely_po_qty). - If there is no remaining gap after timely POs, exclude the component as
timely_po_covers_gap. - If there is no gap before POs, exclude as
target_overstockwhen target effective available exceeds the product overstock threshold; otherwise usestocked_no_gap. - For remaining gap, request transfers from other warehouses using their positive effective available. Allocate from largest effective availability to smallest, breaking ties by warehouse ID, until the remaining gap is zero or no more transferable stock exists.
- Any remaining gap after transfers becomes a purchase requisition for the product supplier at product unit cost.
Transfer request needed_by is the earliest build date for that component. Purchase requisition needed_by is the latest build date whose component demand remains uncovered after stock, timely POs, and transfers. If demand is not bucketed by date, use the latest target build date for that SKU.
Set final actions by outcome:
- no gap and stocked ->
no_action_stocked - no gap because target is overstocked ->
overstock_excluded - timely POs cover the gap ->
timely_po_covered - transfers cover the remaining gap ->
transfer_only - any purchase requisition remains ->
purchase_required
Summary totals are unique component count, purchase units, rounded purchase cost, transfer units, and timely-PO-covered units, not total PO quantities.
Supplier Incident Scorecards
Use the request's date filter, policy, and precision rules. Filter incidents by open_date inclusively. Join suppliers for names and quality status.
For each supplier with filtered incidents:
incident_count: filtered incident rowsincident_percentage: supplier count divided by total filtered population times 100total_resolution_cost: sum of incident resolution costs- duration: calendar-day difference from
open_datetoclose_date; for open incidents useanalysis_date rma_countandwork_order_count: count byincident_typeopen_incident_count: statusopensevere_incident_count: severity in the severe list from the request, usually high or critical
Apply the recommendation policy in the request, in its stated precedence. Typical conditions include quality hold plus incident volume, any critical RMA, high RMA cost/volume, work-order dominance, watch/quality status, severe counts, and default monitor.
Top escalation suppliers include only ESCALATE_SUPPLIER, sorted by incident count descending, total resolution cost descending, then supplier ID ascending. Highest cost/share supplier IDs use the maximum supplier totals; break ties by supplier ID unless the prompt says otherwise.
Procurement Quality Holds
Read the target supplier IDs and analysis window from the memo. For each supplier:
- Fetch supplier metadata.
- Fetch recent incidents with inclusive
open_datewindow. - Fetch purchase orders for the supplier, retaining status
openandconfirmed. - Count recent incidents, RMAs, open incidents, and high/critical severities.
- Sort unique affected SKUs ascending.
- Sort incident IDs ascending and use the first five as sample IDs.
When the memo gives only broad policy, use this precedence inferred from the training pattern:
quality_holdsuppliers with recent incidents ->freeze_new_replenishment- otherwise, at least two high/critical recent incidents ->
buyer_review_required - otherwise ->
monitor_only
For freeze or buyer-review decisions, hold the supplier's open/confirmed POs sorted by PO ID. The training pattern caps per-supplier held PO IDs at the first five when the template gives no larger explicit limit. Monitor-only suppliers have no held POs and appear in release_supplier_ids.
Top-level held_po_ids is the sorted unique union of supplier held POs. Summary counts suppliers reviewed, decisions by type, held PO count, and total recent incidents.