From 91ab1a15515c4c213b2ac4f777a7f20c3d0d59ad Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 28 三月 2025 13:49:53 +0800
Subject: [PATCH] 一个订单在每个站点检验都需要扫码入库报检,在中间站点复核继续试验之后默认自动将样品出库,且在列表中也不需要再展示出来,到最后一步复核结束反而是需要手动去出库不能自动出库,且出库之后也不需要在页面展示

---
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml |  173 ++++++++++++++++++++-------------------------------------
 1 files changed, 61 insertions(+), 112 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 646b25e..f9bc603 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -23,18 +23,19 @@
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
     </resultMap>
-
     <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
         select * from(
         select * from(
         SELECT
         a.*,
         ios.ins_state,
+        ios.is_out,
+        ios.laboratory son_laboratory,
         ios.verify_tell,
         verify_user,
         ios.id orderStateId,
         ios.create_time,
-        (SELECT ins_time FROM ins_order_state WHERE ins_order_id = a.id AND laboratory = a.son_laboratory and
+        (SELECT ins_time FROM ins_order_state WHERE ins_order_id = a.id AND laboratory = son_laboratory and
         ins_order_state.ins_sample_id=a.sampleId ORDER BY ins_time DESC LIMIT 1) AS ins_time ,
         iou.submit_time ,
         ios.sort,
@@ -55,14 +56,16 @@
         isa.sample sample,
         isa.sample_code sampleCode,
         userName,
+        userNameId,
         checkName,
-        ip.son_laboratory,
-        io.laboratory
+        io.laboratory,
+        io.state
         FROM
         ins_order io
         LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
         LEFT JOIN (
         SELECT ins_sample_id,GROUP_CONCAT( DISTINCT uu.name SEPARATOR ',') AS userName
+        ,GROUP_CONCAT( DISTINCT uu.id SEPARATOR ',') AS userNameId
         FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id
         WHERE son_laboratory=#{sonLaboratory}
         and u.state=0
@@ -77,18 +80,13 @@
         GROUP BY ins_sample_id
         ORDER BY ins_sample_id
         )isu2 ON isu2.ins_sample_id = isa.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="userName !=null and userName!=''">
             and ( (userName like CONCAT ('%', #{userName},'%') )
             or (checkName like CONCAT ('%', #{userName},'%') ) )
         </if>
-        and ip.son_laboratory=#{sonLaboratory}
-        GROUP BY
-        ip.son_laboratory,
-        io.id
         ) a
-        ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory and ios.ins_sample_id=a.sampleId
+        ON ios.ins_order_id = a.id AND ios.laboratory = #{sonLaboratory} and ios.ins_sample_id=a.sampleId
         LEFT JOIN ins_order_user iou ON ios.id = iou.ins_order_state_id and ios.num=iou.num
         ORDER BY
         ios.sort,
@@ -97,7 +95,9 @@
         ios.create_time
         ) b
         where ins_state is not null
+        and (is_out is null or is_out !=1)
         and son_laboratory=#{sonLaboratory}
+        and state =1
         <if test="laboratory!=null and laboratory!=''">
             and laboratory=#{laboratory}
         </if>
@@ -110,7 +110,7 @@
     <select id="inspectionOrderDetailsTaskSwitching" resultType="com.yuanchu.mom.vo.InsOrderPlanTaskSwitchVo">
         select * from(
         SELECT
-        a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,verify_user
+        a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,verify_user,ios.laboratory son_laboratory
         FROM
         ins_order_state ios
         LEFT JOIN
@@ -126,9 +126,9 @@
         isa.sample_code sampleCode,
         isu.user_id,
         user.name userName,
-        ip.son_laboratory,
         io.ins_time,
-        io.laboratory
+        io.laboratory,
+        io.state
         FROM
         ins_order io
         LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
@@ -143,7 +143,6 @@
         )
         ORDER BY ins_sample_id, id
         ) isu ON isu.ins_sample_id = isa.id
-        LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
         LEFT JOIN user ON isu.user_id = user.id
         WHERE
         io.state = 1
@@ -152,11 +151,8 @@
             and (isu.user_id = #{userId} OR isu.user_id is NULL )
         </if>
         OR isu.user_id is NULL
-        GROUP BY
-        ip.son_laboratory,
-        io.id
         ) a
-          ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory and a.sampleId=ios.ins_sample_id
+        ON ios.ins_order_id = a.id AND ios.laboratory = #{sonLaboratory} and a.sampleId=ios.ins_sample_id
         left join
         (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM
         ins_sample_user where son_laboratory=#{sonLaboratory} GROUP BY ins_sample_id) md where td.id = md.id
@@ -167,9 +163,7 @@
         ) isu2 on
         isu2.ins_sample_id = a.sampleId
         where ins_state is not null
-        <if test="laboratory != null and laboratory != ''">
-            and a.laboratory=#{laboratory}
-        </if>
+        and state=1
         ORDER BY
         a.type DESC,
         a.id
@@ -188,6 +182,7 @@
                inspection_item_class_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
+
                ip.factory     ip_factory,
                ip.laboratory  ip_laboratory,
                ip.sample_type ip_sample_type,
@@ -229,15 +224,6 @@
                                         left join ins_product ip on is2.id =
                                                                     ip.ins_sample_id
                                where ip.id is not null) s)
-        order by case
-                     when man_hour_group is NULL then 1
-                     when man_hour_group = '' then 1
-                     else 0 end,
-                 CASE
-                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+'
-                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
-                , id asc
     </select>
     <select id="getInsOrderAndSample" resultMap="sampleDto">
         select isa.*,
@@ -283,7 +269,10 @@
                ipr.equip_value,
                ipr.equip_name,
                ipr.before_check,
+               ipr.before_note,
                ipr.after_check,
+               ipr.after_note,
+               ipr.test_result,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -353,7 +342,10 @@
                ipr.equip_value,
                ipr.equip_name,
                ipr.before_check,
+               ipr.before_note,
                ipr.after_check,
+               ipr.after_note,
+               ipr.test_result,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -386,21 +378,21 @@
     </select>
     <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
         select isa.*,
-               ios.num          num1,
-               ip.id            ip_id,
+               ios.num        num1,
+               ip.id          ip_id,
                inspection_item,
                inspection_item_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
                inspection_item_class,
                inspection_item_class_en,
-               ip.factory       ip_factory,
-               ip.laboratory    ip_laboratory,
-               ip.sample_type   ip_sample_type,
-               ip.sample        ip_sample,
-               ip.model         ip_model,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
+               ip.sample_type ip_sample_type,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit          ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -416,65 +408,40 @@
                ask,
                tell,
                `last_value`,
-               ip.ins_result    ip_ins_result,
+               ip.ins_result  ip_ins_result,
                state,
                ip.ins_sample_id,
-               ip.create_user   ip_create_user,
-               ip.update_user   ip_update_user,
-               ip.create_time   ip_create_time,
-               ip.update_time   ip_update_time,
+               ip.create_user ip_create_user,
+               ip.update_user ip_update_user,
+               ip.create_time ip_create_time,
+               ip.update_time ip_update_time,
                template_id,
-               ipr.ins_value,
-               ipr.com_value,
-               ipr.equip_value,
-               ipr.before_check,
-               ipr.after_check,
-               ipr2.frequency,
-               ipr2.often,
-               ipr2.port,
-               ipr2.angle,
-               ipr2.value,
-               ipr2.result,
-               ipr2.equip_value equipValue2,
-               ipr2.equip_name  equipName2,
+
                ip.method_s
         from ins_sample isa
                  left join ins_order_state ios on isa.id = ios.ins_sample_id
                  left join ins_product ip on isa.id = ip.ins_sample_id
-                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
-                 left join ins_product_result_2 ipr2 on ip.id = ipr2.ins_product_id
         where isa.ins_order_id = #{id}
           and ip.standard_method_list_id is not null
           and state = 1
-          and (ipr2.num = ios.num or ipr2.num is null)
-          and (ipr.num = ios.num or ipr.num is null)
-        order by case
-                     when man_hour_group is NULL then 1
-                     when man_hour_group = '' then 1
-                     else 0 end,
-                 CASE
-                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+'
-                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
-                , id asc
     </select>
     <select id="selectSampleProductListByOrder2Id2" resultMap="sampleDto">
         select isa.*,
-               ios.num          num1,
-               ip.id            ip_id,
+               ios.num        num1,
+               ip.id          ip_id,
                inspection_item,
                inspection_item_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
                inspection_item_class,
                inspection_item_class_en,
-               ip.factory       ip_factory,
-               ip.laboratory    ip_laboratory,
-               ip.sample_type   ip_sample_type,
-               ip.sample        ip_sample,
-               ip.model         ip_model,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
+               ip.sample_type ip_sample_type,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit          ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -490,45 +457,21 @@
                ask,
                tell,
                `last_value`,
-               ip.ins_result    ip_ins_result,
+               ip.ins_result  ip_ins_result,
                state,
                ip.ins_sample_id,
-               ip.create_user   ip_create_user,
-               ip.update_user   ip_update_user,
-               ip.create_time   ip_create_time,
-               ip.update_time   ip_update_time,
+               ip.create_user ip_create_user,
+               ip.update_user ip_update_user,
+               ip.create_time ip_create_time,
+               ip.update_time ip_update_time,
                template_id,
-               ipr.ins_value,
-               ipr.com_value,
-               ipr.equip_value,
-               ipr.before_check,
-               ipr.after_check,
-               ipr2.frequency,
-               ipr2.often,
-               ipr2.port,
-               ipr2.angle,
-               ipr2.value,
-               ipr2.result,
-               ipr2.equip_value equipValue2,
-               ipr2.equip_name  equipName2,
                ip.method_s
         from ins_sample isa
                  left join ins_order_state ios on isa.id = ios.ins_sample_id
                  left join ins_product ip on isa.id = ip.ins_sample_id
-                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
-                 left join ins_product_result_2 ipr2 on ip.id = ipr2.ins_product_id
         where isa.ins_order_id = #{id}
           and ip.standard_method_list_id is not null
           and state = 1
-        order by case
-                     when man_hour_group is NULL then 1
-                     when man_hour_group = '' then 1
-                     else 0 end,
-                 CASE
-                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-                     WHEN man_hour_group REGEXP '[0-9]+'
-                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
-                , id asc
     </select>
     <select id="selectSampleProductListByOrderId3" resultMap="sampleDto3">
         select isa.id,
@@ -558,12 +501,6 @@
         <foreach collection="ids" open="(" close=")" item="id" separator=",">
             #{id}
         </foreach>
-        order by case when man_hour_group is NULL then 1
-        when man_hour_group ='' then 1 else 0 end,
-        CASE
-        WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-        WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
-        ,id asc
     </select>
 
     <select id="getInsProduct1" resultMap="product">
@@ -608,7 +545,10 @@
                ipr.equip_value,
                ipr.equip_name,
                ipr.before_check,
+               ipr.before_note,
                ipr.after_check,
+               ipr.after_note,
+               ipr.test_result,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -676,7 +616,10 @@
                ipr.equip_value,
                ipr.equip_name,
                ipr.before_check,
+               ipr.before_note,
                ipr.after_check,
+               ipr.after_note,
+               ipr.test_result,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -742,7 +685,10 @@
                ipr.equip_value,
                ipr.equip_name,
                ipr.before_check,
+               ipr.before_note,
                ipr.after_check,
+               ipr.after_note,
+               ipr.test_result,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -880,7 +826,10 @@
         <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
         <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
         <result property="beforeCheck" column="before_check" jdbcType="VARCHAR"/>
+        <result property="beforeNote" column="before_note" jdbcType="VARCHAR"/>
         <result property="afterCheck" column="after_check" jdbcType="VARCHAR"/>
+        <result property="afterNote" column="after_note" jdbcType="VARCHAR"/>
+        <result property="testResult" column="test_result" jdbcType="VARCHAR"/>
         <result property="equipName" column="equip_name" jdbcType="VARBINARY"/>
     </resultMap>
     <resultMap id="insProductResult2" type="com.yuanchu.mom.pojo.InsProductResult2">

--
Gitblit v1.9.3