chenlu
2025-10-30 174cc2a8aa52f00334e0e9a3a0ea91b2e3e7acd3
north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -107,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">
@@ -271,7 +273,9 @@
               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,
               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
@@ -282,7 +286,7 @@
          and date(rw.reporting_work_time) &lt;= #{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 != ''">
@@ -315,6 +319,91 @@
        <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}
    </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) &lt;= #{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}
@@ -331,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) &lt;= #{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}
@@ -366,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) &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>
        <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>
@@ -621,7 +771,10 @@
        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,
        rw.reporting_work_id
        FROM
        sd.ORDER AS o
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
@@ -671,6 +824,15 @@
        <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>
        <if test="damageReportDTO.reportingWorkId != null and damageReportDTO.reportingWorkId != ''">
            and rw.reporting_work_id regexp #{damageReportDTO.reportingWorkId}
        </if>
        GROUP BY
        dd.id
        limit #{offset},#{pageSize};
@@ -690,7 +852,7 @@
        WHERE
        rw.reporting_work_time >= #{selectTime1}
        AND rw.reporting_work_time &lt;  #{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>
@@ -1060,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
@@ -1069,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) &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,
               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) &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>
@@ -1097,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 &lt;= #{dates[1]}
          AND dd.available = 0 and rw.reviewed_state>=0
@@ -1498,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 == ''">
@@ -1645,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
@@ -2327,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