|
|
|
@ -12,35 +12,43 @@
|
|
|
|
|
where dict_type = #{dictType} and status = '0'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getOverallInfo" resultType="com.op.quality.domain.QcInterface">
|
|
|
|
|
select count(0) quality,'all' ymdTypeName
|
|
|
|
|
from wms_raw_order_in
|
|
|
|
|
where active_flag = '1'
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),receipt_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
<if test="ymdType == 'yyyy'">
|
|
|
|
|
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
|
|
|
|
|
count(0) quality
|
|
|
|
|
FROM(
|
|
|
|
|
select check_result
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where check_type = #{typeCode} and check_status = '2'
|
|
|
|
|
and CONVERT(varchar(4),qct.create_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),receipt_time, 120) =SUBSTRING(#{ymd},0,8)
|
|
|
|
|
<if test="ymdType == 'mm'">
|
|
|
|
|
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
|
|
|
|
|
count(0) quality
|
|
|
|
|
FROM(
|
|
|
|
|
select check_result
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where check_type = #{typeCode} and check_status = '2'
|
|
|
|
|
and CONVERT(varchar(7),qct.create_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),receipt_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
union ALL
|
|
|
|
|
select count(0),'unOk'
|
|
|
|
|
from qc_check_unqualified qcu
|
|
|
|
|
left join qc_check_type qct on qcu.type = qct.order_code
|
|
|
|
|
where qct.type_code = #{typeCode} and qcu.del_flag = '0'
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),qcu.create_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),qcu.create_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qcu.create_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
<if test="ymdType == 'dd'">
|
|
|
|
|
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
|
|
|
|
|
count(0) quality
|
|
|
|
|
FROM(
|
|
|
|
|
select check_result
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where check_type = #{typeCode} and check_status = '2'
|
|
|
|
|
and CONVERT(varchar(10),qct.create_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getCheckProjectsPie" resultType="com.op.quality.domain.QcInterface">
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
select count(0) quality,
|
|
|
|
|
qctd.project_no,
|
|
|
|
|
qctd.rule_name projectName
|
|
|
|
@ -56,63 +64,81 @@
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qcu.update_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
group by qctd.project_no,qctd.rule_name
|
|
|
|
|
<!--
|
|
|
|
|
select qct.remark projectName,
|
|
|
|
|
count(0) quality
|
|
|
|
|
group by qctd.project_no,qctd.rule_name-->
|
|
|
|
|
|
|
|
|
|
<if test="ymdType == 'yyyy'">
|
|
|
|
|
select sum(noOk_quality) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select
|
|
|
|
|
qctd.noOk_quality,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where qct.type_code = 'produce' and qct.check_result = 'N' and qct.remark is not null
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),qct.check_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),qct.check_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qct.check_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
group by qct.remark-->
|
|
|
|
|
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
|
|
|
|
|
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
|
|
|
|
|
where qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(4),qct.create_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
and qdtc.del_flag = '0' and qctd.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ymdType == 'mm'">
|
|
|
|
|
select sum(noOk_quality) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select
|
|
|
|
|
qctd.noOk_quality,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
|
|
|
|
|
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
|
|
|
|
|
where qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(7),qct.create_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
and qdtc.del_flag = '0' and qctd.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ymdType == 'dd'">
|
|
|
|
|
select sum(noOk_quality) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select
|
|
|
|
|
qctd.noOk_quality,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join qc_check_task_defect qctd on qctd.belong_to = qct.record_id
|
|
|
|
|
left join qc_defect_type_class qdtc on qctd.class_id = qdtc.id
|
|
|
|
|
where qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(10),qct.create_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
and qdtc.del_flag = '0' and qctd.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSupplierBadTOP5" resultType="com.op.quality.domain.QcInterface">
|
|
|
|
|
select top 5 * from(
|
|
|
|
|
select
|
|
|
|
|
concat(t1.supplier_name,'-',t1.material_name) supplierName,
|
|
|
|
|
ROUND(t2.noOkNum*100.00/t1.allNum, 2) quality
|
|
|
|
|
from (
|
|
|
|
|
select count(0) allNum,
|
|
|
|
|
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where qct.type_code = #{typeCode}
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
group by
|
|
|
|
|
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
|
|
|
|
|
) t1
|
|
|
|
|
left join (
|
|
|
|
|
select
|
|
|
|
|
count(0) noOkNum,qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where qct.type_code = #{typeCode} and qct.check_result = 'N'
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
group by
|
|
|
|
|
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
|
|
|
|
|
) t2 on t1.supplier_code = t2.supplier_code and t1.material_code = t2.material_code
|
|
|
|
|
) t order by t.quality desc
|
|
|
|
|
select top 5 t.* from (
|
|
|
|
|
select t0.noOkQuality*100/t0.batchs quality,t0.supplierName from(
|
|
|
|
|
SELECT
|
|
|
|
|
qct.supplier_code supplierCode,qct.supplier_name supplierName,
|
|
|
|
|
count(0) batchs,
|
|
|
|
|
SUM(CASE WHEN qct.check_result = 'N' THEN 1 ELSE 0 END) noOkQuality
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where qct.check_type = #{checkType}
|
|
|
|
|
and qct.del_flag = '0'
|
|
|
|
|
<if test='ymdType=="yyyy"'>
|
|
|
|
|
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="mm"'>
|
|
|
|
|
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='ymdType=="dd"'>
|
|
|
|
|
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
</if>
|
|
|
|
|
and qct.check_status = '2'
|
|
|
|
|
group by qct.supplier_code,qct.supplier_name
|
|
|
|
|
) t0
|
|
|
|
|
where t0.noOkQuality != 0
|
|
|
|
|
) t order by t.quality desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSupplierTaskList" resultType="com.op.quality.domain.QcInterface">
|
|
|
|
|
select
|
|
|
|
@ -251,10 +277,10 @@
|
|
|
|
|
sum(t.noOk_quality) noOkQuality
|
|
|
|
|
from(
|
|
|
|
|
select CONVERT(varchar(7),qct.income_time, 120) ymd,
|
|
|
|
|
qct.quality,
|
|
|
|
|
qct.sample_quality quality,
|
|
|
|
|
qct.noOk_quality
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
where qct.type_code = #{typeCode}
|
|
|
|
|
where qct.check_type = 'checkTypeSCXJ'
|
|
|
|
|
and qct.del_flag='0'
|
|
|
|
|
and CONVERT(varchar(4),qct.income_time, 120) in (${ymd})
|
|
|
|
|
) t
|
|
|
|
@ -297,4 +323,50 @@
|
|
|
|
|
and CONVERT(varchar(10),mrw.create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getCheckProjectsPieLL" resultType="com.op.quality.domain.QcInterface">
|
|
|
|
|
<if test="ymdType == 'yyyy'">
|
|
|
|
|
select count(0) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select
|
|
|
|
|
qct.remark_code,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
|
|
|
|
|
where qct.check_type = #{checkType} and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(4),qct.create_time, 120) = SUBSTRING(#{ymd},0,5)
|
|
|
|
|
and qdtc.del_flag = '0' and qct.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ymdType == 'mm'">
|
|
|
|
|
select count(0) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select
|
|
|
|
|
qct.remark_code,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
|
|
|
|
|
where qct.check_type = #{checkType} and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(7),qct.create_time, 120) = SUBSTRING(#{ymd},0,8)
|
|
|
|
|
and qdtc.del_flag = '0' and qct.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ymdType == 'dd'">
|
|
|
|
|
select count(0) quality,
|
|
|
|
|
class_name projectName
|
|
|
|
|
FROM(
|
|
|
|
|
select qct.remark_code,
|
|
|
|
|
qdtc.class_name
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
|
|
|
|
|
where qct.check_type = #{checkType} and qct.check_status = '2'
|
|
|
|
|
and CONVERT(varchar(10),qct.create_time, 120) = SUBSTRING(#{ymd},0,11)
|
|
|
|
|
and qdtc.del_flag = '0' and qct.del_flag = '0'
|
|
|
|
|
) t
|
|
|
|
|
group by class_name
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|
|
|
|
|