于杰
2025-08-11 ba4f03556d24a1548de75c8219cbc3f06e4ff57c
north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetailMapper.xml
@@ -71,7 +71,7 @@
    <!--查询筛选后唯一的流程卡号-->
    <select id="filterOrderProcess">
      select * from( select max(id) as id,process,order_number,technology_number,b.nickname,
      select a.* from( select id as id,process,order_number,technology_number,b.nickname,
                            case b.nickname when '' then 1
                            when null then 1
                            when 'stepC' then 2
@@ -80,12 +80,26 @@
                            when 'stepB' then 4
                     end as sort
        from order_process_detail
        left join (select DISTINCT basic_name,nickname from basic_data where basic_category = 'process') as b
        on b.basic_name = process
        where order_id = #{orderId}
        group by process) as a
        order by sort,id
        left join (SELECT max(count) as count,process from (SELECT count(opd1.id) as count,opd.process
                                                    from order_process_detail as opd
                                                             LEFT JOIN (SELECT id,process_id,order_number,technology_number
                                                                        from order_process_detail
                                                                        where order_id = #{orderId}) as opd1
                                                                       on opd.process_id = opd1.process_id
                                                                           and opd.order_number = opd1.order_number
                                                                           and opd.technology_number = opd1.technology_number
                                                                           and opd.id>=opd1.id
                                                    where opd.order_id =#{orderId}
                                                    group by opd.id) as a
                    GROUP BY process)   as sort1
        on sort1.process = a.process
        order by sort,sort1.count,id
    </select>