You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1404 lines
72 KiB
XML

2 years ago
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
1 year ago
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2 years ago
<mapper namespace="com.op.quality.mapper.QcStaticTableMapper">
1 year ago
<select id="selectQcStaticTableList" parameterType="com.op.quality.domain.QcStaticTable"
resultType="com.op.quality.domain.QcStaticTable">
11 months ago
<!--
1 year ago
SELECT
bs.supplier_id supplierId,
bs.supplier_code supplierCode,
bs.zh_desc supplierName
from base_supplier bs
where bs.del_flag = '0' and bs.active_flag = '1'
<if test="supplierCodes != null and supplierCodes.size()>0">
and bs.supplier_code in
<foreach collection="supplierCodes" item="supplierCode" index="index" separator="," open="(" close=")">
#{supplierCode}
</foreach>
11 months ago
</if>-->
select DISTINCT qct.supplier_code supplierCode,
qct.supplier_name supplierName
from qc_check_task qct
where qct.type_code = 'material' and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{yearMonth}
8 months ago
<if test="supplierCodes != null and supplierCodes.size()>0">
and qct.supplier_code in
<foreach collection="supplierCodes" item="supplierCode" index="index" separator="," open="(" close=")">
#{supplierCode}
</foreach>
</if>
1 year ago
</select>
<select id="selectPcMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
count(0) batchs,sum(qct.quality) nums
from qc_check_task qct
where qct.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="qc.checkResult != null">
and qct.check_result = #{qc.checkResult}
</if>
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
</select>
<select id="selectNumMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
where qct.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
</select>
2 years ago
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
11 months ago
<!--
1 year ago
select concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
qct.material_code materialCode,
qct.material_name materialName,
qct.sample_quality sampleQuality,
qct.aNoOkquality,
qct.bNoOkquality,
qct.cNoOkquality,
qct.income_time
from qc_check_task qct
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
11 months ago
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>-->
select CONVERT(varchar(10),qct.income_time, 120) materailDate,
sum(qct.sample_quality) sampleQuality,
sum(qctd1.noOk_quality)*type1.ratio aNoOkquality,
sum(qctd2.noOk_quality)*type2.ratio bNoOkquality,
sum(qctd3.noOk_quality)*type3.ratio cNoOkquality
from qc_check_task qct
left join qc_check_task_defect qctd1 on qct.record_id = qctd1.belong_to and qctd1.defect_code = '20231212001'
left join qc_defect_type type1 on qctd1.defect_code = type1.defect_code
left join qc_check_task_defect qctd2 on qct.record_id = qctd2.belong_to and qctd2.defect_code = '20231212002'
left join qc_defect_type type2 on qctd2.defect_code = type2.defect_code
left join qc_check_task_defect qctd3 on qct.record_id = qctd3.belong_to and qctd3.defect_code = '20231212003'
left join qc_defect_type type3 on qctd3.defect_code = type3.defect_code
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.create_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.create_time, 120)</if>
group by CONVERT(varchar(10),qct.income_time, 120),type1.ratio,type2.ratio,type3.ratio
1 year ago
</select>
<select id="getProduceNames" resultType="com.op.quality.domain.QcStaticTable">
select distinct qct.material_code materialCode,
qct.material_name materialName
from qc_check_task qct
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
</select>
<select id="getProduceChartDataYM" resultType="com.op.quality.domain.QcStaticTable">
11 months ago
<!--
1 year ago
select
<if test='dataType=="ymd" '>
concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
</if>
<if test='dataType=="ym" '>
concat(qct.material_code,CONVERT(varchar(7),qct.income_time, 120)) materailDate,
</if>
qct.material_code materialCode,
qct.material_name materialName,
sum(qct.sample_quality) sampleQuality,
sum(qct.aNoOkquality) aNoOkquality,
sum(qct.bNoOkquality) bNoOkquality,
sum(qct.cNoOkquality) cNoOkquality,
CONVERT(varchar(7),qct.income_time, 120)
from qc_check_task qct
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test='ymArrayStart != null and dataType=="ym" '>and CONVERT(varchar(7),qct.income_time, 120) >=
#{ymArrayStart}
</if>
<if test='ymArrayEnd != null and dataType=="ym"'>and #{ymArrayEnd}>= CONVERT(varchar(7),qct.income_time, 120)
</if>
<if test='ymArrayStart != null and dataType=="ymd" '>and CONVERT(varchar(10),qct.income_time, 120) >=
#{ymArrayStart}
</if>
<if test='ymArrayEnd != null and dataType=="ymd"'>and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time,
120)
</if>
group by qct.material_code ,
qct.material_name
<if test='dataType=="ymd" '>
,CONVERT(varchar(10),qct.income_time, 120)
</if>
<if test='dataType=="ym" '>
,CONVERT(varchar(7),qct.income_time, 120)
</if>
11 months ago
-->
select
<if test='dataType=="ymd" '>
CONVERT(varchar(10),qct.income_time, 120) materailDate,
</if>
<if test='dataType=="ym" '>
CONVERT(varchar(7),qct.income_time, 120) materailDate,
</if>
sum(qct.sample_quality) sampleQuality,
sum(qctd1.noOk_quality)*type1.ratio aNoOkquality,
sum(qctd2.noOk_quality)*type2.ratio bNoOkquality,
sum(qctd3.noOk_quality)*type3.ratio cNoOkquality
from qc_check_task qct
left join qc_check_task_defect qctd1 on qct.record_id = qctd1.belong_to and qctd1.defect_code = '20231212001'
left join qc_defect_type type1 on qctd1.defect_code = type1.defect_code
left join qc_check_task_defect qctd2 on qct.record_id = qctd2.belong_to and qctd2.defect_code = '20231212002'
left join qc_defect_type type2 on qctd2.defect_code = type2.defect_code
left join qc_check_task_defect qctd3 on qct.record_id = qctd3.belong_to and qctd3.defect_code = '20231212003'
left join qc_defect_type type3 on qctd3.defect_code = type3.defect_code
where qct.del_flag = '0' and qct.type_code = 'produce'
<if test="materialCode != null ">and qct.material_code in (${materialCode})</if>
<if test="workCenter != null ">and qct.supplier_code = #{workCenter}</if>
<if test='ymArrayStart != null and dataType=="ym" '>and CONVERT(varchar(7),qct.income_time, 120) >=#{ymArrayStart}</if>
<if test='ymArrayEnd != null and dataType=="ym"'>and #{ymArrayEnd}>= CONVERT(varchar(7),qct.income_time, 120)</if>
<if test='ymArrayStart != null and dataType=="ymd" '>and CONVERT(varchar(10),qct.income_time, 120) >=#{ymArrayStart}</if>
<if test='ymArrayEnd != null and dataType=="ymd"'>and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time,120)</if>
group by type1.ratio,type2.ratio,type3.ratio
<if test='dataType=="ymd" '>
,CONVERT(varchar(10),qct.income_time, 120)
</if>
<if test='dataType=="ym" '>
,CONVERT(varchar(7),qct.income_time, 120)
</if>
1 year ago
</select>
<select id="getWorkcenterList" resultType="com.op.system.api.domain.quality.FactoryDto">
select factory_name factoryName,
factory_code factoryCode
from sys_factory where f_type = 'c'
2 years ago
</select>
2 years ago
<select id="getXJCheckTableList" resultType="com.op.quality.domain.QcStaticTable">
1 year ago
select distinct
8 months ago
SUBSTRING(pow.workorder_code_sap,4,10) workorderCodeSap,
11 months ago
qct.order_no orderNo,
qct.material_code materialCode, qct.material_name materialName,
qct.quality,qct.unit,
qct.supplier_code supplierCode,qct.supplier_name supplierName,
pow.product_date incomeTimeStr,
8 months ago
pow.shift_id shiftId, be.equipment_name equipmentName
11 months ago
from qc_check_task qct
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
8 months ago
left join base_equipment be on be.equipment_code = qct.check_loc
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0' and pow.del_flag = '0'
8 months ago
<if test="workorderCodeSap != null ">and pow.workorder_code_sap like concat('%',#{workorderCodeSap},'%')</if>
11 months ago
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
8 months ago
<if test="materialCode != null ">and (
qct.material_code like concat('%',#{materialCode},'%') or qct.material_name like concat('%',#{materialCode},'%')
)</if>
11 months ago
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="incomeTimeStr != null ">and CONVERT(varchar(10),pow.product_date, 120) = #{incomeTimeStr}</if>
<if test="incomeTimeStart != null ">and CONVERT(varchar(30),qct.income_time, 120) >= #{incomeTimeStart}</if>
<if test="incomeTimeEnd != null ">and #{incomeTimeEnd} > CONVERT(varchar(30),qct.income_time, 120)</if>
11 months ago
order by pow.product_date desc
1 year ago
</select>
<select id="getXJProjects" resultType="com.op.quality.domain.QcStaticTable">
2 years ago
select qct.rule_name ruleName,
qctp.project_id projectId,
qctp.project_no projectNo
from qc_check_type_project qctp
left join qc_check_project qct on qctp.project_id = qct.id
where qctp.type_id = 'checkTypeSCXJ' and qctp.del_flag = '0' and qct.del_flag = '0'
order by qctp.sort
</select>
1 year ago
<select id="getProjectDetail" resultType="com.op.quality.domain.QcStaticTable">
1 year ago
select qctd.record_id recordId,
qctd.project_id projectId,
qctd.record_id detailId,
2 years ago
qctd.status,
1 year ago
qctd.remark,
CONVERT(VARCHAR(5),qctd.create_time, 108),
2 years ago
concat(qctd.project_id,
case when '09:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '08:00' then '08'
when '10:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '09:00' then '09'
when '11:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '10:00' then '10'
when '12:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '11:00' then '11'
when '13:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '12:30' then '12'
when '14:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '13:30' then '13'
when '15:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '14:30' then '14'
when '16:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '15:30' then '15'
when '17:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '16:30' then '16'
when '19:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '18:00' then '18'
when '20:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '19:00' then '19'
when '21:00'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '20:00' then '20'
2 years ago
else '-' end
)ymdms
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.order_no = #{orderNo} and qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
2 years ago
order by qctd.create_time
</select>
1 year ago
<select id="getProjectDetailNight" resultType="com.op.quality.domain.QcStaticTable">
select qctd.record_id recordId,
qctd.project_id projectId,
qctd.record_id detailId,
1 year ago
qctd.status,
qctd.remark,
CONVERT(VARCHAR(5),qctd.create_time, 108),
concat(qctd.project_id,
case when '21:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '20:30' then '08'
when '22:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '21:30' then '09'
when '23:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '22:30' then '10'
when '23:59'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '23:30' then '11'
when '01:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '00:00' then '11'
when '02:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '01:30' then '12'
when '03:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '02:30' then '13'
when '04:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '03:30' then '14'
when '05:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '04:30' then '15'
when '06:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '05:30' then '16'
when '07:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '06:30' then '18'
when '08:30'>= CONVERT(VARCHAR(5),qctd.create_time, 108) and CONVERT(VARCHAR(5),qctd.create_time, 108)> '07:30' then '19'
else '-' end
)ymdms
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.order_no = #{orderNo} and qct.check_type = 'checkTypeSCXJ' and qct.check_status = '2'
order by qctd.create_time
</select>
1 year ago
<select id="getBatchnos" resultType="java.lang.String">
select powb.batch_code batchCode
from pro_order_workorder_batch powb
left join pro_order_workorder pow on powb.workorder_id = pow.workorder_id
where powb.del_flag = '0' and pow.del_flag = '0'
and pow.workorder_code = #{orderNo}
8 months ago
order by powb.batch_code
</select>
8 months ago
<select id="getCheckBatchnos" resultType="java.lang.String">
select qct.income_batch_no from qc_check_task qct
where qct.check_type = 'checkTypeSCXJ'
and qct.del_flag = '0' and qct.order_no = #{orderNo} and qct.income_batch_no is not null
</select>
1 year ago
<select id="getLegendData" resultType="com.op.quality.domain.QcStaticTable">
select DISTINCT supplier_code supplierCode,
supplier_name supplierName
from qc_check_task
where check_type = 'checkTypeSCXJ' and del_flag = '0'
and CONVERT(varchar(10),income_time, 120) = #{ymdms}
</select>
1 year ago
<select id="getXJMapData" resultType="com.op.quality.domain.QcStaticTable">
11 months ago
<!--
1 year ago
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums,
concat(qct.supplier_code,CONVERT(VARCHAR(2), qct.check_time, 108)) ymdms
from qc_check_task qct
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
and CONVERT(varchar(10),qct.income_time, 120) = #{ymdms}
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
group by qct.supplier_code,qct.supplier_name,CONVERT(VARCHAR(2), qct.check_time, 108)
11 months ago
-->
select
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums,
CONVERT(VARCHAR(2), qct.check_time, 108) ymdms
from qc_check_task qct
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
and CONVERT(varchar(10),qct.income_time, 120) = #{ymdms}
group by CONVERT(VARCHAR(2), qct.check_time, 108)
1 year ago
</select>
<select id="getQmsRateTable" resultType="com.op.quality.domain.QcStaticTable">
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
<if test="orderNo != null ">qct.order_no orderNo, qct.unit,</if>
11 months ago
<if test="incomeBatchNo != null ">qct.income_batch_no incomeBatchNo,</if>
<if test="materialCode != null ">qct.material_code materialCode,qct.material_name materialName,</if>
1 year ago
sum(quality) quality,
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
where qct.del_flag = '0'
<if test="orderNo != null ">and qct.order_no = #{orderNo}</if>
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="supplierCode != null ">and qct.supplier_code = #{supplierCode}</if>
<if test="typeCode != null ">and qct.type_code = #{typeCode}</if>
<if test="checkType != null ">and qct.check_type = #{checkType}</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >=
CONVERT(varchar(10),#{ymArrayStart}, 120)
</if>
<if test="ymArrayEnd != null ">and CONVERT(varchar(10),#{ymArrayEnd}, 120)>=CONVERT(varchar(10),qct.income_time,
120)
</if>
group by qct.supplier_code,qct.supplier_name
<if test="orderNo != null ">,qct.order_no,qct.unit</if>
<if test="incomeBatchNo != null ">,qct.income_batch_no</if>
<if test="materialCode != null ">,qct.material_code,qct.material_name</if>
</select>
<select id="getCheckTypeList" resultType="com.op.quality.domain.QcCheckType">
select order_code checkType,
check_name checkName
from qc_check_type
where del_flag = '0' and type_code= #{typeCode}
</select>
<select id="getSupplier" resultType="com.op.quality.domain.QcStaticTable">
select supplier_code supplierCode,
zh_desc supplierName
from base_supplier where del_flag = '0'
</select>
1 year ago
<select id="getLocList" resultType="com.op.quality.domain.QcStaticTable">
select warehouse_code supplierCode,
warehouse_name supplierName
from base_warehouse
where del_flag = '0' and active_flag = '1'
</select>
1 year ago
<select id="getWorkcenter" resultType="com.op.quality.domain.QcStaticTable">
select factory_name supplierName,
factory_code supplierCode
from sys_factory where f_type = 'c'
</select>
1 year ago
<select id="picsMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
t.source_id recordId,
STUFF(
(SELECT ',' + file_address
FROM (
select file_address,source_id from base_file where source_id in(
select record_id from qc_check_task_detail where beLong_to in (
select record_id from qc_check_task
where order_no = #{orderNo} and check_type = 'checkTypeSCXJ')
)
) t0
WHERE t.source_id = t0.source_id
FOR xml path('')
),1,1,''
) projectId
FROM (
select file_address,source_id from base_file where source_id in(
select record_id from qc_check_task_detail where beLong_to in (
select record_id from qc_check_task
where order_no = #{orderNo} and check_type = 'checkTypeSCXJ')
)
) t
GROUP by t.source_id
</select>
1 year ago
<select id="getDLTableTitle" resultType="com.op.quality.domain.QcStaticTable">
1 year ago
select t0.* ,bp.product_desc_zh materialName from(
SELECT
concat(q.material_code,'-',q.project_no,'-',CONVERT(varchar(10),q.ymdms, 120)) yearMonth,
material_code materialCode,
ymdms,rule_name ruleName,
project_no projectNo,
STUFF(
(SELECT ',' + t.actual_value
FROM (select
qct.material_code,qct.material_name,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
qctd.rule_name, qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >=
CONVERT(varchar(10),#{ymArrayStart}, 120)
</if>
<if test="ymArrayEnd != null ">and CONVERT(varchar(10),#{ymArrayEnd}, 120)>=CONVERT(varchar(10),qct.income_time,
120)
</if>
<if test="projectNoArray != null ">and qctd.project_id in(
<foreach collection="projectNoArray" separator="," item="projectId">
#{projectId}
</foreach>
)
</if>
<if test="orderNo != null ">
and qct.order_no = #{orderNo}
</if>
<if test="materialCode != null ">
and (qct.material_code like concat('%',#{materialCode},'%') or qct.material_name like concat('%',#{materialCode},'%'))
1 year ago
</if>
<if test="supplierCode != null ">
and (qct.supplier_code like concat('%',#{supplierCode},'%') or qct.supplier_name like concat('%',#{materialCode},'%'))
1 year ago
</if>
1 year ago
) t
WHERE t.material_code = q.material_code and t.project_no = q.project_no and t.ymdms=q.ymdms
FOR xml path('')
),1,1,''
) quality
FROM (
select
qct.material_code,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
qctd.rule_name,qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >=
CONVERT(varchar(10),#{ymArrayStart}, 120)
</if>
<if test="ymArrayEnd != null ">and CONVERT(varchar(10),#{ymArrayEnd}, 120)>=CONVERT(varchar(10),qct.income_time,
120)
</if>
<if test="projectNoArray != null ">and qctd.project_id in(
<foreach collection="projectNoArray" separator="," item="projectId">
#{projectId}
</foreach>
)
</if>
<if test="orderNo != null ">
and qct.order_no = #{orderNo}
</if>
<if test="materialCode != null ">
and (qct.material_code like concat('%',#{materialCode},'%') or qct.material_name like concat('%',#{materialCode},'%'))
1 year ago
</if>
<if test="supplierCode != null ">
and (qct.supplier_code like concat('%',#{supplierCode},'%') or qct.supplier_name like concat('%',#{materialCode},'%'))
1 year ago
</if>
) q
GROUP BY q.material_code, q.ymdms,q.rule_name,q.project_no
) t0 left join base_product bp on bp.product_code = t0.materialCode
where t0.quality is not null
1 year ago
</select>
<select id="getDLData" resultType="com.op.quality.domain.QcStaticTable">
SELECT
8 months ago
concat(q.cpkType,'-',q.ymdms) yearMonth,
8 months ago
ymdms,rule_name ruleName,q.lineName,q.checkTypeName,
project_no projectNo,
STUFF(
(SELECT ',' + t.actual_value
FROM (select
bpa.cpk_type cpkType,
CONVERT(varchar(7),qct.income_time, 120) ymdms,
qctd.rule_name, qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >=CONVERT(varchar(7),qct.income_time,120) </if>
8 months ago
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) t
WHERE t.cpkType = q.cpkType and t.project_no = q.project_no and t.ymdms=q.ymdms
FOR xml path('')
),1,1,''
) quality
FROM (
select
bpa.cpk_type cpkType,
CONVERT(varchar(7),qct.income_time, 120) ymdms,
8 months ago
qctd.rule_name,qctd.project_no,qctd.actual_value,
be.equipment_name lineName,qt.check_name checkTypeName
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
8 months ago
left join base_equipment be on be.equipment_type_code = 'equ_type_bzx'
and be.del_flag = '0'
and be.equipment_code = qct.check_loc
8 months ago
left join qc_check_type qt on qt.order_code = qct.check_type
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(7),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>=CONVERT(varchar(7),qct.income_time,120) </if>
8 months ago
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) q
8 months ago
GROUP BY q.cpkType, q.ymdms,q.rule_name,q.project_no,q.lineName,q.checkTypeName
</select>
1 year ago
<select id="getProjectList" resultType="com.op.quality.domain.QcStaticTable">
select qcp.id recordId,
qcp.rule_name ruleName
from qc_check_type_project qctp
1 year ago
left join qc_check_project qcp on qctp.project_id = qcp.id
7 months ago
where qctp.type_id = #{checkType} and qctp.property_code = '1' and qctp.del_flag = '0'
1 year ago
and qctp.material_code is null and qcp.rule_name is not null
1 year ago
</select>
<select id="getUpAndDown" resultType="com.op.quality.domain.QcStaticTable">
select ISNULL(upper_diff,0) upperDiff,
ISNULL(down_diff, 0) downDiff
from qc_check_type_project where project_id = #{projectNo}
and type_id = #{checkType}
</select>
<select id="defectMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qctd.belong_to,
qctd.belong_to_detail detailId,
STUFF(
(SELECT ';' + defect_subclass+':'+ CONVERT(NVARCHAR(15), noOk_quality)
FROM qc_check_task_defect
WHERE belong_to = qctd.belong_to and belong_to_detail = qctd.belong_to_detail
FOR xml path('')
),1,1,''
) remark
FROM qc_check_task_defect qctd
left join qc_check_task qct on qctd.belong_to = qct.record_id
where qctd.del_flag = '0' and qct.order_no = #{orderNo}
GROUP by qctd.belong_to,qctd.belong_to_detail
</select>
11 months ago
<select id="getTableHzTitle" resultType="java.lang.String">
10 months ago
<!--select dtc.class_name
10 months ago
from qc_defect_type dt
left join qc_defect_type_class dtc on dt.defect_code = dtc.defect_code
where dt.defect_type in (select type_code from qc_check_type where order_code = #{remark} and del_flag = '0')
10 months ago
and dtc.del_flag = '0' order by dtc.sort-->
select dtc.class_name
from qc_defect_type dt
left join qc_defect_type_class dtc on dt.defect_code = dtc.defect_code
where dt.defect_type = #{remark}
10 months ago
and dtc.del_flag = '0' order by dtc.sort
11 months ago
</select>
<select id="getTableHzTitle2" resultType="java.lang.String">
select defect_subclass from qc_defect_type where defect_type = #{typeCode} and del_flag = '0'
</select>
10 months ago
<select id="getSamplesNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(sample_quality) sampleQuality,
ymdms
FROM(
10 months ago
select CONVERT(varchar(7),qct.create_time, 120) AS ymdms, qct.sample_quality
10 months ago
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'mm'">
select sum(sample_quality) sampleQuality,
ymdms
FROM(
10 months ago
select CONVERT(varchar(10),qct.create_time, 120) AS ymdms, qct.sample_quality
10 months ago
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'dd'">
select sum(sample_quality) sampleQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
10 months ago
select DATEPART(HOUR, qct.create_time) AS ymdms, qct.sample_quality
10 months ago
from qc_check_task qct
where check_type = #{checkType}
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
</select>
10 months ago
<select id="getNoOkRatioNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(noOkQuality) noOkQuality,
ymdms
FROM(
select
CONVERT(varchar(7),qct.create_time, 120) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
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
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0' and qct.del_flag='0'
) t
group by ymdms
</if>
<if test="ymdms == 'mm'">
select sum(noOkQuality) noOkQuality,
ymdms
FROM(
select
CONVERT(varchar(10),qct.create_time, 120) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
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
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr} and qct.del_flag='0' and qct.check_status = '2'
) t
group by ymdms
</if>
<if test="ymdms == 'dd'">
select sum(noOkQuality) noOkQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
select
DATEPART(HOUR, qct.create_time) AS ymdms,
qctd.class_id,
qctd.noOk_quality*qdt.ratio noOkQuality
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
left join qc_defect_type qdt on qdt.defect_code = qdtc.defect_code
where qct.check_type = #{checkType} and qdt.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr} and qct.del_flag='0' and qct.check_status = '2'
) t
group by ymdms
</if>
</select>
10 months ago
<select id="getNoOkNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select sum(noOk_quality) noOkQuality,
10 months ago
concat(hourName,class_name) ymdUntype
10 months ago
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS hourName,
10 months ago
qctd.noOk_quality,
qdtc.class_name
10 months ago
from qc_check_task qct
10 months ago
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
10 months ago
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
10 months ago
and qdtc.del_flag = '0' and qctd.del_flag = '0'
10 months ago
) t
10 months ago
group by hourName,class_name
10 months ago
</if>
<if test="ymdms == 'mm'">
select sum(noOk_quality) noOkQuality,
10 months ago
concat(hourName,class_name) ymdUntype
10 months ago
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS hourName,
10 months ago
qctd.noOk_quality,
qdtc.class_name
10 months ago
from qc_check_task qct
10 months ago
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
10 months ago
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
10 months ago
and qdtc.del_flag = '0' and qctd.del_flag = '0'
10 months ago
) t
10 months ago
group by hourName,class_name
10 months ago
</if>
<if test="ymdms == 'dd'">
select sum(noOk_quality) noOkQuality,
10 months ago
concat(hourName,class_name) ymdUntype
10 months ago
FROM(
select RIGHT('00' + CAST(DATEPART(HOUR, qct.create_time) AS VARCHAR(2)), 2) AS hourName,
10 months ago
qctd.noOk_quality,
qdtc.class_name
10 months ago
from qc_check_task qct
10 months ago
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
10 months ago
where qct.check_type = #{checkType} and qct.check_status = '2'
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
10 months ago
and qdtc.del_flag = '0' and qctd.del_flag = '0'
10 months ago
) t
10 months ago
group by hourName,class_name
10 months ago
</if>
</select>
<select id="getTableHzNoOkData" resultType="com.op.quality.domain.QcStaticTable">
10 months ago
<!--select * from (
10 months ago
select sum(t.noOk_quality) noOkQuality,
10 months ago
t.dict_label dataType
10 months ago
FROM(
10 months ago
select
qct.noOk_quality,qct.sample_quality,
bdd.dict_label
from qc_check_task qct
left join base_dict_data bdd on bdd.dict_type = 'unqualified_remark' and qct.remark_code = dict_value
10 months ago
where qct.check_type = #{checkType} and qct.check_status = '2'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
10 months ago
</if>
10 months ago
<if test="
ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
10 months ago
</if>
10 months ago
<if test="ymdms == 'dd'">
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
</if>
and del_flag = '0' and qct.remark_code is not null
) t
group by t.dict_label
10 months ago
) t0 order by noOkQuality desc-->
select * from (
select sum(t.noOk_quality) noOkQuality,
t.class_name dataType
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 = #{checkType} and qct.check_status = '2'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'dd'"> and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}</if>
and qct.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0'
) t
group by t.class_name
10 months ago
) t0 order by noOkQuality desc
10 months ago
</select>
<select id="getSamplesPCNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
count(0) sampleQuality,
ymdms
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS ymdms, qct.sample_quality,
qct.check_result
from qc_check_task qct
where check_type = #{checkType} and check_status = 2
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'mm'">
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
count(0) sampleQuality,
ymdms
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS ymdms, check_result
from qc_check_task qct
where check_type = #{checkType} and check_status = 2
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
<if test="ymdms == 'dd'">
select SUM(CASE WHEN check_result = 'N' THEN 1 ELSE 0 END) noOkQuality,
count(0) sampleQuality,
RIGHT('00' + CAST(ymdms AS VARCHAR(2)), 2) ymdms
FROM(
select DATEPART(HOUR, qct.create_time) AS ymdms,check_result
from qc_check_task qct
where check_type = #{checkType} and check_status = 2
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
and del_flag = '0'
) t
group by ymdms
</if>
</select>
<select id="getNoOkPCNum" resultType="com.op.quality.domain.QcStaticTable">
<if test="ymdms == 'yyyy'">
select count(0) noOkQuality,
concat(hourName,class_name) ymdUntype
FROM(
select CONVERT(varchar(7),qct.create_time, 120) AS hourName,
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) = #{incomeTimeStr}
and qdtc.del_flag = '0' and qct.del_flag = '0'
) t
group by hourName,class_name
</if>
<if test="ymdms == 'mm'">
select count(0) noOkQuality,
concat(hourName,class_name) ymdUntype
FROM(
select CONVERT(varchar(10),qct.create_time, 120) AS hourName,
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) = #{incomeTimeStr}
and qdtc.del_flag = '0' and qct.del_flag = '0'
) t
group by hourName,class_name
</if>
<if test="ymdms == 'dd'">
select count(0) noOkQuality,
concat(hourName,class_name) ymdUntype
FROM(
select RIGHT('00' + CAST(DATEPART(HOUR, qct.create_time) AS VARCHAR(2)), 2) AS hourName,
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) = #{incomeTimeStr}
and qdtc.del_flag = '0' and qct.del_flag = '0'
) t
group by hourName,class_name
</if>
</select>
<select id="getTableHzNoOkDataSC" resultType="com.op.quality.domain.QcStaticTable">
select * from (
select count(t.remark_code) noOkQuality,
t.class_name dataType
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'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'dd'"> and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}</if>
and qct.del_flag = '0' and qdtc.del_flag = '0'
) t
group by t.class_name
) t0 order by noOkQuality desc
</select>
<select id="getIncomeDetail" resultType="com.op.quality.domain.QcCheckDetail">
select qct.income_time incomeTime,
qct.order_no orderNo,
qct.check_result checkResult,
qct.supplier_code supplierCode,
qct.supplier_name supplierName,
qct.material_code materialCode,
qct.material_name materialName,
qct.remark_code classCode,
qdtc.class_name className
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 qdtc.del_flag = '0' and qct.del_flag = '0'
<if test="ymdms == 'yyyy'">
and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}
</if>
<if test="ymdms == 'mm'">
and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}
</if>
8 months ago
<if test="ymdms == 'dd'">
and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}
</if>
</select>
<select id="getXJDetail" resultType="com.op.quality.domain.QcCheckDetail">
select
qct.income_time incomeTime,
qct.order_no orderNo,
qct.check_result checkResult,
pow.workorder_name supplierCode,
be.equipment_name supplierName,
qct.material_code materialCode,
qct.material_name materialName,
qdtc.id classCode,
qdtc.class_name className
from qc_check_task qct
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
left join base_equipment be on be.equipment_code = pow.workorder_name
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 = #{checkType} and qct.check_status = '2'
<if test="ymdms == 'yyyy'">and CONVERT(varchar(4),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'mm'">and CONVERT(varchar(7),qct.create_time, 120) = #{incomeTimeStr}</if>
<if test="ymdms == 'dd'"> and CONVERT(varchar(10),qct.create_time, 120) = #{incomeTimeStr}</if>
and qct.del_flag = '0' and qdtc.del_flag = '0' and qctd.del_flag = '0' and pow.del_flag = '0'
and be.del_flag = '0'
order by qct.order_no,qct.income_time
</select>
<select id="getActualValues" resultType="String">
select top 1
qctd.actual_value actualValue
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qctd.project_id = #{projectId} and qct.check_type = #{checkType} and qct.del_flag = '0'
and qctd.actual_value is not null
and qctd.del_flag = '0'
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >= CONVERT(varchar(10),qct.income_time, 120)</if>
order by LEN(qctd.actual_value) desc
</select>
<select id="getDlMxList" resultType="com.op.quality.domain.QcCPKInfo">
select qct.income_time incomeTime,
qct.check_loc checkLoc,be.equipment_name equipmentName,
qct.material_code materialCode,qct.material_name materialName,
bpa.cpk_type cpkType,sdd.dict_label cpkTypeName,
qct.order_no workorderCode,qct.income_batch_no batchNo,pow.workorder_code_sap workorderCodeSap,
qctd.rule_name ruleName,
qctd.actual_value actualValue
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_equipment be on be.equipment_code = qct.check_loc
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_value = bpa.cpk_type and sdd.dict_type= 'qms_category'
where qctd.project_id = #{projectId} and qct.check_type = #{checkType}
and qctd.actual_value is not null
and qctd.del_flag = '0' and qct.del_flag = '0' and be.del_flag = '0' and pow.del_flag = '0'
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
<if test="cpkType != null ">and bpa.cpk_type = #{cpkType}</if>
<if test="workorderCodeSap != null ">and pow.workorder_code_sap like concat('%',#{workorderCodeSap},'%')</if>
<if test="workorderCode != null ">and pow.workorder_code like concat('%',#{workorderCode},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >= CONVERT(varchar(10),qct.income_time, 120)</if>
order by qct.income_time
</select>
<select id="getCpkTypeList" resultType="com.op.quality.domain.QcCPKInfo">
8 months ago
select qpcu.material_code cpkType,
sdd.dict_label cpkTypeName,
ISNULL(qpcu.up_val,0) upperDiff,
ISNULL(qpcu.down_val,0) downDiff
from qc_product_cpk_upDown qpcu
8 months ago
left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_type = 'qms_category'
and sdd.dict_value = qpcu.material_code
8 months ago
where qpcu.del_flag = '0' and qpcu.material_code = #{cpkType} and qpcu.rule_code = #{projectId}
</select>
8 months ago
<select id="getProdLineList" resultType="com.op.system.api.domain.mes.ProLineDTO">
8 months ago
select equipment_code lineCode,equipment_name lineName from base_equipment
where del_flag = '0' and equipment_type_code = 'equ_type_bzx'
</select>
<select id="getDLDataDay" resultType="com.op.quality.domain.QcStaticTable">
SELECT
concat(q.cpkType,'-',q.ymdms) yearMonth,
8 months ago
ymdms,rule_name ruleName,q.lineName,q.checkTypeName,
8 months ago
project_no projectNo,
STUFF(
(SELECT ',' + t.actual_value
FROM (select
bpa.cpk_type cpkType,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
qctd.rule_name, qctd.project_no,qctd.actual_value
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd} >=CONVERT(varchar(10),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) t
WHERE t.cpkType = q.cpkType and t.project_no = q.project_no and t.ymdms=q.ymdms
FOR xml path('')
),1,1,''
) quality
FROM (
select
bpa.cpk_type cpkType,
CONVERT(varchar(10),qct.income_time, 120) ymdms,
8 months ago
qctd.rule_name,qctd.project_no,qctd.actual_value,
be.equipment_name lineName,qt.check_name checkTypeName
8 months ago
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code
8 months ago
left join base_equipment be on be.equipment_type_code = 'equ_type_bzx'
and be.del_flag = '0'
and be.equipment_code = qct.check_loc
8 months ago
left join qc_check_type qt on qt.order_code = qct.check_type
8 months ago
where qct.check_type = #{checkType} and qctd.property_code = '1' and qct.check_time is not null
<if test="ymArrayStart != null ">and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>=CONVERT(varchar(10),qct.income_time,120) </if>
<if test="checkLoc != null ">and qct.check_loc = #{checkLoc}</if>
and qctd.project_id = #{projectId} and bpa.cpk_type = #{cpkType}
) q
8 months ago
GROUP BY q.cpkType, q.ymdms,q.rule_name,q.project_no,q.lineName,q.checkTypeName
8 months ago
</select>
8 months ago
<select id="getXJCheckTableDetailList" resultType="com.op.quality.domain.CheckTypeXJDetail">
select
SUBSTRING(pow.workorder_code_sap,4,10) workorderCodeSap,
qct.order_no orderNo,
SUBSTRING(qct.material_code,8, 12) materialCode, qct.material_name materialName,
qct.quality,qct.unit,
qct.income_batch_no batchCode,
pow.product_date incomeTimeStr,
pow.shift_id shiftId,
qct.check_loc,
be.equipment_name equipmentName,
qct.check_man_name checkManName,
qct.check_time checkTime
from qc_check_task qct
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
left join base_equipment be on be.equipment_code = qct.check_loc
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0' and qct.check_status = '2' and be.del_flag = '0' and pow.del_flag = '0'
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
8 months ago
<if test="workorderCodeSap != null ">and pow.workorder_code_sap like concat('%',#{workorderCodeSap},'%')</if>
8 months ago
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="incomeTimeStr != null ">and CONVERT(varchar(10),pow.product_date, 120) = #{incomeTimeStr}</if>
<if test="incomeTimeStart != null ">and CONVERT(varchar(30),qct.income_time, 120) >= #{incomeTimeStart}</if>
<if test="incomeTimeEnd != null ">and #{incomeTimeEnd} > CONVERT(varchar(30),qct.income_time, 120)</if>
order by qct.order_no,qct.income_batch_no,pow.product_date desc
</select>
<select id="getBPpMaterials" resultType="com.op.quality.domain.QcStaticTable">
select distinct bp.product_code materialCode,
bp.product_desc_zh materialName
from base_product bp
left join qc_check_task qct on qct.check_type = 'checkTypeLL' and qct.material_code = bp.product_code
where bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%' and qct.del_flag = '0'
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
order by bp.product_code
</select>
<select id="getBPNoOkMap" resultType="com.op.quality.domain.QcStaticTable">
select sum(t.noOk_quality) noOkQty,
sum(t.sample_quality) sampleQty,
concat(t.material_code,t.ymd) ymdms
from(
select qct.noOk_quality,
qct.sample_quality,
qct.material_code,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd,t.material_code
</select>
<select id="getBPNoOkHzMap" resultType="com.op.quality.domain.QcStaticTable">
select sum(t.noOk_quality) noOkQty,
sum(t.sample_quality) sampleQty,
t.ymd ymdms
from(
select qct.noOk_quality,
qct.sample_quality,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd
</select>
<select id="getBPSumNoOkMap" resultType="com.op.quality.domain.QcStaticTable">
select sum(t.noOk_quality) noOkQty,
sum(t.sample_quality) sampleQty,
t.ymd ymdms
from(
select qct.noOk_quality,
qct.sample_quality,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd
</select>
<select id="getBPReworkMap" resultType="com.op.quality.domain.QcStaticTable">
select SUM(CASE WHEN t.check_result = 'N' THEN 1 ELSE 0 END) noOkQty,
count(0) sampleQty,
concat(t.material_code,t.ymd) ymdms
from(
select
qct.check_result,
qct.material_code,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd,t.material_code
</select>
<select id="getBPReworkHzMap" resultType="com.op.quality.domain.QcStaticTable">
select SUM(CASE WHEN t.check_result = 'N' THEN 1 ELSE 0 END) noOkQty,
count(0) sampleQty,
t.ymd ymdms
from(
select
qct.check_result,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd
</select>
<select id="getBPSumReworkMap" resultType="com.op.quality.domain.QcStaticTable">
select SUM(CASE WHEN t.check_result = 'N' THEN 1 ELSE 0 END) noOkQty,
count(0) sampleQty,
t.ymd ymdms
from(
select
qct.check_result,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t GROUP BY t.ymd
</select>
<select id="getBpDefects" resultType="java.lang.String">
select qdtc.class_name dataType
from qc_defect_type_class qdtc
where qdtc.defect_id ='8504b23592d44055a0c66661d6318c2e'
and qdtc.remark = '白坯专用' and qdtc.del_flag = '0'
</select>
<select id="getBPDefectMap" resultType="com.op.quality.domain.QcStaticTable">
select count(0) noOkQty,
concat(t.class_name,t.ymd) ymdms
from(
select
qdtc.class_name,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
and qdtc.class_name is not null
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
) t GROUP BY t.ymd,t.class_name
</select>
<select id="getSampMap" resultType="com.op.quality.domain.QcStaticTable">
select count(0) sampleQty,
t.ymd ymdms
from(
select
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
) t GROUP BY t.ymd
</select>
<select id="getBPDefectMothMap" resultType="com.op.quality.domain.QcStaticTable">
select sum(t.noOk_quality) noOkQty,
t.class_name ymdms
from(
select
qdtc.class_name,
qct.noOk_quality
from qc_check_task qct
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
and qdtc.class_name is not null
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
) t GROUP BY t.class_name
</select>
<select id="getBPDefectMothPCMap" resultType="com.op.quality.domain.QcStaticTable">
select count(0) noOkQty,t.class_name ymdms
from(
select
qdtc.class_name
from qc_check_task qct
left join qc_defect_type_class qdtc on qct.remark_code = qdtc.id
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL' and qct.check_result = 'N'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
and qdtc.class_name is not null
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
) t GROUP BY t.class_name
</select>
<select id="getBPHzInfo" resultType="com.op.quality.domain.QcStaticTable">
select sum(t.noOk_quality) noOkQty,
sum(t.sample_quality) sampleQty
from(
select qct.noOk_quality,
qct.sample_quality,
qct.material_code,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t
</select>
3 months ago
<select id="getBPHzInfoPC" resultType="com.op.quality.domain.QcStaticTable">
select
SUM(CASE WHEN t.check_result = 'N' THEN 1 ELSE 0 END) noOkQty,
count(0) sampleQty
from(
select qct.noOk_quality,
qct.sample_quality,
qct.material_code,
qct.check_result,
CONVERT(varchar(10),qct.create_time, 120) ymd
from qc_check_task qct
left join base_product bp on qct.material_code = bp.product_code
where qct.del_flag = '0' and qct.check_type = 'checkTypeLL'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
and check_man_code is not null
<if test="materialName != null ">
and (
bp.product_code like concat('%',#{materialName},'%') or
bp.product_desc_zh like concat('%',#{materialName},'%')
)
</if>
and bp.product_group_name ='白坯' and bp.del_flag = '0' and bp.product_desc_zh like '%白坯%'
) t
</select>
<select id="getCpDefects" resultType="java.lang.String">
select qdtc.class_name
from qc_defect_type qdt
left join qc_defect_type_class qdtc on qdtc.defect_id = qdt.defect_id
where qdt.defect_type = #{checkType} and qdt.del_flag = '0' and qdtc.del_flag = '0'
order by qdtc.sort
</select>
<select id="getCpDefectTypes" resultType="java.lang.String">
select qdt.defect_subclass
from qc_defect_type qdt
where qdt.defect_type = #{checkType} and qdt.del_flag = '0'
order by qdt.defect_subclass
</select>
<select id="getCpDefectMap" resultType="com.op.quality.domain.QcStaticTable">
select t.ymdms,sum(t.noOk_quality) noOkQty
from (
select
concat(qdtc.class_name,CONVERT(varchar(10),qct.create_time, 120)) ymdms,
qctd.defect_code,
qctd.defect_subclass,
qctd.class_id,
qdtc.class_name,
qctd.noOk_quality
from qc_check_task qct
left join qc_check_task_defect qctd on qct.record_id = qctd.belong_to
left join qc_defect_type_class qdtc on qdtc.id = qctd.class_id
where qct.del_flag = '0' and qdtc.class_name is not null --and qct.check_type ='checkTypeSC'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
) t group by t.ymdms
</select>
<select id="getCpDefectTypeMap" resultType="com.op.quality.domain.QcStaticTable">
select t.ymdms,sum(t.noOk_quality) noOkQty
from (
select
concat(qctd.defect_subclass,CONVERT(varchar(10),qct.create_time, 120)) ymdms,
qctd.defect_code,
qctd.defect_subclass,
qctd.class_id,
qdtc.class_name,
qctd.noOk_quality
from qc_check_task qct
left join qc_check_task_defect qctd on qct.record_id = qctd.belong_to
left join qc_defect_type_class qdtc on qdtc.id = qctd.class_id
where qct.del_flag = '0' and qdtc.class_name is not null --and qct.check_type ='checkTypeSC'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
) t group by t.ymdms
</select>
<select id="getCpDefectPCMap" resultType="com.op.quality.domain.QcStaticTable">
select t.ymdms,
SUM(CASE WHEN t.check_result = 'N' THEN 1 ELSE 0 END) noOkQty,
count(0) sampleQty
from (
select
CONVERT(varchar(10),qct.create_time, 120) ymdms,
check_result
from qc_check_task qct
where qct.del_flag = '0' --and qct.check_type ='checkTypeSC'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
) t group by t.ymdms
</select>
<select id="getCpSampMap" resultType="com.op.quality.domain.QcStaticTable">
select t.ymdms,
sum(t.sample_quality) sampleQty
from (
select
CONVERT(varchar(10),qct.create_time, 120) ymdms,
sample_quality
from qc_check_task qct
where qct.del_flag = '0' --and qct.check_type ='checkTypeSC'
and CONVERT(varchar(7),qct.create_time, 120) = #{yearMonth}
) t group by t.ymdms
</select>
2 years ago
</mapper>