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.
1329 lines
56 KiB
1329 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">
|
|
|
|
<!-- 获取IQC报表 -->
|
|
<select id="getIQCReport" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.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,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.roll_no,
|
|
a.supplier_no,
|
|
s.supplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.receipt_no,
|
|
a.receipt_item_no,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.ref_info1,
|
|
a.ref_info2,
|
|
a.ref_info3,
|
|
a.ref_info4,
|
|
a.ref_info5,
|
|
a.warehouse_id,
|
|
w.WareHouseName as warehouseName,
|
|
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.part_no = d.PartNo
|
|
left join Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join WareHouse as w on a.site = w.site and a.warehouse_id = w.WareHouseID
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.warehouseId != null and query.warehouseId != ''">
|
|
AND a.warehouse_id like #{query.warehouseId}
|
|
</if>
|
|
<if test = "query.warehouseName != null and query.warehouseName != ''">
|
|
AND w.WareHouseName like #{query.warehouseName}
|
|
</if>
|
|
<if test = "query.receiptNo != null and query.receiptNo != ''">
|
|
AND a.receipt_no LIKE #{query.receiptNo}
|
|
</if>
|
|
<if test = "query.refInfo1 != null and query.refInfo1 != ''">
|
|
AND a.ref_info1 LIKE #{query.refInfo1}
|
|
</if>
|
|
<if test = "query.refInfo2 != null and query.refInfo2 != ''">
|
|
AND a.ref_info2 LIKE #{query.refInfo2}
|
|
</if>
|
|
<if test = "query.refInfo3 != null and query.refInfo3 != ''">
|
|
AND a.ref_info3 LIKE #{query.refInfo3}
|
|
</if>
|
|
<if test = "query.refInfo4 != null and query.refInfo4 != ''">
|
|
AND a.ref_info4 LIKE #{query.refInfo4}
|
|
</if>
|
|
<if test = "query.refInfo5 != null and query.refInfo5 != ''">
|
|
AND a.ref_info5 LIKE #{query.refInfo5}
|
|
</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="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.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.resourceDesc,
|
|
a.part_no,
|
|
d.PartDescription as part_desc,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
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,
|
|
a.pass_qty,
|
|
wc.WorkCenterDesc as work_center_desc,
|
|
a.not_pass_qty,
|
|
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 WorkCenterResource as r on a.site = r.site and a.resource_id = r.resourceID
|
|
left join part as d on a.site = d.site and a.part_no = d.PartNo
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
LEFT JOIN WorkCenter as wc on a.site = wc.site and a.work_center_no = wc.WorkCenterNo
|
|
<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.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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.PartDescription LIKE #{query.partDesc}
|
|
</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.workCenterNo != null and query.workCenterNo != ''">
|
|
AND a.work_center_no like #{query.workCenterNo}
|
|
</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>
|
|
|
|
<!-- 获取FQAS报表 -->
|
|
<select id="getFQASReport" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.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_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.order_ref_type,
|
|
a.order_ref1,
|
|
a.order_ref2,
|
|
a.order_ref3,
|
|
a.order_ref4,
|
|
a.order_ref5,
|
|
a.order_ref6,
|
|
a.create_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_stock_record as a
|
|
LEFT JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type <![CDATA[<>]]> '发货通知单'
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.orderRef1 != null and query.orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{query.orderRef1}
|
|
</if>
|
|
<if test = "query.orderRef2 != null and query.orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{query.orderRef2}
|
|
</if>
|
|
<if test = "query.orderRef3 != null and query.orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{query.orderRef3}
|
|
</if>
|
|
<if test = "query.orderRef4 != null and query.orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{query.orderRef4}
|
|
</if>
|
|
<if test = "query.orderRef5 != null and query.orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{query.orderRef5}
|
|
</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>
|
|
|
|
<!-- 获取OQC报表 -->
|
|
<select id="getOQCReport" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.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_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.order_ref_type,
|
|
a.order_ref1,
|
|
a.order_ref2,
|
|
a.order_ref3,
|
|
a.order_ref4,
|
|
a.order_ref5,
|
|
a.order_ref6,
|
|
a.create_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_stock_record as a
|
|
LEFT JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type = '发货通知单'
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.orderRef1 != null and query.orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{query.orderRef1}
|
|
</if>
|
|
<if test = "query.orderRef2 != null and query.orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{query.orderRef2}
|
|
</if>
|
|
<if test = "query.orderRef3 != null and query.orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{query.orderRef3}
|
|
</if>
|
|
<if test = "query.orderRef4 != null and query.orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{query.orderRef4}
|
|
</if>
|
|
<if test = "query.orderRef5 != null and query.orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{query.orderRef5}
|
|
</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>
|
|
|
|
|
|
<!-- 获取IQC报表总条数 -->
|
|
<select id="getIQCReportCount" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportData">
|
|
SELECT
|
|
a.inspection_no
|
|
from qc_iqc_detailed_record as b
|
|
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.part_no = d.PartNo
|
|
left join WareHouse as w on a.site = w.site and a.warehouse_id = w.WareHouseID
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.warehouseId != null and query.warehouseId != ''">
|
|
AND a.warehouse_id like #{query.warehouseId}
|
|
</if>
|
|
<if test = "query.warehouseName != null and query.warehouseName != ''">
|
|
AND w.WareHouseName like #{query.warehouseName}
|
|
</if>
|
|
<if test = "query.receiptNo != null and query.receiptNo != ''">
|
|
AND a.receipt_no LIKE #{query.receiptNo}
|
|
</if>
|
|
<if test = "query.refInfo1 != null and query.refInfo1 != ''">
|
|
AND a.ref_info1 LIKE #{query.refInfo1}
|
|
</if>
|
|
<if test = "query.refInfo2 != null and query.refInfo2 != ''">
|
|
AND a.ref_info2 LIKE #{query.refInfo2}
|
|
</if>
|
|
<if test = "query.refInfo3 != null and query.refInfo3 != ''">
|
|
AND a.ref_info3 LIKE #{query.refInfo3}
|
|
</if>
|
|
<if test = "query.refInfo4 != null and query.refInfo4 != ''">
|
|
AND a.ref_info4 LIKE #{query.refInfo4}
|
|
</if>
|
|
<if test = "query.refInfo5 != null and query.refInfo5 != ''">
|
|
AND a.ref_info5 LIKE #{query.refInfo5}
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 导出IQC明细 -->
|
|
<select id="downloadIQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.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,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.roll_no,
|
|
a.supplier_no,
|
|
s.supplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.receipt_no,
|
|
a.receipt_item_no,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.ref_info1,
|
|
a.ref_info2,
|
|
a.ref_info3,
|
|
a.ref_info4,
|
|
a.ref_info5,
|
|
a.warehouse_id,
|
|
w.WareHouseName as warehouseName,
|
|
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.part_no = d.PartNo
|
|
left join Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join WareHouse as w on a.site = w.site and a.warehouse_id = w.WareHouseID
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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="buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{partDesc}
|
|
</if>
|
|
<if test = "disposalMeasures != null and disposalMeasures != ''">
|
|
AND a.disposal_measures = #{disposalMeasures}
|
|
</if>
|
|
<if test = "inspectorName != null and inspectorName != ''">
|
|
AND su.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 = "warehouseId != null and warehouseId != ''">
|
|
AND a.warehouse_id like #{warehouseId}
|
|
</if>
|
|
<if test = "warehouseName != null and warehouseName != ''">
|
|
AND w.WareHouseName like #{warehouseName}
|
|
</if>
|
|
<if test = "receiptNo != null and receiptNo != ''">
|
|
AND a.receipt_no LIKE #{receiptNo}
|
|
</if>
|
|
<if test = "refInfo1 != null and refInfo1 != ''">
|
|
AND a.ref_info1 LIKE #{refInfo1}
|
|
</if>
|
|
<if test = "refInfo2 != null and refInfo2 != ''">
|
|
AND a.ref_info2 LIKE #{refInfo2}
|
|
</if>
|
|
<if test = "refInfo3 != null and refInfo3 != ''">
|
|
AND a.ref_info3 LIKE #{refInfo3}
|
|
</if>
|
|
<if test = "refInfo4 != null and refInfo4 != ''">
|
|
AND a.ref_info4 LIKE #{refInfo4}
|
|
</if>
|
|
<if test = "refInfo5 != null and refInfo5 != ''">
|
|
AND a.ref_info5 LIKE #{refInfo5}
|
|
</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 desc
|
|
</select>
|
|
|
|
|
|
<!-- 获取IPQC报表总条数 -->
|
|
<select id="getIPQCReportCount" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportData">
|
|
SELECT
|
|
a.inspection_no
|
|
from qc_ipqc_detailed_record as b
|
|
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.part_no = d.PartNo
|
|
<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.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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.PartDescription LIKE #{query.partDesc}
|
|
</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.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 导出IPQC明细 -->
|
|
<select id="downloadIPQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportIPQCData">
|
|
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.resourceDesc,
|
|
a.part_no,
|
|
d.PartDescription as part_desc,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
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,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
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 WorkCenterResource as r on a.site = r.site and a.resource_id = r.resourceID
|
|
left join part as d on a.site = d.site and a.part_no = d.PartNo
|
|
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="buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{buDesc}
|
|
</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.PartDescription LIKE #{partDesc}
|
|
</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 = "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 desc
|
|
</select>
|
|
|
|
|
|
<!-- 获取FQAS报表总条数 -->
|
|
<select id="getFQASReportCount" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportData">
|
|
SELECT
|
|
a.inspection_no
|
|
from qc_stock_detailed_record as b
|
|
Left JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type <![CDATA[<>]]> '发货通知单'
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.orderRef1 != null and query.orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{query.orderRef1}
|
|
</if>
|
|
<if test = "query.orderRef2 != null and query.orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{query.orderRef2}
|
|
</if>
|
|
<if test = "query.orderRef3 != null and query.orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{query.orderRef3}
|
|
</if>
|
|
<if test = "query.orderRef4 != null and query.orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{query.orderRef4}
|
|
</if>
|
|
<if test = "query.orderRef5 != null and query.orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{query.orderRef5}
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 导出FQAS明细 -->
|
|
<select id="downloadFQASRecord" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportFQASData">
|
|
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_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.order_ref_type,
|
|
a.order_ref1,
|
|
a.order_ref2,
|
|
a.order_ref3,
|
|
a.order_ref4,
|
|
a.order_ref5,
|
|
a.order_ref6,
|
|
a.create_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_stock_record as a
|
|
LEFT JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type <![CDATA[<>]]> '发货通知单'
|
|
<if test="buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{partDesc}
|
|
</if>
|
|
<if test = "disposalMeasures != null and disposalMeasures != ''">
|
|
AND a.disposal_measures = #{disposalMeasures}
|
|
</if>
|
|
<if test = "inspectorName != null and inspectorName != ''">
|
|
AND su.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 = "orderRef1 != null and orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{orderRef1}
|
|
</if>
|
|
<if test = "orderRef2 != null and orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{orderRef2}
|
|
</if>
|
|
<if test = "orderRef3 != null and orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{orderRef3}
|
|
</if>
|
|
<if test = "orderRef4 != null and orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{orderRef4}
|
|
</if>
|
|
<if test = "orderRef5 != null and orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{orderRef5}
|
|
</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 desc
|
|
</select>
|
|
|
|
<!-- 获取OQC报表总条数 -->
|
|
<select id="getOQCReportCount" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportData">
|
|
SELECT
|
|
a.inspection_no
|
|
from qc_stock_detailed_record as b
|
|
Left JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type = '发货通知单'
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{query.partDesc}
|
|
</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 su.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.orderRef1 != null and query.orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{query.orderRef1}
|
|
</if>
|
|
<if test = "query.orderRef2 != null and query.orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{query.orderRef2}
|
|
</if>
|
|
<if test = "query.orderRef3 != null and query.orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{query.orderRef3}
|
|
</if>
|
|
<if test = "query.orderRef4 != null and query.orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{query.orderRef4}
|
|
</if>
|
|
<if test = "query.orderRef5 != null and query.orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{query.orderRef5}
|
|
</if>
|
|
<if test = "query.itemResult != null and query.itemResult != ''">
|
|
AND b.item_result = #{query.itemResult}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 导出OQC明细 -->
|
|
<select id="downloadOQCRecord" parameterType="com.xujie.sys.modules.pms.data.QcReportData" resultType="com.xujie.sys.modules.pms.data.QcReportFQASData">
|
|
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_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
d.PartDescription + '' + Isnull(d.Spec, '') as part_desc,
|
|
d.umid as umId,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
su.user_display as inspectorName,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.action_by,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.order_ref_type,
|
|
a.order_ref1,
|
|
a.order_ref2,
|
|
a.order_ref3,
|
|
a.order_ref4,
|
|
a.order_ref5,
|
|
a.order_ref6,
|
|
a.create_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_stock_record as a
|
|
LEFT JOIN qc_stock_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.part_no = d.PartNo
|
|
left join sys_user as su on a.site = su.site and a.inspector_no = su.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}))
|
|
and a.order_ref_type = '发货通知单'
|
|
<if test="buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{buDesc}
|
|
</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 d.PartDescription + '' + Isnull(d.Spec, '') LIKE #{partDesc}
|
|
</if>
|
|
<if test = "disposalMeasures != null and disposalMeasures != ''">
|
|
AND a.disposal_measures = #{disposalMeasures}
|
|
</if>
|
|
<if test = "inspectorName != null and inspectorName != ''">
|
|
AND su.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 = "orderRef1 != null and orderRef1 != ''">
|
|
AND a.order_ref1 LIKE #{orderRef1}
|
|
</if>
|
|
<if test = "orderRef2 != null and orderRef2 != ''">
|
|
AND a.order_ref2 LIKE #{orderRef2}
|
|
</if>
|
|
<if test = "orderRef3 != null and orderRef3 != ''">
|
|
AND a.order_ref3 LIKE #{orderRef3}
|
|
</if>
|
|
<if test = "orderRef4 != null and orderRef4 != ''">
|
|
AND a.order_ref4 LIKE #{orderRef4}
|
|
</if>
|
|
<if test = "orderRef5 != null and orderRef5 != ''">
|
|
AND a.order_ref5 LIKE #{orderRef5}
|
|
</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 desc
|
|
</select>
|
|
|
|
</mapper>
|