| | |
| | | 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,0), |
| | | od.width |
| | | ), |
| | | od.height, |
| | | od.area, |
| | | od.gross_area, |
| | |
| | | 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> |
| | | |