Analyzes warehouse shipment backlogs to optimize batch picking and packing workflows. Use when a merchant needs help clearing order backlogs, improving picking efficiency, optimizing batch sizes, or understanding order composition patterns. Triggers on questions about shipping delays, picking strategies, packing station setup, warehouse workflow optimization, or order fulfillment bottlenecks. Works with Fulfil MCP data or user-provided shipment data (CSV/Excel).
Analyzes shipment data to generate actionable recommendations for clearing backlogs and optimizing warehouse workflows.
Option 1: Fulfil MCP Connection
Query the shipments table with nested moves for line-item detail. Key fields:
state (assigned, waiting, done, packed, cancel)warehouse for location filteringmoves.order_channel_name for channel filteringmoves.product_code, moves.quantity, moves.product_nameshipped_date for velocity analysisOption 2: User-Provided Data Accept CSV/Excel with minimum columns: shipment_id, sku, quantity, status. Optional: ship_date, warehouse, channel.
Before analysis, confirm with user:
Order Composition
-- Single vs multi-unit distribution
SELECT
CASE WHEN total_units = 1 THEN '1 unit'
WHEN total_units = 2 THEN '2 units'
WHEN total_units BETWEEN 3 AND 5 THEN '3-5 units'
ELSE '6+ units' END as bucket,
COUNT(*) as shipments,
ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER(), 1) as pct
FROM (
SELECT s.id, SUM(m.quantity) as total_units
FROM shipments s, UNNEST(moves) m
WHERE [filters] AND m.move_type = 'outgoing' AND m.state != 'cancelled'
GROUP BY s.id
)
GROUP BY bucket
SKU Line Distribution
Same pattern but COUNT(DISTINCT m.product_code) for unique SKUs per order.
Top SKUs by Frequency
SELECT m.product_code, COUNT(DISTINCT s.id) as orders, SUM(m.quantity) as units
FROM shipments s, UNNEST(moves) m
WHERE [filters]
GROUP BY m.product_code
ORDER BY orders DESC LIMIT 20
Product Pairing Analysis (for co-location)
-- Find products frequently bought together
WITH pairs AS (
SELECT LEAST(a.product_code, b.product_code) as sku1,
GREATEST(a.product_code, b.product_code) as sku2
FROM shipment_products a
JOIN shipment_products b ON a.shipment_id = b.shipment_id AND a.product_code < b.product_code
)
SELECT sku1, sku2, COUNT(*) as frequency
FROM pairs GROUP BY sku1, sku2 ORDER BY frequency DESC
Shipping Velocity (last 7 days)
SELECT shipped_date, COUNT(DISTINCT id) as shipments
FROM shipments WHERE state = 'done' AND shipped_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
GROUP BY shipped_date ORDER BY shipped_date
High-Volume Single-SKU Candidates (Pre-Print & Pack)
Low-Volume Single-Unit (Mixed Batch)
Inventory Status (if available)
Query inventory_by_location to compare available vs. needed for top SKUs.
Bundle Identification SKUs with "BUNDLE" in code/name are typically assembled from components—don't flag inventory issues.
Primary Pick Locations
SELECT product_code, location_name, quantity_available
FROM inventory_by_location
WHERE product_code IN ([top_skus]) AND quantity_available > 0
ORDER BY product_code, quantity_available DESC
Recommendations must be driven by the actual data. Different merchants have vastly different order profiles. Analyze the composition first, then select and prioritize recommendations accordingly.
After calculating order composition, classify the merchant:
| Profile | Single-Unit % | Multi-Unit % | Primary Challenge |
|---|---|---|---|
| Single-Unit Dominant | >60% | <40% | Throughput speed |
| Multi-Unit Dominant | <40% | >60% | Pick complexity, packing accuracy |
| Balanced Mix | 40-60% | 40-60% | Workflow segmentation |
Choose recommendations based on what the data shows. Not all apply to every merchant.
Pre-Print & Pack (High-Volume Single-SKU)
Mixed Single-Unit Batch (Low-Volume SKUs)
Multi-SKU Batch Picking
Product Co-location
Multi-Unit Same-SKU Handling
Packing Station Setup
Picking Optimization
Cartonization
Order recommendations by shipment volume affected:
Based on selected recommendations, create execution waves:
Generate PDF report with:
Use docx skill to create document, then convert to PDF:
soffice --headless --convert-to pdf document.docx --outdir /mnt/user-data/outputs/
Data drives recommendations: Analyze composition first, then recommend. Never assume a particular order profile.
Identify the bottleneck: Packing is often the constraint for single-unit operations; picking is often the constraint for complex multi-SKU operations. Staffing ratios should reflect the actual bottleneck.
Bundle awareness: Built-on-fly bundles don't have inventory—components do. Never flag bundle inventory issues.
Case quantity threshold: For single-unit batching, the dividing line between "Pre-Print & Pack" and "Mixed Batch" is typically 1 case worth of orders. If case quantities unavailable in system, ask merchant or estimate ~20-30 units.
Optimize for the majority first: Whatever segment represents the largest share of orders should get the first and most detailed recommendation.