From ac79dfd8d661dbe166553ff80fbdbfee64e8134e Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 28 四月 2026 16:02:20 +0800
Subject: [PATCH] feat(production): 添加工序ID字段支持

---
 src/main/resources/mapper/production/ProductionProductMainMapper.xml |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index 90c9fcc..7e16334 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -51,8 +51,11 @@
             <if test="c.auditStatus != null">
                 and ppm.audit_status = #{c.auditStatus}
             </if>
+            <if test="c.workOrderId != null">
+                and ppm.work_order_id = #{c.workOrderId}
+            </if>
         </where>
-        order by ppm.id
+        order by  ppm.id desc
 
     </select>
     <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder">
@@ -74,7 +77,13 @@
         slpa.process,
         ppo.quantity,
         slpa.work_hours,
-        slpa.work_hours * slpa.finished_num AS wages
+        slpa.work_hours * slpa.finished_num AS wages,
+        ppm.device_name,
+        ppm.device_id,
+        IFNULL(
+        TIMESTAMPDIFF(MINUTE, ppm.start_time, ppm.end_time),
+        0
+        ) AS work_minutes
         FROM
         production_product_main ppm
         LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id
@@ -85,7 +94,7 @@
         LEFT JOIN product_model pm ON po.product_model_id = pm.id
         LEFT JOIN product p ON p.id = pm.product_id
         LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id
-        <where>
+        where ppm.audit_status = 1
             <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''">
                 and slpa.scheduling_user_name = #{ew.schedulingUserName}
             </if>
@@ -97,7 +106,6 @@
                 and slpa.scheduling_date >= #{ew.entryDateStart}
                 and slpa.scheduling_date &lt; date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY)
             </if>
-        </where>
     </select>
     <select id="listMain" resultType="java.lang.Long">
         SELECT ppm.id FROM production_product_main ppm

--
Gitblit v1.9.3