| | |
| | | |
| | | SELECT |
| | | slpa.scheduling_user_name, |
| | | SUM(ppout.quantity) AS output_num, |
| | | SUM(COALESCE(prp.quantity, slpa.finished_num)) AS output_num, |
| | | CONCAT( |
| | | ROUND( |
| | | CASE |
| | |
| | | FROM sales_ledger_production_accounting slpa |
| | | LEFT JOIN production_product_main ppm |
| | | ON slpa.product_main_id = ppm.id |
| | | LEFT JOIN production_report_person prp |
| | | ON prp.product_main_id = ppm.id AND prp.user_id = slpa.scheduling_user_id |
| | | LEFT JOIN production_product_output ppout |
| | | ON ppm.id = ppout.product_main_id |
| | | left join device_ledger dl on dl.id = slpa.device_id |
| | |
| | | |
| | | <select id="selectDailyWagesStats" resultType="java.util.Map"> |
| | | SELECT DATE(ppout.create_time) AS dateStr, |
| | | SUM(ppout.quantity - IFNULL(ppout.scrap_qty, 0)) AS numberOfCompleted, |
| | | SUM((ppout.quantity - IFNULL(ppout.scrap_qty, 0)) * IFNULL(pp.salary_quota, 0)) AS amount, |
| | | SUM(ppout.quantity + IFNULL(ppout.add_qty, 0) - IFNULL(ppout.scrap_qty, 0)) AS numberOfCompleted, |
| | | SUM((ppout.quantity + IFNULL(ppout.add_qty, 0) - IFNULL(ppout.scrap_qty, 0)) * IFNULL(pp.salary_quota, 0)) AS amount, |
| | | ROUND( |
| | | SUM(ppout.quantity - IFNULL(ppout.scrap_qty, 0)) * 100 / NULLIF(SUM(ppout.quantity), 0), |
| | | SUM(ppout.quantity + IFNULL(ppout.add_qty, 0) - IFNULL(ppout.scrap_qty, 0)) * 100 / NULLIF(SUM(ppout.quantity), 0), |
| | | 2 |
| | | ) AS passRate |
| | | FROM production_product_output ppout |