From b504b19b0881a7c1bd9e280ba41e993956b7f94e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 30 一月 2026 16:41:56 +0800
Subject: [PATCH] feat: 进销存生产分析大屏
---
src/main/resources/mapper/production/ProductOrderMapper.xml | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index 7fe84fa..4d11daf 100644
--- a/src/main/resources/mapper/production/ProductOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -20,11 +20,14 @@
slp.product_category,
slp.specification_model,
ppr.process_route_code,
- ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus
+ pb.bom_no,
+ ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus,
+ DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff
from product_order po
left join sales_ledger sl on po.sales_ledger_id = sl.id
- left join sales_ledger_product slp on po.product_model_id = slp.id
+ left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id
left join product_process_route ppr on po.id = ppr.product_order_id
+ left join product_bom pb on pb.id = ppr.bom_id
<where>
<if test="c.npsNo != null and c.npsNo != ''">
and po.nps_no like concat('%',#{c.npsNo},'%')
@@ -40,6 +43,9 @@
</if>
<if test="c.specificationModel != null and c.specificationModel != ''">
and slp.specification_model like concat('%',#{c.specificationModel},'%')
+ </if>
+ <if test="c.startTime != null and c.endTime != null">
+ and po.create_time between #{c.startTime} and #{c.endTime}
</if>
</where>
</select>
@@ -61,6 +67,43 @@
left join sales_ledger_product slp on pm.id = slp.product_model_id
where slp.id = #{productModelId}
</select>
+ <select id="listProcessBom" resultType="com.ruoyi.production.dto.ProductStructureDto">
+ select ps.id,
+ ps.product_model_id,
+ ps.process_id,
+ ps.unit_quantity,
+ ps.unit_quantity * po.quantity as demandedQuantity,
+ ps.unit,
+ p.product_name,
+ pp.name as process_name,
+ pm.product_id,
+ pm.model
+ from
+ product_structure ps
+ left join product_model pm on ps.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ left join product_process pp on ps.process_id = pp.id
+ left join product_process_route ppr on ps.bom_id = ppr.bom_id
+ left join product_order po on po.id = ppr.product_order_id
+ where ppr.product_order_id = #{orderId}
+ order by ps.id
+ </select>
+ <select id="countCreated" resultType="java.lang.Integer">
+ SELECT count(1) FROM product_order
+ WHERE create_time >= #{startDate} AND create_time <= #{endDate}
+ </select>
+
+ <select id="countCompleted" resultType="java.lang.Integer">
+ SELECT count(1) FROM product_order
+ WHERE end_time >= #{startDate} AND end_time <= #{endDate}
+ AND complete_quantity >= quantity
+ </select>
+
+ <select id="countPending" resultType="java.lang.Integer">
+ SELECT count(1) FROM product_order
+ WHERE create_time >= #{startDate} AND create_time <= #{endDate}
+ AND complete_quantity < quantity
+ </select>
</mapper>
--
Gitblit v1.9.3