| | |
| | | SELECT g.* |
| | | ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName |
| | | from( SELECT f.*, |
| | | e.reporting_work_num-f.reporting_work_num as quantity, |
| | | (e.reporting_work_num-f.reporting_work_num)*f.area as glassArea |
| | | e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity, |
| | | (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea |
| | | from (SELECT a.order_id, |
| | | a.project, |
| | | C.product_id, |
| | | b.order_number, |
| | | b.process_id, |
| | | b.technology_number, |
| | | b.reporting_work_num, |
| | | b.reporting_work_num_count, |
| | | d.`group` , |
| | | b.broken_num, |
| | | b.id, |
| | | c.area, |
| | | d.glass_child |
| | | d.glass_child, |
| | | ifnull(cb.patchNumSum,0) as patchNumSum |
| | | |
| | | FROM sd.`order` as a |
| | | LEFT JOIN sd.order_process_detail as b |
| | |
| | | on a.order_id = c.order_id and b.order_number =c.order_number |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum', |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number, |
| | | rwk.this_process |
| | | FROM |
| | | pp.rework AS rw |
| | | LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE |
| | | position( #{process} IN rwk.this_process ) |
| | | AND rw.review_status >= 0 |
| | | GROUP BY |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number |
| | | ) AS cb ON cb.process_id = b.process_id |
| | | AND cb.order_sort = b.order_number |
| | | AND cb.technology_number = b.technology_number |
| | | where a.processing_card>0 |
| | | and a.warehousing!=2 |
| | | and (c.quantity-b.reporting_work_num)>0 |
| | | and (c.quantity-b.reporting_work_num_count)>0 |
| | | GROUP BY b.process_id, b.order_number, |
| | | b.technology_number) as f |
| | | LEFT JOIN sd.order_process_detail as e |
| | | on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number |
| | | where |
| | | e.id is not null |
| | | and e.reporting_work_num-f.reporting_work_num>0 ) as g |
| | | and (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)>0 ) as g |
| | | <choose> |
| | | <when test="laminating == 'stepC' and process == '预压'"> |
| | | GROUP BY g.process_id, g.order_number, g.technology_number |
| | | </when> |
| | | <when test="laminating == 'stepC'"> |
| | | GROUP BY g.process_id, g.order_number, g.`group` |
| | | </when> |
| | |
| | | </choose> |
| | | |
| | | </select> |
| | | |
| | | <select id="getWorkInProgressCombinationFootSum"> |
| | | select |
| | | SUM(h.quantity) as stockNum, |
| | | SUM(h.glassArea) as stockArea |
| | | from ( |
| | | SELECT g.* |
| | | ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName |
| | | from( SELECT f.*, |
| | | e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity, |
| | | (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea |
| | | from (SELECT a.order_id, |
| | | a.project, |
| | | C.product_id, |
| | | b.order_number, |
| | | b.process_id, |
| | | b.technology_number, |
| | | b.reporting_work_num_count, |
| | | d.`group` , |
| | | b.broken_num, |
| | | b.id, |
| | | c.area, |
| | | d.glass_child, |
| | | ifnull(cb.patchNumSum,0) as patchNumSum |
| | | |
| | | FROM sd.`order` as a |
| | | LEFT JOIN sd.order_process_detail as b |
| | | on b.process = #{process} and a.order_id =b.order_id |
| | | LEFT JOIN sd.order_detail as c |
| | | on a.order_id = c.order_id and b.order_number =c.order_number |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum', |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number, |
| | | rwk.this_process |
| | | FROM |
| | | pp.rework AS rw |
| | | LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE |
| | | position( #{process} IN rwk.this_process ) |
| | | AND rw.review_status >= 0 |
| | | GROUP BY |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number |
| | | ) AS cb ON cb.process_id = b.process_id |
| | | AND cb.order_sort = b.order_number |
| | | AND cb.technology_number = b.technology_number |
| | | where a.processing_card>0 |
| | | and a.warehousing!=2 |
| | | and (c.quantity-b.reporting_work_num_count)>0 |
| | | GROUP BY b.process_id, b.order_number, |
| | | b.technology_number) as f |
| | | LEFT JOIN sd.order_process_detail as e |
| | | on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number |
| | | where |
| | | e.id is not null |
| | | and e.reporting_work_num_count-f.reporting_work_num_count>0 ) as g |
| | | <choose> |
| | | <when test="laminating == 'stepC' and process == '预压'"> |
| | | GROUP BY g.process_id, g.order_number, g.technology_number |
| | | </when> |
| | | <when test="laminating == 'stepC'"> |
| | | GROUP BY g.process_id, g.order_number, g.`group` |
| | | </when> |
| | | <when test="laminating == 'stepD'"> |
| | | GROUP BY g.process_id, g.order_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY g.process_id, g.order_number, g.technology_number |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | |
| | | ) as h |
| | | |
| | | </select> |
| | | |
| | | <select id="exportWorkInProgressCombination"> |
| | | select |
| | | #{process} as thisProcess, |
| | | if(#{inputVal} = 1,'',h.project) as project, |
| | | SUM(h.quantity) as stockNum, |
| | | SUM(h.glassArea) as stockArea, |
| | | if(#{inputVal} = 1,'',h.childName) as glassName |
| | | |
| | | from ( |
| | | |
| | | SELECT g.* |
| | | ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName |
| | | from( SELECT f.*, |
| | | e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity, |
| | | (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea |
| | | from (SELECT a.order_id, |
| | | a.project, |
| | | C.product_id, |
| | | b.order_number, |
| | | b.process_id, |
| | | b.technology_number, |
| | | b.reporting_work_num_count, |
| | | d.`group` , |
| | | b.broken_num, |
| | | b.id, |
| | | c.area, |
| | | d.glass_child, |
| | | ifnull(cb.patchNumSum,0) as patchNumSum |
| | | |
| | | FROM sd.`order` as a |
| | | LEFT JOIN sd.order_process_detail as b |
| | | on b.process = #{process} and a.order_id =b.order_id |
| | | LEFT JOIN sd.order_detail as c |
| | | on a.order_id = c.order_id and b.order_number =c.order_number |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum', |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number, |
| | | rwk.this_process |
| | | FROM |
| | | pp.rework AS rw |
| | | LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE |
| | | position( #{process} IN rwk.this_process ) |
| | | AND rw.review_status >= 0 |
| | | GROUP BY |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number |
| | | ) AS cb ON cb.process_id = b.process_id |
| | | AND cb.order_sort = b.order_number |
| | | AND cb.technology_number = b.technology_number |
| | | where a.processing_card>0 |
| | | and a.warehousing!=2 |
| | | and (c.quantity-b.reporting_work_num_count)>0 |
| | | GROUP BY b.process_id, b.order_number, |
| | | b.technology_number) as f |
| | | LEFT JOIN sd.order_process_detail as e |
| | | on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number |
| | | where |
| | | e.id is not null |
| | | and (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)>0 ) as g |
| | | <choose> |
| | | <when test="laminating == 'stepC' and process == '预压'"> |
| | | GROUP BY g.process_id, g.order_number, g.technology_number |
| | | </when> |
| | | <when test="laminating == 'stepC'"> |
| | | GROUP BY g.process_id, g.order_number, g.`group` |
| | | </when> |
| | | <when test="laminating == 'stepD'"> |
| | | GROUP BY g.process_id, g.order_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY g.process_id, g.order_number, g.technology_number |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | |
| | | ) as h |
| | | <choose> |
| | | <when test="inputVal == 1"> |
| | | GROUP BY thisProcess |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY h.project,h.childName |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | </mapper> |