廖井涛
2025-10-28 fcc929fa2888c6b06a168f1ca84344e3bf9fdce5
north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -64,6 +64,7 @@
        <result column="glass_child" property="glassChild"/>
        <result column="process_id" property="processId"/>
        <result column="code" property="code"/>
        <result column="responsible_personnel" property="responsiblePersonnel"/>
    </resultMap>
@@ -106,6 +107,8 @@
        <result column="glassNumber" property="glassNumber"/>
        <result column="child_width" property="childWidth"/>
        <result column="child_height" property="childHeight"/>
        <result column="this_process" property="thisProcess"/>
        <result column="creator" property="creator"/>
    </resultMap>
    <resultMap id="teamOutputMap" type="com.example.erp.dto.pp.TeamOutputDTO">
@@ -261,6 +264,7 @@
               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,
@@ -269,12 +273,13 @@
               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
               CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id,
               rw.creator
        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 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
                             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) &lt;= #{endDate}
@@ -310,6 +315,81 @@
        <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>
        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
        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) &lt;= #{endDate}
        and rw.this_worn_quantity > 0
        and dd.available = 0
        and reviewed_state != 2
        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>
        GROUP BY dd.id
        order by dd.id desc
        limit #{offset},#{pageSize}
@@ -318,8 +398,8 @@
    <select id="getProcessBreakingTotal">
        select CEILING(count(dd.id) / #{pageSize}) as 'pageTotal',
               count(distinct dd.id)               as 'total'
        from damage_details as dd
                 left join reporting_work as rw
        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
@@ -358,6 +438,59 @@
        </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>
        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
        where date(rw.reporting_work_time) >= #{startDate}
        and date(rw.reporting_work_time) &lt;= #{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>
        order by dd.id desc
    </select>
@@ -613,12 +746,14 @@
        ogd.glass_child,
        ogd.child_width,
        ogd.child_height,
        ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber
        ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber,
        rw.this_process,
        rw.creator
        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
        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
        left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
@@ -663,6 +798,12 @@
        <if test="damageReportDTO.glassNumber != null and damageReportDTO.glassNumber != ''">
            and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{damageReportDTO.glassNumber}
        </if>
        <if test="damageReportDTO.thisProcess != null and damageReportDTO.thisProcess != ''">
            and rw.this_process regexp #{damageReportDTO.thisProcess}
        </if>
        <if test="damageReportDTO.creator != null and damageReportDTO.creator != ''">
            and rw.creator regexp #{damageReportDTO.creator}
        </if>
        GROUP BY
        dd.id
        limit #{offset},#{pageSize};
@@ -675,8 +816,8 @@
        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
        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
@@ -1052,7 +1193,11 @@
               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
        from damage_details as dd
                 left join reporting_work as rw
                           on rw.reporting_work_id = dd.reporting_work_id
@@ -1061,12 +1206,49 @@
                 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) &lt;= #{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
        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) &lt;= #{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>
@@ -1089,13 +1271,17 @@
               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
        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 &lt;= #{dates[1]}
          AND dd.available = 0 and rw.reviewed_state>=0
@@ -1420,6 +1606,7 @@
        rw.this_process,
        rw.teams_groups_name,
        o.project,
        o.order_id,
        rw.process_id,
        fc.order_number,
        MAX(ogd.child_width)  AS width,
@@ -1439,10 +1626,10 @@
        END AS workProcessName,
        o.batch
        FROM
        reporting_work AS rw
        LEFT JOIN reporting_work_detail AS rwd
        pp.reporting_work AS rw
        LEFT JOIN pp.reporting_work_detail AS rwd
        ON rwd.reporting_work_id = rw.reporting_work_id
        LEFT JOIN flow_card AS fc
        LEFT JOIN pp.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
@@ -1612,8 +1799,8 @@
        od.product_name,
        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code
        FROM
        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
        pp.reporting_work as rw left join pp.reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id
        left join pp.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
@@ -2156,7 +2343,7 @@
            SUM(odpd.reporting_work_num) AS completeNum,
            ROUND(SUM(ogd.child_width * ogd.child_height * odpd.reporting_work_num) / 1000000, 2) AS completeArea,
            SUM(fc.quantity - odpd.reporting_work_num) AS incompleteNum,
            ROUND(SUM(ogd.child_width * ogd.child_height * (fc.quantity - odpd.reporting_work_num)) / 1000000, 2) AS incompleteArea
            ROUND(SUM(ogd.child_width * ogd.child_height * (CAST(fc.quantity AS SIGNED) - CAST(odpd.reporting_work_num AS SIGNED))) / 1000000, 2) AS incompleteArea
        FROM sd.order_detail AS od
                 LEFT JOIN sd.order_glass_detail AS ogd
                           ON od.order_id = ogd.order_id
@@ -2179,7 +2366,7 @@
          AND o.create_time &lt;  #{selectTime2}
          and position(#{orderId} in od.order_id)
          and position(#{inputProject} in o.project)
          AND fc.quantity - odpd.reporting_work_num > 0;
          AND CAST(fc.quantity AS SIGNED) - CAST(odpd.reporting_work_num AS SIGNED)>0;
    </select>
@@ -2190,8 +2377,8 @@
        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
                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
                LEFT JOIN sd.order_detail AS od ON o.order_id = od.order_id
@@ -2268,10 +2455,10 @@
        END AS workProcessName,
        o.batch
        FROM
        reporting_work AS rw
        LEFT JOIN reporting_work_detail AS rwd
        pp.reporting_work AS rw
        LEFT JOIN pp.reporting_work_detail AS rwd
        ON rwd.reporting_work_id = rw.reporting_work_id
        LEFT JOIN flow_card AS fc
        LEFT JOIN pp.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
@@ -2896,7 +3083,6 @@
                                        AND cb.technology_number = b.technology_number
                             where a.processing_card>0
                               and a.warehousing!=2
                                and (c.quantity-b.reporting_work_num)>0
                             GROUP BY  b.process_id, b.order_number,
                                 b.technology_number) as f
                                LEFT JOIN sd.order_process_detail as e
@@ -2987,7 +3173,6 @@
        AND cb.technology_number = b.technology_number
        where a.processing_card>0
        and a.warehousing!=2
        and (c.quantity-b.reporting_work_num)>0
        GROUP BY  b.process_id, b.order_number,
        b.technology_number) as f
        LEFT JOIN sd.order_process_detail as e
@@ -3289,7 +3474,7 @@
        ROUND(ogd.child_width * ogd.child_height * odpd.reporting_work_num / 1000000,
        2)                                                             as completeArea,
        fc.quantity - odpd.reporting_work_num - ifnull(fc.termination_quantity,0)      as incompleteNum,
        ROUND(ogd.child_width * ogd.child_height * (fc.quantity - odpd.reporting_work_num- ifnull(fc.termination_quantity,0)) / 1000000,
        ROUND(ogd.child_width * ogd.child_height * (CAST(fc.quantity AS SIGNED) - CAST(odpd.reporting_work_num AS SIGNED)- ifnull(fc.termination_quantity,0)) / 1000000,
        2)                                                             as incompleteArea,
        od.product_name
@@ -3315,7 +3500,7 @@
          AND o.create_time &lt;  #{selectTime2}
          and position(#{orderId} in od.order_id)
          and position(#{inputProject} in o.project)
        and GREATEST(fc.quantity - odpd.reporting_work_num, 0)>0
        and CAST(fc.quantity AS SIGNED) - CAST(odpd.reporting_work_num AS SIGNED)>0
        and fc.quantity-ifnull(fc.termination_quantity,0)>0
        GROUP BY fc.process_id, fc.order_number, fc.technology_number
        order by fc.process_id, fc.order_number, fc.technology_number