guoyuji
2024-08-26 d3dfcd3e96cb0f2b04cfe973e4f348ee5fe96032
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -217,7 +217,7 @@
            sd.order_glass_detail as ogd left join flow_card as fc
                on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number
        set ogd.splitting_status=0
        where ogd.order_id = #{orderId}
        where fc.process_id = #{processId}
    </update>
@@ -225,7 +225,7 @@
    <update id="deleteFlowCardMp">
        delete
        from flow_card as fc
        where fc.order_id = left(#{processId}, 10)
        where fc.process_id = #{processId}
    </update>
    <!--    分架新增明细查询-->
@@ -442,7 +442,7 @@
    <delete id="deleteReportingWork">
        delete
        from sd.order_process_detail
        where order_id = left(#{processId}, 10)
        where process_id = #{processId}
    </delete>
    <select id="selectPrintFlowCardMp">
@@ -736,7 +736,9 @@
               opd.stock_id,
               od.quantity,
               od.other_columns,
               od.bend_radius
               od.bend_radius,
               opd.heat_layout_id,
               opd.heat_layout_sort
        from pp.optimize_detail opd
                 left join sd.`order` o on SUBSTR(opd.process_id, 1, 10) = o.order_id
                 left join sd.order_detail od
@@ -807,8 +809,8 @@
                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
        where fc.process_id = #{processId}
          and position(fc.technology_number in #{technologyNumber})
        order by IF(fc.sort != NULL or fc.sort != '', fc.sort, fc.order_number)
        GROUP BY fc.process_id,fc.order_number,fc.technology_number
        order by IF(fcs.sort != NULL or fcs.sort != '', fcs.sort, fc.order_number)
    </select>
    <update id="printSortMp">
@@ -887,7 +889,7 @@
               od.building_number                                    as buildingNumber,
               od.product_name                                       as productName,
               od.edging_type                                        as edgingType,
               p.remarks,
               od.remarks,
               c.customer_abbreviation                               as customerAbbreviation,
               p.product_abbreviation                                as productAbbreviation,
               fc.process_id                                         as processId,
@@ -1021,7 +1023,8 @@
        from sd.order_detail as od
                 left join flow_card as fc on od.order_id = fc.order_id and od.order_number = fc.order_number
        where fc.process_id = #{processId}
          and fc.technology_number = #{technologyNumber}
          and POSITION(fc.technology_number in #{technologyNumber})
        GROUP BY other_columns
        order by IF(fc.sort != NULL or fc.sort != '', fc.sort, fc.order_number)
    </select>
@@ -1136,7 +1139,7 @@
                                           pl.order_sort = fc.order_number and
                                           pl.technology_number = fc.technology_number
        where pl.create_time between #{selectTime1} and #{selectTime2}
        GROUP BY fc.process_id, ogd.technology_number, pl.reporting_work_id
        GROUP BY fc.process_id,fc.order_number, ogd.technology_number, pl.reporting_work_id
        order by pl.id desc, fc.process_id, ogd.technology_number
    </select>
@@ -1260,7 +1263,8 @@
               dd.breakage_reason,
               dd.responsible_process,
               dd.responsible_team,
               concat('对应我司单号', o.batch)                 AS otherRemarks
               concat('对应我司单号', o.batch)                 AS otherRemarks,
               dd.responsible_personnel
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -1336,7 +1340,13 @@
               round(SUM(ogd.total_area), 2)                   as gross_area,
               sum(od.weight)                                  as weight,
               #{technologyNumber}                             as technologyNumber,
               concat(fc.process_id, '/', #{technologyNumber}) as processIdNumber
               concat(fc.process_id, '/', #{technologyNumber}) as processIdNumber,
               dd.breakage_type,
               dd.breakage_reason,
               dd.responsible_process,
               dd.responsible_team,
               concat('对应我司单号', o.batch)                 AS otherRemarks,
               dd.responsible_personnel
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -1358,9 +1368,14 @@
                              ogdc.technology_number = ogd.technology_number
                 left join rework as pl on pl.process_id = fc.process_id and pl.order_sort = fc.order_number and
                                           pl.technology_number = fc.technology_number
                 left join pp.reporting_work as rw on rw.order_id = fc.order_id and rw.process_id = fc.process_id
                 left join pp.damage_details as dd
                           on rw.reporting_work_id = dd.reporting_work_id and dd.order_number = fc.order_number and
                              dd.technology_number = fc.technology_number
        where fc.process_id = #{processId}
          and fc.order_number = #{orderNumber}
          and fc.technology_number = #{technologyNumber}
          and rw.reporting_work_id = #{reportingWorkId}
        group by fc.process_id, fc.technology_number
    </select>
@@ -1492,7 +1507,7 @@
               od.building_number                                    as buildingNumber,
               od.product_name                                       as productName,
               od.edging_type                                        as edgingType,
               p.remarks,
               od.remarks,
               c.customer_abbreviation                               as customerAbbreviation,
               p.product_abbreviation                                as productAbbreviation,
               CONCAT(fc.process_id, '/', fc.technology_number)      as processId,
@@ -1972,7 +1987,7 @@
               od.building_number                                    as buildingNumber,
               od.product_name                                       as productName,
               od.edging_type                                        as edgingType,
               p.remarks,
               od.remarks,
               c.customer_abbreviation                               as customerAbbreviation,
               p.product_abbreviation                                as productAbbreviation,
               fc.process_id                                         as processId,
@@ -2034,4 +2049,50 @@
                 fcs.order_number,
                 fcs.technology_number
    </select>
    <select id="countFlowCard">
        select count(distinct process_id) from flow_card where order_id = #{orderId}
    </select>
    <select id="remakList">
        SELECT
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S01')) AS S01,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S04')) AS S02,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S05')) AS S03,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S06')) AS S04,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S07')) AS S05
        FROM flow_card as fc left join sd.order_detail as od on  fc.order_id = od.order_id
        and fc.order_number = od.order_number
        WHERE fc.process_id=#{processId}
        GROUP BY fc.order_number
    </select>
    <select id="selectMaxFlowCard">
        select ifnull((select fc.process_id
                       from sd.order_detail as od
                                left join sd.order_glass_detail as ogd
                                          on od.order_id = ogd.order_id and od.order_number = ogd.order_number
                                left join flow_card as fc on fc.order_id=od.order_id and fc.order_number=od.order_number and fc.technology_number=ogd.technology_number
                       where od.order_id = #{orderId}
                         and ogd.production_id = #{productionId}
                       GROUP BY od.order_number
                       order by fc.process_id desc LIMIT 1),'') as process_id
    </select>
    <select id="selectFlowCardMerge">
        select *
        from pp.flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
                              fc.technology_number = ogd.technology_number
                 left join sd.order_detail as od on od.order_id = ogd.order_id and od.order_number = ogd.order_number
        where fc.process_id = #{processId}
        GROUP BY fc.order_id, fc.process_id, ogd.glass_child
    </select>
    <update id="updateFlowCardMerge">
        update  pp.flow_card fc set fc.merge=1
        where fc.process_id = #{processId}
    </update>
</mapper>