From 2ab6b6860e4f7bee67a0f66831b9b1fb0f420710 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 22 四月 2026 10:45:01 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro

---
 src/main/resources/mapper/production/ProductionOperationTaskMapper.xml |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 5b67bf6..5a40417 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -21,4 +21,68 @@
         <result column="dept_id" property="deptId" />
     </resultMap>
 
+    <select id="selectTaskStatisticsByDate" resultType="com.ruoyi.home.dto.ProductionTaskStatisticsDto">
+        select pot.id,
+               pot.work_order_no,
+               pot.plan_start_time as planStartTime,
+               pot.plan_end_time as planEndTime,
+               pot.actual_start_time as actualStartTime,
+               pot.actual_end_time as actualEndTime,
+               pot.plan_quantity as planQuantity,
+               ifnull(pot.complete_quantity, 0) as completeQuantity,
+               top2.name as processName,
+               p.product_name as productName,
+               pm.model,
+               pm.unit,
+               po.nps_no as productOrderNpsNo
+        from production_operation_task pot
+                 left join production_order po on pot.production_order_id = po.id
+                 left join product_model pm on po.product_model_id = pm.id
+                 left join product p on pm.product_id = p.id
+                 left join technology_routing_operation tro on pot.technology_routing_operation_id = tro.id
+                 left join technology_operation top2 on tro.technology_operation_id = top2.id
+        where date(pot.create_time) between #{startDate} and #{endDate}
+        order by pot.create_time desc
+    </select>
+
+    <select id="selectTaskStartStats" resultType="com.ruoyi.home.dto.ProductionTaskStatisticsDto">
+        select id,
+               actual_start_time as actualStartTime,
+               plan_quantity as planQuantity
+        from production_operation_task
+        where actual_start_time &gt;= #{startDateTime}
+          and actual_start_time &lt;= #{endDateTime}
+    </select>
+
+    <select id="calculateProductionStatistics" resultType="com.ruoyi.home.dto.processDataProductionStatisticsDto">
+        select top2.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
+        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
+                 inner join technology_routing_operation tro on pot.technology_routing_operation_id = tro.id
+                 inner join technology_operation top2 on tro.technology_operation_id = top2.id
+                 left join production_product_input ppi on ppi.production_product_main_id = ppm.id
+        <where>
+            <if test="startDateTime != null">
+                and ppo.create_time &gt;= #{startDateTime}
+            </if>
+            <if test="endDateTime != null">
+                and ppo.create_time &lt;= #{endDateTime}
+            </if>
+            <if test="userId != null">
+                and ppm.create_user = #{userId}
+            </if>
+            <if test="processIds != null and processIds.size() > 0">
+                and top2.id in
+                <foreach collection="processIds" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        group by top2.id, top2.name
+    </select>
+
 </mapper>

--
Gitblit v1.9.3