AND (select IFNULL(sum(p.pick_num), 0) from `ecw_order_cargo_control_pick` p where p.order_id = o.order_id and p.status in(1,3) and p.deleted = 0) < o.`sum_num`
AND (select IFNULL(sum(p.pick_num), 0) from `ecw_order_cargo_control_pick` p where p.order_id = o.order_id and p.status in(1,3) and p.deleted = 0) < o.`sum_num`
AND ((select count(1) from `ecw_order_cargo_control_pick` p where p.order_id = o.order_id and p.status in(1,3) and p.deleted = 0) <= 3 or
AND ((select count(1) from `ecw_order_cargo_control_pick` p where p.order_id = o.order_id and p.status in(1,3) and p.deleted = 0) >= 3 or