From f00a59b4f30accf2b23ae0d58fac23d966a48d24 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 13 六月 2026 20:11:51 +0800
Subject: [PATCH] fix: 优化生产订单查询
---
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 199eb21..c872103 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -110,7 +110,7 @@
select poro.operation_name as processName,
sum(ifnull(ppi.input_quantity, 0)) as totalInput,
sum(ifnull(ppo.scrap_qty, 0)) as totalScrap,
- sum(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0)) as totalOutput
+ sum(greatest(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0), 0)) as totalOutput
from production_product_output ppo
inner join production_product_main ppm on ppo.production_product_main_id = ppm.id
inner join production_operation_task pot on ppm.production_operation_task_id = pot.id
@@ -123,9 +123,9 @@
<if test="endDateTime != null">
and ppo.create_time <= #{endDateTime}
</if>
- <if test="userId != null">
- and ppm.create_user = #{userId}
- </if>
+<!-- <if test="userId != null">-->
+<!-- and ppm.create_user = #{userId}-->
+<!-- </if>-->
<if test="processIds != null and processIds.size() > 0">
and poro.technology_operation_id in
<foreach collection="processIds" item="id" open="(" separator="," close=")">
@@ -215,4 +215,18 @@
order by min(poro.drag_sort), poro.operation_name
</select>
+ <select id="listProcessStatusByOrderIds" resultType="com.ruoyi.production.bean.vo.ProductionOrderProcessTaskVo">
+ select pot.production_order_id as productionOrderId,
+ poro.operation_name as operationName,
+ ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus
+ from production_operation_task pot
+ left join production_order_routing_operation poro
+ on pot.production_order_routing_operation_id = poro.id
+ where pot.production_order_id in
+ <foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
+ #{orderId}
+ </foreach>
+ order by pot.production_order_id, poro.drag_sort asc, pot.id asc
+ </select>
+
</mapper>
--
Gitblit v1.9.3