| | |
| | | |
| | | <select id="getOrderBomDataMp"> |
| | | SELECT product_id,product_name,SUM(quantity) as quantity, |
| | | SUM(gross_area) as area,SUM(perimeter) as perimeter from sd.order_detail where order_id=#{orderId} |
| | | SUM(gross_area) as area,SUM(perimeter) as perimeter,order_id from sd.order_detail where order_id=#{orderId} |
| | | GROUP BY product_id |
| | | </select> |
| | | |
| | | <select id="getBOMDetails"> |
| | | select *,(consume*price) as materialPric from sd.bom_product as bp left join sd.bom_base as bb on bb.id=bp.base_id |
| | | where bp.product_id = #{productId} ORDER BY product_layer |
| | | select bp.*,bb.*,(consume*price) as materialPric,od.quantity from sd.bom_product as bp |
| | | left join sd.bom_base as bb on bb.id=bp.base_id |
| | | left join ( select order_id,product_id,SUM(quantity) as quantity from sd.order_detail GROUP BY order_id,product_id |
| | | ) as od on od.product_id = bp.product_id |
| | | where bp.product_id = #{productId} and od.order_id = #{orderId} ORDER BY product_layer |
| | | </select> |
| | | |
| | | <select id="getOrderBomSumDataMp"> |
| | |
| | | bb.type, |
| | | sum(bb.consume) as consume, |
| | | sum(bb.price) as price, |
| | | sum(bb.consume * bb.price) AS materialPrice |
| | | sum(bb.consume * bb.price) AS materialPrice, |
| | | od.quantity |
| | | FROM |
| | | sd.bom_product AS bp |
| | | LEFT JOIN sd.bom_base AS bb ON bb.id = bp.base_id |
| | | LEFT JOIN ( |
| | | select order_id,product_id from sd.order_detail GROUP BY product_id |
| | | select order_id,product_id,SUM(quantity) as quantity from sd.order_detail GROUP BY order_id,product_id |
| | | ) as od on od.product_id = bp.product_id |
| | | |
| | | WHERE od.order_id=#{orderId} |