| | |
| | | <update id="updateReceiptNumber"> |
| | | update ope_use_flow |
| | | set receipt_number = #{1} |
| | | , note = #{2} |
| | | where reagent_code = #{0} |
| | | </update> |
| | | <sql id="queryWhereSql"> |
| | |
| | | </if> |
| | | <if test="endDate != null and endDate !=''"> |
| | | and oa.create_time <= #{endDate} |
| | | </if> |
| | | <if test="operatestate != null and operatestate !=''"> |
| | | and bm1.id = #{operatestate} |
| | | </if> |
| | | <if test="containerCode != null and containerCode !=''"> |
| | | and wc.container_code = #{containerCode} |
| | |
| | | LEFT JOIN ope_reagent_status ors on ors.reagent_code = ouf.reagent_code |
| | | LEFT JOIN sys_reagent sr on sr.id = ors.reagent_id |
| | | left join base_meta bm1 on bm1.id = su.department |
| | | <if test="userId !=null and userId != ''"> |
| | | LEFT JOIN sys_reagent sr2 on sr2.id = ouf.user_id |
| | | </if> |
| | | WHERE ouf.operatestate = #{operatestate} |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | WHERE |
| | | (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | and ouf.valid_flag = 1 |
| | | <if test="userId !=null and userId != ''"> |
| | | and ouf.user_id = #{userId} |
| | | </if> |
| | | <if test="reagentCode !=null and reagentCode != ''"> |
| | | and ouf.reagent_code like concat("%",#{reagentCode},"%") |
| | | </if> |
| | |
| | | </select> |
| | | <select id="selectPersonalUseInfo" resultType="com.nanometer.smartlab.entity.OpeUseFlow"> |
| | | SELECT ouf.receipt_number receiptNumber, |
| | | ouf.note, |
| | | count(ouf.reagent_code) applyNum, |
| | | su.name username, |
| | | su.project , |
| | |
| | | LEFT JOIN sys_reagent sr on sr.id = ors.reagent_id |
| | | left join base_meta bm1 on bm1.id = su.department |
| | | left join sys_laboratory sl on sl.id = ouf.house_id |
| | | <if test="userId !=null and userId != ''"> |
| | | LEFT JOIN sys_reagent sr2 on sr2.id = ouf.user_id |
| | | </if> |
| | | WHERE ouf.operatestate = #{operatestate} |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | |
| | | WHERE |
| | | (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | and ouf.valid_flag = 1 |
| | | <if test="userId !=null and userId != ''"> |
| | | and ouf.user_id = #{userId} |
| | | </if> |
| | | <if test="reagentCode !=null and reagentCode != ''"> |
| | | and ouf.reagent_code like concat("%",#{reagentCode},"%") |
| | | </if> |
| | |
| | | LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit |
| | | LEFT JOIN base_meta bm2 on bm2.id = sr.product_home |
| | | LEFT JOIN base_meta bm3 on bm3.id = sr.control_products |
| | | WHERE ouf.operatestate = #{operatestate} |
| | | WHERE |
| | | (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and ouf.receipt_number = #{receiptNumber} |
| | | and ouf.valid_flag = 1 |
| | | </select> |
| | |
| | | LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit |
| | | LEFT JOIN base_meta bm2 on bm2.id = sr.product_home |
| | | LEFT JOIN base_meta bm3 on bm3.id = sr.control_products |
| | | WHERE ouf.operatestate = #{operatestate} |
| | | WHERE (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate}) |
| | | and ouf.receipt_number = #{receiptNumber} |
| | | and ouf.valid_flag = 1 |
| | | </select> |
| | |
| | | </select> |
| | | <select id="selectByReceiptNumber" resultType="com.nanometer.smartlab.entity.OpeUseFlow"> |
| | | SELECT ouf.receipt_number receiptNumber, |
| | | ouf.note, |
| | | count(ouf.reagent_code) applyNum, |
| | | su.name username, |
| | | su.project , |
| | |
| | | <if test="userId !=null and userId != ''"> |
| | | LEFT JOIN sys_reagent sr2 on sr2.id = ouf.user_id |
| | | </if> |
| | | WHERE ouf.operatestate = #{operatestate} |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | WHERE (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | and ouf.valid_flag = 1 |
| | | and ouf.receipt_number = #{receiptNumber} |
| | | group by ouf.receipt_number |
| | | ORDER BY ouf.create_time desc |
| | | </select> |
| | | <select id="selectAll" resultType="java.util.Map"> |
| | | select |
| | | oa.reagent_code as reagentCode, |
| | | sr.`name` as reagentName, |
| | | CASE WHEN wc.container_code is NULL THEN lc.container_code ELSE wc.container_code END as laboratoryContainerCode, |
| | | bm1.meta_value as operatestateName, |
| | | CASE WHEN bm1.meta_value = '仓库入库' or bm1.meta_value='仓库领用' THEN NULL ELSE oa.remainder END as remainder, |
| | | CASE WHEN w.name is NULL THEN l.name ELSE w.name END as warehouseContainerName, |
| | | su.name as userName, |
| | | oa.create_time as createTime |
| | | from ope_use_flow as oa |
| | | left join ope_reagent_status ors on ors.reagent_code = oa.reagent_code |
| | | left join sys_reagent sr on ors.reagent_id = sr.id |
| | | left join sys_supplier as ss on sr.supplier_id = ss.id |
| | | left join sys_user as su on oa.user_id = su.id |
| | | left join sys_warehouse_container wc on wc.id = oa.container_id |
| | | left join sys_warehouse w on w.id = wc.warehouse_id |
| | | left join sys_laboratory_container lc on lc.id = oa.container_id |
| | | left join sys_laboratory l on l.id = lc.laboratory_id |
| | | left join base_meta bm1 on bm1.id = oa.operatestate |
| | | where oa.valid_flag = 1 |
| | | <include refid="queryWhereSql"/> |
| | | order by oa.create_time desc |
| | | </select> |
| | | |
| | | <select id="selectDetail" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | sr.product_sn productSn, |
| | | sr.NAME reagentName, |
| | | ouf.reagent_code reagentCode, |
| | | bm3.meta_value controlProducts, |
| | | bm.meta_value reagentFormat, |
| | | CONCAT(sr.main_metering,bm1.meta_value) perInfo, |
| | | bm2.meta_value productHome, |
| | | ors.article_number articleNumber, |
| | | su.name username, |
| | | su.project, |
| | | bm4.meta_value department, |
| | | sl.name location, |
| | | date_format(ouf.create_time,'%Y-%m-%d %H:%i') createTime |
| | | from `ope_use_flow` ouf |
| | | LEFT JOIN ope_reagent_status ors ON ors.reagent_code = ouf.reagent_code |
| | | LEFT join sys_reagent sr ON ors.reagent_id = sr.id |
| | | LEFT JOIN base_meta bm ON bm.id = sr.reagent_format |
| | | LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit |
| | | LEFT JOIN base_meta bm2 on bm2.id = sr.product_home |
| | | LEFT JOIN base_meta bm3 on bm3.id = sr.control_products |
| | | LEFT JOIN sys_user as su on su.id = ouf.user_id |
| | | left join base_meta bm4 on bm4.id = su.department |
| | | LEFT JOIN sys_laboratory sl on sl.id = ouf.house_id |
| | | WHERE |
| | | (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and ouf.valid_flag = 1 |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | <if test="userId !=null and userId != ''"> |
| | | and ouf.user_id = #{userId} |
| | | </if> |
| | | <if test="reagentCode !=null and reagentCode != ''"> |
| | | and ouf.reagent_code like concat("%",#{reagentCode},"%") |
| | | </if> |
| | | <if test="startTime !=null and startTime != ''"> |
| | | and ouf.create_time >#{startTime} |
| | | </if> |
| | | <if test="endTime !=null and endTime != ''"> |
| | | and ouf.create_time <#{endTime} |
| | | </if> |
| | | <if test="project !=null and project != ''"> |
| | | and su.project like concat("%",#{project},"%") |
| | | </if> |
| | | <if test="department !=null and department != ''"> |
| | | and su.bm1.meta_value like concat("%",#{department},"%") |
| | | </if> |
| | | <if test="receiptNumber !=null and receiptNumber != ''"> |
| | | and ouf.receipt_number like concat("%",#{receiptNumber},"%") |
| | | </if> |
| | | <if test="reagentName !=null and reagentName != ''"> |
| | | and sr.name like concat("%",#{reagentName},"%") |
| | | </if> |
| | | <if test="applyPerson !=null and applyPerson != ''"> |
| | | and su.name like concat("%",#{applyPerson},"%") |
| | | </if> |
| | | </select> |
| | | |
| | | <insert id="insertOpeUseFlow" parameterType="com.nanometer.smartlab.entity.OpeUseFlow"> |
| | | insert into ope_use_flow(id, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, create_time, realstatus, operatestate |
| | | <if test="receiptNumber != null"> |