| | |
| | | sum(aa.stockNum) AS stockNum, |
| | | SUM(aa.stockArea) AS stockArea, |
| | | count(* ) AS 'total', |
| | | CEILING( count(* )/#{pageSize} ) AS 'pageTotal' |
| | | CEILING( count(* )/100 ) AS 'pageTotal' |
| | | from |
| | | ( |
| | | SELECT (od.quantity) AS quantity, |
| | | (odpds.reporting_work_num_count + IFNULL(c.patchNumSum, 0) - odpd.reporting_work_num_count - odpd.broken_num) AS stockNum, |
| | | (ROUND(ogd.child_width * ogd.child_height * |
| | | (odpds.reporting_work_num_count + IFNULL(c.patchNumSum, 0) - odpd.reporting_work_num_count - odpd.broken_num) / 1000000, 2)) AS stockArea |
| | | d.numCounts + d.patchNumSum - d.numCount -d.broken_num as stockNum, |
| | | ROUND(ogd.child_width * ogd.child_height * |
| | | (d.numCounts + d.patchNumSum - d.numCount - |
| | | d.broken_num) / 1000000, 2) as stockArea |
| | | FROM |
| | | sd.order_detail AS od |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | |
| | | 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_process_detail as odpds |
| | | ON odpds.id = odpd.id - 1 |
| | | left join |
| | | (SELECT sum(rw.rework_num) as 'patchNumSum', |
| | | left join ( |
| | | SELECT |
| | | odpd.process, |
| | | odpd.process_id, |
| | | odpd.order_number, |
| | | odpd.technology_number, |
| | | odpds.reporting_work_num_count as numCounts, |
| | | ifnull( c.patchNumSum, 0 ) as patchNumSum, |
| | | odpd.reporting_work_num_count as numCount, |
| | | odpd.broken_num |
| | | FROM |
| | | sd.order_process_detail AS odpd |
| | | LEFT JOIN sd.order_process_detail AS odpds ON odpds.id = odpd.id - 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | sum( rw.rework_num ) 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(#{selectProcesses} in rwk.this_process ) |
| | | and rw.review_status >= 0 |
| | | GROUP BY rw.process_id, rw.order_sort, rw.technology_number) as c |
| | | on c.process_id = fc.process_id |
| | | and c.order_sort = fc.order_number |
| | | and c.technology_number = fc.technology_number |
| | | left join sd.`order` as o |
| | | on o.order_id = od.order_id |
| | | FROM |
| | | pp.rework AS rw |
| | | LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE |
| | | o.create_order>0 |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 and odpd.process!=SUBSTRING_INDEX(ogd.process, '->', 1) |
| | | and position(#{selectProcesses} in odpd.process) |
| | | position( #{selectProcesses} IN rwk.this_process ) |
| | | AND rw.review_status >= 0 |
| | | GROUP BY |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number |
| | | ) AS c ON c.process_id = odpd.process_id |
| | | AND c.order_sort = odpd.order_number |
| | | AND c.technology_number = odpd.technology_number |
| | | WHERE |
| | | position(#{selectProcesses} IN odpd.process ) and odpds.reporting_work_num_count is not null |
| | | GROUP BY |
| | | odpd.process_id, |
| | | odpd.order_number, |
| | | odpd.technology_number, |
| | | odpd.process |
| | | |
| | | ) as d |
| | | on d.process_id=fc.process_id and d.order_number=fc.order_number and d.technology_number=fc.technology_number |
| | | and position(#{selectProcesses} in d.process) |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 |
| | | and d.numCounts +d.patchNumSum - d.numCount - d.broken_num != 0 |
| | | and d.process!=SUBSTRING_INDEX(ogd.process, '->', 1) |
| | | and position(#{selectProcesses} in d.process) |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | group by fc.process_id, fc.order_number, fc.technology_number,odpd.process |
| | | |
| | | group by fc.process_id, fc.order_number, fc.technology_number,d.process |
| | | ) as aa |
| | | |
| | | </select> |
| | |
| | | </select> |
| | | |
| | | <select id="workInProgressMpdataList1" resultMap="workInProgressMap"> |
| | | select if(#{selectProcesses}='',odpd.process,#{selectProcesses}) as thisProcess, |
| | | select if(#{selectProcesses}='',d.process,#{selectProcesses}) as thisProcess, |
| | | fc.process_id, |
| | | o.customer_name, |
| | | o.project, |
| | |
| | | od.quantity, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num as stockNum, |
| | | d.numCounts + d.patchNumSum - d.numCount -d.broken_num as stockNum, |
| | | ROUND(ogd.child_width * ogd.child_height * |
| | | (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num) / 1000000, 2) as stockArea, |
| | | (d.numCounts + d.patchNumSum - d.numCount - |
| | | d.broken_num) / 1000000, 2) as stockArea, |
| | | od.product_name, |
| | | od.bend_radius, |
| | | ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber |
| | | -- , |
| | | -- rws.teams_groups_name |
| | | |
| | | from sd.order_detail AS od |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON od.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_process_detail as odpds |
| | | ON odpds.id = odpd.id - 1 |
| | | left join |
| | | (SELECT sum(rw.rework_num) as 'patchNumSum', |
| | | left join ( |
| | | SELECT |
| | | odpd.process, |
| | | odpd.process_id, |
| | | odpd.order_number, |
| | | odpd.technology_number, |
| | | odpds.reporting_work_num_count as numCounts, |
| | | ifnull( c.patchNumSum, 0 ) as patchNumSum, |
| | | odpd.reporting_work_num_count as numCount, |
| | | odpd.broken_num |
| | | FROM |
| | | sd.order_process_detail AS odpd |
| | | LEFT JOIN sd.order_process_detail AS odpds ON odpds.id = odpd.id - 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | sum( rw.rework_num ) 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(#{selectProcesses} in rwk.this_process) |
| | | and rw.review_status >= 0 |
| | | GROUP BY rw.process_id, rw.order_sort, rw.technology_number) as c |
| | | on c.process_id = fc.process_id |
| | | and c.order_sort = fc.order_number |
| | | and c.technology_number = fc.technology_number |
| | | left join sd.`order` as o |
| | | on o.order_id = od.order_id |
| | | FROM |
| | | pp.rework AS rw |
| | | LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE |
| | | position( #{selectProcesses} IN rwk.this_process ) |
| | | AND rw.review_status >= 0 |
| | | GROUP BY |
| | | rw.process_id, |
| | | rw.order_sort, |
| | | rw.technology_number |
| | | ) AS c ON c.process_id = odpd.process_id |
| | | AND c.order_sort = odpd.order_number |
| | | AND c.technology_number = odpd.technology_number |
| | | WHERE |
| | | position(#{selectProcesses} IN odpd.process ) and odpds.reporting_work_num_count is not null |
| | | GROUP BY |
| | | odpd.process_id, |
| | | odpd.order_number, |
| | | odpd.technology_number, |
| | | odpd.process |
| | | |
| | | ) as d |
| | | on d.process_id=fc.process_id and d.order_number=fc.order_number and d.technology_number=fc.technology_number |
| | | and position(#{selectProcesses} in d.process) |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 and odpd.process!=SUBSTRING_INDEX(ogd.process, '->', 1) |
| | | and position(#{selectProcesses} in odpd.process) |
| | | and d.numCounts +d.patchNumSum - d.numCount - d.broken_num != 0 |
| | | and d.process!=SUBSTRING_INDEX(ogd.process, '->', 1) |
| | | and position(#{selectProcesses} in d.process) |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | |
| | | <if test="workInProgressDTO.glassNumber != null and workInProgressDTO.glassNumber != ''"> |
| | | and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{workInProgressDTO.glassNumber} |
| | | </if> |
| | | group by fc.process_id, fc.order_number, fc.technology_number,odpd.process |
| | | group by fc.process_id, fc.order_number, fc.technology_number,d.process |
| | | order by fc.process_id, fc.order_number, fc.technology_number |
| | | limit #{offset},#{pageSize}; |
| | | </select> |