From 9b52218c49caaf38fa986516eae04c0e2acda7b4 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期四, 19 九月 2024 16:35:33 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/Report.xml |   58 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 20 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 e33522c..70037fa 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/Report.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -50,20 +50,19 @@
 
     </resultMap>
 
-    <resultMap id="damageDetailsTableMap" type="com.example.erp.entity.pp.DamageDetails">
+    <resultMap id="damageDetailsTableMap" type="com.example.erp.dto.pp.CrossProcessBreakingDTO">
         <result column="responsible_process" property="responsibleProcess"/>
         <result column="responsible_team" property="responsibleTeam"/>
         <result column="breakage_type" property="breakageType"/>
         <result column="breakage_reason" property="breakageReason"/>
         <result column="breakage_quantity" property="breakageQuantity"/>
         <result column="area" property="area"/>
-        <result column="reporting_work_id" property="reportingWork.reportingWorkId"/>
-        <result column="reporting_work_time" property="reportingWork.reportingWorkTime"/>
-        <result column="this_process" property="reportingWork.thisProcess"/>
-        <result column="project" property="order.project"/>
-        <result column="order_id" property="order.orderId"/>
-        <result column="glass_child" property="orderGlassDetail.glassChild"/>
-        <result column="process_id" property="reportingWork.processId"/>
+        <result column="reporting_work_time" property="reportingWorkTime"/>
+        <result column="this_process" property="thisProcess"/>
+        <result column="project" property="project"/>
+        <result column="order_id" property="orderId"/>
+        <result column="glass_child" property="glassChild"/>
+        <result column="process_id" property="processId"/>
         <result column="code" property="code"/>
     </resultMap>
 
@@ -237,6 +236,21 @@
           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>
         GROUP BY dd.id
         order by dd.id desc
         limit #{offset},#{pageSize}
@@ -706,6 +720,7 @@
                  left join mm.finished_goods_inventory as f
                            on c.order_id = f.order_id and f.order_number = c.order_number
                  left join (SELECT process_id,
+                                   order_number,
                                    technology_number,
                                    sum(a.broken_num) as broken_num,
                                    concat('{',
@@ -713,16 +728,18 @@
                                           '}'
                                        )             as reportWorkQuantity,
                                    concat('{',
-                                          GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num, "\"")),
+                                          GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num_count, "\"")),
                                           '}'
                                        )             as reportWorkQuantityCount
                             FROM sd.order_process_detail as a
                             where a.order_id = #{orderId}
-                            GROUP BY process_id, a.technology_number) as e
+                            GROUP BY process_id, a.order_number,a.technology_number) as e
                            on e.process_id = c.process_id
+                                and   e.order_number=c.order_number
                                and e.technology_number = c.technology_number
                  left join sd.delivery_detail as dd on dd.order_id = a.order_id and dd.order_number = a.order_number
         where a.order_id = #{orderId}
+        group by c.order_number,c.technology_number
         ORDER BY a.order_number
     </select>
 
@@ -1208,19 +1225,18 @@
         MAX( ogd.child_width ) as width,
         MAX( ogd.child_height ) as height,
         od.edging_type,
-        opd.reporting_work_num as completed_quantity,
-        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*opd.reporting_work_num/1000000,2) as area,
+        rwd.completed_quantity as completed_quantity,
+        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area,
         od.product_name,
         JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code
         FROM
-        sd.`order` as o left join sd.order_detail as od  on od.order_id=o.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 flow_card as fc on fc.order_id=ogd.order_id and fc.order_number=ogd.order_number and fc.technology_number=ogd.technology_number
-        left join reporting_work as rw on rw.order_id=od.order_id and rw.process_id=fc.process_id
-        left join sd.order_process_detail as opd on opd.order_id = o.order_id  AND opd.process_id = rw.process_id
-        AND opd.order_number = fc.order_number AND opd.technology_number = fc.technology_number and opd.process=rw.this_process
+        reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id
+        left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id  and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number
+        left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number
+        left join sd.order_detail as od  on od.order_id=ogd.order_id and od.order_number=ogd.order_number
+        left join sd.`order` as o on o.order_id=od.order_id
         left join sd.product_detail as pd	on pd.prod_id = od.product_id and pd.glass_sort = fc.technology_number and detail_type = "glass"
-        where opd.reporting_work_num > 0 and rw.reviewed_state=1 and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
+        where o.create_order>0 and rw.reviewed_state>=0 and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
         and position(#{selectProcesses} in rw.this_process)
         <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''">
             and rw.this_process regexp #{teamOutputDTO.thisProcess}
@@ -1239,10 +1255,12 @@
         </if>
 
         GROUP BY
+        rw.order_id,
+        rw.reporting_work_id,
         rw.this_process,
         rw.teams_groups_name,
         rw.process_id,
-        fc.order_number
+        rwd.order_number
         ORDER BY
         rw.this_process,
         rw.process_id,

--
Gitblit v1.8.0