You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2817 lines
115 KiB
2817 lines
115 KiB
<?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.xujie.sys.modules.pms.mapper.QcMapper">
|
|
|
|
<!-- ================================================= 检验方法 ================================================= -->
|
|
|
|
<!-- 条件查询检验方法 -->
|
|
<select id="qcMethodSearch" parameterType="QcMethodData" resultType="QcMethodData">
|
|
SELECT
|
|
qm.site,
|
|
qm.method_no,
|
|
qm.method_name,
|
|
qm.create_date,
|
|
qm.create_by,
|
|
qm.method_remark,
|
|
qm.update_date,
|
|
qm.update_by,
|
|
qm.inspection_type_no,
|
|
qit.inspection_type_name
|
|
FROM qc_method as qm
|
|
LEFT JOIN qc_inspection_type as qit on qm.site = qit.site and qm.inspection_type_no = qit.inspection_type_no
|
|
<where>
|
|
qm.site = #{query.site}
|
|
<if test="query.methodNo != null and query.methodNo != ''">
|
|
AND qm.method_no LIKE '%' + #{query.methodNo} +'%'
|
|
</if>
|
|
<if test="query.methodName != null and query.methodName != ''">
|
|
AND qm.method_name LIKE '%' + #{query.methodName} +'%'
|
|
</if>
|
|
<if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND qm.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获得检验方法单号 -->
|
|
<select id="getMethodNo" resultType="string" parameterType="QcMethodData">
|
|
SELECT
|
|
Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(method_no,4))),0)+1),4)
|
|
FROM qc_method
|
|
WHERE site = #{site}
|
|
AND inspection_type_no = #{inspectionTypeNo}
|
|
</select>
|
|
|
|
<!-- 新增检验方法 -->
|
|
<insert id="qcMethodSave" parameterType="QcMethodData">
|
|
INSERT INTO qc_method (site, method_no, method_name, create_date, create_by, method_remark, update_date, update_by, inspection_type_no)
|
|
VALUES (#{site}, #{methodNo}, #{methodName}, GetDate(), #{createBy}, #{methodRemark}, getDate(), #{updateBy}, #{inspectionTypeNo})
|
|
</insert>
|
|
|
|
<!-- 修改检验方法 -->
|
|
<update id="qcMethodUpdate" parameterType="QcMethodData">
|
|
UPDATE qc_method
|
|
SET method_name = #{methodName},
|
|
method_remark = #{methodRemark},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
inspection_type_no = #{inspectionTypeNo}
|
|
WHERE site = #{site} and method_no = #{methodNo}
|
|
</update>
|
|
|
|
<!-- 检查方法是否在被项目使用 -->
|
|
<select id="checkMethodIsUsed" parameterType="QcMethodData" resultType="EamPropertiesItemData">
|
|
SELECT
|
|
ItemNo
|
|
FROM qc_method_item
|
|
WHERE site = #{site} and method_no = #{methodNo}
|
|
</select>
|
|
|
|
<!-- 删除检验方法 -->
|
|
<delete id="qcMethodDelete" parameterType="QcMethodData">
|
|
DELETE
|
|
FROM qc_method
|
|
WHERE site = #{site} and method_no = #{methodNo}
|
|
</delete>
|
|
|
|
<!-- ================================================= 检验项目 ================================================= -->
|
|
|
|
<!-- 根据条件查询检验项目 -->
|
|
<select id="qcItemSearch" parameterType="QcItemData" resultType="QcItemData">
|
|
SELECT
|
|
epi.site,
|
|
epi.ItemNo,
|
|
epi.ItemDesc,
|
|
epi.DefaultValue,
|
|
epi.ValueType,
|
|
epi.ValueType_DB as valueTypeDb,
|
|
epi.ValueChooseFlag,
|
|
epi.CreatedDate,
|
|
epi.CreatedBy,
|
|
epi.MaxValue,
|
|
epi.MinValue,
|
|
epi.ItemRemark,
|
|
epi.ItemType,
|
|
epi.update_date,
|
|
epi.update_by,
|
|
qm.method_no,
|
|
qm.method_name,
|
|
qm.method_remark,
|
|
epi.inspection_type_no,
|
|
qit.inspection_type_name,
|
|
epi.item_sampling_quantity
|
|
FROM eam_properties_item as epi
|
|
LEFT JOIN qc_method_item as qmi on epi.ItemNo = qmi.ItemNo and epi.site = qmi.site
|
|
LEFT JOIN qc_method as qm on qmi.method_no = qm.method_no and qmi.site = qm.site
|
|
LEFT JOIN qc_inspection_type as qit on qit.inspection_type_no = epi.inspection_type_no and qit.site = epi.site
|
|
<where>
|
|
epi.site = #{query.site}
|
|
and epi.ItemType = #{query.itemType}
|
|
<if test="query.itemDesc != null and query.itemDesc != ''">
|
|
AND epi.ItemDesc LIKE '%' + #{query.itemDesc} +'%'
|
|
</if>
|
|
<if test="query.itemNo != null and query.itemNo != ''">
|
|
AND epi.ItemNo LIKE '%' + #{query.itemNo} +'%'
|
|
</if>
|
|
<if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND epi.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 检测是否存在该项目 -->
|
|
<select id="checkQcItem" parameterType="QcItemData" resultType="QcItemData">
|
|
SELECT ItemNo,
|
|
ItemDesc
|
|
FROM eam_properties_item
|
|
WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
|
|
</select>
|
|
|
|
<!-- 获得检验项目单号 -->
|
|
<select id="getItemNo" resultType="string" parameterType="QcItemData">
|
|
SELECT
|
|
Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(ItemNo,4))),0)+1),4)
|
|
FROM eam_properties_item
|
|
WHERE site = #{site} and ItemType = 'D' and inspection_type_no = #{inspectionTypeNo}
|
|
</select>
|
|
|
|
<!-- 新增检验项目 -->
|
|
<insert id="qcItemSave" parameterType="QcItemData">
|
|
INSERT INTO eam_properties_item (site, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, CreatedDate, CreatedBy, MaxValue, MinValue, ItemRemark, ItemType, update_date, update_by, inspection_type_no, item_sampling_quantity)
|
|
VALUES (#{site}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType}, getDate(), #{updateBy}, #{inspectionTypeNo}, #{itemSamplingQuantity})
|
|
</insert>
|
|
|
|
<!-- 新增项目里的方法 -->
|
|
<insert id="qcItemMethodSave" parameterType="QcItemData">
|
|
INSERT INTO qc_method_item (ItemNo, method_no, site)
|
|
VALUES (#{itemNo}, #{methodNo}, #{site})
|
|
</insert>
|
|
|
|
<!-- 修改检验项目 -->
|
|
<update id="qcItemUpdate" parameterType="QcItemData">
|
|
UPDATE eam_properties_item
|
|
SET ItemDesc = #{itemDesc},
|
|
DefaultValue = #{defaultValue},
|
|
ValueType = #{valueType},
|
|
ValueType_DB = #{valueTypeDb},
|
|
ValueChooseFlag = #{valueChooseFlag},
|
|
MaxValue = #{maxValue,jdbcType=DECIMAL},
|
|
MinValue = #{minValue,jdbcType=DECIMAL},
|
|
ItemRemark = #{itemRemark},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
inspection_type_no = #{inspectionTypeNo},
|
|
item_sampling_quantity = #{itemSamplingQuantity}
|
|
WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
|
|
</update>
|
|
|
|
<!-- 修改项目中的方法 -->
|
|
<update id="qcItemMethodUpdate" parameterType="QcItemData">
|
|
UPDATE qc_method_item
|
|
SET method_no = #{methodNo}
|
|
WHERE site = #{site} and ItemNo = #{itemNo}
|
|
</update>
|
|
|
|
<!-- 检查项目是否在被模板使用 -->
|
|
<select id="checkItemIsUsed" parameterType="QcItemData" resultType="EamPropertiesModelDetailData">
|
|
SELECT template_id
|
|
FROM qc_template_detailed
|
|
WHERE site = #{site} and ItemNo = #{itemNo}
|
|
</select>
|
|
|
|
<!-- 删除检验项目 -->
|
|
<delete id="qcItemDelete" parameterType="QcItemData">
|
|
DELETE
|
|
FROM eam_properties_item
|
|
WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
|
|
</delete>
|
|
|
|
<!-- 删除项目-方法中间表数据 -->
|
|
<delete id="qcItemMethodDelete" parameterType="QcItemData">
|
|
DELETE
|
|
FROM qc_method_item
|
|
WHERE site = #{site} and ItemNo = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- ================================================= 质检员信息维护 ================================================= -->
|
|
|
|
<!-- 查询质检员信息列表 -->
|
|
<select id="inspectorSearch" resultType="QcInspectorData">
|
|
SELECT inspector_no,
|
|
inspector_name,
|
|
inspector_phone,
|
|
inspector_type,
|
|
inspector_active
|
|
FROM qc_inspector
|
|
</select>
|
|
|
|
<!-- 检验是否已存在该质检员 -->
|
|
<select id="checkInspector" resultType="QcInspectorData">
|
|
SELECT inspector_name
|
|
FROM qc_inspector
|
|
WHERE inspector_no = #{inspectorNo}
|
|
</select>
|
|
|
|
<!-- 新增质检员 -->
|
|
<insert id="inspectorSave" parameterType="QcInspectorData">
|
|
INSERT INTO qc_inspector (inspector_no, inspector_name, inspector_phone, inspector_type, inspector_active, create_time)
|
|
VALUES (#{inspectorNo}, #{inspectorName}, #{inspectorPhone}, #{inspectorType}, #{inspectorActive}, getDate())
|
|
</insert>
|
|
|
|
<!-- 修改质检员 -->
|
|
<update id="inspectorUpdate" parameterType="QcInspectorData">
|
|
UPDATE qc_inspector
|
|
SET inspector_name = #{inspectorName},
|
|
inspector_phone = #{inspectorPhone},
|
|
inspector_type = #{inspectorType},
|
|
inspector_active = #{inspectorActive}
|
|
WHERE inspector_no = #{inspectorNo}
|
|
</update>
|
|
|
|
<!-- 删除质检员 -->
|
|
<delete id="inspectorDelete" parameterType="QcInspectorData">
|
|
DELETE FROM qc_inspector
|
|
WHERE inspector_no = #{inspectorNo}
|
|
</delete>
|
|
|
|
<!-- ================================================= 抽样矩阵维护 ================================================= -->
|
|
|
|
<!-- 查询抽样矩阵 -->
|
|
<select id="samplingInspectionPlanSearch" parameterType="QcSamplingInspectionPlanData" resultType="QcSamplingInspectionPlanData">
|
|
SELECT
|
|
qsip.site,
|
|
qsip.sampling_plan_no,
|
|
qsip.sampling_plan_desc,
|
|
qsip.sampling_qty_no,
|
|
qsiq.sampling_qty,
|
|
qsiq.sampling_qty_desc,
|
|
qsip.sampling_qty_rank_no,
|
|
qsiqr.sampling_qty_rank_desc,
|
|
qsiqr.min_qty,
|
|
qsiqr.max_qty,
|
|
qsip.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qsip.sampling_plan_active,
|
|
qsip.create_date,
|
|
qsip.create_by,
|
|
qsip.update_date,
|
|
qsip.update_by
|
|
FROM qc_sampling_inspection_plan as qsip
|
|
LEFT JOIN qc_sampling_inspection_qty as qsiq
|
|
ON qsip.sampling_qty_no = qsiq.sampling_qty_no
|
|
LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr
|
|
ON qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no
|
|
LEFT JOIN qc_sampling_inspection_level as qsil
|
|
ON qsip.sampling_level_no = qsil.sampling_level_no
|
|
<where>
|
|
qsip.site = #{query.site}
|
|
<if test="query.samplingQtyDesc != null and query.samplingQtyDesc != ''">
|
|
AND qsiq.sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc}+'%'
|
|
</if>
|
|
<if test="query.samplingLevelDesc != null and query.samplingLevelDesc != ''">
|
|
AND qsil.sampling_level_desc LIKE '%' + #{query.samplingLevelDesc}+'%'
|
|
</if>
|
|
<if test="query.samplingPlanActive != null and query.samplingPlanActive != ''">
|
|
AND qsip.sampling_plan_active = #{query.samplingPlanActive}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据三个编码查矩阵 -->
|
|
<select id="selectSamplingPlanByNo" resultType="QcSamplingInspectionPlanData" parameterType="QcSamplingInspectionPlanData">
|
|
SELECT
|
|
site,
|
|
sampling_plan_no,
|
|
sampling_qty_no,
|
|
sampling_qty_rank_no,
|
|
sampling_level_no,
|
|
sampling_plan_active
|
|
FROM qc_sampling_inspection_plan
|
|
WHERE sampling_qty_no = #{samplingQtyNo}
|
|
AND sampling_qty_rank_no = #{samplingQtyRankNo}
|
|
AND sampling_level_no = #{samplingLevelNo}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 根据名称查矩阵 -->
|
|
<select id="selectSamplingPlanByDesc" resultType="QcSamplingInspectionPlanData" parameterType="QcSamplingInspectionPlanData">
|
|
SELECT
|
|
site,
|
|
sampling_plan_no,
|
|
sampling_qty_no,
|
|
sampling_qty_rank_no,
|
|
sampling_level_no,
|
|
sampling_plan_active
|
|
FROM qc_sampling_inspection_plan
|
|
WHERE sampling_plan_desc = #{samplingPlanDesc}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取最大方矩阵编码 -->
|
|
<select id="queryLastSamplingPlanNo" resultType="string" parameterType="QcSamplingInspectionPlanData">
|
|
SELECT top 1 sampling_plan_no
|
|
FROM qc_sampling_inspection_plan
|
|
where site = #{site}
|
|
ORDER BY sampling_plan_no Desc
|
|
</select>
|
|
|
|
<!-- 新增抽样矩阵 -->
|
|
<insert id="samplingInspectionPlanSave" parameterType="QcSamplingInspectionPlanData">
|
|
INSERT INTO qc_sampling_inspection_plan (site, sampling_plan_no, sampling_plan_desc, sampling_qty_rank_no, sampling_level_no, sampling_qty_no, sampling_plan_active, create_date, create_by, update_date, update_by)
|
|
VALUES (#{site}, #{samplingPlanNo}, #{samplingPlanDesc}, #{samplingQtyRankNo}, #{samplingLevelNo}, #{samplingQtyNo}, #{samplingPlanActive}, getDate(), #{createBy}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 修改抽样矩阵 -->
|
|
<update id="samplingInspectionPlanUpdate" parameterType="QcSamplingInspectionPlanData">
|
|
UPDATE qc_sampling_inspection_plan
|
|
SET sampling_qty_rank_no = #{samplingQtyRankNo},
|
|
sampling_level_no = #{samplingLevelNo},
|
|
sampling_qty_no = #{samplingQtyNo},
|
|
sampling_plan_active = #{samplingPlanActive},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE sampling_plan_no = #{samplingPlanNo}
|
|
AND site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除抽样矩阵 -->
|
|
<delete id="samplingInspectionPlanDelete" parameterType="QcSamplingInspectionPlanData">
|
|
DELETE FROM qc_sampling_inspection_plan
|
|
WHERE sampling_plan_no = #{samplingPlanNo}
|
|
AND site = #{site}
|
|
</delete>
|
|
|
|
<!-- ================================================= 检验模板维护 ================================================= -->
|
|
|
|
<!-- 查询模板 -->
|
|
<select id="templateSearch" parameterType="QcTemplateData" resultType="QcTemplateData">
|
|
SELECT
|
|
qt.site,
|
|
qt.template_id,
|
|
qt.template_name,
|
|
qt.template_remark,
|
|
qt.template_type,
|
|
qt.template_version,
|
|
qt.sampling_programme_no,
|
|
qsip.sampling_programme_Desc,
|
|
qt.inspection_type_no,
|
|
qit.inspection_type_name,
|
|
qt.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qt.inspection_cycle,
|
|
qt.create_time,
|
|
qt.create_by,
|
|
qt.update_date,
|
|
qt.update_by,
|
|
qt.AQL,
|
|
qt.AC,
|
|
qt.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_template as qt
|
|
LEFT JOIN qc_inspection_type as qit on qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
|
|
LEFT JOIN qc_sampling_inspection_level as qsil on qt.sampling_level_no = qsil.sampling_level_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip on qt.sampling_programme_no = qsip.sampling_programme_no
|
|
<where>
|
|
qt.site = #{query.site}
|
|
<if test = "query.templateId != null and query.templateId != ''">
|
|
AND qt.template_id LIKE '%' + #{query.templateId}+'%'
|
|
</if>
|
|
<if test = "query.templateName != null and query.templateName != ''">
|
|
AND qt.template_name LIKE '%' + #{query.templateName}+'%'
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND qt.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获得检验模板单号 -->
|
|
<select id="getTemplateNo" resultType="string" parameterType="QcTemplateData">
|
|
SELECT
|
|
Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(template_id,3))),0)+1),3)
|
|
FROM qc_template
|
|
WHERE site = #{site} and inspection_type_no = #{inspectionTypeNo}
|
|
</select>
|
|
|
|
<!-- 新增模板 -->
|
|
<insert id="templateSave" parameterType="QcTemplateData">
|
|
INSERT INTO qc_template (site, template_id, template_name, template_version, template_remark, template_type, sampling_programme_no, inspection_type_no, create_time, create_by, sampling_level_no, inspection_cycle, AQL, AC, RE, default_sampling_quantity, default_sampling_proportion, update_date, update_by)
|
|
VALUES (#{site}, #{templateId}, #{templateName},#{templateVersion}, #{templateRemark}, #{templateType}, #{samplingProgrammeNo}, #{inspectionTypeNo}, getDate(), #{createBy}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{aql}, #{ac}, #{re}, #{defaultSamplingQuantity}, #{defaultSamplingProportion}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 修改模板 -->
|
|
<update id="templateUpdate" parameterType="QcTemplateData">
|
|
UPDATE qc_template
|
|
SET template_name = #{templateName},
|
|
template_version = #{templateVersion},
|
|
template_remark = #{templateRemark},
|
|
template_type = #{templateType},
|
|
sampling_programme_no = #{samplingProgrammeNo},
|
|
inspection_cycle = #{inspectionCycle},
|
|
inspection_type_no = #{inspectionTypeNo},
|
|
sampling_level_no = #{samplingLevelNo},
|
|
AQL = #{aql},
|
|
AC = #{ac},
|
|
RE = #{re},
|
|
default_sampling_quantity = #{defaultSamplingQuantity},
|
|
default_sampling_proportion = #{defaultSamplingProportion},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE template_id = #{templateId}
|
|
AND site = #{site}
|
|
</update>
|
|
|
|
<!-- 查询模板里的项目详情 -->
|
|
<select id="templateDetailsSearch" resultType="QcTemplateData">
|
|
SELECT
|
|
a.site,
|
|
a.template_id,
|
|
a.ItemNo,
|
|
b.ItemDesc,
|
|
a.default_value,
|
|
b.ValueType,
|
|
b.ValueType_DB,
|
|
a.max_value,
|
|
a.min_value,
|
|
b.ItemRemark,
|
|
b.ItemType,
|
|
a.object_id,
|
|
eo.objectDesc,
|
|
b.item_sampling_quantity
|
|
FROM qc_template_detailed a
|
|
LEFT JOIN eam_properties_item b ON a.ItemNo = b.ItemNo and a.site = b.site
|
|
LEFT JOIN eam_object eo ON a.object_id = eo.ObjectID and a.site = b.site
|
|
WHERE a.template_id = #{templateId} AND b.ItemType = #{itemType} and a.site = #{site}
|
|
</select>
|
|
|
|
|
|
<!-- 查询模板里是否已存在该项目 -->
|
|
<select id="selectItemDetails" resultType="QcTemplateData">
|
|
SELECT template_id,
|
|
ItemNo,
|
|
default_value,
|
|
max_value,
|
|
min_value
|
|
FROM qc_template_detailed
|
|
WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询项目的最大最小值 -->
|
|
<select id="selectDetail" resultType="QcTemplateData">
|
|
SELECT ItemNo,
|
|
DefaultValue,
|
|
MaxValue,
|
|
MinValue
|
|
FROM eam_properties_item
|
|
WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 新增模板的检验项目 -->
|
|
<insert id="addItemDetails" parameterType="QcTemplateData">
|
|
INSERT INTO qc_template_detailed (template_id, ItemNo, default_value, max_value, min_value, site)
|
|
VALUES (#{templateId}, #{itemNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{site})
|
|
</insert>
|
|
|
|
<!-- 删除模板的检验项目 -->
|
|
<delete id="delItemDetails" >
|
|
DELETE FROM qc_template_detailed
|
|
WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 获取当前模板不包含的项目 -->
|
|
<select id="getItemList" resultType="QcTemplateData">
|
|
SELECT
|
|
a.site,
|
|
a.itemNo,
|
|
a.ItemDesc,
|
|
a.DefaultValue,
|
|
a.MaxValue,
|
|
a.MinValue
|
|
FROM eam_properties_item a
|
|
LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site
|
|
WHERE a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null
|
|
</select>
|
|
|
|
<!-- 查询项目 -->
|
|
<select id="getItem" resultType="QcTemplateData">
|
|
SELECT
|
|
a.site,
|
|
a.itemNo,
|
|
a.ItemDesc,
|
|
a.DefaultValue,
|
|
a.MaxValue,
|
|
a.MinValue
|
|
FROM eam_properties_item a
|
|
LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site
|
|
<where>
|
|
a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null
|
|
<if test = "itemNo != null and itemNo != ''">
|
|
AND a.ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test = "itemDesc != null and itemDesc != ''">
|
|
AND a.ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<!-- 删除模板 -->
|
|
<delete id="templateDelete" parameterType="QcTemplateData">
|
|
DELETE FROM qc_template
|
|
WHERE template_id = #{templateId}
|
|
AND site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除模板-项目中间表 -->
|
|
<delete id="itemItemDelete" parameterType="QcTemplateData">
|
|
DELETE FROM qc_template_detailed
|
|
WHERE template_id = #{templateId} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 搜索所有检验类型 -->
|
|
<select id="inspectionTypeSearch" resultType="QcInspectionTypeData" parameterType="QcInspectionTypeData">
|
|
SELECT inspection_type_no,
|
|
inspection_type_name
|
|
FROM qc_inspection_type
|
|
WHERE site = #{site}
|
|
</select>
|
|
|
|
<!-- 搜索所有设备 -->
|
|
<select id="objectSearch" resultType="EamObjectData">
|
|
SELECT ObjectID,
|
|
ObjectDesc
|
|
FROM eam_object
|
|
WHERE Active = 'Y'
|
|
</select>
|
|
|
|
<!-- 导入文件检验 -->
|
|
<select id="getItemByItemNo" resultType="EamPropertiesItemData" parameterType="QcItemData">
|
|
SELECT ItemDesc,
|
|
ItemType
|
|
FROM eam_properties_item
|
|
WHERE ItemDesc = #{itemDesc}
|
|
AND DefaultValue = #{defaultValue}
|
|
AND MaxValue = #{maxValue}
|
|
AND MinValue = #{minValue}
|
|
AND ItemType = #{itemType}
|
|
</select>
|
|
|
|
<!-- 新增检验项目 -->
|
|
<insert id="insertItem" parameterType="EamPropertiesItemData">
|
|
INSERT INTO eam_properties_item (ItemNo, ItemDesc,DefaultValue,ValueType,ValueType_DB, CreatedDate,CreatedBy,MaxValue, MinValue, ItemRemark,ItemType)
|
|
VALUES(#{itemNo},#{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType})
|
|
</insert>
|
|
|
|
<!-- <!– 获取最大项目编码 –>-->
|
|
<!-- <select id="queryLastItemNo" resultType="string" parameterType="QcItemData">-->
|
|
<!-- SELECT top 1 ItemNo-->
|
|
<!-- FROM eam_properties_item-->
|
|
<!-- WHERE ItemType = #{itemType}-->
|
|
<!-- ORDER BY ItemNo Desc-->
|
|
<!-- </select>-->
|
|
|
|
<!-- 根据模板名称查询模板 -->
|
|
<select id="selectTemplateByDesc" parameterType="QcTemplateData" resultType="QcTemplateData">
|
|
SELECT template_id,
|
|
template_name,
|
|
template_version
|
|
FROM qc_template
|
|
WHERE template_name = #{templateName}
|
|
AND site = #{site}
|
|
AND template_version = #{templateVersion}
|
|
</select>
|
|
|
|
<!-- 修改项目明细的最大最小值 -->
|
|
<update id="saveItemDetailed" parameterType="QcTemplateData">
|
|
UPDATE qc_template_detailed
|
|
SET default_value = #{defaultValue},
|
|
max_value = #{maxValue,jdbcType=DECIMAL},
|
|
min_value = #{minValue,jdbcType=DECIMAL},
|
|
object_id = #{objectID}
|
|
WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 查询项目明细 -->
|
|
<select id="selectItem" resultType="QcTemplateData">
|
|
SELECT ItemNo,
|
|
ItemDesc,
|
|
DefaultValue,
|
|
ValueType,
|
|
ValueType_DB,
|
|
MaxValue,
|
|
MinValue,
|
|
ItemRemark,
|
|
ItemType
|
|
FROM eam_properties_item
|
|
WHERE ItemNo = #{itemNo}
|
|
AND ItemType = #{itemType}
|
|
</select>
|
|
|
|
<!-- ================================================= 样本量维护 ================================================= -->
|
|
|
|
<!-- 查询样本量 -->
|
|
<select id="samplingQtySearch" parameterType="QcSamplingInspectionQtyData" resultType="QcSamplingInspectionQtyData">
|
|
SELECT
|
|
site,
|
|
sampling_qty_no,
|
|
sampling_qty_desc,
|
|
sampling_qty,
|
|
sampling_qty_remark,
|
|
sampling_qty_active,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM qc_sampling_inspection_qty
|
|
<where>
|
|
site = #{site}
|
|
<if test="samplingQtyNo != null and samplingQtyNo != ''">
|
|
AND sampling_qty_no LIKE '%' + #{samplingQtyNo}+'%'
|
|
</if>
|
|
<if test="samplingQtyDesc != null and samplingQtyDesc != ''">
|
|
AND sampling_qty_desc LIKE '%' + #{samplingQtyDesc}+'%'
|
|
</if>
|
|
<if test="samplingQty != null">
|
|
AND sampling_qty = #{samplingQty,jdbcType=DECIMAL}
|
|
</if>
|
|
<if test="samplingQtyActive != null and samplingQtyActive != ''">
|
|
AND sampling_qty_active = #{samplingQtyActive}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 新增样本量 -->
|
|
<insert id="samplingQtySave" parameterType="QcSamplingInspectionQtyData">
|
|
INSERT INTO qc_sampling_inspection_qty (site, sampling_qty_no, sampling_qty, sampling_qty_remark, sampling_qty_active, sampling_qty_desc, create_date, create_by, update_date, update_by)
|
|
VALUES(#{site}, #{samplingQtyNo}, #{samplingQty,jdbcType=DECIMAL}, #{samplingQtyRemark}, #{samplingQtyActive}, #{samplingQtyDesc}, getDate(), #{createBy}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 根据样本量字码查询样本量 -->
|
|
<select id="selectSamplingQtyByDesc" parameterType="QcSamplingInspectionQtyData" resultType="QcSamplingInspectionQtyData">
|
|
SELECT
|
|
site,
|
|
sampling_qty_no,
|
|
sampling_qty_desc,
|
|
sampling_qty,
|
|
sampling_qty_remark,
|
|
sampling_qty_active
|
|
FROM qc_sampling_inspection_qty
|
|
WHERE sampling_qty_desc = #{samplingQtyDesc}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取最大样本量编码 -->
|
|
<select id="queryLastSamplingQtyNo" resultType="string" parameterType="QcSamplingInspectionQtyData">
|
|
SELECT top 1 sampling_qty_no
|
|
FROM qc_sampling_inspection_qty
|
|
where site = #{site}
|
|
ORDER BY sampling_qty_no Desc
|
|
</select>
|
|
|
|
<!-- 修改样本量 -->
|
|
<update id="samplingQtyUpdate" parameterType="QcSamplingInspectionQtyData">
|
|
UPDATE qc_sampling_inspection_qty
|
|
SET sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
sampling_qty_desc = #{samplingQtyDesc},
|
|
sampling_qty_remark = #{samplingQtyRemark},
|
|
sampling_qty_active = #{samplingQtyActive},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE sampling_qty_no = #{samplingQtyNo}
|
|
AND site = #{site}
|
|
</update>
|
|
|
|
<!-- 根据样本量编码查询矩阵 -->
|
|
<select id="selectSamplingPlanBySamplingQtyNo" resultType="QcSamplingInspectionPlanData" parameterType="QcSamplingInspectionQtyData">
|
|
SELECT
|
|
site,
|
|
sampling_plan_no,
|
|
sampling_qty_no,
|
|
sampling_qty_rank_no,
|
|
sampling_level_no,
|
|
sampling_plan_active
|
|
FROM qc_sampling_inspection_plan
|
|
WHERE site = #{site}
|
|
AND sampling_qty_no = #{samplingQtyNo}
|
|
</select>
|
|
|
|
<!-- 删除样本量 -->
|
|
<delete id="samplingQtyDelete" parameterType="QcSamplingInspectionQtyData">
|
|
DELETE FROM qc_sampling_inspection_qty
|
|
WHERE site = #{site}
|
|
AND sampling_qty_no = #{samplingQtyNo}
|
|
AND sampling_qty_desc = #{samplingQtyDesc}
|
|
</delete>
|
|
|
|
<!-- ================================================= 批量级次维护 ================================================= -->
|
|
|
|
<!-- 查询批量级次 -->
|
|
<select id="samplingQtyRankSearch" parameterType="QcSamplingInspectionQtyRankData" resultType="QcSamplingInspectionQtyRankData">
|
|
SELECT
|
|
site,
|
|
sampling_qty_rank_no,
|
|
sampling_qty_rank_desc,
|
|
min_qty,
|
|
max_qty,
|
|
sampling_qty_rank_active,
|
|
sampling_qty_rank_Remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM qc_sampling_inspection_qty_rank
|
|
<where>
|
|
site = #{site}
|
|
<if test="samplingQtyRankNo != null and samplingQtyRankNo != ''">
|
|
AND sampling_qty_rank_no LIKE '%' + #{samplingQtyRankNo}+'%'
|
|
</if>
|
|
<if test="samplingQtyRankDesc != null and samplingQtyRankDesc != ''">
|
|
AND sampling_qty_rank_desc LIKE '%' + #{samplingQtyRankDesc}+'%'
|
|
</if>
|
|
<if test="samplingQtyRankActive != null and samplingQtyRankActive != ''">
|
|
AND sampling_qty_rank_active = #{samplingQtyRankActive}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据名称查询批量级次 -->
|
|
<select id="selectSamplingQtyRankByDesc" parameterType="QcSamplingInspectionQtyRankData" resultType="QcSamplingInspectionQtyRankData">
|
|
SELECT
|
|
site,
|
|
sampling_qty_rank_no,
|
|
sampling_qty_rank_desc,
|
|
min_qty,
|
|
max_qty,
|
|
sampling_qty_rank_active,
|
|
sampling_qty_rank_Remark
|
|
FROM qc_sampling_inspection_qty_rank
|
|
WHERE sampling_qty_rank_desc = #{samplingQtyRankDesc}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取最大批量级次编码 -->
|
|
<select id="queryLastSamplingQtyRankNo" resultType="string" parameterType="QcSamplingInspectionQtyRankData">
|
|
SELECT top 1 sampling_qty_rank_no
|
|
FROM qc_sampling_inspection_qty_rank
|
|
where site = #{site}
|
|
ORDER BY sampling_qty_rank_no Desc
|
|
</select>
|
|
|
|
<!-- 新增批量级次 -->
|
|
<insert id="samplingQtyRankSave" parameterType="QcSamplingInspectionQtyRankData">
|
|
INSERT INTO qc_sampling_inspection_qty_rank (site, sampling_qty_rank_no, sampling_qty_rank_desc, min_qty, max_qty, sampling_qty_rank_Remark, sampling_qty_rank_active, create_date, create_by, update_date, update_by)
|
|
VALUES(#{site}, #{samplingQtyRankNo}, #{samplingQtyRankDesc}, #{minQty,jdbcType=DECIMAL}, #{maxQty,jdbcType=DECIMAL}, #{samplingQtyRankRemark}, #{samplingQtyRankActive}, getDate(), #{createBy}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 根据批量级次编码查询矩阵 -->
|
|
<select id="selectSamplingPlanBySamplingQtyRankNo" resultType="QcSamplingInspectionPlanData" parameterType="QcSamplingInspectionQtyRankData">
|
|
SELECT
|
|
site,
|
|
sampling_plan_no,
|
|
sampling_qty_no,
|
|
sampling_qty_rank_no,
|
|
sampling_level_no,
|
|
sampling_plan_active
|
|
FROM qc_sampling_inspection_plan
|
|
WHERE site = #{site}
|
|
AND sampling_qty_rank_no = #{samplingQtyRankNo}
|
|
</select>
|
|
|
|
<!-- 修改批量级次 -->
|
|
<update id="samplingQtyRankUpdate" parameterType="QcSamplingInspectionQtyRankData">
|
|
UPDATE qc_sampling_inspection_qty_rank
|
|
SET sampling_qty_rank_desc = #{samplingQtyRankDesc},
|
|
min_qty = #{minQty,jdbcType=DECIMAL},
|
|
max_qty = #{maxQty,jdbcType=DECIMAL},
|
|
sampling_qty_rank_Remark = #{samplingQtyRankRemark},
|
|
sampling_qty_rank_active = #{samplingQtyRankActive},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE sampling_qty_rank_no = #{samplingQtyRankNo}
|
|
AND site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除批量级次 -->
|
|
<delete id="samplingQtyRankDelete" parameterType="QcSamplingInspectionQtyRankData">
|
|
DELETE FROM qc_sampling_inspection_qty_rank
|
|
WHERE site = #{site}
|
|
AND sampling_qty_rank_no = #{samplingQtyRankNo}
|
|
AND sampling_qty_rank_desc = #{samplingQtyRankDesc}
|
|
</delete>
|
|
|
|
<!-- ================================================= 检验等级维护 ================================================= -->
|
|
|
|
<!-- 查询检验等级 -->
|
|
<select id="samplingLevelSearch" parameterType="QcSamplingInspectionLevelData" resultType="QcSamplingInspectionLevelData">
|
|
SELECT
|
|
site,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_level_remark,
|
|
sampling_level_active,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM qc_sampling_inspection_level
|
|
<where>
|
|
site = #{site}
|
|
<if test="samplingLevelNo != null and samplingLevelNo != ''">
|
|
AND sampling_level_no LIKE '%' + #{samplingLevelNo}+'%'
|
|
</if>
|
|
<if test="samplingLevelDesc != null and samplingLevelDesc != ''">
|
|
AND sampling_level_desc LIKE '%' + #{samplingLevelDesc}+'%'
|
|
</if>
|
|
<if test="samplingLevelActive != null and samplingLevelActive != ''">
|
|
AND sampling_level_active = #{samplingLevelActive}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据名称查询检验等级 -->
|
|
<select id="selectSamplingLevelByDesc" parameterType="QcSamplingInspectionLevelData" resultType="QcSamplingInspectionLevelData">
|
|
SELECT
|
|
site,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_level_remark,
|
|
sampling_level_active
|
|
FROM qc_sampling_inspection_level
|
|
WHERE sampling_level_desc = #{samplingLevelDesc}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取最大检验等级编码 -->
|
|
<select id="queryLastSamplingLevelNo" resultType="string" parameterType="QcSamplingInspectionLevelData">
|
|
SELECT top 1 sampling_level_no
|
|
FROM qc_sampling_inspection_level
|
|
where site = #{site}
|
|
ORDER BY sampling_level_no Desc
|
|
</select>
|
|
|
|
<!-- 新增检验等级 -->
|
|
<insert id="samplingLevelSave" parameterType="QcSamplingInspectionLevelData">
|
|
INSERT INTO qc_sampling_inspection_level (site, sampling_level_no, sampling_level_desc, sampling_level_remark, sampling_level_active, create_date, create_by, update_date, update_by)
|
|
VALUES(#{site}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingLevelRemark}, #{samplingLevelActive}, getDate(), #{createBy}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 根据检验等级编码查询矩阵 -->
|
|
<select id="selectSamplingPlanBySamplingLevelNo" resultType="QcSamplingInspectionPlanData" parameterType="QcSamplingInspectionLevelData">
|
|
SELECT
|
|
site,
|
|
sampling_plan_no,
|
|
sampling_qty_no,
|
|
sampling_qty_rank_no,
|
|
sampling_level_no,
|
|
sampling_plan_active
|
|
FROM qc_sampling_inspection_plan
|
|
WHERE site = #{site}
|
|
AND sampling_level_no = #{samplingLevelNo}
|
|
</select>
|
|
|
|
<!-- 修改检验等级 -->
|
|
<update id="samplingLevelUpdate" parameterType="QcSamplingInspectionLevelData">
|
|
UPDATE qc_sampling_inspection_level
|
|
SET sampling_level_desc = #{samplingLevelDesc},
|
|
sampling_level_remark = #{samplingLevelRemark},
|
|
sampling_level_active = #{samplingLevelActive},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE sampling_level_no = #{samplingLevelNo}
|
|
AND site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除检验等级 -->
|
|
<delete id="samplingLevelDelete" parameterType="QcSamplingInspectionLevelData">
|
|
DELETE FROM qc_sampling_inspection_level
|
|
WHERE site = #{site}
|
|
AND sampling_level_no = #{samplingLevelNo}
|
|
AND sampling_level_desc = #{samplingLevelDesc}
|
|
</delete>
|
|
|
|
<!-- ================================================= 物料属性设置维护 ================================================= -->
|
|
|
|
<!-- 查询物料属性 -->
|
|
<select id="qcPartAttributeSearch" parameterType="QcPartAttributeData" resultType="QcPartAttributeData">
|
|
SELECT
|
|
qa.site,
|
|
p.part_no,
|
|
p.part_desc,
|
|
p.FamilyID,
|
|
p.spec as FamilyName,
|
|
p.umid,
|
|
qa.supplier_no,
|
|
dbo.qc_get_supplier_name(qa.site, qa.supplier_no) as supplierDesc,
|
|
qa.attribute_remark,
|
|
qa.create_time,
|
|
qa.create_by,
|
|
qa.attribute_type,
|
|
qa.update_date,
|
|
qa.update_by,
|
|
qa.exempt_inspection
|
|
FROM qc_part_attribute as qa
|
|
LEFT JOIN part as p on qa.attribute_no = p.part_no and qa.site = p.site
|
|
LEFT JOIN PartFamily as pf on p.FamilyID = pf.FamilyID and p.site = pf.site
|
|
<where>
|
|
qa.site = #{query.site}
|
|
and qa.attribute_type = #{query.attributeType}
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND qa.attribute_no LIKE '%' + #{query.partNo}+'%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND p.part_desc LIKE '%' + #{query.partDesc}+'%'
|
|
</if>
|
|
<if test = "query.familyName != null and query.familyName != ''">
|
|
AND p.spec LIKE '%' + #{query.familyName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询是否已有该物料属性 -->
|
|
<select id="selectPartAttributeByNo" resultType="QcPartAttributeData" parameterType="QcPartAttributeData">
|
|
SELECT
|
|
attribute_no,
|
|
supplier_no,
|
|
attribute_remark,
|
|
attribute_type
|
|
FROM qc_part_attribute
|
|
WHERE site = #{site} and attribute_no = #{attributeNo} and attribute_type = #{attributeType}
|
|
</select>
|
|
|
|
<!-- 新增物料属性 -->
|
|
<insert id="qcPartAttributeSave" parameterType="QcPartAttributeData">
|
|
INSERT INTO qc_part_attribute (attribute_no, supplier_no, attribute_remark, create_time, create_by, attribute_type, site, exempt_inspection)
|
|
VALUES(#{partNo}, #{supplierNo}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{exemptInspection})
|
|
</insert>
|
|
|
|
<!-- 物料属性修改 -->
|
|
<update id="qcPartAttributeEdit" parameterType="QcPartAttributeData">
|
|
UPDATE qc_part_attribute
|
|
SET attribute_remark = #{attributeRemark},
|
|
exempt_inspection = #{exemptInspection},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType}
|
|
</update>
|
|
|
|
<!-- 删除物料属性 -->
|
|
<delete id="qcPartAttributeDelete" parameterType="QcPartAttributeData">
|
|
DELETE FROM qc_part_attribute
|
|
WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType}
|
|
</delete>
|
|
|
|
<!-- 删除物料属性模板 -->
|
|
<delete id="deletePartAttributeTemplate" parameterType="QcPartAttributeData">
|
|
DELETE FROM qc_attribute_template
|
|
WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType}
|
|
</delete>
|
|
|
|
<!-- 查询类别模板 -->
|
|
<select id="searchPartAttributeDetails" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
qat.site,
|
|
qpa.attribute_no,
|
|
qpa.attribute_type,
|
|
qt.template_id,
|
|
qt.template_name,
|
|
qt.template_remark,
|
|
qt.template_version,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.inspection_type_no,
|
|
qit.inspection_type_name,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.operation,
|
|
qat.manufacturer_id,
|
|
dbo.qc_get_supplier_name(qat.site, qat.manufacturer_id) as manufacturerName,
|
|
qat.resource_id
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_part_attribute as qpa ON qpa.attribute_no = qat.attribute_no and qat.site = qpa.site
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no
|
|
LEFT JOIN qc_inspection_type as qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no
|
|
WHERE qat.site = #{site} and qpa.attribute_type = #{attributeType} and qpa.attribute_no = #{attributeNo}
|
|
</select>
|
|
|
|
<!-- 物料属性模板查重 -->
|
|
<select id="searchPartRepeat" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
attribute_no,
|
|
template_id
|
|
FROM qc_attribute_template
|
|
WHERE attribute_no = #{attributeNo}
|
|
AND template_id = #{templateId}
|
|
AND attribute_type = #{attributeType}
|
|
AND special_field = #{specialField}
|
|
</select>
|
|
|
|
<!-- 新增物料属性模板 -->
|
|
<insert id="savePartAttributeDetails" parameterType="QcTemplateData">
|
|
INSERT INTO qc_attribute_template (attribute_no, template_id, sampling_level_no, inspection_cycle, sampling_programme_no, AQL, AC, RE, attribute_type, operation, manufacturer_id, resource_id, site)
|
|
VALUES(#{attributeNo}, #{templateId}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{samplingProgrammeNo}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{attributeType}, #{operation}, #{manufacturerID}, #{resourceID}, #{site})
|
|
</insert>
|
|
|
|
<!-- 可选模板 -->
|
|
<select id="getTemplateList" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
qt.template_id,
|
|
qt.template_name,
|
|
qit.inspection_type_name
|
|
FROM qc_template as qt
|
|
LEFT JOIN qc_attribute_template as qat ON qat.template_id = qt.template_id and qat.attribute_no = #{attributeNo}
|
|
LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
|
|
<where>
|
|
qt.site = #{site}
|
|
AND qat.attribute_no is null
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
<if test = "templateId != null and templateId != ''">
|
|
AND qt.template_id LIKE '%' + #{templateId}+'%'
|
|
</if>
|
|
<if test = "templateName != null and templateName != ''">
|
|
AND qt.template_name LIKE '%' + #{templateName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 已有模板 -->
|
|
<select id="getPartTemplateList" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
qt.template_id,
|
|
qt.template_name,
|
|
qit.inspection_type_name,
|
|
qat.operation,
|
|
qat.manufacturer_id,
|
|
dbo.qc_get_supplier_name(qt.site, qat.manufacturer_id) as manufacturerName,
|
|
qat.resource_id
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site
|
|
LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
|
|
WHERE qt.site = #{site}
|
|
AND qat.attribute_no = #{attributeNo}
|
|
</select>
|
|
|
|
<!-- 物料可选模板 -->
|
|
<select id="getTemplateListAll" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
qt.template_id,
|
|
qt.template_name,
|
|
qit.inspection_type_name
|
|
FROM qc_template as qt
|
|
LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
|
|
<where>
|
|
qt.site = #{site}
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
<if test = "templateId != null and templateId != ''">
|
|
AND qt.template_id LIKE '%' + #{templateId}+'%'
|
|
</if>
|
|
<if test = "templateName != null and templateName != ''">
|
|
AND qt.template_name LIKE '%' + #{templateName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 删除物料属性模板 -->
|
|
<delete id="deletePartAttributeDetails" parameterType="QcTemplateData">
|
|
DELETE FROM qc_attribute_template
|
|
<where>
|
|
site = #{site}
|
|
and attribute_no = #{attributeNo}
|
|
and template_id = #{templateId}
|
|
and attribute_type = #{attributeType}
|
|
<if test = "operation != null and operation != ''">
|
|
and operation = #{operation}
|
|
</if>
|
|
<if test = "resourceID != null and resourceID != ''">
|
|
and resource_id = #{resourceID}
|
|
</if>
|
|
<if test = "manufacturerID != null and manufacturerID != ''">
|
|
and manufacturer_id = #{manufacturerID}
|
|
</if>
|
|
</where>
|
|
</delete>
|
|
|
|
<!-- 查询模板的基础数据 -->
|
|
<select id="selectTemplateData" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
template_id,
|
|
template_name,
|
|
sampling_programme_no,
|
|
sampling_level_no,
|
|
inspection_cycle,
|
|
AQL,
|
|
AC,
|
|
RE
|
|
FROM qc_template
|
|
WHERE site = #{site}
|
|
AND template_id = #{templateId}
|
|
</select>
|
|
|
|
<!-- 新增物料属性模板详情 -->
|
|
<update id="saveAttributeDetailed" parameterType="QcTemplateData">
|
|
UPDATE qc_attribute_template
|
|
SET sampling_level_no = #{samplingLevelNo},
|
|
inspection_cycle = #{inspectionCycle,jdbcType=DECIMAL},
|
|
sampling_programme_no = #{samplingProgrammeNo},
|
|
AQL = #{aql,jdbcType=DECIMAL},
|
|
AC = #{ac,jdbcType=DECIMAL},
|
|
RE = #{re,jdbcType=DECIMAL}
|
|
<where>
|
|
site = #{site}
|
|
and attribute_no = #{attributeNo}
|
|
AND template_id = #{templateId}
|
|
AND attribute_type = #{attributeType}
|
|
<if test = "operation != null and operation != ''">
|
|
AND operation = #{operation}
|
|
</if>
|
|
<if test = "resourceID != null and resourceID != ''">
|
|
AND resource_id = #{resourceID}
|
|
</if>
|
|
<if test = "manufacturerID != null and manufacturerID != ''">
|
|
AND manufacturer_id = #{manufacturerID}
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<!-- 更新物料属性修改时间 -->
|
|
<update id="updatePartAttributeTime" parameterType="QcTemplateData">
|
|
UPDATE qc_part_attribute
|
|
SET update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE site = #{site} and attribute_no = #{attributeNo} and attribute_type = #{attributeType}
|
|
</update>
|
|
|
|
<!-- ================================================= 类别属性设置维护 ================================================= -->
|
|
|
|
<!-- 查询类别属性 -->
|
|
<select id="qcFamilyAttributeSearch" parameterType="QcPartAttributeData" resultType="QcPartAttributeData">
|
|
SELECT
|
|
qa.site,
|
|
qa.attribute_no as familyID,
|
|
pf.FamilyName,
|
|
qa.supplier_no,
|
|
qa.attribute_remark,
|
|
qa.create_time,
|
|
qa.create_by,
|
|
qa.update_date,
|
|
qa.update_by,
|
|
qa.attribute_type
|
|
FROM qc_part_attribute as qa
|
|
LEFT JOIN PartFamily as pf on qa.attribute_no = pf.FamilyID and qa.site = pf.site
|
|
<where>
|
|
qa.site = #{query.site}
|
|
and qa.attribute_type = #{query.attributeType}
|
|
<if test = "query.familyID != null and query.familyID != ''">
|
|
AND qa.attribute_no LIKE '%' + #{query.familyID}+'%'
|
|
</if>
|
|
<if test = "query.familyName != null and query.familyName != ''">
|
|
AND pf.FamilyName LIKE '%' + #{query.familyName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 新增类别属性 -->
|
|
<insert id="qcFamilyAttributeSave" parameterType="QcPartAttributeData">
|
|
INSERT INTO qc_part_attribute (attribute_no, attribute_remark, create_time, create_by, attribute_type, site)
|
|
VALUES(#{familyID}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site})
|
|
</insert>
|
|
|
|
<!-- 删除分类属性 -->
|
|
<delete id="qcFamilyAttributeDelete" parameterType="QcPartAttributeData">
|
|
DELETE FROM qc_part_attribute
|
|
WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType}
|
|
</delete>
|
|
|
|
<!-- 删除分类属性模板 -->
|
|
<delete id="deleteFamilyAttributeTemplate" parameterType="QcPartAttributeData">
|
|
DELETE FROM qc_attribute_template
|
|
WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType}
|
|
</delete>
|
|
|
|
<!-- ================================================= 抽样方案维护 ================================================= -->
|
|
|
|
<!-- 查询类别属性 -->
|
|
<select id="samplingProgrammeSearch" parameterType="QcSamplingInspectionProgrammeData" resultType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
site,
|
|
sampling_programme_no,
|
|
sampling_programme_desc,
|
|
sampling_programme_code,
|
|
create_time,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM qc_sampling_inspection_programme
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.samplingProgrammeNo != null and query.samplingProgrammeNo != ''">
|
|
AND sampling_programme_no LIKE '%' + #{query.samplingProgrammeNo}+'%'
|
|
</if>
|
|
<if test = "query.samplingProgrammeCode != null and query.samplingProgrammeCode != ''">
|
|
AND sampling_programme_code LIKE '%' + #{query.samplingProgrammeCode}+'%'
|
|
</if>
|
|
<if test = "query.samplingProgrammeDesc != null and query.samplingProgrammeDesc != ''">
|
|
AND sampling_programme_desc LIKE '%' + #{query.samplingProgrammeDesc}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 新增抽样方案 -->
|
|
<insert id="samplingProgrammeSave" parameterType="QcSamplingInspectionProgrammeData">
|
|
INSERT INTO qc_sampling_inspection_programme (site, sampling_programme_no, sampling_programme_desc, sampling_programme_code, create_time, create_by, update_date, update_by)
|
|
VALUES(#{site}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{samplingProgrammeCode}, getDate(), #{createBy}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 删除抽样方案 -->
|
|
<delete id="samplingProgrammeDelete" parameterType="QcSamplingInspectionProgrammeData">
|
|
DELETE FROM qc_sampling_inspection_programme
|
|
WHERE site = #{site}
|
|
AND sampling_programme_no = #{samplingProgrammeNo}
|
|
</delete>
|
|
|
|
<!-- 删除抽样方案中的矩阵 -->
|
|
<delete id="deletePlanByProgrammeNo" parameterType="QcSamplingInspectionProgrammeData">
|
|
DELETE FROM qc_programme_plan
|
|
WHERE sampling_programme_no = #{samplingProgrammeNo}
|
|
</delete>
|
|
|
|
<!-- 根据名称查询抽样方案 -->
|
|
<select id="selectSamplingProgrammeByDesc" parameterType="QcSamplingInspectionProgrammeData" resultType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
site,
|
|
sampling_programme_no,
|
|
sampling_programme_desc
|
|
FROM qc_sampling_inspection_programme
|
|
WHERE sampling_programme_desc = #{samplingProgrammeDesc}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取最大抽样方案编码 -->
|
|
<select id="queryLastSamplingProgrammeNo" resultType="string" parameterType="QcSamplingInspectionProgrammeData">
|
|
SELECT top 1 sampling_programme_no
|
|
FROM qc_sampling_inspection_programme
|
|
where site = #{site}
|
|
ORDER BY sampling_programme_no Desc
|
|
</select>
|
|
|
|
<!-- 搜索抽样方案中的矩阵 -->
|
|
<select id="searchSamplingProgrammeDetails" parameterType="QcSamplingInspectionProgrammeData" resultType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
qpp.site,
|
|
qpp.sampling_programme_no,
|
|
qsip.sampling_plan_no,
|
|
qsip.sampling_plan_Desc,
|
|
qsip.sampling_qty_no,
|
|
qsiq.sampling_qty_desc,
|
|
qsiq.sampling_qty,
|
|
qsip.sampling_qty_rank_no,
|
|
qsiqr.sampling_qty_rank_desc,
|
|
qsiqr.min_qty,
|
|
qsiqr.max_qty,
|
|
qsip.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qsip.sampling_plan_active
|
|
FROM qc_programme_plan as qpp
|
|
LEFT JOIN qc_sampling_inspection_plan as qsip on qpp.sampling_plan_no = qsip.sampling_plan_no
|
|
LEFT JOIN qc_sampling_inspection_qty as qsiq on qsip.sampling_qty_no = qsiq.sampling_qty_no
|
|
LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr on qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no
|
|
LEFT JOIN qc_sampling_inspection_level as qsil on qsip.sampling_level_no = qsil.sampling_level_no
|
|
WHERE qpp.sampling_programme_no = #{samplingProgrammeNo}
|
|
</select>
|
|
|
|
<!-- 获取该方案不包含的矩阵 -->
|
|
<select id="getPlanList" resultType="QcSamplingInspectionProgrammeData" parameterType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
qip.sampling_plan_no,
|
|
qip.sampling_plan_desc
|
|
FROM qc_sampling_inspection_plan as qip
|
|
LEFT JOIN qc_programme_plan as qpp
|
|
ON qpp.sampling_plan_no = qip.sampling_plan_no and qpp.sampling_programme_no = #{samplingProgrammeNo}
|
|
WHERE qip.site = #{site}
|
|
AND qpp.sampling_programme_no is null
|
|
</select>
|
|
|
|
<!-- 获取当前方案所包含的矩阵 -->
|
|
<select id="getProgrammePlanList" resultType="QcSamplingInspectionProgrammeData" parameterType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
qip.sampling_plan_no,
|
|
qip.sampling_plan_desc
|
|
FROM qc_programme_plan as qpp
|
|
LEFT JOIN qc_sampling_inspection_plan as qip
|
|
ON qpp.sampling_plan_no = qip.sampling_plan_no
|
|
WHERE qip.site = #{site}
|
|
AND qpp.sampling_programme_no = #{samplingProgrammeNo}
|
|
</select>
|
|
|
|
<!-- 查重 -->
|
|
<select id="searchPlanRepeat" resultType="QcSamplingInspectionProgrammeData" parameterType="QcSamplingInspectionProgrammeData">
|
|
SELECT
|
|
sampling_plan_no,
|
|
sampling_programme_no
|
|
FROM qc_programme_plan
|
|
WHERE sampling_programme_no = #{samplingProgrammeNo}
|
|
AND sampling_plan_no = #{samplingPlanNo}
|
|
</select>
|
|
|
|
<!-- 新增抽样方案中的矩阵 -->
|
|
<insert id="saveSamplingProgrammeDetails" parameterType="QcSamplingInspectionProgrammeData">
|
|
INSERT INTO qc_programme_plan (site, sampling_programme_no, sampling_plan_no)
|
|
VALUES(#{site}, #{samplingProgrammeNo}, #{samplingPlanNo})
|
|
</insert>
|
|
|
|
<!-- 更新抽样方案修改时间 -->
|
|
<update id="updateSamplingInspectionProgrammeDate" parameterType="QcSamplingInspectionProgrammeData">
|
|
UPDATE qc_sampling_inspection_programme
|
|
SET update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE site = #{site}
|
|
AND sampling_programme_no = #{samplingProgrammeNo}
|
|
</update>
|
|
|
|
<!-- 删除抽样方案中的矩阵 -->
|
|
<delete id="deleteSamplingProgrammeDetails" parameterType="QcSamplingInspectionProgrammeData">
|
|
DELETE FROM qc_programme_plan
|
|
WHERE sampling_programme_no = #{samplingProgrammeNo} and sampling_plan_no = #{samplingPlanNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- ================================================= FAI检验维护 ================================================= -->
|
|
|
|
<!-- 查询FAI基础数据 -->
|
|
<select id="selectFAIBasicData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
top 1
|
|
a.orderno as orderNo,
|
|
j.part_no,
|
|
j.part_desc,
|
|
c.operation_desc,
|
|
b.approve_qty as rollQty,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
a.itemno as itemNo,
|
|
a.id as ssrId
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b
|
|
ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
|
|
select min(sfdc.id)
|
|
from sfdc
|
|
group by sfdc.assjob_seq_no, site
|
|
)
|
|
LEFT JOIN so_routing as c
|
|
ON c.order_no = a.orderno and a.itemno = c.item_no and c.site = a.site
|
|
LEFT JOIN part j
|
|
ON a.site = j.site and a.part_no = j.part_no
|
|
WHERE a.itemno = '10'
|
|
AND a.id not in (select ssr_id from qc_fai_record)
|
|
AND b.approve_qty is not null
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<!-- 获取该物料属性下维护的iqc -->
|
|
<select id="selectPartAttributeByPartNo" resultType="QcFAIRecordData">
|
|
SELECT
|
|
qat.attribute_no,
|
|
qat.template_id,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no
|
|
WHERE qat.site = #{site}
|
|
AND qat.attribute_no = #{partNo}
|
|
AND qat.attribute_type = #{attributeType}
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
AND qat.manufacturer_id = #{supplierNo}
|
|
</select>
|
|
|
|
<!-- 获取该物料属性下维护的ipqc -->
|
|
<select id="selectPartAttributeByOperationAndResource" resultType="QcFAIRecordData">
|
|
SELECT
|
|
qat.attribute_no,
|
|
qat.template_id,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no
|
|
WHERE qat.site = #{site}
|
|
AND qat.attribute_no = #{partNo}
|
|
AND qat.attribute_type = #{attributeType1}
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
AND qat.operation = #{operationDesc}
|
|
AND qat.resource_id = #{resourceId}
|
|
</select>
|
|
|
|
<!-- 获取模板详情 -->
|
|
<select id="selectTemplate" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
qt.template_id,
|
|
qt.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qt.inspection_cycle,
|
|
qt.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qt.AQL,
|
|
qt.AC,
|
|
qt.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_template as qt
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qt.sampling_level_no = qsil.sampling_level_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qt.sampling_programme_no = qsip.sampling_programme_no
|
|
WHERE qt.site = #{site} and qt.template_id = #{templateId}
|
|
</select>
|
|
|
|
|
|
<!-- 新增FAI主记录信息 -->
|
|
<insert id="saveFAIRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_fai_record (inspection_no, site, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES(#{inspectionNo}, #{site}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<!-- 新增FAI明细记录信息 -->
|
|
<insert id="saveFAIDetailedRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_fai_detailed_record (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty)
|
|
VALUES(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL})
|
|
</insert>
|
|
|
|
<!-- 查询FAI主记录信息 -->
|
|
<select id="qcFAIInspectionSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
inspection_no,
|
|
site,
|
|
state,
|
|
inspection_result,
|
|
task_date,
|
|
inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName,
|
|
inspection_cycle,
|
|
order_no,
|
|
operation_desc,
|
|
resource_id,
|
|
dbo.qc_get_resource_desc(site, resource_id, work_center_no) as resourceDesc,
|
|
part_no,
|
|
dbo.qc_get_part_desc(part_no) as part_desc,
|
|
inspection_remark,
|
|
roll_qty,
|
|
sampling_qty,
|
|
disposal_measures,
|
|
disposal_remark,
|
|
inspector_date,
|
|
inspector_no,
|
|
dbo.qc_get_inspector_name(site, inspector_no) as inspectorName,
|
|
ssr_id,
|
|
unqualified_qty,
|
|
submit_flag,
|
|
dbo.qc_get_cinv_source_code(part_no) as cinvSourceCode,
|
|
dbo.qc_get_sku(part_no) as sku,
|
|
dbo.qc_get_spec(part_no) as spec,
|
|
seq_no,
|
|
batch_roll_no,
|
|
special_requirements,
|
|
work_center_no,
|
|
roll_no,
|
|
um_id,
|
|
dbo.qc_get_um_name(site, um_id) as umName
|
|
FROM qc_fai_record
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.state != null and query.state != ''">
|
|
AND state = #{query.state}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= inspector_date
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN state = '待检验' THEN 1
|
|
WHEN state = '待审核' THEN 2
|
|
WHEN state = '已完成' THEN 3
|
|
END, task_date desc
|
|
</select>
|
|
|
|
<!-- 获取物料的类别编码 -->
|
|
<select id="selectFamilyIdByPartNo" parameterType="string" resultType="string">
|
|
SELECT FamilyID
|
|
FROM part
|
|
WHERE part_no = #{partNo}
|
|
AND site = #{site}
|
|
</select>
|
|
|
|
<!-- FAI明细记录查询 -->
|
|
<select id="faiDetailSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
inspection_no,
|
|
order_no,
|
|
template_id,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_programme_no,
|
|
sampling_programme_desc,
|
|
AQL,
|
|
AC,
|
|
RE,
|
|
item_no,
|
|
item_desc,
|
|
object_id,
|
|
object_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
text_value,
|
|
number_value,
|
|
value_type_db,
|
|
value_type,
|
|
case when item_result = '' or item_result is null then 'Y' else item_result end as itemResult,
|
|
is_submit,
|
|
isnull(unqualified_quantity,0) as unqualifiedQuantity,
|
|
sampling_qty,
|
|
dbo.qc_get_fai_sub_record_num(site, inspection_no, item_no) as subDetailRecordNum
|
|
FROM qc_fai_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 修改FAI主记录信息 -->
|
|
<update id="updateFAIMasterRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL}
|
|
WHERE site = #{site} AND inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录信息 -->
|
|
<update id="updateFAIDetailedRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改子明细提交标识 -->
|
|
<update id="updateSubDetailedRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 删除FAI检验记录 -->
|
|
<delete id="deleteFAIRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fai_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除FAI明细记录信息 -->
|
|
<delete id="deleteFAIDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fai_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除FAI子明细记录信息 -->
|
|
<delete id="deleteFAISubDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 修改FAI主记录标识为已提交 -->
|
|
<update id="updateFAIMasterSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录标识为已提交 -->
|
|
<update id="updateFAIDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改子明细记录标识为已提交 -->
|
|
<update id="updateFAISubDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fai_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 查询FAI检验记录是否已提交 -->
|
|
<select id="checkFAIIsSubmit" parameterType="SubDetailValues" resultType="QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_fai_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 删除子明细的老数据 -->
|
|
<delete id="delFAISubDetailedRecord" parameterType="QcSubDetailInformationData">
|
|
DELETE FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 新增FAI子明细信息 -->
|
|
<insert id="saveFAISubDetailed">
|
|
INSERT INTO qc_fai_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询FAI的子明细 -->
|
|
<select id="selectFAISubDetailedRecord" parameterType="SubDetailValues" resultType="SubDetailValues">
|
|
SELECT
|
|
site,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b
|
|
FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectFAISubDetailValue" parameterType="string" resultType="SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- ================================================= IPQC检验维护 ================================================= -->
|
|
|
|
<!-- 查询IPQC基础数据 -->
|
|
<select id="selectIPQCBasicData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
top 1
|
|
a.orderno as orderNo,
|
|
j.part_no,
|
|
j.part_desc,
|
|
c.operation_desc,
|
|
b.approve_qty as rollQty,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
a.itemno as itemNo,
|
|
a.id as ssrId
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b
|
|
ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
|
|
select max(sfdc.id)
|
|
from sfdc
|
|
group by sfdc.assjob_seq_no, site
|
|
)
|
|
LEFT JOIN so_routing as c
|
|
ON c.order_no = a.orderno and a.itemno = c.item_no and c.site = a.site
|
|
LEFT JOIN part j
|
|
ON a.site = j.site and a.part_no = j.part_no
|
|
LEFT JOIN (select ssr_id from qc_ipqc_record where check_type = '末件检') as temp
|
|
ON a.id = temp.ssr_id
|
|
WHERE b.approve_qty is not null and temp.ssr_id is null
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<select id="qcExec" resultType="QcFAIRecordData" parameterType="string" statementType="CALLABLE">
|
|
{CALL
|
|
getIpqcRecord(#{site,mode=IN,jdbcType=VARCHAR})
|
|
}
|
|
</select>
|
|
|
|
<!-- 新增IPQC明细记录信息 -->
|
|
<insert id="saveIPQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_ipqc_detailed_record (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty)
|
|
VALUES(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL})
|
|
</insert>
|
|
|
|
<!-- 新增IPQC记录到count表 -->
|
|
<insert id="saveIPQCRecordCount" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_ipqc_record_count (inspection_no, site, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id, new_data)
|
|
VALUES(#{inspectionNo}, #{site}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId}, 'Y')
|
|
</insert>
|
|
|
|
<!-- 新增IPQC主记录信息 -->
|
|
<insert id="saveIPQCRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_ipqc_record (inspection_no, site, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES(#{inspectionNo}, #{site}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<!-- 查询IPQC主记录信息 -->
|
|
<select id="qcIPQCInspectionSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
inspection_no,
|
|
site,
|
|
state,
|
|
inspection_result,
|
|
task_date,
|
|
inspection_type_no,
|
|
inspection_cycle,
|
|
order_no,
|
|
operation_desc,
|
|
resource_id,
|
|
dbo.qc_get_resource_desc(site, resource_id, work_center_no) as resourceDesc,
|
|
part_no,
|
|
dbo.qc_get_part_desc(part_no) as part_desc,
|
|
inspection_remark,
|
|
roll_qty,
|
|
sampling_qty,
|
|
disposal_measures,
|
|
disposal_remark,
|
|
inspector_date,
|
|
inspector_no,
|
|
dbo.qc_get_inspector_name(site, inspector_no) as inspectorName,
|
|
ssr_id,
|
|
unqualified_qty,
|
|
submit_flag,
|
|
dbo.qc_get_cinv_source_code(part_no) as cinvSourceCode,
|
|
dbo.qc_get_sku(part_no) as sku,
|
|
dbo.qc_get_spec(part_no) as spec,
|
|
seq_no,
|
|
batch_roll_no,
|
|
special_requirements,
|
|
work_center_no,
|
|
roll_no,
|
|
um_id,
|
|
dbo.qc_get_um_name(site, um_id) as umName
|
|
FROM qc_ipqc_record
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.state != null and query.state != ''">
|
|
AND state = #{query.state}
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= inspector_date
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN state = '待检验' THEN 1
|
|
WHEN state = '待审核' THEN 2
|
|
WHEN state = '已完成' THEN 3
|
|
END, task_date desc
|
|
</select>
|
|
|
|
<!-- IPQC明细记录查询 -->
|
|
<select id="ipqcDetailSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
inspection_no,
|
|
order_no,
|
|
template_id,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_programme_no,
|
|
sampling_programme_desc,
|
|
AQL,
|
|
AC,
|
|
RE,
|
|
item_no,
|
|
item_desc,
|
|
object_id,
|
|
object_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
text_value,
|
|
number_value,
|
|
value_type_db,
|
|
value_type,
|
|
case when item_result = '' or item_result is null then 'Y' else item_result end as itemResult,
|
|
is_submit,
|
|
isnull(unqualified_quantity,0) as unqualifiedQuantity,
|
|
sampling_qty,
|
|
dbo.qc_get_ipqc_sub_record_num(site, inspection_no, item_no) as subDetailRecordNum
|
|
FROM qc_ipqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 删除IPQC检验记录 -->
|
|
<delete id="deleteIPQCRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC检验记录 -->
|
|
<delete id="deleteIPQCRecordCount" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_record_count
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC明细记录信息 -->
|
|
<delete id="deleteIPQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC子明细记录信息 -->
|
|
<delete id="deleteIPQCSubDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 修改IPQC主记录信息 -->
|
|
<update id="updateIPQCMasterRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_ipqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL}
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 修改IPQC明细记录信息 -->
|
|
<update id="updateIPQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_ipqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改IPQC主记录标识为已提交 -->
|
|
<update id="updateIPQCMasterSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_ipqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改IPQC明细记录标识为已提交 -->
|
|
<update id="updateIPQCDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_ipqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改IPQC子明细记录标识为已提交 -->
|
|
<update id="updateIPQCSubDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_ipqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除IPQC子明细的老数据 -->
|
|
<delete id="delIPQCSubDetailedRecord" parameterType="QcSubDetailInformationData">
|
|
DELETE FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 新增IPQC子明细信息 -->
|
|
<insert id="saveIPQCSubDetailed">
|
|
INSERT INTO qc_ipqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询IPQC的子明细 -->
|
|
<select id="selectIPQCSubDetailedRecord" parameterType="SubDetailValues" resultType="SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b
|
|
FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询IPQC检验记录是否已提交 -->
|
|
<select id="checkIPQCIsSubmit" parameterType="SubDetailValues" resultType="QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_ipqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectIPQCSubDetailValue" parameterType="string" resultType="SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询工序列表 -->
|
|
<select id="getOperationList" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
DISTINCT
|
|
a.seqno as seqNo,
|
|
a.orderno as orderNo,
|
|
j.part_no,
|
|
j.part_desc,
|
|
j.spec,
|
|
j.sku,
|
|
c.operation_desc as operationDesc,
|
|
a.itemno as operationNo,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
c.work_center_no
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN so_routing as c ON c.order_no = a.orderno and a.itemno = c.item_no
|
|
LEFT JOIN part j ON a.part_no = j.part_no
|
|
WHERE a.seqno = #{seqNo}
|
|
</select>
|
|
|
|
<!-- 根据工单号和工序号查出所有数据 -->
|
|
<select id="getResourceList" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
c.work_center_no
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
|
|
LEFT JOIN so_routing as c ON c.order_no = a.orderno and a.itemno = c.item_no and c.site = a.site
|
|
LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
|
|
WHERE a.site = #{site} and b.approve_qty is not null and a.seqno = #{seqNo}
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<!-- a.orderno = #{orderNo} and c.operation_desc = #{operationDesc}-->
|
|
|
|
<!-- 查询机台名称 -->
|
|
<select id="selectResourceDesc" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT distinct
|
|
resource_desc
|
|
FROM resource
|
|
WHERE site = #{site} and resource_id = #{resourceId}
|
|
</select>
|
|
|
|
<!-- 查询物料名称 -->
|
|
<select id="selectPartDesc" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT distinct
|
|
part_desc
|
|
FROM part
|
|
WHERE site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- ================================================= IQC检验维护 ================================================= -->
|
|
<!-- 查询IQC基础数据 -->
|
|
<select id="selectIQCBasicData" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
qir.inspection_no,
|
|
qir.state,
|
|
qir.create_date as taskDate,
|
|
qir.roll_no,
|
|
qir.part_no,
|
|
p.part_desc,
|
|
qir.roll_qty,
|
|
qir.print_flag,
|
|
qir.create_by,
|
|
qir.supplier_no,
|
|
qir.site,
|
|
qir.po_orderNo,
|
|
qir.po_itemNo,
|
|
qir.roll_count
|
|
FROM qc_iqc_record as qir
|
|
LEFT JOIN part p ON qir.part_no = p.part_no and qir.site = p.site
|
|
WHERE qir.site = #{site} and qir.detail_flag = 'N'
|
|
</select>
|
|
|
|
<!-- 新增IQC明细记录信息 -->
|
|
<insert id="saveIQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_iqc_detailed_record (inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site)
|
|
VALUES(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site})
|
|
</insert>
|
|
|
|
<!-- 修改IQC检验记录 -->
|
|
<update id="updateIQCRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET inspection_type_no = #{inspectionTypeNo},
|
|
sampling_qty = #{samplingQty},
|
|
inspection_cycle = #{inspectionCycle},
|
|
part_desc = #{partDesc},
|
|
detail_flag = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 查询IQC主记录信息 -->
|
|
<select id="qcIQCInspectionSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
inspection_no,
|
|
site,
|
|
state,
|
|
inspection_result,
|
|
create_date as taskDate,
|
|
inspection_type_no,
|
|
inspection_cycle,
|
|
part_no,
|
|
part_desc,
|
|
dbo.qc_get_part_umid(site, part_no) as umId,
|
|
inspection_remark,
|
|
roll_qty,
|
|
sampling_qty,
|
|
disposal_measures,
|
|
disposal_remark,
|
|
inspector_date,
|
|
inspector_no,
|
|
dbo.qc_get_inspector_name(site, inspector_no) as inspectorName,
|
|
unqualified_quantity,
|
|
submit_flag,
|
|
roll_no,
|
|
supplier_no,
|
|
dbo.qc_get_supplier_name(site, supplier_no) as supplierDesc,
|
|
po_orderNo,
|
|
po_itemNo,
|
|
roll_count
|
|
FROM qc_iqc_record
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.state != null and query.state != ''">
|
|
AND state = #{query.state}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.supplierDesc != null and query.supplierDesc != ''">
|
|
AND dbo.qc_get_supplier_name(site, supplier_no) LIKE '%' + #{query.supplierDesc} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.inspectorName != null and query.inspectorName != ''">
|
|
AND dbo.qc_get_inspector_name(site, inspector_no) LIKE '%' + #{query.inspectorName} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= inspector_date
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN state = '待检验' THEN 1
|
|
WHEN state = '待审核' THEN 2
|
|
WHEN state = '已完成' THEN 3
|
|
END, create_date desc
|
|
</select>
|
|
|
|
<!-- IQC明细记录查询 -->
|
|
<select id="iqcDetailSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
inspection_no,
|
|
template_id,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_programme_no,
|
|
sampling_programme_desc,
|
|
AQL,
|
|
AC,
|
|
RE,
|
|
item_no,
|
|
item_desc,
|
|
object_id,
|
|
object_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
text_value,
|
|
number_value,
|
|
value_type_db,
|
|
value_type,
|
|
case when item_result = '' or item_result is null then 'Y' else item_result end as itemResult,
|
|
is_submit,
|
|
isnull(unqualified_quantity,0) as unqualifiedQuantity,
|
|
dbo.qc_get_iqc_sub_record_num(site, inspection_no, item_no) as subDetailRecordNum
|
|
FROM qc_iqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询IQC的子明细 -->
|
|
<select id="selectIQCSubDetailedRecord" parameterType="SubDetailValues" resultType="SubDetailValues">
|
|
SELECT
|
|
site,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b
|
|
FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectIQCSubDetailValue" parameterType="string" resultType="SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 修改IQC主记录信息 -->
|
|
<update id="updateIQCMasterRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL}
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 修改IQC明细记录信息 -->
|
|
<update id="updateIQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 查询该记录明细是否已存在 -->
|
|
<select id="checkIQCDetail" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT inspection_no,
|
|
template_id
|
|
FROM qc_iqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询IQC检验记录是否已提交 -->
|
|
<select id="checkIQCIsSubmit" parameterType="SubDetailValues" resultType="QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_iqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 删除IQC子明细的老数据 -->
|
|
<delete id="delIQCSubDetailedRecord" parameterType="QcSubDetailInformationData">
|
|
DELETE FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 新增IQC子明细信息 -->
|
|
<insert id="saveIQCSubDetailed">
|
|
INSERT INTO qc_iqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 修改IQC主记录标识为已提交 -->
|
|
<update id="updateIQCMasterSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改IQC明细记录标识为已提交 -->
|
|
<update id="updateIQCDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改IQC子明细记录标识为已提交 -->
|
|
<update id="updateIQCSubDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_iqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除IQC检验记录 -->
|
|
<delete id="deleteIQCRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_iqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除IQC明细记录信息 -->
|
|
<delete id="deleteIQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_iqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除IQC子明细记录信息 -->
|
|
<delete id="deleteIQCSubDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 查询文件ID -->
|
|
<select id="queryFileId" parameterType="SysOssEntity" resultType="SysOssEntity">
|
|
SELECT id, file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
|
|
</select>
|
|
|
|
<!-- 获取工序列表 -->
|
|
<select id="getOperationDescList" parameterType="QcPartAttributeData" resultType="QcPartAttributeData">
|
|
SELECT distinct
|
|
operation_desc
|
|
FROM so_routing
|
|
<where>
|
|
<if test = "operationDesc != null and operationDesc != ''">
|
|
AND operation_desc LIKE '%' + #{operationDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取供应商列表 -->
|
|
<select id="getManufacturerList" parameterType="QcPartAttributeData" resultType="QcPartAttributeData">
|
|
SELECT
|
|
supplierID as manufacturerID,
|
|
supplierName as manufacturerName
|
|
FROM view_Supplier
|
|
<where>
|
|
site = #{site}
|
|
<if test = "manufacturerID != null and manufacturerID != ''">
|
|
AND supplierID LIKE '%' + #{manufacturerID} + '%'
|
|
</if>
|
|
<if test = "manufacturerName != null and manufacturerName != ''">
|
|
AND supplierName LIKE '%' + #{manufacturerName} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取机台列表 -->
|
|
<select id="getAllResourceList" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT distinct
|
|
resource_id,
|
|
resource_desc
|
|
FROM resource
|
|
<where>
|
|
site = #{site}
|
|
<if test = "resourceId != null and resourceId != ''">
|
|
AND resource_id LIKE '%' + #{resourceId} + '%'
|
|
</if>
|
|
<if test = "resourceDesc != null and resourceDesc != ''">
|
|
AND resource_desc LIKE '%' + #{resourceDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取工单列表 -->
|
|
<select id="getOrderNoList" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT DISTINCT
|
|
a.orderno as orderNo
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
|
|
LEFT JOIN so_routing as c ON c.order_no = a.orderno and a.itemno = c.item_no and c.site = a.site
|
|
LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
|
|
<where>
|
|
a.site = #{site}
|
|
AND b.approve_qty is not null
|
|
<if test = "orderNo != null and orderNo != ''">
|
|
AND a.orderno LIKE '%' + #{orderNo} + '%'
|
|
</if>
|
|
</where>
|
|
order by a.orderno DESC
|
|
</select>
|
|
|
|
<!-- 查询FQC主记录信息 -->
|
|
<select id="qcFQCInspectionSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
inspection_no,
|
|
site,
|
|
state,
|
|
inspection_result,
|
|
task_date,
|
|
inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName,
|
|
inspection_cycle,
|
|
order_no,
|
|
operation_desc,
|
|
resource_id,
|
|
dbo.qc_get_resource_desc(site, resource_id, work_center_no) as resourceDesc,
|
|
part_no,
|
|
dbo.qc_get_part_desc(part_no) as part_desc,
|
|
inspection_remark,
|
|
roll_qty,
|
|
sampling_qty,
|
|
disposal_measures,
|
|
disposal_remark,
|
|
inspector_date,
|
|
inspector_no,
|
|
dbo.qc_get_inspector_name(site, inspector_no) as inspectorName,
|
|
ssr_id,
|
|
unqualified_qty,
|
|
submit_flag,
|
|
dbo.qc_get_cinv_source_code(part_no) as cinvSourceCode,
|
|
dbo.qc_get_sku(part_no) as sku,
|
|
dbo.qc_get_spec(part_no) as spec,
|
|
seq_no,
|
|
batch_roll_no,
|
|
special_requirements,
|
|
work_center_no,
|
|
roll_no,
|
|
um_id,
|
|
dbo.qc_get_um_name(site, um_id) as umName
|
|
FROM qc_fqc_record
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.state != null and query.state != ''">
|
|
AND state = #{query.state}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= inspector_date
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN state = '待检验' THEN 1
|
|
WHEN state = '待审核' THEN 2
|
|
WHEN state = '已完成' THEN 3
|
|
END, task_date desc
|
|
</select>
|
|
|
|
<!-- 新增FQC明细记录信息 -->
|
|
<insert id="saveFQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_fqc_detailed_record (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty)
|
|
VALUES(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL})
|
|
</insert>
|
|
|
|
<!-- 新增FQC主记录信息 -->
|
|
<insert id="saveFQCRecord" parameterType="QcFAIRecordData">
|
|
INSERT INTO qc_fqc_record (inspection_no, site, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES(#{inspectionNo}, #{site}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<!-- FQC明细记录查询 -->
|
|
<select id="fqcDetailSearch" parameterType="QcFAIRecordData" resultType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
inspection_no,
|
|
order_no,
|
|
template_id,
|
|
sampling_level_no,
|
|
sampling_level_desc,
|
|
sampling_programme_no,
|
|
sampling_programme_desc,
|
|
AQL,
|
|
AC,
|
|
RE,
|
|
item_no,
|
|
item_desc,
|
|
object_id,
|
|
object_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
text_value,
|
|
number_value,
|
|
value_type_db,
|
|
value_type,
|
|
case when item_result = '' or item_result is null then 'Y' else item_result end as itemResult,
|
|
is_submit,
|
|
isnull(unqualified_quantity,0) as unqualifiedQuantity,
|
|
sampling_qty,
|
|
dbo.qc_get_fqc_sub_record_num(site, inspection_no, item_no) as subDetailRecordNum
|
|
FROM qc_fqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 删除FQC检验记录 -->
|
|
<delete id="deleteFQCRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除FQC明细记录信息 -->
|
|
<delete id="deleteFQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除FQC子明细记录信息 -->
|
|
<delete id="deleteFQCSubDetailedRecord" parameterType="QcFAIRecordData">
|
|
DELETE FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 修改FQC主记录信息 -->
|
|
<update id="updateFQCMasterRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL}
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 修改FQC明细记录信息 -->
|
|
<update id="updateFQCDetailedRecord" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改FQC主记录标识为已提交 -->
|
|
<update id="updateFQCMasterSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录标识为已提交 -->
|
|
<update id="updateFQCDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 修改子明细记录标识为已提交 -->
|
|
<update id="updateFQCSubDetailSubmitFlag" parameterType="QcFAIRecordData">
|
|
UPDATE qc_fqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</update>
|
|
|
|
<!-- 删除子明细的老数据 -->
|
|
<delete id="delFQCSubDetailedRecord" parameterType="QcSubDetailInformationData">
|
|
DELETE FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 新增子明细信息 -->
|
|
<insert id="saveFQCSubDetailed">
|
|
INSERT INTO qc_fqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询FQC的子明细 -->
|
|
<select id="selectFQCSubDetailedRecord" parameterType="SubDetailValues" resultType="SubDetailValues">
|
|
SELECT
|
|
site,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b
|
|
FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询FQC检验记录是否已提交 -->
|
|
<select id="checkFQCIsSubmit" parameterType="SubDetailValues" resultType="QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_fqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectFQCSubDetailValue" parameterType="string" resultType="SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 生成FQC检验单号 -->
|
|
<select id="selectFQCInspectionNo" resultType="string" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
|
|
FROM qc_fqc_record
|
|
WHERE site = #{site}
|
|
</select>
|
|
|
|
<!-- 生成IPQC检验单号 -->
|
|
<select id="selectIPQCInspectionNo" resultType="string" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
|
|
FROM qc_ipqc_record
|
|
WHERE site = #{site}
|
|
</select>
|
|
|
|
<!-- 生成FAI检验单号 -->
|
|
<select id="selectFAIInspectionNo" resultType="string" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
|
|
FROM qc_fai_record
|
|
WHERE site = #{site}
|
|
</select>
|
|
|
|
<!-- 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 -->
|
|
<select id="queryDataFromViewPoOrder" resultType="PoOrderData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
order_no,
|
|
item_no,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
supplier_id,
|
|
supplier_name,
|
|
order_qty,
|
|
created_date,
|
|
status,
|
|
citem_code,
|
|
citem_class,
|
|
sendto_address,
|
|
order_type
|
|
FROM view_po_order
|
|
WHERE site = #{site} and order_no = #{poOrderNo} and item_no = #{poItemNo}
|
|
</select>
|
|
|
|
<!-- 向收货任务表里添加数据 -->
|
|
<insert id="saveReceivingTask" parameterType="PoOrderData">
|
|
INSERT INTO receiving_task (site, order_no, item_no, part_no, part_desc, spec, supplier_id, supplier_name, order_qty, created_date, status, citem_code, citem_class, sendto_address, order_type)
|
|
VALUES (#{site}, #{orderNo}, #{itemNo}, #{partNo}, #{partDesc}, #{spec}, #{supplierId}, #{supplierName}, #{orderQty}, #{createdDate}, #{status}, #{citemCode}, #{citemClass}, #{sendtoAddress}, #{orderType})
|
|
</insert>
|
|
|
|
<!-- 检查动控是否开启 -->
|
|
<select id="queryController" parameterType="SysSceneDynamicControlModelEntity" resultType="SysSceneDynamicControlModelEntity">
|
|
SELECT
|
|
type,
|
|
base_data,
|
|
base_desc,
|
|
status,
|
|
remark,
|
|
third_type,
|
|
second_type,
|
|
page_control,
|
|
control_style
|
|
FROM sys_scene_dynamic_control_model
|
|
where site = #{site} and control_no = #{controlNo}
|
|
</select>
|
|
|
|
<!-- 查询检验模板列表 -->
|
|
<select id="queryTemplateList" resultType="QcTemplateData" parameterType="QcTemplateData">
|
|
SELECT
|
|
site,
|
|
template_id as templateId,
|
|
template_name as templateName,
|
|
dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
|
|
FROM qc_template
|
|
<where>
|
|
site = #{site}
|
|
<if test = "templateId != null and templateId != ''">
|
|
AND template_id LIKE '%' + #{templateId}+'%'
|
|
</if>
|
|
<if test = "templateName != null and templateName != ''">
|
|
AND template_name LIKE '%' + #{templateName}+'%'
|
|
</if>
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询检验模板列表 -->
|
|
<select id="getPartInformation" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
select
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
sku
|
|
from part
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 获取特殊工序列表 -->
|
|
<select id="getSpecialOperationList" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
select
|
|
site,
|
|
operation_no,
|
|
operation_desc
|
|
from qc_special_task_operation
|
|
where site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取处置措施列表 -->
|
|
<select id="disposalMeasuresSearch" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
id,
|
|
disposal_measures
|
|
FROM qc_disposal_measures
|
|
<where>
|
|
<if test = "inspectionTypeNo != '101'">
|
|
inspection_type != 'IPQC'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询文件路径 -->
|
|
<select id="searchItemFileUrl" resultType="SysOssEntity" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref3 = #{itemNo}
|
|
</select>
|
|
|
|
<!-- 删除图片-->
|
|
<delete id="imageDelete" parameterType="SysOssEntity">
|
|
DELETE FROM sys_oss
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<!-- 模糊查询标签号 -->
|
|
<select id="getRollNo" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT DISTINCT top 3
|
|
a.seqno,
|
|
a.orderno,
|
|
b.roll_no
|
|
FROM soscheduledrouting AS a
|
|
LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
|
|
WHERE a.site = #{site} and b.roll_no like '%' + #{rollNo} + '%'
|
|
</select>
|
|
|
|
<!-- 标签号回车事件 -->
|
|
<select id="rollNoEnter" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.seqno as seqNo,
|
|
a.orderno as orderNo,
|
|
b.roll_no
|
|
FROM soscheduledrouting AS a
|
|
LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
|
|
WHERE b.roll_no = #{rollNo}
|
|
</select>
|
|
|
|
<!-- 查询物料列表 -->
|
|
<select id="queryPartList" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
sku,
|
|
spec
|
|
FROM part
|
|
<where>
|
|
site = #{site}
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND part_no LIKE '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND part_desc LIKE '%' + #{partDesc} + '%'
|
|
</if>
|
|
<if test = "sku != null and sku != ''">
|
|
AND sku LIKE '%' + #{sku} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询单位列表 -->
|
|
<select id="umSearch" resultType="QcFAIRecordData" parameterType="QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
UMID as umId,
|
|
UMName as umName
|
|
FROM UM
|
|
WHERE site = #{site} and active = #{active}
|
|
</select>
|
|
|
|
<!-- 查询单位列表 -->
|
|
<select id="checkItem" resultType="SubDetailValues" parameterType="SubDetailValues">
|
|
SELECT
|
|
site,
|
|
inspection_no,
|
|
item_no,
|
|
value_type_db,
|
|
min_value,
|
|
max_value
|
|
<if test = "flag == 'IPQC'">
|
|
FROM qc_ipqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'IQC'">
|
|
FROM qc_iqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'FQC'">
|
|
FROM qc_fqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'FAI'">
|
|
FROM qc_fai_detailed_record
|
|
</if>
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
|
|
</select>
|
|
|
|
</mapper>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|