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 |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index c872103..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}
@@ -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
@@ -218,10 +231,12 @@
     <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}

--
Gitblit v1.9.3