| | |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | sl.delivery_date, |
| | | CASE |
| | | WHEN shipping_status_counts.total_count = 0 THEN false |
| | | WHEN shipping_status_counts.unshipped_count = 0 THEN true |
| | | ELSE false |
| | | END AS is_fh |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.product_model_id = slp.id |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_id, |
| | | COUNT(*) as total_count, |
| | | SUM(CASE WHEN status != '已发货' THEN 1 ELSE 0 END) as unshipped_count |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id |
| | | ) shipping_status_counts ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | | left join product_process_route ppr on po.id = ppr.product_order_id |
| | | left join product_bom pb on pb.id = ppr.bom_id |
| | | <where> |
| | |
| | | and po.create_time between #{c.startTime} and #{c.endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="productMainByOrderId" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*, |
| | | pwo.work_order_no, |
| | | pwo.report_work, |
| | | pwo.status, |
| | | pwo.quantity, |
| | | pwo.plan_quantity |
| | | from product_order po |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | where po.id = #{c.id} |
| | | </select> |
| | | <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute"> |
| | | select pr.* |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="countCreated" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE create_time >= #{startDate} AND create_time <= #{endDate} |
| | | </select> |
| | | |
| | | <select id="countCompleted" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE end_time >= #{startDate} AND end_time <= #{endDate} |
| | | AND complete_quantity >= quantity |
| | | </select> |
| | | |
| | | <select id="countPending" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE create_time >= #{startDate} AND create_time <= #{endDate} |
| | | AND complete_quantity < quantity |
| | | </select> |
| | | </mapper> |