From 94c0a729da1b88ab4a0067f1e14a00264e0447cf Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 15 十二月 2025 17:04:05 +0800
Subject: [PATCH] bom管理中空胶计算调整

---
 north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
index 86f0d35..abfe0af 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
@@ -34,10 +34,14 @@
     </select>
 
     <select id="getBOMDetails">
-        select bp.*,bb.*,(consume*price) as materialPric,od.quantity from sd.bom_product as bp
+        select  bp.*,bb.*,(consume*price) as materialPric,od.quantity,pdd.detail_type,
+            IFNULL(JSON_UNQUOTE(JSON_EXTRACT(pdd.separation, '$.GlueDepth')),0) as glueDepth,
+            CAST(SUBSTRING_INDEX(IFNULL(JSON_UNQUOTE(JSON_EXTRACT(pdd.separation, '$.thickness')), '0mm'), 'mm', 1) AS DECIMAL(10, 2)) AS thickness
+               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
+            left join sd.product_detail as pdd on pdd.prod_id = bp.product_id and pdd.sort_num = bp.product_layer
         where bp.product_id = #{productId} and od.order_id = #{orderId} ORDER BY product_layer
     </select>
 
@@ -57,14 +61,18 @@
             sum(bb.consume) as consume,
             sum(bb.price) as price,
             sum(bb.consume * bb.price) AS materialPrice,
-            od.quantity
+            od.quantity,
+            pdd.detail_type,
+            IFNULL( JSON_UNQUOTE( JSON_EXTRACT( pdd.separation, '$.GlueDepth' )), 0 ) AS glueDepth,
+            CAST(
+                    SUBSTRING_INDEX( IFNULL( JSON_UNQUOTE( JSON_EXTRACT( pdd.separation, '$.thickness' )), '0mm' ), 'mm', 1 ) AS DECIMAL ( 10, 2 )) AS thickness
         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
-
+                LEFT JOIN sd.product_detail AS pdd ON pdd.prod_id = bp.product_id  AND pdd.sort_num = bp.product_layer
         WHERE od.order_id=#{orderId}
         GROUP BY bb.material_id
         ORDER BY bp.product_layer

--
Gitblit v1.8.0