{"publisher":"WESWOO","id":"pick-remaining-units","title":{"zh":"查看样例与复核查询","en":"View the records and verification query"},"setup_sql":"CREATE TABLE work(line TEXT PRIMARY KEY,location TEXT,sku TEXT,ordered INT,remaining INT,released INT);\nINSERT INTO work VALUES ('A','East','Blue-M',5,2,1),('B','East','Blue-M',3,3,1),\n ('C','East','Blue-M',4,4,0),('D','West','Blue-M',2,2,1);","query_sql":"SELECT location,sku,SUM(remaining) AS to_pick FROM work\nWHERE released=1 AND remaining>0 GROUP BY location,sku ORDER BY location,sku;","checks":[{"condition":"Two released East jobs, one held","change_sql":"","expected":[["East","Blue-M",5],["West","Blue-M",2]],"observed":[["East","Blue-M",5],["West","Blue-M",2]]},{"condition":"Held job released","change_sql":"UPDATE work SET released=1 WHERE line='C';","expected":[["East","Blue-M",9],["West","Blue-M",2]],"observed":[["East","Blue-M",9],["West","Blue-M",2]]},{"condition":"A completed before pick starts","change_sql":"UPDATE work SET remaining=0 WHERE line='A';","expected":[["East","Blue-M",3],["West","Blue-M",2]],"observed":[["East","Blue-M",3],["West","Blue-M",2]]}]}