chenlu
2024-06-19 3760bb766253ea2b2291e00d7bc5147bdee9bb44
north-glass-erp/src/main/resources/mapper/sd/OrderGlassDetailMapper.xml
@@ -24,7 +24,10 @@
            pd.glass_sort,
            if(pd.glass_sort=1,'(外)',if(pd2.glass_sort=pd.glass_sort,'(内)','')),
            pd.detail,
            od.width,
            if( od.bend_radius!='',
                round(od.width*(od.bend_radius-round(sum(t.thicknessCount),2))/od.bend_radius,1),
                od.width
              ),
            od.height,
            od.area,
            od.gross_area,
@@ -35,8 +38,26 @@
            on od.product_id = pd.prod_id and pd.detail_type='glass'
        LEFT JOIN (SELECT max(id) as id ,max(glass_sort) as glass_sort  from product_detail GROUP BY prod_id)as pd2
            on pd2.id=pd.id
        left join (
            select
                a.prod_id,
                a.sort_num,
                a.glass_sort,
                (case
                      when a.sort_num=1
                          then left(detail,LOCATE('mm',detail)-1)/2
                      else
                          left(detail,LOCATE('mm',detail)-1)
                end) as 'thicknessCount'
            from product_detail as a
            group  by prod_id,a.sort_num
        ) as t
        ON t.prod_id = od.product_id and t.sort_num <=pd.sort_num
        where od.order_id = #{orderId}
        group by od.order_number,pd.glass_sort
        ORDER BY od.order_number
    </insert>
@@ -122,4 +143,14 @@
        </foreach>
    </update>
    <select id="getDifferentSizeNumber">
       select if(count(id)>1,1,0) from (select
          id
        from order_glass_detail as a
        where a.order_id = #{orderId}
          and a.order_number = #{orderNumber}
        group by child_width,child_height) as c
    </select>
</mapper>