From 174cc2a8aa52f00334e0e9a3a0ea91b2e3e7acd3 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 30 十月 2025 16:20:41 +0800
Subject: [PATCH] 修改次破报表翻页汇总不正确问题
---
north-glass-erp/src/main/resources/mapper/pp/Report.xml | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 212 insertions(+), 9 deletions(-)
diff --git a/north-glass-erp/src/main/resources/mapper/pp/Report.xml b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
index bcaf6b1..ddce89e 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/Report.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -274,7 +274,8 @@
rw.this_process,
JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code,
CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id,
- rw.creator
+ rw.creator,
+ rw.reporting_work_id
from
sd.`order` as o left join sd.order_detail as od on o.order_id=od.order_id
left join sd.order_glass_detail as ogd on ogd.order_id=od.order_id and ogd.order_number=od.order_number
@@ -285,7 +286,7 @@
and date(rw.reporting_work_time) <= #{endDate}
and rw.this_worn_quantity > 0
and dd.available = 0
- and reviewed_state != 2
+ and reviewed_state >-1
and rw.this_process != dd.responsible_process
and o.create_order>0
<if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
@@ -321,6 +322,88 @@
<if test="crossProcessBreakingDTO.creator != null and crossProcessBreakingDTO.creator != ''">
and rw.creator regexp #{crossProcessBreakingDTO.creator}
</if>
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{crossProcessBreakingDTO.code}
+ </if>
+ <if test="crossProcessBreakingDTO.reportingWorkId != null and crossProcessBreakingDTO.reportingWorkId != ''">
+ and rw.reporting_work_id regexp #{crossProcessBreakingDTO.reportingWorkId}
+ </if>
+ GROUP BY dd.id
+ order by dd.id desc
+ limit #{offset},#{pageSize}
+ </select>
+
+ <select id="getNotProcessBreaking" resultMap="damageDetailsTableMap">
+ select rw.reporting_work_id,
+ rw.reporting_work_time,
+ dd.responsible_process,
+ dd.responsible_team,
+ dd.breakage_type,
+ dd.breakage_reason,
+ dd.responsible_personnel,
+ ROUND((dd.breakage_quantity)) as breakage_quantity,
+ round(ogd.child_width * ogd.child_height * (dd.breakage_quantity) / 1000000, 2) as area,
+ rw.this_process,
+ o.project,
+ o.order_id,
+ ogd.glass_child,
+ rw.this_process,
+ JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code,
+ CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id,
+ rw.creator,
+ rw.reporting_work_id
+ from
+ sd.`order` as o left join sd.order_detail as od on o.order_id=od.order_id
+ left join sd.order_glass_detail as ogd on ogd.order_id=od.order_id and ogd.order_number=od.order_number
+ left join pp.reporting_work as rw on rw.order_id=o.order_id
+ left join pp.damage_details as dd on dd.reporting_work_id=rw.reporting_work_id and dd.order_number=ogd.order_number
+ and dd.technology_number=ogd.technology_number
+ where date(rw.reporting_work_time) >= #{startDate}
+ and date(rw.reporting_work_time) <= #{endDate}
+ and rw.this_worn_quantity > 0
+ and dd.available = 0
+ and reviewed_state >-1
+ and rw.this_process = dd.responsible_process
+ and o.create_order>0
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code}
+ </if>
+ <if test="crossProcessBreakingDTO.processId != null and crossProcessBreakingDTO.processId != ''">
+ and rw.process_id regexp #{crossProcessBreakingDTO.processId}
+ </if>
+ <if test="crossProcessBreakingDTO.thisProcess != null and crossProcessBreakingDTO.thisProcess != ''">
+ and rw.this_process regexp #{crossProcessBreakingDTO.thisProcess}
+ </if>
+ <if test="crossProcessBreakingDTO.responsibleProcess != null and crossProcessBreakingDTO.responsibleProcess != ''">
+ and dd.responsible_process regexp #{crossProcessBreakingDTO.responsibleProcess}
+ </if>
+ <if test="crossProcessBreakingDTO.responsibleTeam != null and crossProcessBreakingDTO.responsibleTeam != ''">
+ and dd.responsible_team regexp #{crossProcessBreakingDTO.responsibleTeam}
+ </if>
+ <if test="crossProcessBreakingDTO.glassChild != null and crossProcessBreakingDTO.glassChild != ''">
+ and ogd.glass_child regexp #{crossProcessBreakingDTO.glassChild}
+ </if>
+ <if test="crossProcessBreakingDTO.breakageType != null and crossProcessBreakingDTO.breakageType != ''">
+ and dd.breakage_type regexp #{crossProcessBreakingDTO.breakageType}
+ </if>
+ <if test="crossProcessBreakingDTO.project != null and crossProcessBreakingDTO.project != ''">
+ and o.project regexp #{crossProcessBreakingDTO.project}
+ </if>
+ <if test="crossProcessBreakingDTO.orderId != null and crossProcessBreakingDTO.orderId != ''">
+ and o.order_id regexp #{crossProcessBreakingDTO.orderId}
+ </if>
+ <if test="crossProcessBreakingDTO.responsiblePersonnel != null and crossProcessBreakingDTO.responsiblePersonnel != ''">
+ and dd.responsible_personnel regexp #{crossProcessBreakingDTO.responsiblePersonnel}
+ </if>
+ <if test="crossProcessBreakingDTO.creator != null and crossProcessBreakingDTO.creator != ''">
+ and rw.creator regexp #{crossProcessBreakingDTO.creator}
+ </if>
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{crossProcessBreakingDTO.code}
+ </if>
+ <if test="crossProcessBreakingDTO.reportingWorkId != null and crossProcessBreakingDTO.reportingWorkId != ''">
+ and rw.reporting_work_id regexp #{crossProcessBreakingDTO.reportingWorkId}
+ </if>
GROUP BY dd.id
order by dd.id desc
limit #{offset},#{pageSize}
@@ -337,11 +420,12 @@
left join sd.order_glass_detail as ogd
on ogd.order_id = o.order_id and ogd.order_number = dd.order_number
and ogd.technology_number and dd.technology_number
+ left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
where date(rw.reporting_work_time) >= #{startDate}
and date(rw.reporting_work_time) <= #{endDate}
and rw.this_worn_quantity > 0
and dd.available = 0
- and reviewed_state != 2
+ and rw.reviewed_state>=0
and rw.this_process != dd.responsible_process
<if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code}
@@ -372,6 +456,66 @@
</if>
<if test="crossProcessBreakingDTO.responsiblePersonnel != null and crossProcessBreakingDTO.responsiblePersonnel != ''">
and dd.responsible_personnel regexp #{crossProcessBreakingDTO.responsiblePersonnel}
+ </if>
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{crossProcessBreakingDTO.code}
+ </if>
+ <if test="crossProcessBreakingDTO.reportingWorkId != null and crossProcessBreakingDTO.reportingWorkId != ''">
+ and rw.reporting_work_id regexp #{crossProcessBreakingDTO.reportingWorkId}
+ </if>
+ order by dd.id desc
+ </select>
+
+ <select id="getNotProcessBreakingTotal">
+ select CEILING(count(dd.id) / #{pageSize}) as 'pageTotal',
+ count(distinct dd.id) as 'total'
+ from pp.damage_details as dd
+ left join pp.reporting_work as rw
+ on rw.reporting_work_id = dd.reporting_work_id
+ left join sd.order as o
+ on rw.order_id = o.order_id
+ left join sd.order_glass_detail as ogd
+ on ogd.order_id = o.order_id and ogd.order_number = dd.order_number
+ and ogd.technology_number and dd.technology_number
+ left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
+ where date(rw.reporting_work_time) >= #{startDate}
+ and date(rw.reporting_work_time) <= #{endDate}
+ and rw.this_worn_quantity > 0
+ and dd.available = 0
+ and reviewed_state != 2
+ and rw.this_process = dd.responsible_process
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code}
+ </if>
+ <if test="crossProcessBreakingDTO.processId != null and crossProcessBreakingDTO.processId != ''">
+ and rw.process_id regexp #{crossProcessBreakingDTO.processId}
+ </if>
+ <if test="crossProcessBreakingDTO.thisProcess != null and crossProcessBreakingDTO.thisProcess != ''">
+ and rw.this_process regexp #{crossProcessBreakingDTO.thisProcess}
+ </if>
+ <if test="crossProcessBreakingDTO.responsibleProcess != null and crossProcessBreakingDTO.responsibleProcess != ''">
+ and dd.responsible_process regexp #{crossProcessBreakingDTO.responsibleProcess}
+ </if>
+ <if test="crossProcessBreakingDTO.responsibleTeam != null and crossProcessBreakingDTO.responsibleTeam != ''">
+ and dd.responsible_team regexp #{crossProcessBreakingDTO.responsibleTeam}
+ </if>
+ <if test="crossProcessBreakingDTO.glassChild != null and crossProcessBreakingDTO.glassChild != ''">
+ and ogd.glass_child regexp #{crossProcessBreakingDTO.glassChild}
+ </if>
+ <if test="crossProcessBreakingDTO.breakageType != null and crossProcessBreakingDTO.breakageType != ''">
+ and dd.breakage_type regexp #{crossProcessBreakingDTO.breakageType}
+ </if>
+ <if test="crossProcessBreakingDTO.project != null and crossProcessBreakingDTO.project != ''">
+ and o.project regexp #{crossProcessBreakingDTO.project}
+ </if>
+ <if test="crossProcessBreakingDTO.orderId != null and crossProcessBreakingDTO.orderId != ''">
+ and o.order_id regexp #{crossProcessBreakingDTO.orderId}
+ </if>
+ <if test="crossProcessBreakingDTO.responsiblePersonnel != null and crossProcessBreakingDTO.responsiblePersonnel != ''">
+ and dd.responsible_personnel regexp #{crossProcessBreakingDTO.responsiblePersonnel}
+ </if>
+ <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
+ and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{crossProcessBreakingDTO.code}
</if>
order by dd.id desc
</select>
@@ -629,7 +773,8 @@
ogd.child_height,
ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber,
rw.this_process,
- rw.creator
+ rw.creator,
+ rw.reporting_work_id
FROM
sd.ORDER AS o
LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
@@ -685,6 +830,9 @@
<if test="damageReportDTO.creator != null and damageReportDTO.creator != ''">
and rw.creator regexp #{damageReportDTO.creator}
</if>
+ <if test="damageReportDTO.reportingWorkId != null and damageReportDTO.reportingWorkId != ''">
+ and rw.reporting_work_id regexp #{damageReportDTO.reportingWorkId}
+ </if>
GROUP BY
dd.id
limit #{offset},#{pageSize};
@@ -704,7 +852,7 @@
WHERE
rw.reporting_work_time >= #{selectTime1}
AND rw.reporting_work_time < #{selectTime2}
- AND dd.available = 0
+ AND dd.available = 0 and rw.reviewed_state>=0
<if test="damageReportDTO.orderId != null and damageReportDTO.orderId != ''">
and o.order_id regexp #{damageReportDTO.orderId}
</if>
@@ -1074,7 +1222,12 @@
rw.this_process,
o.project,
o.order_id,
- ogd.glass_child
+ ogd.glass_child,
+ rw.this_process,
+ JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code,
+ CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id,
+ rw.creator,
+ rw.reporting_work_id
from damage_details as dd
left join reporting_work as rw
on rw.reporting_work_id = dd.reporting_work_id
@@ -1083,12 +1236,50 @@
left join sd.order_glass_detail as ogd
on ogd.order_id = o.order_id and ogd.order_number = dd.order_number
and ogd.technology_number and dd.technology_number
+ left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
where date(rw.reporting_work_time) >= #{dates[0]}
and date(rw.reporting_work_time) <= #{dates[1]}
and rw.this_worn_quantity > 0
and dd.available = 0
and reviewed_state != 2
and rw.this_process != dd.responsible_process
+ GROUP BY dd.id
+ order by dd.id desc
+ </select>
+
+ <select id="exportNotCrossProcessBreakingMp">
+ select rw.reporting_work_id,
+ rw.reporting_work_time,
+ dd.responsible_process,
+ dd.responsible_team,
+ dd.breakage_type,
+ dd.breakage_reason,
+ ROUND((dd.breakage_quantity)) as breakage_quantity,
+ round(ogd.child_width * ogd.child_height * (dd.breakage_quantity) / 1000000, 2) as area,
+ rw.this_process,
+ o.project,
+ o.order_id,
+ ogd.glass_child,
+ rw.this_process,
+ JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code,
+ CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id,
+ rw.creator,
+ rw.reporting_work_id
+ from damage_details as dd
+ left join reporting_work as rw
+ on rw.reporting_work_id = dd.reporting_work_id
+ left join sd.order as o
+ on rw.order_id = o.order_id
+ left join sd.order_glass_detail as ogd
+ on ogd.order_id = o.order_id and ogd.order_number = dd.order_number
+ and ogd.technology_number and dd.technology_number
+ left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
+ where date(rw.reporting_work_time) >= #{dates[0]}
+ and date(rw.reporting_work_time) <= #{dates[1]}
+ and rw.this_worn_quantity > 0
+ and dd.available = 0
+ and reviewed_state != 2
+ and rw.this_process = dd.responsible_process
GROUP BY dd.id
order by dd.id desc
</select>
@@ -1111,13 +1302,18 @@
IFNULL(dd.responsible_personnel, '') as personnel,
ogd.glass_child,
ogd.child_width,
- ogd.child_height
+ ogd.child_height,
+ ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber,
+ rw.this_process,
+ rw.creator,
+ rw.reporting_work_id
FROM sd.ORDER AS o
LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
LEFT JOIN reporting_work AS rw ON rw.order_id = o.order_id
LEFT JOIN damage_details AS dd ON dd.reporting_work_id = rw.reporting_work_id
AND dd.order_number = ogd.order_number
AND dd.technology_number = ogd.technology_number
+ left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
WHERE rw.reporting_work_time >= #{dates[0]}
and rw.reporting_work_time <= #{dates[1]}
AND dd.available = 0 and rw.reviewed_state>=0
@@ -1512,6 +1708,9 @@
<if test="teamOutputDTO.deviceName != null and teamOutputDTO.deviceName != ''">
AND rw.device_name REGEXP #{teamOutputDTO.deviceName}
</if>
+ <if test="teamOutputDTO.batch != null and teamOutputDTO.batch != ''">
+ AND o.batch REGEXP #{teamOutputDTO.batch}
+ </if>
<choose>
<when test="laminating == ''">
@@ -1659,7 +1858,9 @@
<if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''">
and od.edging_type regexp #{teamOutputDTO.edgingType}
</if>
-
+ <if test="teamOutputDTO.batch != null and teamOutputDTO.batch != ''">
+ AND o.batch REGEXP #{teamOutputDTO.batch}
+ </if>
<choose>
<when test="laminating == ''">
GROUP BY
@@ -2341,7 +2542,9 @@
<if test="teamOutputDTO.deviceName != null and teamOutputDTO.deviceName != ''">
AND rw.device_name REGEXP #{teamOutputDTO.deviceName}
</if>
-
+ <if test="teamOutputDTO.batch != null and teamOutputDTO.batch != ''">
+ AND o.batch REGEXP #{teamOutputDTO.batch}
+ </if>
<choose>
<when test="laminating == ''">
GROUP BY
--
Gitblit v1.8.0