From 8bf55e1ac0ac6eb6c97a025f0c03b78e208f668e Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期一, 26 八月 2024 17:26:58 +0800 Subject: [PATCH] 复核确认+插队+认领判断是否在库 --- inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 190 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 159 insertions(+), 31 deletions(-) diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml index e822231..dd9c6f8 100644 --- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml +++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml @@ -27,7 +27,7 @@ <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> select * from(select * from( SELECT - a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,(ios.verify_user = #{userId}) verify_user + a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId,ios.create_time,ios.sort FROM ( SELECT @@ -37,33 +37,53 @@ io.appointed, io.send_time, group_concat(distinct isa.sample,' ') sample, - isu.user_id, + userName, + checkName, ip.son_laboratory, - io.ins_time + io.ins_time, + io.laboratory FROM ins_order io LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id - LEFT JOIN ( SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id ) isu ON isu.ins_sample_id = io.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 son_laboratory=#{sonLaboratory} + and u.state=0 + 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 son_laboratory=#{sonLaboratory} + and u.state=1 + 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 io.ins_state != 5 - and send_time is not null - and (isu.user_id = #{userId} OR isu.user_id is NULL) + 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 LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory - 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 GROUP BY ins_sample_id) md where td.id = md.id and user_id = #{userId}) isu2 on - isu2.ins_sample_id = a.id ORDER BY - a.user_id DESC, + ios.sort, a.type DESC, - a.id + ios.create_time ) b - where ins_state is not null)A + where ins_state is not null + and son_laboratory=#{sonLaboratory} + <if test="laboratory!=null and laboratory!=''"> + and laboratory=#{laboratory} + </if> + )A <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} </if> @@ -72,7 +92,7 @@ <select id="inspectionOrderDetailsTaskSwitching" resultType="com.yuanchu.mom.vo.InsOrderPlanTaskSwitchVo"> select * from( SELECT - a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,(ios.verify_user = #{userId}) verify_user + a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user FROM ( SELECT @@ -81,30 +101,55 @@ io.type, io.appointed, io.send_time, - io.sample_type, + group_concat(distinct isa.sample,' ') sampleType, isu.user_id, + user.name userName, ip.son_laboratory, - io.ins_time + io.ins_time, + io.laboratory FROM ins_order io LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id - LEFT JOIN ( SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id ) isu ON isu.ins_sample_id = io.id + LEFT JOIN ( <!--SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id --> + SELECT * + FROM ins_sample_user u + WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN ( + SELECT ins_sample_id, MAX(id) + FROM ins_sample_user + WHERE son_laboratory=#{sonLaboratory} + GROUP BY ins_sample_id + ) + ORDER BY ins_sample_id, id + ) isu ON isu.ins_sample_id = io.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 - # AND io.ins_state != 5 +-- # AND io.ins_state != 5 and send_time is not null - and (isu.user_id = #{userId} OR isu.user_id is NULL) + <if test="userId !=null and userId!=''"> + 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 LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory 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 GROUP BY ins_sample_id) md where td.id = md.id and user_id = #{userId}) isu2 on + ins_sample_user where son_laboratory=#{sonLaboratory} GROUP BY ins_sample_id) md where td.id = md.id + <if test="userId !=null and userId!=''"> + and user_id = #{userId} OR user_id is NULL + </if> + OR user_id is NULL + ) isu2 on isu2.ins_sample_id = a.id + where ins_state is not null + <if test="laboratory != null and laboratory != ''"> + and a.laboratory=#{laboratory} + </if> ORDER BY - a.user_id DESC, + <!--a.user_id DESC,--> a.type DESC, a.id ) b @@ -161,9 +206,16 @@ left join ins_product_result ipr on ip.id = ipr.ins_product_id where ins_order_id = #{id} and state = 1 - and ins_fiber_id is null - and ins_fibers_id is null - and isa.sample_code NOT REGEXP '/' +-- and ins_fiber_id is null +-- and ins_fibers_id is null + and <!--isa.sample_code NOT REGEXP '/'--> + isa.id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 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.*, @@ -218,13 +270,12 @@ where ins_order_id = #{id} and state = 1 and ip.son_laboratory = #{laboratory} - and ins_fiber_id is null - and ins_fibers_id is null </select> <select id="getSampleEn" resultType="java.lang.String"> select name_en from `center-lims`.product where name = #{sample} + limit 1 </select> <select id="selectSampleProductListByOrderId2" resultMap="sampleDto"> select isa.*, @@ -254,7 +305,8 @@ method, man_day, bsm, - tell as ask, + ask, + tell, `last_value`, ip.ins_result ip_ins_result, state, @@ -272,13 +324,20 @@ 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 where ins_order_id = #{id} - and template_id is not null + 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, sample_code, + isa.sample, entrust_code, is_leave, isa.model, @@ -300,6 +359,12 @@ <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"> @@ -353,6 +418,7 @@ and ip.son_laboratory = #{laboratory} and ins_fiber_id is null and ins_fibers_id is null + and standard_method_list_id is not null </select> <select id="getInsProduct2" resultMap="product"> select ip.id ip_id, @@ -403,6 +469,7 @@ where ins_fibers_id = #{id} and state = 1 and ins_fiber_id is null + and standard_method_list_id is not null </select> <select id="getInsProduct3" resultMap="product"> select ip.id ip_id, @@ -453,6 +520,60 @@ where ins_fiber_id = #{id} and state = 1 and ins_fibers_id is null + and standard_method_list_id is not null + </select> + + <select id="getInsProduct4" resultMap="product"> + select ip.id ip_id, + inspection_item, + inspection_item_en, + inspection_item_class, + 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, + ip.sample ip_sample, + ip.model ip_model, + ip.ins_bush_id, + son_laboratory, + ip.unit ip_unit, + price, + man_hour, + man_hour_group, + inspection_item_type, + inspection_value_type, + device_group, + checkout_number, + section, + value_type, + method, + man_day, + bsm, + ask, + `last_value`, + ip.ins_result ip_ins_result, + state, + 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, + template_id, + ipr.ins_value, + ipr.com_value, + ipr.equip_value, + ipr.equip_name, + ip.method_s, + ip.tell, + ip.dic + from ins_product ip + left join ins_product_result ipr on ip.id = ipr.ins_product_id + where ins_bush_id = #{id} + and state = 1 + and ins_fibers_id is null + and standard_method_list_id is not null </select> <select id="getReportModel" resultType="java.util.Map"> </select> @@ -513,6 +634,7 @@ <result property="lastValue" column="last_value" jdbcType="VARCHAR"/> <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/> <result property="state" column="state" jdbcType="INTEGER"/> + <result property="insBushId" column="ins_bush_id" jdbcType="INTEGER"/> <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/> <result property="createUser" column="ip_create_user" jdbcType="INTEGER"/> <result property="updateUser" column="ip_update_user" jdbcType="INTEGER"/> @@ -590,6 +712,12 @@ code methodName from ins_sample is2 inner join standard_method sm on standard_method_list_id = sm.id - where is2.id=#{sampleId} + where is2.id = #{sampleId} + </select> + + <select id="selMethodById" resultType="java.lang.String"> + select code + from standard_method + where id = (select standard_method_list_id from ins_sample where id = #{sampleId}) </select> </mapper> -- Gitblit v1.9.3