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.

158 lines
8.4 KiB
XML

<?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.op.quality.mapper.QcStaticTableMapper">
<select id="selectQcStaticTableList" parameterType="com.op.quality.domain.QcStaticTable" resultType="com.op.quality.domain.QcStaticTable">
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>
</if>
</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>
<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,
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>
<if test="ymArrayEnd != null "> and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
</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">
select
concat(qct.material_code,CONVERT(varchar(7),qct.income_time, 120)) materailDate,
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) incomeTime
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>
group by qct.material_code ,
qct.material_name ,
CONVERT(varchar(7),qct.income_time, 120)
</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'
</select>
<select id="getXJCheckTableList" resultType="com.op.quality.domain.QcStaticTable">
select distinct check_no checkNo,
order_no orderNo,income_batch_no incomeBatchNo,
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)</if>
order by income_time desc
</select>
<select id="getXJProjects" resultType="com.op.quality.domain.QcStaticTable">
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>
<select id="getProjectDetail" resultType="com.op.quality.domain.QcStaticTable">
select qctd.project_id projectId,
qctd.status,
SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5),
concat(qctd.project_id,
case when '09:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '08:00' then '08'
when '10:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '09:00' then '09'
when '11:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '10:00' then '10'
when '12:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '11:00' then '11'
when '13:30'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '12:30' then '12'
when '14:30'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '13:30' then '13'
when '15:30'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '14:30' then '14'
when '16:30'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '15:30' then '15'
when '17:30'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '16:30' then '16'
when '19:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '18:00' then '18'
when '20:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '19:00' then '19'
when '21:00'>= SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5) and SUBSTRING(CONVERT(varchar(18),qctd.create_time, 120), 12, 5)> '20:00' then '20'
else '-' end
)ymdms
from qc_check_task qct
left join qc_check_task_detail qctd on qct.record_id = qctd.belong_to
where qct.income_batch_no = #{incomeBatchNo} and qct.check_type = 'checkTypeSCXJ'
order by qctd.create_time
</select>
</mapper>