廖井涛
2025-08-12 5a0b47f515ceef0ce135dd91eb7d8ba49754a570
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>
@@ -201,4 +215,20 @@
            group by e.order_number
        </if>
    </select>
    <select id="getBehindProcess">
        select group_concat(process) from sd.order_process_detail as a
        where a.order_id = #{orderId}
        and a.process_id = #{processId}
        and a.order_number =#{orderNumber}
        and a.technology_number =#{technologyNumber}
        and a.id>(select id
                  from sd.order_process_detail as b
                  where b.order_id = #{orderId}
                    and b.process_id = #{processId}
                    and b.order_number =#{orderNumber}
                    and b.technology_number =#{technologyNumber}
                  and b.process = #{thisProcess}
                )
    </select>
</mapper>