| | |
| | | |
| | | |
| | | </select> |
| | | |
| | | <select id="selectProcessCompletedMp"> |
| | | SELECT |
| | | #{selectProcesses} as process, |
| | | hz.project,hz.batch, |
| | | SUM(quantity) as quantity, |
| | | SUM(childArea)as childArea, |
| | | SUM(actualArea) as actualArea, |
| | | SUM(completeNum) as completeNum, |
| | | SUM(completeArea) as completeArea, |
| | | SUM(incompleteNum) as incompleteNum, |
| | | SUM(incompleteArea) as incompleteArea, |
| | | hz.product_name |
| | | from ( |
| | | select DATE(o.create_time) as create_time, |
| | | DATE(o.delivery_date) as delivery_date, |
| | | o.order_id, |
| | | fc.process_id, |
| | | o.customer_name, |
| | | o.project, |
| | | o.batch, |
| | | od.order_number, |
| | | ogd.technology_number, |
| | | ogd.glass_child, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | fc.quantity - ifnull(fc.termination_quantity,0) as quantity, |
| | | ROUND(ogd.child_width * ogd.child_height / 1000000, 2) as childArea, |
| | | ROUND(ogd.child_width * ogd.child_height * (fc.quantity- ifnull(fc.termination_quantity,0)) / 1000000, 2) as actualArea, |
| | | odpd.reporting_work_num as completeNum, |
| | | ROUND(ogd.child_width * ogd.child_height * odpd.reporting_work_num / 1000000, |
| | | 2) as completeArea, |
| | | fc.quantity - odpd.reporting_work_num - ifnull(fc.termination_quantity,0) as incompleteNum, |
| | | ROUND(ogd.child_width * ogd.child_height * (fc.quantity - odpd.reporting_work_num- ifnull(fc.termination_quantity,0)) / 1000000, |
| | | 2) as incompleteArea, |
| | | od.product_name |
| | | |
| | | from sd.order_detail AS od |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | LEFT JOIN flow_card AS fc |
| | | ON fc.order_id = ogd.order_id |
| | | and fc.production_id = ogd.production_id |
| | | AND fc.order_number = ogd.order_number |
| | | AND fc.technology_number = ogd.technology_number |
| | | left join sd.order_process_detail as odpd |
| | | ON odpd.order_id = fc.order_id |
| | | AND odpd.order_number = fc.order_number |
| | | AND odpd.technology_number = fc.technology_number |
| | | and odpd.process_id = fc.process_id |
| | | left join sd.`order` as o |
| | | on o.order_id = od.order_id |
| | | where o.create_order>0 |
| | | and odpd.process = #{selectProcesses} |
| | | and o.create_time >= #{selectTime1} |
| | | AND o.create_time < #{selectTime2} |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | and GREATEST(fc.quantity - odpd.reporting_work_num, 0)>0 |
| | | and fc.quantity-ifnull(fc.termination_quantity,0)>0 |
| | | <choose> |
| | | <when test="laminating != null and laminating == 'stepC'"> |
| | | GROUP BY fc.process_id, fc.order_number, ogd.`group` |
| | | </when> |
| | | <when test="laminating != null and laminating == 'stepD'"> |
| | | GROUP BY fc.process_id, fc.order_number |
| | | </when> |
| | | <when test="laminating != null and laminating == 'stepB'"> |
| | | GROUP BY fc.process_id, fc.order_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY fc.process_id, fc.order_number, fc.technology_number |
| | | </otherwise> |
| | | </choose> |
| | | order by fc.process_id, fc.order_number, fc.technology_number |
| | | ) as hz |
| | | GROUP BY hz.project,hz.batch,product_name |
| | | </select> |
| | | |
| | | |
| | | </mapper> |