From c2ad2126d6f8423e0a5e6e20bbb91ef6bb1cffc0 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期一, 25 五月 2026 13:26:27 +0800
Subject: [PATCH] fix(approve): 修复审批流程为空时的异常处理
---
src/main/resources/mapper/production/ProductionProductMainMapper.xml | 93 ++++++++--------------------------------------
1 files changed, 16 insertions(+), 77 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index 3c3dbca..ff9f34e 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -71,6 +71,14 @@
left join sales_ledger sl on sl.id = po.sales_ledger_id
left join sys_user u on u.user_id = ppm.user_id
<where>
+ and ppm.status = 1
+ and ifnull(ppo.quantity, 0) > 0
+ <if test="c.workOrderIds != null and c.workOrderIds.size() > 0">
+ and ppm.work_order_id in
+ <foreach collection="c.workOrderIds" item="workOrderId" open="(" separator="," close=")">
+ #{workOrderId}
+ </foreach>
+ </if>
<if test="c.nickName != null and c.nickName != ''">
and u.nick_name like concat('%',#{c.nickName},'%')
</if>
@@ -89,83 +97,6 @@
</where>
group by ppm.work_order_id, po.sales_ledger_id, po.sale_ledger_product_id, ppm.user_id
order by max(ppm.id) desc
- </select>
-
- <select id="listPageProductionProductMainDailyDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto">
- select
- min(ppm.id) as id,
- min(ppm.product_no) as productNo,
- d.user_id as userId,
- d.work_order_id as workOrderId,
- max(pwo.work_order_no) as workOrderNo,
- max(po.nps_no) as productOrderNpsNo,
- max(pwo.status) as workOrderStatus,
- max(u.nick_name) as nickName,
- max(p.product_name) as productName,
- max(CASE pp.type
- WHEN 1 THEN '鍔犲伐'
- WHEN 2 THEN '鍒澘鍐疯姱鍒朵綔'
- WHEN 3 THEN '绠¤矾缁勫'
- WHEN 4 THEN '缃愪綋杩炴帴鍙婅皟璇�'
- WHEN 5 THEN '娴嬭瘯鎵撳帇'
- WHEN 6 THEN '鍏朵粬'
- ELSE pp.name
- END) as process,
- max(pm.model) as productModelName,
- max(pm.unit) as unit,
- max(sl.sales_contract_no) as salesContractNo,
- d.report_date as schedulingDate,
- sum(d.duration_minutes) as reportDurationMinutes,
- round(sum(d.duration_minutes) / 60, 2) as dailyPersonHours,
- round(sum(d.duration_minutes) / 60, 2) as actualReportHours,
- sum(ifnull(ppo.quantity, 0)) as quantity,
- sum(ifnull(ppo.scrap_qty, 0)) as scrapQty,
- sum(ifnull(ppo.quantity, 0)) as outputTotalQuantity,
- sum(ifnull(ppo.scrap_qty, 0)) as scrapTotalQuantity,
- round(ifnull((
- select sum(ifnull(pri.planned_work_hours, 0))
- from product_process_route_item pri
- where pri.product_order_id = po.id
- ), 0), 2) as projectTotalHours,
- ifnull(max(pp.salary_quota), 0) as processStandardHours
- from production_product_report_daily d
- left join production_product_main ppm on ppm.id = d.product_main_id
- left join product_work_order pwo on pwo.id = d.work_order_id
- left join product_process_route_item ppri on ppri.id = pwo.product_process_route_item_id
- left join product_process pp on pp.id = ppri.process_id
- left join product_order po on po.id = pwo.product_order_id
- left join production_product_output ppo
- on ppm.id = ppo.product_main_id
- and date(ppm.report_end_time) = d.report_date
- left join product_model pm on pm.id = ppo.product_model_id
- left join product p on p.id = pm.product_id
- left join sales_ledger sl on sl.id = po.sales_ledger_id
- left join sys_user u on u.user_id = d.user_id
- <where>
- <if test="c.workOrderId != null">
- and d.work_order_id = #{c.workOrderId}
- </if>
- <if test="c.nickName != null and c.nickName != ''">
- and u.nick_name like concat('%',#{c.nickName},'%')
- </if>
- <if test="c.workOrderNo != null and c.workOrderNo != ''">
- and pwo.work_order_no like concat('%',#{c.workOrderNo},'%')
- </if>
- <if test="c.workOrderStatus != null and c.workOrderStatus != ''">
- and pwo.status = #{c.workOrderStatus}
- </if>
- <if test="c.userId != null">
- and d.user_id = #{c.userId}
- </if>
- <if test="c.startDate != null">
- and d.report_date <![CDATA[ >= ]]> #{c.startDate}
- </if>
- <if test="c.endDate != null">
- and d.report_date <![CDATA[ <= ]]> #{c.endDate}
- </if>
- </where>
- group by d.work_order_id, d.user_id, d.report_date, po.sales_ledger_id, po.sale_ledger_product_id
- order by d.report_date desc, d.user_id
</select>
<select id="listPageProductionProductMainDetailDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto">
@@ -216,6 +147,14 @@
left join sales_ledger sl on sl.id = po.sales_ledger_id
left join sys_user u on u.user_id = ppm.user_id
<where>
+ and ppm.status = 1
+ and ifnull(ppo.quantity, 0) > 0
+ <if test="c.workOrderIds != null and c.workOrderIds.size() > 0">
+ and ppm.work_order_id in
+ <foreach collection="c.workOrderIds" item="workOrderId" open="(" separator="," close=")">
+ #{workOrderId}
+ </foreach>
+ </if>
<if test="c.workOrderId != null">
and ppm.work_order_id = #{c.workOrderId}
</if>
--
Gitblit v1.9.3