| | |
| | | order by min(poro.drag_sort), poro.operation_name |
| | | </select> |
| | | |
| | | <select id="listByOrderId" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo"> |
| | | select pot.id, |
| | | pot.work_order_no, |
| | | pot.plan_start_time as planStartTime, |
| | | pot.plan_end_time as planEndTime, |
| | | pot.actual_start_time as actualStartTime, |
| | | pot.actual_end_time as actualEndTime, |
| | | pot.status, |
| | | pot.production_order_id as productionOrderId, |
| | | pot.plan_quantity as planQuantity, |
| | | pot.complete_quantity as completeQuantity, |
| | | po.nps_no as npsNo, |
| | | po.is_end_order as endOrder, |
| | | p.product_name as productName, |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | poro.operation_name as operationName, |
| | | poro.type as type, |
| | | case when pot.work_order_no like 'FG%' then '返工返修' else '正常' end as workOrderType, |
| | | ifnull(scrapStat.scrapQty, 0) as scrapQty, |
| | | round(ifnull(pot.complete_quantity, 0) / nullif(pot.plan_quantity, 0) * 100, 2) as completionStatus |
| | | from production_operation_task pot |
| | | left join production_order po on pot.production_order_id = po.id |
| | | left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id |
| | | left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id) |
| | | left join product p on pm.product_id = p.id |
| | | left join ( |
| | | select ppm.production_operation_task_id as taskId, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapQty |
| | | from production_product_main ppm |
| | | left join production_product_output ppo on ppo.production_product_main_id = ppm.id |
| | | group by ppm.production_operation_task_id |
| | | ) scrapStat on scrapStat.taskId = pot.id |
| | | where pot.production_order_id = #{orderId} |
| | | order by pot.id desc |
| | | </select> |
| | | |
| | | </mapper> |