From 6c82f16f44cf9e51d0fae9593fdefe4c43cb5e55 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 06 五月 2026 15:38:38 +0800
Subject: [PATCH] feat:1.生产追溯(订单-工单-报工-质检) 2.订单工序数据查询 3.领料退料调整
---
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 67 +++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 0ccb06f..577bcfd 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -29,7 +29,8 @@
pm.model as model,
pm.unit as unit,
poro.operation_name as operationName,
- ROUND(pot.complete_quantity / pot.plan_quantity * 100, 2) AS completionStatus,
+ IFNULL(scrapStat.scrapQty, 0) AS scrapQty,
+ ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus,
CASE
WHEN pot.work_order_no LIKE 'FG%' THEN '杩斿伐杩斾慨'
ELSE '姝e父'
@@ -39,9 +40,19 @@
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>
<if test="c != null and c.id != null">
and pot.id = #{c.id}
+ </if>
+ <if test="c != null and c.npsNo != null">
+ and po.nps_no like concat('%', #{c.npsNo}, '%')
</if>
<if test="c != null and c.productionOrderId != null">
and pot.production_order_id = #{c.productionOrderId}
@@ -145,4 +156,58 @@
WHERE pot.id = #{id}
</select>
+ <select id="getOperation" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo">
+ select poro.operation_name as operationName,
+ count(pot.id) as productionTaskCount,
+ sum(ifnull(pot.plan_quantity, 0)) as planQuantity,
+ sum(ifnull(pot.complete_quantity, 0)) as completeQuantity,
+ sum(ifnull(pot.complete_quantity, 0)) as goodQuantity,
+ sum(ifnull(outputStat.scrapQty, 0)) as scrapQty,
+ round(
+ case
+ when sum(ifnull(pot.plan_quantity, 0)) = 0 then 0
+ else (sum(ifnull(pot.complete_quantity, 0)) + sum(ifnull(outputStat.scrapQty, 0)))
+ / sum(ifnull(pot.plan_quantity, 0)) * 100
+ end,
+ 2
+ ) as completionStatus
+ from production_operation_task pot
+ left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.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
+ ) outputStat on outputStat.taskId = pot.id
+ <where>
+ <if test="c != null and c.startDate != null">
+ and date(pot.create_time) >= #{c.startDate}
+ </if>
+ <if test="c != null and c.endDate != null">
+ and date(pot.create_time) <= #{c.endDate}
+ </if>
+ <if test="c != null and c.planStartTime != null">
+ and pot.plan_start_time >= #{c.planStartTime}
+ </if>
+ <if test="c != null and c.planEndTime != null">
+ and pot.plan_end_time <= #{c.planEndTime}
+ </if>
+ <if test="c != null and c.productionOrderId != null">
+ and pot.production_order_id = #{c.productionOrderId}
+ </if>
+ <if test="c != null and c.productionOrderRoutingOperationId != null">
+ and pot.production_order_routing_operation_id = #{c.productionOrderRoutingOperationId}
+ </if>
+ <if test="c != null and c.status != null">
+ and pot.status = #{c.status}
+ </if>
+ <if test="c != null and c.processName != null and c.processName != ''">
+ and poro.operation_name like concat('%', #{c.processName}, '%')
+ </if>
+ </where>
+ group by poro.operation_name
+ order by min(poro.drag_sort), poro.operation_name
+ </select>
+
</mapper>
--
Gitblit v1.9.3