<!-- AND (o.type is null or o.type = '' or NOT FIND_IN_SET(2, o.type))-->
AND o.`is_cargo_control` = 1
AND o.unload_time is not null
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 = 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 = 3 and p.deleted = 0) <= 3 or
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