From 396e85e6863abc3f2910ef0bfe1c4a6081e3e03e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 14 一月 2026 10:10:54 +0800
Subject: [PATCH] 偏差预警返回数据排除电缆、包装材料

---
 inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml |   49 ++++++++++++++++++++++++++++---------------------
 1 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
index a585358..ab44e9e 100644
--- a/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsProductDeviationWarningMapper.xml
@@ -4,41 +4,48 @@
 
     <!-- 鏌ョ湅棰勮鍒楄〃 -->
     <select id="selectDeviationWarningPage" resultType="com.ruoyi.inspect.dto.InsProductDeviationWarningDto">
-<!--        select *-->
-<!--        from (select ipdw.*,-->
-<!--        isa.sample                                              sample_name,-->
-<!--        isa.model                                               sample_model,-->
-<!--        concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item_name-->
-<!--        from ins_product_deviation_warning ipdw-->
-<!--        left join ins_sample isa on isa.id = ipdw.ins_sample_id-->
-<!--        left join ins_product ip On ip.id = ipdw.ins_product_id) a-->
-<!--        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">-->
-<!--            ${ew.customSqlSegment}-->
-<!--        </if>-->
-<!--        order by ipdw.detection_time desc-->
-        SELECT
-        a.*,
-        sto.object_type
+        <!--        select *-->
+        <!--        from (select ipdw.*,-->
+        <!--        isa.sample                                              sample_name,-->
+        <!--        isa.model                                               sample_model,-->
+        <!--        concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item_name-->
+        <!--        from ins_product_deviation_warning ipdw-->
+        <!--        left join ins_sample isa on isa.id = ipdw.ins_sample_id-->
+        <!--        left join ins_product ip On ip.id = ipdw.ins_product_id) a-->
+        <!--        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">-->
+        <!--            ${ew.customSqlSegment}-->
+        <!--        </if>-->
+        <!--        order by ipdw.detection_time desc-->
+        SELECT *
         FROM (
         SELECT
         ipdw.*,
         sip.sample AS sss,
         isa.sample AS sample_name,
         isa.model AS sample_model,
-        CONCAT(ip.inspection_item, ip.inspection_item_subclass) AS inspection_item_name
+        io.ifs_inventory_id,
+        CONCAT(ip.inspection_item, ip.inspection_item_subclass) AS inspection_item_name,
+        sto.object_type,
         FROM ins_product_deviation_warning ipdw
         LEFT JOIN ins_sample isa ON isa.id = ipdw.ins_sample_id
         LEFT JOIN ins_product ip ON ip.id = ipdw.ins_product_id
         LEFT JOIN structure_item_parameter sip ON sip.id = ip.structure_item_parameter_id
-        ) a
-        LEFT JOIN structure_test_object sto
-        ON a.sss LIKE CONCAT('%"', sto.specimen_name, '"%')  -- 妯$硦鍖归厤
+        LEFT JOIN ins_order io ON io.id = isa.ins_order_id
+        LEFT JOIN structure_test_object sto ON sip.sample LIKE CONCAT('%"', sto.specimen_name, '"%')
+        LEFT JOIN ifs_inventory_quantity ifs ON ifs.id = io.ifs_inventory_id
+        LEFT JOIN sys_dict_data dict
+        ON dict.dict_type = 'material_prop_type'
+        AND dict.dict_value = ifs.material_prop
+        AND dict.dict_value NOT IN ('04Dlan', '03Package')
         WHERE
-        sto.object_type != 3  -- 杩囨护鏉′欢锛氭帓闄� object_type 涓� 3 鐨勮褰�
+        sto.object_type != 3 -- 杩囨护鏉′欢锛氭帓闄� object_type 涓� 3 鐨勮褰�
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             AND ${ew.customSqlSegment}
         </if>
-        ORDER BY a.detection_time DESC
+        AND (ifs.material_prop IS NULL OR dict.dict_value IS NOT NULL)
+        ) t
+        ORDER BY t.detection_time DESC
+
     </select>
 
 </mapper>

--
Gitblit v1.9.3