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, "+
StringBufferhql=newStringBuffer("select workOrder.organize_code as organizeCode,workOrder.part_no as partNo, "+
" sum(case when work_order_status = 40 then reported_qty else qty end ) as qty "+
" date_format(workOrder.plan_start_time, '%Y-%m-%d' ) as planStartTime, workOrder.product_version as productVersion, "+
" from mes_work_order where is_deleted=:isDeleted and is_valid = :isValid and organize_code = :organizeCode "+
" sum(case when workOrder.work_order_status = 40 then workOrder.reported_qty else workOrder.qty end ) as qty "+
" and work_order_type = :workOrderType and order_flag != :orderFlag and work_order_status in (20,30,40,50) and plan_start_time >= :today"+
" from mes_work_order as workOrder left join mes_part_sap as partSap on workOrder.part_no = partSap.part_no"+
" group by organize_code,part_no, date_format(plan_start_time, '%Y-%m-%d' ), product_version ");
" where workOrder.is_deleted=:isDeleted and workOrder.is_valid = :isValid and workOrder.organize_code = :organizeCode "+
" and partSap.is_deleted=:isDeleted and partSap.is_valid = :isValid and partSap.organize_code = :organizeCode "+
" and partSap.is_test_piece = :isTestPiece and workOrder.work_order_type = :workOrderType and workOrder.order_flag != :orderFlag "+
" and workOrder.work_order_status in (20,30,40,50) and workOrder.plan_start_time >= :today"+
" group by workOrder.organize_code,workOrder.part_no, date_format(workOrder.plan_start_time, '%Y-%m-%d' ), workOrder.product_version ");