| | |
| | | order by max(ppm.id) desc |
| | | </select> |
| | | |
| | | <select id="listPageProductionProductMainDailyDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | select |
| | | min(ppm.id) as id, |
| | | min(ppm.product_no) as productNo, |
| | | d.user_id as userId, |
| | | d.work_order_id as workOrderId, |
| | | max(pwo.work_order_no) as workOrderNo, |
| | | max(po.nps_no) as productOrderNpsNo, |
| | | max(pwo.status) as workOrderStatus, |
| | | max(u.nick_name) as nickName, |
| | | max(p.product_name) as productName, |
| | | max(CASE pp.type |
| | | WHEN 1 THEN '加工' |
| | | WHEN 2 THEN '刮板冷芯制作' |
| | | WHEN 3 THEN '管路组对' |
| | | WHEN 4 THEN '罐体连接及调试' |
| | | WHEN 5 THEN '测试打压' |
| | | WHEN 6 THEN '其他' |
| | | ELSE pp.name |
| | | END) as process, |
| | | max(pm.model) as productModelName, |
| | | max(pm.unit) as unit, |
| | | max(sl.sales_contract_no) as salesContractNo, |
| | | d.report_date as schedulingDate, |
| | | sum(d.duration_minutes) as reportDurationMinutes, |
| | | round(sum(d.duration_minutes) / 60, 2) as dailyPersonHours, |
| | | round(sum(d.duration_minutes) / 60, 2) as actualReportHours, |
| | | sum(ifnull(ppo.quantity, 0)) as quantity, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapQty, |
| | | sum(ifnull(ppo.quantity, 0)) as outputTotalQuantity, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapTotalQuantity, |
| | | round(ifnull(( |
| | | select sum(ifnull(pri.planned_work_hours, 0)) |
| | | from product_process_route_item pri |
| | | where pri.product_order_id = po.id |
| | | ), 0), 2) as projectTotalHours, |
| | | ifnull(max(pp.salary_quota), 0) as processStandardHours |
| | | from production_product_report_daily d |
| | | left join production_product_main ppm on ppm.id = d.product_main_id |
| | | left join product_work_order pwo on pwo.id = d.work_order_id |
| | | left join product_process_route_item ppri on ppri.id = pwo.product_process_route_item_id |
| | | left join product_process pp on pp.id = ppri.process_id |
| | | left join product_order po on po.id = pwo.product_order_id |
| | | left join production_product_output ppo |
| | | on ppm.id = ppo.product_main_id |
| | | and date(ppm.report_end_time) = d.report_date |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = d.user_id |
| | | <where> |
| | | <if test="c.workOrderId != null"> |
| | | and d.work_order_id = #{c.workOrderId} |
| | | </if> |
| | | <if test="c.nickName != null and c.nickName != ''"> |
| | | and u.nick_name like concat('%',#{c.nickName},'%') |
| | | </if> |
| | | <if test="c.workOrderNo != null and c.workOrderNo != ''"> |
| | | and pwo.work_order_no like concat('%',#{c.workOrderNo},'%') |
| | | </if> |
| | | <if test="c.workOrderStatus != null and c.workOrderStatus != ''"> |
| | | and pwo.status = #{c.workOrderStatus} |
| | | </if> |
| | | <if test="c.userId != null"> |
| | | and d.user_id = #{c.userId} |
| | | </if> |
| | | <if test="c.startDate != null"> |
| | | and d.report_date <![CDATA[ >= ]]> #{c.startDate} |
| | | </if> |
| | | <if test="c.endDate != null"> |
| | | and d.report_date <![CDATA[ <= ]]> #{c.endDate} |
| | | </if> |
| | | </where> |
| | | group by d.work_order_id, d.user_id, d.report_date, po.sales_ledger_id, po.sale_ledger_product_id |
| | | order by d.report_date desc, d.user_id |
| | | </select> |
| | | |
| | | <select id="listPageProductionProductMainDetailDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | select |
| | | ppm.*, |