|
|
|
<?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>
|
|
|
|
</mapper>
|