From d096516873552404eac98ee7c1d37490af9e8340 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 14 九月 2026 11:00:46 +0800
Subject: [PATCH] feat(home): 添加工序颜色支持功能
---
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 41 +++++++++++++++++++++++++++++++++++------
1 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 199eb21..b013abc 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -30,7 +30,9 @@
pm.unit as unit,
poro.operation_name as operationName,
poro.type as type,
+ topo.color as operationColor,
IFNULL(scrapStat.scrapQty, 0) AS scrapQty,
+ CASE WHEN pickStat.pickCount > 0 THEN 1 ELSE 0 END AS picked,
ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus,
CASE
WHEN pot.work_order_no LIKE 'FG%' THEN '杩斿伐杩斾慨'
@@ -41,6 +43,13 @@
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 technology_operation topo on poro.technology_operation_id = topo.id
+ left join (
+ select count(1) as pickCount, pop.production_order_id, pop.technology_operation_id
+ from production_order_pick pop
+ group by pop.production_order_id, pop.technology_operation_id
+ ) pickStat on pickStat.production_order_id = pot.production_order_id
+ and pickStat.technology_operation_id = poro.technology_operation_id
left join (
select ppm.production_operation_task_id as taskId,
sum(ifnull(ppo.scrap_qty, 0)) as scrapQty
@@ -71,7 +80,7 @@
and pot.work_order_no like concat('%', #{c.workOrderNo}, '%')
</if>
</where>
- order by pot.id desc
+ order by pot.work_order_no desc
</select>
<select id="selectTaskStatisticsByDate" resultType="com.ruoyi.home.dto.ProductionTaskStatisticsDto">
@@ -87,10 +96,12 @@
p.product_name as productName,
pm.model,
pm.unit,
- po.nps_no as productOrderNpsNo
+ po.nps_no as productOrderNpsNo,
+ topo.color as processColor
from production_operation_task pot
left join production_order po on pot.production_order_id = po.id
left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
+ left join technology_operation topo on poro.technology_operation_id = topo.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
where date(pot.create_time) between #{startDate} and #{endDate}
@@ -110,7 +121,7 @@
select poro.operation_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
+ sum(greatest(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0), 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
@@ -123,9 +134,9 @@
<if test="endDateTime != null">
and ppo.create_time <= #{endDateTime}
</if>
- <if test="userId != null">
- and ppm.create_user = #{userId}
- </if>
+<!-- <if test="userId != null">-->
+<!-- and ppm.create_user = #{userId}-->
+<!-- </if>-->
<if test="processIds != null and processIds.size() > 0">
and poro.technology_operation_id in
<foreach collection="processIds" item="id" open="(" separator="," close=")">
@@ -163,6 +174,7 @@
<select id="getOperation" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo">
select poro.operation_name as operationName,
max(poro.type) as type,
+ max(topo.color) as operationColor,
count(pot.id) as productionTaskCount,
sum(ifnull(pot.plan_quantity, 0)) as planQuantity,
sum(ifnull(pot.complete_quantity, 0)) as completeQuantity,
@@ -178,6 +190,7 @@
) 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 technology_operation topo on poro.technology_operation_id = topo.id
left join (
select ppm.production_operation_task_id as taskId,
sum(ifnull(ppo.scrap_qty, 0)) as scrapQty
@@ -215,4 +228,20 @@
order by min(poro.drag_sort), poro.operation_name
</select>
+ <select id="listProcessStatusByOrderIds" resultType="com.ruoyi.production.bean.vo.ProductionOrderProcessTaskVo">
+ select pot.production_order_id as productionOrderId,
+ poro.operation_name as operationName,
+ topo.color as operationColor,
+ ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 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 technology_operation topo on poro.technology_operation_id = topo.id
+ where pot.production_order_id in
+ <foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
+ #{orderId}
+ </foreach>
+ order by pot.production_order_id, poro.drag_sort asc, pot.id asc
+ </select>
+
</mapper>
--
Gitblit v1.9.3