← Inventory & Replenishment Exceptions My saved work →
Final project · SQLite
Handoff a replenishment and exception queue
Project dataset
Your work
Active 0:00 · Paused 0sKeep a handoff you can replay
Check your current answer, then download the output and its report. The report includes the source, answer and each check so you can review what passed and what needs work.
To replay your work, open this task with the same dataset, import your answer and check it again.
Show the reference answer
WITH clean_inbound AS (SELECT DISTINCT p.* FROM inbound p WHERE NOT EXISTS (SELECT 1 FROM inbound x WHERE x.po_id=p.po_id AND (x.sku<>p.sku OR x.units<>p.units OR x.eta<>p.eta OR x.status<>p.status))), due AS (SELECT sku,SUM(units) AS due_units FROM clean_inbound WHERE status='confirmed' AND eta<='2026-10-07' GROUP BY sku), positions AS (SELECT s.*,s.on_hand-s.reserved AS available,COALESCE(d.due_units,0) AS due_units,s.on_hand-s.reserved+COALESCE(d.due_units,0) AS position FROM stock s LEFT JOIN due d ON s.sku=d.sku) SELECT sku,available,due_units,position,CASE WHEN on_hand IS NULL THEN 'recount' WHEN available<0 THEN 'resolve_reservations' WHEN position<reorder_point THEN 'reorder' ELSE 'hold' END AS action,CASE WHEN on_hand IS NULL OR available<0 THEN NULL WHEN position<reorder_point THEN ((target-position+pack_size-1)/pack_size)*pack_size ELSE 0 END AS order_qty FROM positions ORDER BY sku;
Turn stock snapshots and inbound orders into a checked replenishment queue.