|
|
|
@ -194,12 +194,8 @@ |
|
|
|
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 |
|
|
|
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 |
|
|
|
@ -420,8 +416,6 @@ |
|
|
|
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, |
|
|
|
@ -1227,9 +1221,695 @@ |
|
|
|
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.task_date, c.num desc |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 获取FAI明细报表 --> |
|
|
|
<select id="getFAIDetailReport" 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_cycle, |
|
|
|
a.order_no, |
|
|
|
a.operation_desc, |
|
|
|
a.resource_id, |
|
|
|
r.resource_desc, |
|
|
|
a.part_no, |
|
|
|
d.part_desc, |
|
|
|
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, |
|
|
|
d.cinv_source_code as cinvSourceCode, |
|
|
|
d.sku as sku, |
|
|
|
d.invdefinetype as invdefinetype, |
|
|
|
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_fai_record as a |
|
|
|
inner JOIN qc_fai_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_fai_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 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, c.num desc |
|
|
|
</select> |
|
|
|
<!-- 获取FAI明细报表总条数 --> |
|
|
|
<select id="getFAIDetailReportCount" parameterType="QcDetailReport" resultType="QcDetailReport"> |
|
|
|
SELECT |
|
|
|
a.inspection_no |
|
|
|
FROM qc_fai_sub_detail_record as c |
|
|
|
LEFT JOIN qc_fai_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_fai_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 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> |
|
|
|
</select> |
|
|
|
<!-- 导出FAI明细 --> |
|
|
|
<select id="downloadFAIDetailRecord" parameterType="QcDetailReport" resultType="QcReportOtherData"> |
|
|
|
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, |
|
|
|
'FAI' as inspectionTypeNo, |
|
|
|
a.task_date, |
|
|
|
a.inspection_cycle, |
|
|
|
a.order_no, |
|
|
|
a.operation_desc, |
|
|
|
a.resource_id, |
|
|
|
r.resource_desc, |
|
|
|
a.part_no, |
|
|
|
d.part_desc, |
|
|
|
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, |
|
|
|
d.cinv_source_code as cinvSourceCode, |
|
|
|
d.sku as sku, |
|
|
|
d.invdefinetype as invdefinetype, |
|
|
|
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_fai_record as a |
|
|
|
inner JOIN qc_fai_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_fai_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 = "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 = #{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> |
|
|
|
|
|
|
|
<!-- 获取FQC明细报表 --> |
|
|
|
<select id="getFQCDetailReport" 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_cycle, |
|
|
|
a.order_no, |
|
|
|
a.operation_desc, |
|
|
|
a.resource_id, |
|
|
|
r.resource_desc, |
|
|
|
a.part_no, |
|
|
|
d.part_desc, |
|
|
|
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, |
|
|
|
d.cinv_source_code as cinvSourceCode, |
|
|
|
d.sku as sku, |
|
|
|
d.invdefinetype as invdefinetype, |
|
|
|
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_fqc_record as a |
|
|
|
inner JOIN qc_fqc_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_fqc_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 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, c.num desc |
|
|
|
</select> |
|
|
|
<!-- 获取FQC明细报表总条数 --> |
|
|
|
<select id="getFQCDetailReportCount" parameterType="QcDetailReport" resultType="QcDetailReport"> |
|
|
|
SELECT |
|
|
|
a.inspection_no |
|
|
|
FROM qc_fqc_sub_detail_record as c |
|
|
|
LEFT JOIN qc_fqc_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_fqc_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 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> |
|
|
|
</select> |
|
|
|
<!-- 导出FQC明细 --> |
|
|
|
<select id="downloadFQCDetailRecord" parameterType="QcDetailReport" resultType="QcReportOtherData"> |
|
|
|
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, |
|
|
|
'FQC' as inspectionTypeNo, |
|
|
|
a.task_date, |
|
|
|
a.inspection_cycle, |
|
|
|
a.order_no, |
|
|
|
a.operation_desc, |
|
|
|
a.resource_id, |
|
|
|
r.resource_desc, |
|
|
|
a.part_no, |
|
|
|
d.part_desc, |
|
|
|
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, |
|
|
|
d.cinv_source_code as cinvSourceCode, |
|
|
|
d.sku as sku, |
|
|
|
d.invdefinetype as invdefinetype, |
|
|
|
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_fqc_record as a |
|
|
|
inner JOIN qc_fqc_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_fqc_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 = "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 = #{itemResult} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY |
|
|
|
CASE WHEN a.state = '待检验' THEN 1 |
|
|
|
WHEN a.state = '待审核' THEN 2 |
|
|
|
|