From 763d7cf2f4aed4d21921e08d05b7b121c24ce136 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 21 十一月 2025 07:39:54 +0800
Subject: [PATCH] 解决报工查询班组带括号无法筛选问题

---
 north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml |  163 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 160 insertions(+), 3 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml b/north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml
index 488e0dd..97a9760 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml
@@ -47,6 +47,84 @@
         <where>
             date(r.create_time)>=#{startDate} and date(r.create_time) &lt;= #{endDate}
             and o.create_order>0
+            <if test="rework.reworkId != null and rework.reworkId != ''">
+                and r.rework_id regexp #{rework.reworkId}
+            </if>
+            <if test="rework.reworkTeam != null and rework.reworkTeam != ''">
+                and r.rework_team regexp #{rework.reworkTeam}
+            </if>
+            <if test="rework.orderId != null and rework.orderId != ''">
+                and r.order_id regexp #{rework.orderId}
+            </if>
+            <if test="rework.reportingWorkId != null and rework.reportingWorkId != ''">
+                and r.reporting_work_id regexp #{rework.reportingWorkId}
+            </if>
+            <if test="rework.processId != null and rework.processId != ''">
+                and r.process_id regexp #{rework.processId}
+            </if>
+            <if test="rework.project != null and rework.project != ''">
+                and o.project regexp #{rework.project}
+            </if>
+            <if test="rework.batch != null and rework.batch != ''">
+                and o.batch regexp #{rework.batch}
+            </if>
+            <if test="rework.orderSort != null and rework.orderSort != ''">
+                and r.order_sort regexp #{rework.orderSort}
+            </if>
+            <if test="rework.buildingNumber != null and rework.buildingNumber != ''">
+                and od.building_number regexp #{rework.buildingNumber}
+            </if>
+            <if test="rework.productName != null and rework.productName != ''">
+                and od.product_name regexp #{rework.productName}
+            </if>
+            <if test="rework.technologyNumber != null and rework.technologyNumber != ''">
+                and r.technology_number regexp #{rework.technologyNumber}
+            </if>
+            <if test="rework.qualityInspector != null and rework.qualityInspector != ''">
+                and r.quality_inspector regexp #{rework.qualityInspector}
+            </if>
+            <if test="rework.width != null and rework.width != ''">
+                and od.width regexp #{rework.width}
+            </if>
+            <if test="rework.height != null and rework.height != ''">
+                and od.height regexp #{rework.height}
+            </if>
+            <if test="rework.shape != null and rework.shape != ''">
+                and od.shape regexp #{rework.shape}
+            </if>
+            <if test="rework.reworkNum != null and rework.reworkNum != ''">
+                and r.rework_num regexp #{rework.reworkNum}
+            </if>
+            <if test="rework.glassAddress != null and rework.glassAddress != ''">
+                and ogd.glass_address regexp #{rework.glassAddress}
+            </if>
+            <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''">
+                and r.responsible_team regexp #{rework.responsibleTeam}
+            </if>
+            <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''">
+                and r.responsible_equipment regexp #{rework.responsibleEquipment}
+            </if>
+            <if test="rework.responsiblePersonnel != null and rework.responsiblePersonnel != ''">
+                and r.responsible_personnel regexp #{rework.responsiblePersonnel}
+            </if>
+            <if test="rework.reworkType != null and rework.reworkType != ''">
+                and r.rework_type regexp #{rework.reworkType}
+            </if>
+            <if test="rework.reworkReason != null and rework.reworkReason != ''">
+                and r.rework_reason regexp #{rework.reworkReason}
+            </if>
+            <if test="rework.reworkArea != null and rework.reworkArea != ''">
+                and r.rework_area regexp #{rework.reworkArea}
+            </if>
+            <if test="rework.qualityInspector != null and rework.qualityInspector != ''">
+                and r.quality_inspector regexp #{rework.qualityInspector}
+            </if>
+            <if test="rework.reworkProcesses != null and rework.reworkProcesses != ''">
+                and r.rework_processes regexp #{rework.reworkProcesses}
+            </if>
+            <if test="rework.reviewer != null and rework.reviewer != ''">
+                and r.reviewer regexp #{rework.reviewer}
+            </if>
         </where>
          order by r.review_status,r.id desc limit #{offset},#{pageSize};
     </select>
@@ -63,9 +141,86 @@
         <where>
             date(r.create_time)>=#{startDate} and date(r.create_time) &lt;= #{endDate}
             and o.create_order>0
+            <if test="rework.reworkId != null and rework.reworkId != ''">
+                and r.rework_id regexp #{rework.reworkId}
+            </if>
+            <if test="rework.reworkTeam != null and rework.reworkTeam != ''">
+                and r.rework_team regexp #{rework.reworkTeam}
+            </if>
+            <if test="rework.orderId != null and rework.orderId != ''">
+                and r.order_id regexp #{rework.orderId}
+            </if>
+            <if test="rework.reportingWorkId != null and rework.reportingWorkId != ''">
+                and r.reporting_work_id regexp #{rework.reportingWorkId}
+            </if>
+            <if test="rework.processId != null and rework.processId != ''">
+                and r.process_id regexp #{rework.processId}
+            </if>
+            <if test="rework.project != null and rework.project != ''">
+                and o.project regexp #{rework.project}
+            </if>
+            <if test="rework.batch != null and rework.batch != ''">
+                and o.batch regexp #{rework.batch}
+            </if>
+            <if test="rework.orderSort != null and rework.orderSort != ''">
+                and r.order_sort regexp #{rework.orderSort}
+            </if>
+            <if test="rework.buildingNumber != null and rework.buildingNumber != ''">
+                and od.building_number regexp #{rework.buildingNumber}
+            </if>
+            <if test="rework.productName != null and rework.productName != ''">
+                and od.product_name regexp #{rework.productName}
+            </if>
+            <if test="rework.technologyNumber != null and rework.technologyNumber != ''">
+                and r.technology_number regexp #{rework.technologyNumber}
+            </if>
+            <if test="rework.qualityInspector != null and rework.qualityInspector != ''">
+                and r.quality_inspector regexp #{rework.qualityInspector}
+            </if>
+            <if test="rework.width != null and rework.width != ''">
+                and od.width regexp #{rework.width}
+            </if>
+            <if test="rework.height != null and rework.height != ''">
+                and od.height regexp #{rework.height}
+            </if>
+            <if test="rework.shape != null and rework.shape != ''">
+                and od.shape regexp #{rework.shape}
+            </if>
+            <if test="rework.reworkNum != null and rework.reworkNum != ''">
+                and r.rework_num regexp #{rework.reworkNum}
+            </if>
+            <if test="rework.glassAddress != null and rework.glassAddress != ''">
+                and ogd.glass_address regexp #{rework.glassAddress}
+            </if>
+            <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''">
+                and r.responsible_team regexp #{rework.responsibleTeam}
+            </if>
+            <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''">
+                and r.responsible_equipment regexp #{rework.responsibleEquipment}
+            </if>
+            <if test="rework.responsiblePersonnel != null and rework.responsiblePersonnel != ''">
+                and r.responsible_personnel regexp #{rework.responsiblePersonnel}
+            </if>
+            <if test="rework.reworkType != null and rework.reworkType != ''">
+                and r.rework_type regexp #{rework.reworkType}
+            </if>
+            <if test="rework.reworkReason != null and rework.reworkReason != ''">
+                and r.rework_reason regexp #{rework.reworkReason}
+            </if>
+            <if test="rework.reworkArea != null and rework.reworkArea != ''">
+                and r.rework_area regexp #{rework.reworkArea}
+            </if>
+            <if test="rework.qualityInspector != null and rework.qualityInspector != ''">
+                and r.quality_inspector regexp #{rework.qualityInspector}
+            </if>
+            <if test="rework.reworkProcesses != null and rework.reworkProcesses != ''">
+                and r.rework_processes regexp #{rework.reworkProcesses}
+            </if>
+            <if test="rework.reviewer != null and rework.reviewer != ''">
+                and r.reviewer regexp #{rework.reviewer}
+            </if>
         </where>
-              ) as zu
-        limit #{offset},#{pageSize};
+        ) as zu;
     </select>
 
     <select id="getSelectRework">
@@ -102,7 +257,8 @@
                  left join (select * from sd.order_glass_detail group by order_id,order_number) as ogd
                            on rw.order_id = ogd.order_id and dd.order_number = ogd.order_number
 
-        where  dd.breakage_quantity-dd.quantity>0 and dd.available=1 and o.create_order>0 order by dd.id desc
+        where  dd.breakage_quantity-dd.quantity>0 and dd.available=1 and o.create_order>0 and  rw.reviewed_state>=0
+        order by dd.id desc
     </select>
 
 
@@ -140,6 +296,7 @@
     <update id="updateReworkDdMp">
         update pp.damage_details set patch_status=0,quantity=quantity-#{reworkNum}
         where reporting_work_id=#{reportingWorkId} and order_number=#{orderSort} and technology_number=#{technologyNumber}
+              and breakage_type=#{reworkType} and breakage_reason=#{reworkReason}
     </update>
 
     <update id="updateReworkBgMp">

--
Gitblit v1.8.0