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.
1239 lines
56 KiB
1239 lines
56 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.QcReportMapper">
|
|
|
|
<select id="getOperatorName" parameterType="string" resultType="OperatorData">
|
|
select
|
|
a.site,
|
|
a.order_no,
|
|
a.function_type,
|
|
a.operator,
|
|
b.user_display as operatorName,
|
|
a.bu_no
|
|
from eam_actual_operator as a
|
|
left join sys_user as b on a.operator = b.username
|
|
where a.function_type in (#{type1}, #{type2})
|
|
</select>
|
|
|
|
<!-- 获取IQC报表 -->
|
|
<select id="getIQCReport" parameterType="QcReportData" resultType="QcReportData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.create_date as taskDate,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
a.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku,
|
|
d.umid as umId,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display inspectorName,
|
|
a.roll_no,
|
|
a.supplier_no,
|
|
s.SupplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.submission_remark,
|
|
a.submission_type,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格'
|
|
WHEN b.item_result = 'N' THEN '不合格'
|
|
END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value
|
|
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
|
|
END as textValue
|
|
FROM qc_iqc_record as a
|
|
LEFT JOIN qc_iqc_detailed_record b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.inspectorName != null and query.inspectorName != ''">
|
|
AND u.user_display LIKE '%' + #{query.inspectorName} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.create_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "query.poOrderNo != null and query.poOrderNo != ''">
|
|
AND a.po_orderNo LIKE #{query.poOrderNo}
|
|
</if>
|
|
<if test = "query.poItemNo != null and query.poItemNo != ''">
|
|
AND a.po_itemNo LIKE #{query.poItemNo}
|
|
</if>
|
|
<if test = "query.orderType != null and query.orderType != ''">
|
|
AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
|
|
</if>
|
|
<if test = "query.submissionType != null and query.submissionType != ''">
|
|
AND a.submission_type = #{query.submissionType}
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.create_date desc
|
|
</select>
|
|
|
|
<!-- 获取IPQC报表 -->
|
|
<select id="getIPQCReport" parameterType="QcReportData" resultType="QcReportData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resource_desc,
|
|
a.part_no,
|
|
d.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格'
|
|
WHEN b.item_result = 'N' THEN '不合格'
|
|
END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value
|
|
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
|
|
END as textValue
|
|
FROM qc_ipqc_record as a
|
|
LEFT JOIN qc_ipqc_detailed_record b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE #{query.operationDesc}
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date desc
|
|
</select>
|
|
|
|
<!-- 获取FAI报表 -->
|
|
<select id="getFAIReport" parameterType="QcReportData" resultType="QcReportData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
dbo.qc_get_resource_desc(a.site, a.resource_id, a.work_center_no) as resourceDesc,
|
|
a.part_no,
|
|
dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) as part_desc,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
dbo.qc_get_inspector_name(a.site, a.inspector_no) as inspectorName,
|
|
dbo.qc_get_cinv_source_code(a.part_no) as cinvSourceCode,
|
|
dbo.qc_get_sku(a.part_no) as sku,
|
|
dbo.qc_get_invdefinetype(a.site, a.part_no) as invdefinetype,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
dbo.qc_get_um_name(a.site, a.um_id) as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格'
|
|
WHEN b.item_result = 'N' THEN '不合格'
|
|
END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value
|
|
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
|
|
END as textValue
|
|
FROM qc_fai_record as a
|
|
LEFT JOIN qc_fai_detailed_record b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND dbo.Get_Part_DescSpec(a.site, a.part_no) LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND dbo.qc_get_cinv_source_code(a.part_no) LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND dbo.qc_get_sku(a.part_no) LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date desc
|
|
</select>
|
|
|
|
<!-- 获取FQC报表 -->
|
|
<select id="getFQCReport" parameterType="QcReportData" resultType="QcReportData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
dbo.qc_get_resource_desc(a.site, a.resource_id, a.work_center_no) as resourceDesc,
|
|
a.part_no,
|
|
dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) as part_desc,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
dbo.qc_get_inspector_name(a.site, a.inspector_no) as inspectorName,
|
|
dbo.qc_get_cinv_source_code(a.part_no) as cinvSourceCode,
|
|
dbo.qc_get_sku(a.part_no) as sku,
|
|
dbo.qc_get_invdefinetype(a.site, a.part_no) as invdefinetype,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
dbo.qc_get_um_name(a.site, a.um_id) as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格'
|
|
WHEN b.item_result = 'N' THEN '不合格'
|
|
END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value
|
|
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
|
|
END as textValue
|
|
FROM qc_fqc_record as a
|
|
LEFT JOIN qc_fqc_detailed_record b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND dbo.qc_get_cinv_source_code(a.part_no) LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND dbo.qc_get_sku(a.part_no) LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date desc
|
|
</select>
|
|
|
|
|
|
<!-- 获取IQC明细报表 -->
|
|
<select id="getIQCDetailReport" parameterType="QcDetailReport" resultType="QcDetailReport">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.create_date as taskDate,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
a.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku,
|
|
d.umid as umId,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display inspectorName,
|
|
a.roll_no,
|
|
a.supplier_no,
|
|
s.SupplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.submission_remark,
|
|
a.submission_type,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格' WHEN b.item_result = 'N' THEN '不合格' END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) END as textValue,
|
|
c.id,
|
|
c.num,
|
|
c.sampling_location,
|
|
c.sampling_location_b,
|
|
c.sub_detail_value,
|
|
c.sub_detail_value_b,
|
|
c.sub_detail_value_c,
|
|
c.sub_detail_value_d,
|
|
c.sub_detail_value_e
|
|
FROM qc_iqc_record as a
|
|
inner JOIN qc_iqc_detailed_record as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
inner JOIN qc_iqc_sub_detail_record as c on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.inspectorName != null and query.inspectorName != ''">
|
|
AND u.user_display LIKE '%' + #{query.inspectorName} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.create_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "query.poOrderNo != null and query.poOrderNo != ''">
|
|
AND a.po_orderNo LIKE #{query.poOrderNo}
|
|
</if>
|
|
<if test = "query.poItemNo != null and query.poItemNo != ''">
|
|
AND a.po_itemNo LIKE #{query.poItemNo}
|
|
</if>
|
|
<if test = "query.orderType != null and query.orderType != ''">
|
|
AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
|
|
</if>
|
|
<if test = "query.submissionType != null and query.submissionType != ''">
|
|
AND a.submission_type = #{query.submissionType}
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.create_date, c.num desc
|
|
</select>
|
|
<!-- 获取IQC明细报表总条数 -->
|
|
<select id="getIQCDetailReportCount" parameterType="QcDetailReport" resultType="QcDetailReport">
|
|
SELECT
|
|
a.inspection_no
|
|
FROM qc_iqc_sub_detail_record as c
|
|
LEFT JOIN qc_iqc_detailed_record as b on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
Left JOIN qc_iqc_record as a ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.inspectorName != null and query.inspectorName != ''">
|
|
AND u.user_display LIKE '%' + #{query.inspectorName} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.create_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "query.poOrderNo != null and query.poOrderNo != ''">
|
|
AND a.po_orderNo LIKE #{query.poOrderNo}
|
|
</if>
|
|
<if test = "query.poItemNo != null and query.poItemNo != ''">
|
|
AND a.po_itemNo LIKE #{query.poItemNo}
|
|
</if>
|
|
<if test = "query.submissionType != null and query.submissionType != ''">
|
|
AND a.submission_type = #{query.submissionType}
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<!-- 导出IQC明细 -->
|
|
<select id="downloadIQCDetailRecord" parameterType="QcDetailReport" resultType="QcDetailReport">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.create_date as taskDate,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
a.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku,
|
|
d.umid as umId,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
u.user_display inspectorName,
|
|
a.roll_no,
|
|
s.SupplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
'' as orderType,
|
|
a.action_date,
|
|
a.submission_remark,
|
|
a.submission_type,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格' WHEN b.item_result = 'N' THEN '不合格' END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) END as textValue,
|
|
c.id,
|
|
c.num,
|
|
c.sampling_location,
|
|
c.sampling_location_b,
|
|
c.sub_detail_value,
|
|
c.sub_detail_value_b,
|
|
c.sub_detail_value_c,
|
|
c.sub_detail_value_d,
|
|
c.sub_detail_value_e
|
|
FROM qc_iqc_record as a
|
|
inner JOIN qc_iqc_detailed_record as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
inner JOIN qc_iqc_sub_detail_record as c on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{userName}))
|
|
<if test="buNo != null and buNo != ''">
|
|
AND a.bu_no = #{buNo}
|
|
</if>
|
|
<if test = "inspectionNo != null and inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{inspectionNo} + '%'
|
|
</if>
|
|
<if test = "states != null and states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "inspectionResult != null and inspectionResult != ''">
|
|
AND a.inspection_result = #{inspectionResult}
|
|
</if>
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND a.part_no LIKE '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{partDesc} + '%'
|
|
</if>
|
|
<if test = "cinvSourceCode != null and cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "sku != null and sku != ''">
|
|
AND d.sku LIKE '%' + #{sku} + '%'
|
|
</if>
|
|
<if test = "disposalMeasures != null and disposalMeasures != ''">
|
|
AND a.disposal_measures = #{disposalMeasures}
|
|
</if>
|
|
<if test = "inspectorName != null and inspectorName != ''">
|
|
AND u.user_display LIKE '%' + #{inspectorName} + '%'
|
|
</if>
|
|
<if test="startDate != null">
|
|
AND a.inspector_date >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null">
|
|
AND #{endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="startDate2 != null">
|
|
AND a.create_date >= #{startDate2}
|
|
</if>
|
|
<if test="endDate2 != null">
|
|
AND #{endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "poOrderNo != null and poOrderNo != ''">
|
|
AND a.po_orderNo LIKE #{poOrderNo}
|
|
</if>
|
|
<if test = "poItemNo != null and poItemNo != ''">
|
|
AND a.po_itemNo LIKE #{poItemNo}
|
|
</if>
|
|
<if test = "submissionType != null and submissionType != ''">
|
|
AND a.submission_type = #{submissionType}
|
|
</if>
|
|
<if test = "operatorName != null and operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{operatorName} + '%'
|
|
</if>
|
|
<if test = "responsiblePersonName != null and responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "itemResult != null and itemResult != ''">
|
|
AND b.item_result = #{itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.create_date, c.num desc
|
|
</select>
|
|
|
|
<!-- 获取IPQC明细报表 -->
|
|
<select id="getIPQCDetailReport" parameterType="QcDetailReport" resultType="QcDetailReport">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resource_desc,
|
|
a.part_no,
|
|
d.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格' WHEN b.item_result = 'N' THEN '不合格' END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) END as textValue,
|
|
c.id,
|
|
c.num,
|
|
c.sampling_location,
|
|
c.sampling_location_b,
|
|
c.sub_detail_value,
|
|
c.sub_detail_value_b,
|
|
c.sub_detail_value_c,
|
|
c.sub_detail_value_d,
|
|
c.sub_detail_value_e
|
|
FROM qc_ipqc_record as a
|
|
inner JOIN qc_ipqc_detailed_record as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
inner JOIN qc_ipqc_sub_detail_record as c on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE #{query.operationDesc}
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date, c.num desc
|
|
</select>
|
|
<!-- 获取IPQC明细报表总条数 -->
|
|
<select id="getIPQCDetailReportCount" parameterType="QcDetailReport" resultType="QcDetailReport">
|
|
SELECT
|
|
a.inspection_no
|
|
FROM qc_ipqc_sub_detail_record as c
|
|
LEFT JOIN qc_ipqc_detailed_record as b on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
Left JOIN qc_ipqc_record as a ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{query.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures = #{query.disposalMeasures}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE #{query.operationDesc}
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.operatorName != null and query.operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
|
|
</if>
|
|
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<!-- 导出IPQC明细 -->
|
|
<select id="downloadIPQCDetailRecord" parameterType="QcDetailReport" resultType="QcReportOtherData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resource_desc,
|
|
a.part_no,
|
|
d.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.invdefinetype as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
b.item_no,
|
|
b.item_desc,
|
|
b.default_value,
|
|
b.max_value,
|
|
b.min_value,
|
|
b.sampling_qty as itemSamplingQty,
|
|
b.unqualified_quantity,
|
|
b.item_result,
|
|
CASE WHEN b.item_result = 'Y' THEN '合格' WHEN b.item_result = 'N' THEN '不合格' END as itemResultDesc,
|
|
CASE WHEN b.value_type_db = 'T' THEN b.text_value WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) END as textValue,
|
|
c.id,
|
|
c.num,
|
|
c.sampling_location,
|
|
c.sampling_location_b,
|
|
c.sub_detail_value,
|
|
c.sub_detail_value_b,
|
|
c.sub_detail_value_c,
|
|
c.sub_detail_value_d,
|
|
c.sub_detail_value_e
|
|
FROM qc_ipqc_record as a
|
|
inner JOIN qc_ipqc_detailed_record as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no
|
|
inner JOIN qc_ipqc_sub_detail_record as c on b.site = c.site AND b.bu_no = c.bu_no AND b.inspection_no = c.inspection_no and b.item_no = c.item_no
|
|
left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{userName}))
|
|
<if test="buNo != null and buNo != ''">
|
|
AND a.bu_no = #{buNo}
|
|
</if>
|
|
<if test = "inspectionNo != null and inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{inspectionNo} + '%'
|
|
</if>
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND a.part_no LIKE '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND d.part_desc LIKE '%' + #{partDesc} + '%'
|
|
</if>
|
|
<if test = "cinvSourceCode != null and cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "sku != null and sku != ''">
|
|
AND d.sku LIKE '%' + #{sku} + '%'
|
|
</if>
|
|
<if test = "states != null and states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
<if test = "inspectionResult != null and inspectionResult != ''">
|
|
AND a.inspection_result = #{inspectionResult}
|
|
</if>
|
|
<if test = "disposalMeasures != null and disposalMeasures != ''">
|
|
AND a.disposal_measures = #{disposalMeasures}
|
|
</if>
|
|
<if test = "orderNo != null and orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{orderNo} + '%'
|
|
</if>
|
|
<if test = "seqNo != null and seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{seqNo} + '%'
|
|
</if>
|
|
<if test = "operationDesc != null and operationDesc != ''">
|
|
AND a.operation_desc LIKE #{operationDesc}
|
|
</if>
|
|
<if test="startDate != null">
|
|
AND a.inspector_date >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null">
|
|
AND #{endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="startDate2 != null">
|
|
AND a.task_date >= #{startDate2}
|
|
</if>
|
|
<if test="endDate2 != null">
|
|
AND #{endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "operatorName != null and operatorName != ''">
|
|
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{operatorName} + '%'
|
|
</if>
|
|
<if test = "responsiblePersonName != null and responsiblePersonName != ''">
|
|
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{responsiblePersonName} + '%'
|
|
</if>
|
|
<if test = "itemResult != null and itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date, c.num desc
|
|
</select>
|
|
</mapper>
|