From 4f258638d62ccaae0050f1ed6c7231941b66fb50 Mon Sep 17 00:00:00 2001
From: deslrey <deslre0381@gmail.com>
Date: 星期六, 10 一月 2026 11:29:04 +0800
Subject: [PATCH] 【物料属性】的回显及查询

---
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml |  187 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 150 insertions(+), 37 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 9c9f99f..2d4f4b6 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -162,13 +162,15 @@
                ip.structure_item_parameter_id
     </sql>
 
-
     <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO">
-        select * from(select * from(
+        SELECT * FROM (
+        SELECT * FROM (
         SELECT
-        a.*,ios.ins_state,ios.verify_tell,verify_user
-        FROM
-        (
+        a.*,
+        ios.ins_state,
+        ios.verify_tell,
+        verify_user
+        FROM (
         SELECT
         io.id,
         io.entrust_code,
@@ -176,10 +178,7 @@
         io.appointed,
         io.send_time,
         io.order_type,
-        case when
-            io.type_source = 0
-            then io.sample_view
-            else io.sample end sample,
+        CASE WHEN io.type_source = 0 THEN io.sample_view ELSE io.sample END AS sample,
         GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,
         userName,
         checkName,
@@ -188,51 +187,65 @@
         io.laboratory,
         io.type_source,
         io.ifs_inventory_id,
-        ira.id ins_report_id,
+        ira.id AS ins_report_id,
         ira.url,
         ira.url_s,
         ira.temp_url_pdf,
-        iiq.is_copper
+        iiq.is_copper,
+        iiq.is_split_order,
+        iiq.update_batch_no,
+        iiq.part_desc,
+        iiq.material_prop AS material_prop
         FROM
         ins_order io
         LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
         LEFT JOIN ins_report ira ON ira.ins_order_id = io.id
         LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id
         LEFT JOIN (
-        SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName
-        FROM ins_sample_user u LEFT JOIN  user uu ON u.user_id = uu.id
-        WHERE u.state=0
-        <if test="sonLaboratory!= null and sonLaboratory != ''">
-           and son_laboratory=#{sonLaboratory}
+        SELECT
+        ins_sample_id,
+        GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS userName
+        FROM ins_sample_user u
+        LEFT JOIN user uu ON u.user_id = uu.id
+        WHERE u.state = 0
+        <if test="sonLaboratory != null and sonLaboratory != ''">
+            AND son_laboratory = #{sonLaboratory}
         </if>
         GROUP BY ins_sample_id
-        ORDER BY ins_sample_id
         ) isu ON isu.ins_sample_id = io.id
         LEFT JOIN (
-        SELECT ins_sample_id,uu.name checkName
-        FROM ins_sample_user u LEFT JOIN  user uu ON u.user_id = uu.id
-        WHERE u.state=1
-        <if test="sonLaboratory!= null and sonLaboratory != ''">
-            and son_laboratory=#{sonLaboratory}
+        SELECT
+        ins_sample_id,
+        uu.name AS checkName
+        FROM ins_sample_user u
+        LEFT JOIN user uu ON u.user_id = uu.id
+        WHERE u.state = 1
+        <if test="sonLaboratory != null and sonLaboratory != ''">
+            AND son_laboratory = #{sonLaboratory}
         </if>
         GROUP BY ins_sample_id
-        ORDER BY ins_sample_id
-        )isu2 ON isu2.ins_sample_id = io.id
+        ) isu2 ON isu2.ins_sample_id = io.id
         LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
-        WHERE io.state = 1 and send_time is not null
+
+        WHERE io.state = 1
+        AND io.send_time IS NOT NULL
+        <if test="materialProp != null and materialProp != ''">
+            AND iiq.material_prop LIKE CONCAT('%', #{materialProp}, '%')
+        </if>
+        <if test="sonLaboratory != null and sonLaboratory != ''">
+            AND ip.son_laboratory = #{sonLaboratory}
+        </if>
         <if test="isCheck != null">
-            <if test="userName !=null and userName!=''">
-                and checkName like CONCAT ('%', #{userName},'%')
+            <if test="userName != null and userName != ''">
+                AND checkName LIKE CONCAT('%', #{userName}, '%')
             </if>
         </if>
         <if test="isCheck == null">
-            <if test="userName !=null and userName!=''">
-                and userName like CONCAT ('%', #{userName},'%')
+            <if test="userName != null and userName != ''">
+                AND userName LIKE CONCAT('%', #{userName}, '%')
             </if>
         </if>
-        <if test="sonLaboratory!= null and sonLaboratory != ''">
-            and ip.son_laboratory = #{sonLaboratory}
-        </if>
+
         GROUP BY
         ip.son_laboratory,
         io.id
@@ -242,17 +255,117 @@
         a.type DESC,
         a.id
         ) b
-        where ins_state is not null
-        <if test="laboratory!=null and laboratory!=''">
-            and laboratory=#{laboratory}
+        WHERE ins_state IS NOT NULL
+        <if test="laboratory != null and laboratory != ''">
+            AND laboratory = #{laboratory}
         </if>
-        )A
+        ) A
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
         </if>
-        ORDER BY send_time asc
+        ORDER BY send_time ASC
     </select>
 
+<!--    <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO">-->
+<!--        select * from(select * from(-->
+<!--        SELECT-->
+<!--        a.*,ios.ins_state,ios.verify_tell,verify_user-->
+<!--        FROM-->
+<!--        (-->
+<!--        SELECT-->
+<!--        io.id,-->
+<!--        io.entrust_code,-->
+<!--        io.type,-->
+<!--        io.appointed,-->
+<!--        io.send_time,-->
+<!--        io.order_type,-->
+<!--        case when-->
+<!--        io.type_source = 0-->
+<!--        then io.sample_view-->
+<!--        else io.sample end sample,-->
+<!--        GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model,-->
+<!--        userName,-->
+<!--        checkName,-->
+<!--        ip.son_laboratory,-->
+<!--        io.ins_time,-->
+<!--        io.laboratory,-->
+<!--        io.type_source,-->
+<!--        io.ifs_inventory_id,-->
+<!--        ira.id ins_report_id,-->
+<!--        ira.url,-->
+<!--        ira.url_s,-->
+<!--        ira.temp_url_pdf,-->
+<!--        iiq.is_copper,-->
+<!--        iiq.is_split_order,-->
+<!--        iiq.update_batch_no,-->
+<!--        iiq.part_desc,-->
+<!--        iiq.material_prop AS material_prop-->
+<!--        FROM-->
+<!--        ins_order io-->
+<!--        LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id-->
+<!--        LEFT JOIN ins_report ira ON ira.ins_order_id = io.id-->
+
+<!--        LEFT JOIN ifs_inventory_quantity iiq-->
+<!--        ON iiq.id = io.ifs_inventory_id-->
+<!--        <if test="materialProp != null and materialProp != ''">-->
+<!--            AND iiq.material_prop LIKE CONCAT('%', #{materialProp}, '%')-->
+<!--        </if>-->
+
+<!--        LEFT JOIN (-->
+<!--        SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName-->
+<!--        FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id-->
+<!--        WHERE u.state=0-->
+<!--        <if test="sonLaboratory!= null and sonLaboratory != ''">-->
+<!--            and son_laboratory=#{sonLaboratory}-->
+<!--        </if>-->
+<!--        GROUP BY ins_sample_id-->
+<!--        ORDER BY ins_sample_id-->
+<!--        ) isu ON isu.ins_sample_id = io.id-->
+<!--        LEFT JOIN (-->
+<!--        SELECT ins_sample_id,uu.name checkName-->
+<!--        FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id-->
+<!--        WHERE u.state=1-->
+<!--        <if test="sonLaboratory!= null and sonLaboratory != ''">-->
+<!--            and son_laboratory=#{sonLaboratory}-->
+<!--        </if>-->
+<!--        GROUP BY ins_sample_id-->
+<!--        ORDER BY ins_sample_id-->
+<!--        )isu2 ON isu2.ins_sample_id = io.id-->
+<!--        LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id-->
+<!--        WHERE io.state = 1 and send_time is not null-->
+<!--        <if test="isCheck != null">-->
+<!--            <if test="userName !=null and userName!=''">-->
+<!--                and checkName like CONCAT ('%', #{userName},'%')-->
+<!--            </if>-->
+<!--        </if>-->
+<!--        <if test="isCheck == null">-->
+<!--            <if test="userName !=null and userName!=''">-->
+<!--                and userName like CONCAT ('%', #{userName},'%')-->
+<!--            </if>-->
+<!--        </if>-->
+<!--        <if test="sonLaboratory!= null and sonLaboratory != ''">-->
+<!--            and ip.son_laboratory = #{sonLaboratory}-->
+<!--        </if>-->
+<!--        GROUP BY-->
+<!--        ip.son_laboratory,-->
+<!--        io.id-->
+<!--        ) a-->
+<!--        LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory-->
+<!--        ORDER BY-->
+<!--        a.type DESC,-->
+<!--        a.id-->
+<!--        ) b-->
+<!--        where ins_state is not null-->
+<!--        <if test="laboratory!=null and laboratory!=''">-->
+<!--            and laboratory=#{laboratory}-->
+<!--        </if>-->
+<!--        )A-->
+<!--        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">-->
+<!--            ${ew.customSqlSegment}-->
+<!--        </if>-->
+<!--        ORDER BY send_time asc-->
+<!--    </select>-->
+
     <select id="inspectionOrderDetailsTaskSwitching" resultType="com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo">
         select * from(
         SELECT

--
Gitblit v1.9.3