| | |
| | | and date(scheduled_start_time) <= #{date[1]} |
| | | GROUP BY ps.order_id, ps.processes |
| | | </select> |
| | | |
| | | <select id="workInProgressOrderFootSum"> |
| | | SELECT |
| | | SUM(od.quantity) AS quantity, |
| | | SUM(odpds.reporting_work_num_count + IFNULL(c.patchNumSum, 0) - odpd.reporting_work_num_count - odpd.broken_num) AS stockNum, |
| | | SUM(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 |
| | | 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_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 rework AS rw |
| | | LEFT JOIN reporting_work AS rwk |
| | | ON rw.reporting_work_id = rwk.reporting_work_id |
| | | WHERE rwk.this_process = #{selectProcesses} |
| | | 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 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | a.process_id, |
| | | a.teams_groups_name, |
| | | a.next_process, |
| | | b.technology_number, |
| | | b.order_number |
| | | FROM reporting_work AS a |
| | | LEFT JOIN reporting_work_detail AS b |
| | | ON a.reporting_work_id = b.reporting_work_id |
| | | GROUP BY a.process_id, a.teams_groups_name, a.next_process, b.order_number, b.technology_number |
| | | ) AS rws |
| | | ON rws.process_id = fc.process_id |
| | | AND rws.order_number = fc.order_number |
| | | AND rws.technology_number = fc.technology_number |
| | | AND rws.next_process = #{selectProcesses} |
| | | 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 = #{selectProcesses} |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | order by o.order_id, fc.process_id |
| | | </select> |
| | | |
| | | <select id="processToBeCompletedFootSum"> |
| | | SELECT |
| | | SUM(fc.quantity) AS quantity, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height) / 1000000, 2) AS childArea, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * fc.quantity) / 1000000, 2) AS actualArea, |
| | | SUM(odpd.reporting_work_num) AS completeNum, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * odpd.reporting_work_num) / 1000000, 2) AS completeArea, |
| | | SUM(fc.quantity - odpd.reporting_work_num) AS incompleteNum, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * (fc.quantity - odpd.reporting_work_num)) / 1000000, 2) AS incompleteArea |
| | | 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('' IN od.order_id) |
| | | AND POSITION('' IN o.project) |
| | | AND fc.quantity - odpd.reporting_work_num > 0; |
| | | |
| | | </select> |
| | | |
| | | <select id="damageReportFootSum"> |
| | | SELECT |
| | | SUM(dd.breakage_quantity) AS breakageQuantity, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * dd.breakage_quantity) / 1000000, 2) AS area |
| | | FROM |
| | | sd.ORDER AS o |
| | | LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id |
| | | LEFT JOIN reporting_work AS rw ON rw.order_id = o.order_id |
| | | LEFT JOIN damage_details AS dd ON dd.reporting_work_id = rw.reporting_work_id |
| | | AND dd.order_number = ogd.order_number |
| | | AND dd.technology_number = ogd.technology_number |
| | | LEFT JOIN sd.order_detail AS od ON o.order_id = od.order_id |
| | | AND od.order_number = ogd.order_number |
| | | WHERE |
| | | rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | AND dd.available = 0; |
| | | <if test="damageReportDTO.orderId != null and damageReportDTO.orderId != ''"> |
| | | and o.order_id regexp #{damageReportDTO.orderId} |
| | | </if> |
| | | <if test="damageReportDTO.project != null and damageReportDTO.project != ''"> |
| | | and o.project regexp #{damageReportDTO.project} |
| | | </if> |
| | | <if test="damageReportDTO.processId != null and damageReportDTO.processId != ''"> |
| | | and rw.process_id regexp #{damageReportDTO.processId} |
| | | </if> |
| | | <if test="damageReportDTO.orderNumber != null and damageReportDTO.orderNumber != ''"> |
| | | and dd.order_number regexp #{damageReportDTO.orderNumber} |
| | | </if> |
| | | <if test="damageReportDTO.technologyNumber != null and damageReportDTO.technologyNumber != ''"> |
| | | and dd.technology_number regexp #{damageReportDTO.technologyNumber} |
| | | </if> |
| | | <if test="damageReportDTO.responsibleProcess != null and damageReportDTO.responsibleProcess != ''"> |
| | | and dd.responsible_process regexp #{damageReportDTO.responsibleProcess} |
| | | </if> |
| | | <if test="damageReportDTO.responsibleTeam != null and damageReportDTO.responsibleTeam != ''"> |
| | | and dd.responsible_team regexp #{damageReportDTO.responsibleTeam} |
| | | </if> |
| | | <if test="damageReportDTO.responsibleEquipment != null and damageReportDTO.responsibleEquipment != ''"> |
| | | and dd.responsible_equipment regexp #{damageReportDTO.responsibleEquipment} |
| | | </if> |
| | | <if test="damageReportDTO.breakageType != null and damageReportDTO.breakageType != ''"> |
| | | and dd.breakage_type regexp #{damageReportDTO.breakageType} |
| | | </if> |
| | | <if test="damageReportDTO.breakageReason != null and damageReportDTO.breakageReason != ''"> |
| | | and dd.breakage_reason regexp #{damageReportDTO.breakageReason} |
| | | </if> |
| | | <if test="damageReportDTO.glassChild != null and damageReportDTO.glassChild != ''"> |
| | | and ogd.glass_child regexp #{damageReportDTO.glassChild} |
| | | </if> |
| | | <if test="damageReportDTO.glassNumber != null and damageReportDTO.glassNumber != ''"> |
| | | and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{damageReportDTO.glassNumber} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="teamOutputFootSum"> |
| | | select SUM(completed_quantity) as completedQuantity, |
| | | ifnull(SUM(ROUND(width * height * completed_quantity / 1000000, 2)),0) AS area |
| | | from ( |
| | | SELECT |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX( ogd.child_width ) as width, |
| | | MAX( ogd.child_height ) as height, |
| | | rwd.completed_quantity as completed_quantity |
| | | FROM |
| | | reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id |
| | | left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number |
| | | left join sd.order_detail as od on od.order_id=ogd.order_id and od.order_number=ogd.order_number |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 |
| | | AND rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | and position(#{selectProcesses} in rw.this_process) |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{teamOutputDTO.thisProcess} |
| | | </if> |
| | | <if test="teamOutputDTO.teamsGroupsName != null and teamOutputDTO.teamsGroupsName != ''"> |
| | | and rw.teams_groups_name regexp #{teamOutputDTO.teamsGroupsName} |
| | | </if> |
| | | <if test="teamOutputDTO.project != null and teamOutputDTO.project != ''"> |
| | | and o.project regexp #{teamOutputDTO.project} |
| | | </if> |
| | | <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''"> |
| | | and rw.process_id regexp #{teamOutputDTO.processId} |
| | | </if> |
| | | <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''"> |
| | | and od.edging_type regexp #{teamOutputDTO.edgingType} |
| | | </if> |
| | | GROUP BY |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | ORDER BY |
| | | rw.this_process, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rw.reporting_work_time, |
| | | rw.teams_groups_name |
| | | ) as subquery |
| | | </select> |
| | | </mapper> |