|
|
|
@ -56,6 +56,7 @@
|
|
|
|
|
group by qct.supplier_code,qct.supplier_name
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
<!--
|
|
|
|
|
select concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
|
|
|
|
|
qct.material_code materialCode,
|
|
|
|
|
qct.material_name materialName,
|
|
|
|
@ -69,7 +70,25 @@
|
|
|
|
|
<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>
|
|
|
|
|
<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
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getProduceNames" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
select distinct qct.material_code materialCode,
|
|
|
|
@ -82,6 +101,7 @@
|
|
|
|
|
<if test="ymArrayEnd != null ">and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getProduceChartDataYM" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
<!--
|
|
|
|
|
select
|
|
|
|
|
<if test='dataType=="ymd" '>
|
|
|
|
|
concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
|
|
|
|
@ -119,6 +139,41 @@
|
|
|
|
|
<if test='dataType=="ym" '>
|
|
|
|
|
,CONVERT(varchar(7),qct.income_time, 120)
|
|
|
|
|
</if>
|
|
|
|
|
-->
|
|
|
|
|
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>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getWorkcenterList" resultType="com.op.system.api.domain.quality.FactoryDto">
|
|
|
|
|
select factory_name factoryName,
|
|
|
|
@ -127,20 +182,21 @@
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getXJCheckTableList" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
select distinct
|
|
|
|
|
order_no orderNo,
|
|
|
|
|
material_code materialCode, material_name materialName,
|
|
|
|
|
quality,unit,
|
|
|
|
|
supplier_code supplierCode,supplier_name supplierName,
|
|
|
|
|
income_time incomeTime
|
|
|
|
|
from qc_check_task
|
|
|
|
|
where check_type = 'checkTypeSCXJ' and del_flag = '0'
|
|
|
|
|
<if test="orderNo != null ">and check_no like concat('%',#{orderNo},'%')</if>
|
|
|
|
|
<if test="materialCode != null ">and material_code like concat('%',#{materialCode},'%')</if>
|
|
|
|
|
<if test="incomeBatchNo != null ">and income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
|
|
|
|
|
<if test="incomeTime != null ">and CONVERT(varchar(10),income_time, 120) >= CONVERT(varchar(10),#{incomeTime},
|
|
|
|
|
120)
|
|
|
|
|
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,
|
|
|
|
|
pow.shift_id shiftId
|
|
|
|
|
from qc_check_task qct
|
|
|
|
|
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
|
|
|
|
|
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
|
|
|
|
|
<if test="orderNo != null ">and qct.check_no like concat('%',#{orderNo},'%')</if>
|
|
|
|
|
<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>
|
|
|
|
|
order by income_time desc
|
|
|
|
|
order by pow.product_date desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getXJProjects" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
select qct.rule_name ruleName,
|
|
|
|
@ -223,6 +279,7 @@
|
|
|
|
|
and CONVERT(varchar(10),income_time, 120) = #{ymdms}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getXJMapData" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
<!--
|
|
|
|
|
select qct.supplier_code supplierCode,
|
|
|
|
|
qct.supplier_name supplierName,
|
|
|
|
|
sum(qct.sample_quality) sampleQuality,
|
|
|
|
@ -234,6 +291,15 @@
|
|
|
|
|
<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)
|
|
|
|
|
-->
|
|
|
|
|
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)
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getQmsRateTable" resultType="com.op.quality.domain.QcStaticTable">
|
|
|
|
|
select qct.supplier_code supplierCode,
|
|
|
|
|