StringBufferhql=newStringBuffer("select organize_code as organizeCode,part_no as partNo, date_format(plan_start_time, '%Y-%m-%d' ) as planStartTime, product_version as productVersion, "+
" sum(case when work_order_status = 40 then 0 else qty end ) as qty " +
" sum(case when work_order_status = 40 then reported_qty else qty end ) as qty " +
" from mes_work_order where is_deleted=:isDeleted and is_valid = :isValid and organize_code = :organizeCode "+
" and work_order_type = :workOrderType and order_flag != :orderFlag and work_order_status in (20,40) and plan_start_time >= :today" +
" and work_order_type = :workOrderType and order_flag != :orderFlag and work_order_status in (20,30,40) and plan_start_time >= :today" +
" group by organize_code,part_no, date_format(plan_start_time, '%Y-%m-%d' ), product_version ");