From 711a9201dfcb8fe8d445a6cf940bc7e4a9182e9d Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 02 四月 2026 15:34:39 +0800
Subject: [PATCH] feat: 首页-计划与生产趋势

---
 src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
index 4205a15..e86b7d2 100644
--- a/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
+++ b/src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -58,6 +58,9 @@
         <if test="c.model != null and c.model != '' ">
             AND pms.model LIKE CONCAT('%',#{c.model},'%')
         </if>
+         <if test="c.status != null">
+            AND pp.status =#{c.status}
+        </if>
         <if test="c.applyNo != null and c.applyNo != '' ">
             AND pp.apply_no LIKE CONCAT('%',#{c.applyNo},'%')
         </if>
@@ -80,13 +83,14 @@
         pp.height,
         pm.unit AS unit,
         COALESCE(SUM(pp.quantity),0) AS quantity,
-        COALESCE(SUM(pp.volume),0) AS volume
+        COALESCE(SUM(pp.volume-pp.assigned_quantity),0) AS volume
         FROM production_plan pp
         LEFT JOIN product_material_sku sku
         ON pp.product_material_sku_id = sku.id
         LEFT JOIN product_material pm
         ON sku.product_id = pm.id
-        <where>
+        where
+            pp.status!=2
             <if test="materialCode != null and materialCode != ''">
                 AND sku.material_code LIKE CONCAT('%', #{materialCode}, '%')
             </if>
@@ -98,7 +102,6 @@
             <if test="model != null and model != ''">
                 AND sku.model LIKE CONCAT('%', #{model}, '%')
             </if>
-        </where>
         GROUP BY
         sku.material_code,
         pm.product_name,
@@ -125,4 +128,18 @@
         </foreach>
         ORDER BY pp.id ASC
     </select>
-</mapper>
\ No newline at end of file
+    <select id="selectProductionPlanDtoById"
+            resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">
+        SELECT
+            pp.*,
+            pms.material_code AS materialCode,
+            pms.model,
+            pms.product_id AS productMaterialId,
+            pm.product_name AS productName,
+            pm.unit
+        FROM production_plan pp
+                 left join product_material_sku pms on pp.product_material_sku_id = pms.id
+                 left join product_material pm on pms.product_id = pm.id
+        WHERE  pp.id = #{productionPlanId}
+    </select>
+</mapper>

--
Gitblit v1.9.3