质量检验添加质检结果填报功能

This commit is contained in:
yinjinlu-pc\尹金路
2024-12-03 23:54:26 +08:00
parent 76f6ffbe09
commit a529dc1bc9
14 changed files with 1929 additions and 6 deletions

View File

@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.qc.mapper.QcResultDetailMapper">
<resultMap type="QcResultDetail" id="QcResultDetailResult">
<result property="detailId" column="detail_id" />
<result property="resultId" column="result_id" />
<result property="indexId" column="index_id" />
<result property="indexCode" column="index_code" />
<result property="indexName" column="index_name" />
<result property="indexType" column="index_type" />
<result property="qcTool" column="qc_tool" />
<result property="checkMethod" column="check_method" />
<result property="standerVal" column="stander_val" />
<result property="unitOfMeasure" column="unit_of_measure" />
<result property="thresholdMax" column="threshold_max" />
<result property="thresholdMin" column="threshold_min" />
<result property="qcResultType" column="qc_result_type" />
<result property="qcResultSpc" column="qc_result_spc" />
<result property="qcValFloat" column="qc_val_float" />
<result property="qcValInteger" column="qc_val_integer" />
<result property="qcValText" column="qc_val_text" />
<result property="qcValDict" column="qc_val_dict" />
<result property="qcValFile" column="qc_val_file" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectQcResultDetailVo">
select detail_id, result_id, index_id, index_type, qc_tool, check_method, stander_val, unit_of_measure, threshold_max, threshold_min, qc_result_type, qc_result_spc, qc_val_float, qc_val_integer, qc_val_text, qc_val_dict, qc_val_file, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_result_detail
</sql>
<select id="selectQcResultDetailList" parameterType="QcResultDetail" resultMap="QcResultDetailResult">
<include refid="selectQcResultDetailVo"/>
<where>
<if test="resultId != null "> and result_id = #{resultId}</if>
<if test="indexId != null "> and index_id = #{indexId}</if>
<if test="indexType != null and indexType != ''"> and index_type = #{indexType}</if>
<if test="qcTool != null and qcTool != ''"> and qc_tool = #{qcTool}</if>
<if test="checkMethod != null and checkMethod != ''"> and check_method = #{checkMethod}</if>
<if test="standerVal != null "> and stander_val = #{standerVal}</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if>
<if test="thresholdMax != null "> and threshold_max = #{thresholdMax}</if>
<if test="thresholdMin != null "> and threshold_min = #{thresholdMin}</if>
<if test="qcResultType != null and qcResultType != ''"> and qc_result_type = #{qcResultType}</if>
<if test="qcResultSpc != null and qcResultSpc != ''"> and qc_result_spc = #{qcResultSpc}</if>
<if test="qcValFloat != null "> and qc_val_float = #{qcValFloat}</if>
<if test="qcValInteger != null "> and qc_val_integer = #{qcValInteger}</if>
<if test="qcValText != null and qcValText != ''"> and qc_val_text = #{qcValText}</if>
<if test="qcValDict != null and qcValDict != ''"> and qc_val_dict = #{qcValDict}</if>
<if test="qcValFile != null and qcValFile != ''"> and qc_val_file = #{qcValFile}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null "> and attr3 = #{attr3}</if>
<if test="attr4 != null "> and attr4 = #{attr4}</if>
</where>
</select>
<select id="selectQcResultDetailByResultIdAndIQCId" parameterType="QcResultDetail" resultMap="QcResultDetailResult">
select detail_id, result_id, ql.index_id, ql.index_code, ql.index_name, ql.index_type, ql.qc_tool, ql.check_method, ql.stander_val, ql.unit_of_measure, ql.threshold_max, ql.threshold_min, qi.qc_result_type, qi.qc_result_spc, d.qc_val_float, d.qc_val_integer, d.qc_val_text, d.qc_val_dict, d.qc_val_file, d.remark, d.create_by, d.create_time, d.update_by, d.update_time
from qc_iqc_line ql
left join qc_index qi
on ql.index_id = qi.index_id
left join qc_result_detail d
<choose>
<when test="resultId !=null " >
on qi.index_id = d.index_id and d.result_id = #{resultId}
</when>
<otherwise>
on qi.index_id = d.index_id and d.result_id = -1
</otherwise>
</choose>
where 1=1
and ql.iqc_id = #{qcId}
order by qi.index_id asc
</select>
<select id="selectQcResultDetailByResultIdAndIPQCId" parameterType="QcResultDetail" resultMap="QcResultDetailResult">
select detail_id, result_id, ql.index_id, ql.index_code, ql.index_name, ql.index_type, ql.qc_tool, ql.check_method, ql.stander_val, ql.unit_of_measure, ql.threshold_max, ql.threshold_min, qi.qc_result_type, qi.qc_result_spc, d.qc_val_float, d.qc_val_integer, d.qc_val_text, d.qc_val_dict, d.qc_val_file, d.remark, d.create_by, d.create_time, d.update_by, d.update_time
from qc_ipqc_line ql
left join qc_index qi
on ql.index_id = qi.index_id
left join qc_result_detail d
<choose>
<when test="resultId !=null " >
on qi.index_id = d.index_id and d.result_id = #{resultId}
</when>
<otherwise>
on qi.index_id = d.index_id and d.result_id = -1
</otherwise>
</choose>
where 1=1
and ql.ipqc_id = #{qcId}
order by qi.index_id asc
</select>
<select id="selectQcResultDetailByResultIdAndOQCId" parameterType="QcResultDetail" resultMap="QcResultDetailResult">
select detail_id, result_id, ql.index_id, ql.index_code, ql.index_name, ql.index_type, ql.qc_tool, ql.check_method, ql.stander_val, ql.unit_of_measure, ql.threshold_max, ql.threshold_min, qi.qc_result_type, qi.qc_result_spc, d.qc_val_float, d.qc_val_integer, d.qc_val_text, d.qc_val_dict, d.qc_val_file, d.remark, d.create_by, d.create_time, d.update_by, d.update_time
from qc_oqc_line ql
left join qc_index qi
on ql.index_id = qi.index_id
left join qc_result_detail d
<choose>
<when test="resultId !=null " >
on qi.index_id = d.index_id and d.result_id = #{resultId}
</when>
<otherwise>
on qi.index_id = d.index_id and d.result_id = -1
</otherwise>
</choose>
where 1=1
and ql.oqc_id = #{qcId}
order by qi.index_id asc
</select>
<select id="selectQcResultDetailByDetailId" parameterType="Long" resultMap="QcResultDetailResult">
<include refid="selectQcResultDetailVo"/>
where detail_id = #{detailId}
</select>
<insert id="insertQcResultDetail" parameterType="QcResultDetail" useGeneratedKeys="true" keyProperty="detailId">
insert into qc_result_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="resultId != null">result_id,</if>
<if test="indexId != null">index_id,</if>
<if test="indexType != null">index_type,</if>
<if test="qcTool != null">qc_tool,</if>
<if test="checkMethod != null">check_method,</if>
<if test="standerVal != null">stander_val,</if>
<if test="unitOfMeasure != null">unit_of_measure,</if>
<if test="thresholdMax != null">threshold_max,</if>
<if test="thresholdMin != null">threshold_min,</if>
<if test="qcResultType != null and qcResultType != ''">qc_result_type,</if>
<if test="qcResultSpc != null">qc_result_spc,</if>
<if test="qcValFloat != null">qc_val_float,</if>
<if test="qcValInteger != null">qc_val_integer,</if>
<if test="qcValText != null">qc_val_text,</if>
<if test="qcValDict != null">qc_val_dict,</if>
<if test="qcValFile != null">qc_val_file,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="resultId != null">#{resultId},</if>
<if test="indexId != null">#{indexId},</if>
<if test="indexType != null">#{indexType},</if>
<if test="qcTool != null">#{qcTool},</if>
<if test="checkMethod != null">#{checkMethod},</if>
<if test="standerVal != null">#{standerVal},</if>
<if test="unitOfMeasure != null">#{unitOfMeasure},</if>
<if test="thresholdMax != null">#{thresholdMax},</if>
<if test="thresholdMin != null">#{thresholdMin},</if>
<if test="qcResultType != null and qcResultType != ''">#{qcResultType},</if>
<if test="qcResultSpc != null">#{qcResultSpc},</if>
<if test="qcValFloat != null">#{qcValFloat},</if>
<if test="qcValInteger != null">#{qcValInteger},</if>
<if test="qcValText != null">#{qcValText},</if>
<if test="qcValDict != null">#{qcValDict},</if>
<if test="qcValFile != null">#{qcValFile},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQcResultDetail" parameterType="QcResultDetail">
update qc_result_detail
<trim prefix="SET" suffixOverrides=",">
<if test="resultId != null">result_id = #{resultId},</if>
<if test="indexId != null">index_id = #{indexId},</if>
<if test="indexType != null">index_type = #{indexType},</if>
<if test="qcTool != null">qc_tool = #{qcTool},</if>
<if test="checkMethod != null">check_method = #{checkMethod},</if>
<if test="standerVal != null">stander_val = #{standerVal},</if>
<if test="unitOfMeasure != null">unit_of_measure = #{unitOfMeasure},</if>
<if test="thresholdMax != null">threshold_max = #{thresholdMax},</if>
<if test="thresholdMin != null">threshold_min = #{thresholdMin},</if>
<if test="qcResultType != null and qcResultType != ''">qc_result_type = #{qcResultType},</if>
<if test="qcResultSpc != null">qc_result_spc = #{qcResultSpc},</if>
<if test="qcValFloat != null">qc_val_float = #{qcValFloat},</if>
<if test="qcValInteger != null">qc_val_integer = #{qcValInteger},</if>
<if test="qcValText != null">qc_val_text = #{qcValText},</if>
<if test="qcValDict != null">qc_val_dict = #{qcValDict},</if>
<if test="qcValFile != null">qc_val_file = #{qcValFile},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where detail_id = #{detailId}
</update>
<delete id="deleteQcResultDetailByDetailId" parameterType="Long">
delete from qc_result_detail where detail_id = #{detailId}
</delete>
<delete id="deleteQcResultDetailByDetailIds" parameterType="String">
delete from qc_result_detail where detail_id in
<foreach item="detailId" collection="array" open="(" separator="," close=")">
#{detailId}
</foreach>
</delete>
<delete id="deleteQcResultDetailByResultId" parameterType="Long">
delete from qc_result_detail where result_id = #{resultId}
</delete>
</mapper>

View File

@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.qc.mapper.QcResultMapper">
<resultMap type="QcResult" id="QcResultResult">
<result property="resultId" column="result_id" />
<result property="resultCode" column="result_code" />
<result property="sourceDocId" column="source_doc_id" />
<result property="sourceDocCode" column="source_doc_code" />
<result property="sourceDocName" column="source_doc_name" />
<result property="sourceDocType" column="source_doc_type" />
<result property="itemId" column="item_id" />
<result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" />
<result property="specification" column="specification" />
<result property="unitOfMeasure" column="unit_of_measure" />
<result property="snCode" column="sn_code" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectQcResultVo">
select result_id, result_code, source_doc_id, source_doc_code, source_doc_name, source_doc_type, item_id, item_code, item_name, specification, unit_of_measure, sn_code, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from qc_result
</sql>
<select id="selectQcResultList" parameterType="QcResult" resultMap="QcResultResult">
<include refid="selectQcResultVo"/>
<where>
<if test="resultCode != null "> and result_code = #{resultCode}</if>
<if test="sourceDocId != null "> and source_doc_id = #{sourceDocId}</if>
<if test="sourceDocCode != null and sourceDocCode != ''"> and source_doc_code = #{sourceDocCode}</if>
<if test="sourceDocName != null and sourceDocName != ''"> and source_doc_name like concat('%', #{sourceDocName}, '%')</if>
<if test="sourceDocType != null and sourceDocType != ''"> and source_doc_type = #{sourceDocType}</if>
<if test="itemId != null "> and item_id = #{itemId}</if>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="specification != null and specification != ''"> and specification = #{specification}</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if>
<if test="snCode != null and snCode != ''"> and sn_code = #{snCode}</if>
</where>
</select>
<select id="selectQcResultByResultId" parameterType="Long" resultMap="QcResultResult">
<include refid="selectQcResultVo"/>
where result_id = #{resultId}
</select>
<insert id="insertQcResult" parameterType="QcResult" useGeneratedKeys="true" keyProperty="resultId">
insert into qc_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="resultCode != null">result_code,</if>
<if test="sourceDocId != null">source_doc_id,</if>
<if test="sourceDocCode != null">source_doc_code,</if>
<if test="sourceDocName != null">source_doc_name,</if>
<if test="sourceDocType != null">source_doc_type,</if>
<if test="itemId != null">item_id,</if>
<if test="itemCode != null">item_code,</if>
<if test="itemName != null">item_name,</if>
<if test="specification != null">specification,</if>
<if test="unitOfMeasure != null">unit_of_measure,</if>
<if test="snCode != null">sn_code,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="resultCode != null">#{resultCode},</if>
<if test="sourceDocId != null">#{sourceDocId},</if>
<if test="sourceDocCode != null">#{sourceDocCode},</if>
<if test="sourceDocName != null">#{sourceDocName},</if>
<if test="sourceDocType != null">#{sourceDocType},</if>
<if test="itemId != null">#{itemId},</if>
<if test="itemCode != null">#{itemCode},</if>
<if test="itemName != null">#{itemName},</if>
<if test="specification != null">#{specification},</if>
<if test="unitOfMeasure != null">#{unitOfMeasure},</if>
<if test="snCode != null">#{snCode},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQcResult" parameterType="QcResult">
update qc_result
<trim prefix="SET" suffixOverrides=",">
<if test="resultCode != null">result_code = #{resultCode},</if>
<if test="sourceDocId != null">source_doc_id = #{sourceDocId},</if>
<if test="sourceDocCode != null">source_doc_code = #{sourceDocCode},</if>
<if test="sourceDocName != null">source_doc_name = #{sourceDocName},</if>
<if test="sourceDocType != null">source_doc_type = #{sourceDocType},</if>
<if test="itemId != null">item_id = #{itemId},</if>
<if test="itemCode != null">item_code = #{itemCode},</if>
<if test="itemName != null">item_name = #{itemName},</if>
<if test="specification != null">specification = #{specification},</if>
<if test="unitOfMeasure != null">unit_of_measure = #{unitOfMeasure},</if>
<if test="snCode != null">sn_code = #{snCode},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where result_id = #{resultId}
</update>
<delete id="deleteQcResultByResultId" parameterType="Long">
delete from qc_result where result_id = #{resultId}
</delete>
<delete id="deleteQcResultByResultIds" parameterType="String">
delete from qc_result where result_id in
<foreach item="resultId" collection="array" open="(" separator="," close=")">
#{resultId}
</foreach>
</delete>
</mapper>