|
|
|
<?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.QcCheckTaskProduceMapper">
|
|
|
|
|
|
|
|
<resultMap type="QcCheckTaskProduce" id="QcCheckTaskProduceResult">
|
|
|
|
<result property="recordId" column="record_id"/>
|
|
|
|
<result property="checkNo" column="check_no"/>
|
|
|
|
<result property="incomeBatchNo" column="income_batch_no"/>
|
|
|
|
<result property="orderNo" column="order_no"/>
|
|
|
|
<result property="materialCode" column="material_code"/>
|
|
|
|
<result property="materialName" column="material_name"/>
|
|
|
|
<result property="quality" column="quality"/>
|
|
|
|
<result property="unit" column="unit"/>
|
|
|
|
<result property="supplierCode" column="supplier_code"/>
|
|
|
|
<result property="supplierName" column="supplier_name"/>
|
|
|
|
<result property="incomeTime" column="income_time"/>
|
|
|
|
<result property="checkLoc" column="check_loc"/>
|
|
|
|
<result property="checkStatus" column="check_status"/>
|
|
|
|
<result property="checkManCode" column="check_man_code"/>
|
|
|
|
<result property="checkManName" column="check_man_name"/>
|
|
|
|
<result property="checkTime" column="check_time"/>
|
|
|
|
<result property="checkResult" column="check_result"/>
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="attr1" column="attr1"/>
|
|
|
|
<result property="attr2" column="attr2"/>
|
|
|
|
<result property="attr3" column="attr3"/>
|
|
|
|
<result property="attr4" column="attr4"/>
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
<result property="factoryCode" column="factory_code"/>
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
<result property="sampleQuality" column="sample_quality"/>
|
|
|
|
<result property="checkName" column="check_name"/>
|
|
|
|
<result property="checkType" column="check_type"/>
|
|
|
|
<result property="noOkQuality" column="noOk_quality"/>
|
|
|
|
<result property="reason" column="reason"/>
|
|
|
|
<result property="productType" column="product_type"/>
|
|
|
|
<result property="confirm" column="confirm"/>
|
|
|
|
<result property="confirmManCode" column="confirm_man_code"/>
|
|
|
|
<result property="confirmManName" column="confirm_man_name"/>
|
|
|
|
<result property="confirmRemark" column="confirm_remark"/>
|
|
|
|
<result property="confirmTime" column="confirm_time"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap type="QcCheckReportIncome" id="QcCheckReportIncomeResult">
|
|
|
|
<result property="recordId" column="record_id"/>
|
|
|
|
<result property="checkNo" column="check_no"/>
|
|
|
|
<result property="incomeBatchNo" column="income_batch_no"/>
|
|
|
|
<result property="orderNo" column="order_no"/>
|
|
|
|
<result property="materialCode" column="material_code"/>
|
|
|
|
<result property="materialName" column="material_name"/>
|
|
|
|
<result property="quality" column="quality"/>
|
|
|
|
<result property="unit" column="unit"/>
|
|
|
|
<result property="supplierCode" column="supplier_code"/>
|
|
|
|
<result property="supplierName" column="supplier_name"/>
|
|
|
|
<result property="incomeTime" column="income_time"/>
|
|
|
|
<result property="checkLoc" column="check_loc"/>
|
|
|
|
<result property="checkStatus" column="check_status"/>
|
|
|
|
<result property="checkManCode" column="check_man_code"/>
|
|
|
|
<result property="checkManName" column="check_man_name"/>
|
|
|
|
<result property="checkTime" column="check_time"/>
|
|
|
|
<result property="checkResult" column="check_result"/>
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="attr1" column="attr1"/>
|
|
|
|
<result property="attr2" column="attr2"/>
|
|
|
|
<result property="attr3" column="attr3"/>
|
|
|
|
<result property="attr4" column="attr4"/>
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
<result property="factoryCode" column="factory_code"/>
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
<result property="sampleQuality" column="sample_quality"/>
|
|
|
|
<result property="checkName" column="check_name"/>
|
|
|
|
<result property="checkType" column="check_type"/>
|
|
|
|
<result property="createTimeStr" column="createTimeStr"/>
|
|
|
|
<result property="confirm" column="confirm"/>
|
|
|
|
<result property="confirmManCode" column="confirm_man_code"/>
|
|
|
|
<result property="confirmManName" column="confirm_man_name"/>
|
|
|
|
<result property="confirmRemark" column="confirm_remark"/>
|
|
|
|
<result property="shiftId" column="shift_id"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectQcCheckTaskProduceVo">
|
|
|
|
select record_id, check_no, income_batch_no, order_no, material_code, material_name,
|
|
|
|
quality, unit, supplier_code, supplier_name, income_time, check_loc, check_status,
|
|
|
|
check_man_code, check_man_name, check_time, check_result, status, attr1,
|
|
|
|
attr2, attr3, attr4, create_by, create_time, update_by, update_time,
|
|
|
|
factory_code, del_flag , check_type,sample_quality,noOk_quality,
|
|
|
|
aNoOkquality,bNoOkquality,cNoOkquality,reason,product_type,
|
|
|
|
confirm,confirm_man_code,confirm_man_name,confirm_remark ,confirm_time
|
|
|
|
from qc_check_task
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskProduceList" parameterType="QcCheckTaskProduce" resultMap="QcCheckTaskProduceResult">
|
|
|
|
select qct.record_id, qct.check_no, qct.income_batch_no,
|
|
|
|
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
|
|
|
|
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status,
|
|
|
|
qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status,
|
|
|
|
qct.create_by,qct.create_time, qct.update_by, qct.update_time,
|
|
|
|
qct.check_type,qct.sample_quality,qct.noOk_quality,
|
|
|
|
q.type_code,q.check_name
|
|
|
|
from qc_check_task qct
|
|
|
|
left join qc_check_type q on q.id = qct.check_type
|
|
|
|
<where>
|
|
|
|
<if test="checkNo != null and checkNo != ''">and qct.check_no = #{checkNo}</if>
|
|
|
|
<if test="incomeBatchNo != null and incomeBatchNo != ''">and qct.income_batch_no = #{incomeBatchNo}</if>
|
|
|
|
<if test="orderNo != null and orderNo != ''">and qct.order_no = #{orderNo}</if>
|
|
|
|
<if test="materialCode != null and materialCode != ''">and qct.material_code like concat('%',
|
|
|
|
#{materialCode}, '%')</if>
|
|
|
|
<if test="materialName != null and materialName != ''">and qct.material_name like concat('%',
|
|
|
|
#{materialName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">and qct.supplier_code = #{supplierCode}</if>
|
|
|
|
<if test="supplierName != null and supplierName != ''">and qct.supplier_name like concat('%',
|
|
|
|
#{supplierName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="incomeTime != null ">and qct.income_time = #{incomeTime}</if>
|
|
|
|
<if test="checkLoc != null and checkLoc != ''">and qct.check_loc = #{checkLoc}</if>
|
|
|
|
<if test="checkStatus != null and checkStatus != ''">and qct.check_status = #{checkStatus}</if>
|
|
|
|
<if test="checkManCode != null and checkManCode != ''">and qct.check_man_code = #{checkManCode}</if>
|
|
|
|
<if test="checkManName != null and checkManName != ''">and qct.check_man_name like concat('%',
|
|
|
|
#{checkManName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="checkResult != null and checkResult != ''">and qct.check_result = #{checkResult}</if>
|
|
|
|
<if test="status != null and status != ''">and qct.status = #{status}</if>
|
|
|
|
<if test="delFlag != null and delFlag != ''">and qct.del_flag = #{delFlag}</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">and qct.factory_code = #{factoryCode}</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>
|
|
|
|
<if test="checkTimeStart != null ">and CONVERT(varchar(30),qct.check_time, 120) >= #{checkTimeStart}</if>
|
|
|
|
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_time, 120)</if>
|
|
|
|
<if test="checkType != null ">and qct.check_type = #{checkType}</if>
|
|
|
|
<if test="typeCode != null ">and q.type_code = #{typeCode}</if>
|
|
|
|
</where>
|
|
|
|
order by qct.create_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskProduceByRecordId" parameterType="String" resultMap="QcCheckTaskProduceResult">
|
|
|
|
<include refid="selectQcCheckTaskProduceVo"/>
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getQcListWorkCenter" resultType="com.op.quality.domain.QcCheckTaskProduce">
|
|
|
|
select factory_code supplierCode,
|
|
|
|
factory_name supplierName
|
|
|
|
from sys_factory
|
|
|
|
where f_type = 'c' and status = '1' and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getTodayMaxNum" resultType="java.lang.Integer">
|
|
|
|
select count(0)+1
|
|
|
|
from qc_check_task
|
|
|
|
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
</select>
|
|
|
|
<select id="getCheckTypes" resultType="com.op.quality.domain.QcCheckType">
|
|
|
|
select
|
|
|
|
id,check_name checkName
|
|
|
|
from qc_check_type
|
|
|
|
where del_flag='0'
|
|
|
|
<if test="typeCode != null and typeCode!=''">and type_code = #{typeCode}</if>
|
|
|
|
</select>
|
|
|
|
<select id="getOrderWorks" resultType="com.op.quality.domain.QcCheckTaskProduce">
|
|
|
|
select qct.factory_code factoryCode,
|
|
|
|
qct.order_no workorderCode,
|
|
|
|
qct.material_code materialCode,
|
|
|
|
qct.material_name materialName,
|
|
|
|
qct.quality,
|
|
|
|
qct.unit,
|
|
|
|
qct.supplier_code supplierCode,
|
|
|
|
qct.supplier_name supplierName,
|
|
|
|
qct.income_time incomeTime,
|
|
|
|
max(qct.create_time) createTime,
|
|
|
|
qct.check_loc checkLoc,
|
|
|
|
qct.product_type productType,
|
|
|
|
qct.confirm_man_code confirmManCode,
|
|
|
|
qct.confirm_man_name confirmManName
|
|
|
|
from qc_check_task qct
|
|
|
|
left join pro_order_workorder pow on qct.order_no = pow.workorder_code
|
|
|
|
where qct.check_type = 'checkTypeSCXJ' and qct.del_flag = '0'
|
|
|
|
and pow.del_flag = '0'
|
|
|
|
and CONVERT(varchar(10),income_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
and pow.status = 'w2' and pow.parent_order = '0'
|
|
|
|
group by qct.factory_code,
|
|
|
|
qct.order_no,qct.material_code,qct.material_name,
|
|
|
|
qct.quality,qct.unit,qct.supplier_code,qct.supplier_name,
|
|
|
|
qct.income_time,qct.check_loc,
|
|
|
|
qct.product_type,qct.confirm_man_code,qct.confirm_man_name
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertQcCheckTaskProduce" parameterType="QcCheckTaskProduce">
|
|
|
|
insert into qc_check_task
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="recordId != null">record_id,</if>
|
|
|
|
<if test="checkNo != null">check_no,</if>
|
|
|
|
<if test="incomeBatchNo != null">income_batch_no,</if>
|
|
|
|
<if test="orderNo != null">order_no,</if>
|
|
|
|
<if test="materialCode != null">material_code,</if>
|
|
|
|
<if test="materialName != null">material_name,</if>
|
|
|
|
<if test="quality != null">quality,</if>
|
|
|
|
<if test="sampleQuality != null">sample_quality,</if>
|
|
|
|
<if test="noOkQuality != null">noOk_quality,</if>
|
|
|
|
<if test="aNoOkquality != null">aNoOkquality,</if>
|
|
|
|
<if test="bNoOkquality != null">bNoOkquality,</if>
|
|
|
|
<if test="cNoOkquality != null">cNoOkquality,</if>
|
|
|
|
<if test="unit != null">unit,</if>
|
|
|
|
<if test="supplierCode != null">supplier_code,</if>
|
|
|
|
<if test="supplierName != null">supplier_name,</if>
|
|
|
|
<if test="incomeTime != null">income_time,</if>
|
|
|
|
<if test="checkLoc != null">check_loc,</if>
|
|
|
|
<if test="checkStatus != null">check_status,</if>
|
|
|
|
<if test="checkManCode != null">check_man_code,</if>
|
|
|
|
<if test="checkManName != null">check_man_name,</if>
|
|
|
|
<if test="checkTime != null">check_time,</if>
|
|
|
|
<if test="checkResult != null">check_result,</if>
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
<if test="attr4 != null">attr4,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
<if test="checkType != null">check_type,</if>
|
|
|
|
<if test="typeCode != null">type_code,</if>
|
|
|
|
<if test="reason != null">reason,</if>
|
|
|
|
<if test="productType != null">product_type,</if>
|
|
|
|
<if test="confirmManCode != null">confirm_man_code,</if>
|
|
|
|
<if test="confirmManName != null">confirm_man_name,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="recordId != null">#{recordId},</if>
|
|
|
|
<if test="checkNo != null">#{checkNo},</if>
|
|
|
|
<if test="incomeBatchNo != null">#{incomeBatchNo},</if>
|
|
|
|
<if test="orderNo != null">#{orderNo},</if>
|
|
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
|
|
<if test="materialName != null">#{materialName},</if>
|
|
|
|
<if test="quality != null">#{quality},</if>
|
|
|
|
<if test="sampleQuality != null">#{sampleQuality},</if>
|
|
|
|
<if test="noOkQuality != null">#{noOkQuality},</if>
|
|
|
|
<if test="aNoOkquality != null">#{aNoOkquality},</if>
|
|
|
|
<if test="bNoOkquality != null">#{bNoOkquality},</if>
|
|
|
|
<if test="cNoOkquality != null">#{cNoOkquality},</if>
|
|
|
|
<if test="unit != null">#{unit},</if>
|
|
|
|
<if test="supplierCode != null">#{supplierCode},</if>
|
|
|
|
<if test="supplierName != null">#{supplierName},</if>
|
|
|
|
<if test="incomeTime != null">#{incomeTime},</if>
|
|
|
|
<if test="checkLoc != null">#{checkLoc},</if>
|
|
|
|
<if test="checkStatus != null">#{checkStatus},</if>
|
|
|
|
<if test="checkManCode != null">#{checkManCode},</if>
|
|
|
|
<if test="checkManName != null">#{checkManName},</if>
|
|
|
|
<if test="checkTime != null">#{checkTime},</if>
|
|
|
|
<if test="checkResult != null">#{checkResult},</if>
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
<if test="attr4 != null">#{attr4},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
<if test="checkType != null">#{checkType},</if>
|
|
|
|
<if test="typeCode != null">#{typeCode},</if>
|
|
|
|
<if test="reason != null">#{reason},</if>
|
|
|
|
<if test="productType != null">#{productType},</if>
|
|
|
|
<if test="confirmManCode != null">#{confirmManCode},</if>
|
|
|
|
<if test="confirmManName != null">#{confirmManName},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateQcCheckTaskProduce" parameterType="QcCheckTaskProduce">
|
|
|
|
update qc_check_task
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="checkNo != null">check_no = #{checkNo},</if>
|
|
|
|
<if test="incomeBatchNo != null">income_batch_no = #{incomeBatchNo},</if>
|
|
|
|
<if test="orderNo != null">order_no = #{orderNo},</if>
|
|
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
|
|
<if test="quality != null">quality = #{quality},</if>
|
|
|
|
<if test="sampleQuality != null">sample_quality = #{sampleQuality},</if>
|
|
|
|
<if test="noOkQuality != null">noOk_quality = #{noOkQuality},</if>
|
|
|
|
<if test="aNoOkquality != null">aNoOkquality = #{aNoOkquality},</if>
|
|
|
|
<if test="bNoOkquality != null">bNoOkquality = #{bNoOkquality},</if>
|
|
|
|
<if test="cNoOkquality != null">cNoOkquality = #{cNoOkquality},</if>
|
|
|
|
<if test="unit != null">unit = #{unit},</if>
|
|
|
|
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
|
|
|
|
<if test="supplierName != null">supplier_name = #{supplierName},</if>
|
|
|
|
<if test="incomeTime != null">income_time = #{incomeTime},</if>
|
|
|
|
<if test="checkLoc != null">check_loc = #{checkLoc},</if>
|
|
|
|
<if test="checkStatus != null">check_status = #{checkStatus},</if>
|
|
|
|
<if test="checkManCode != null">check_man_code = #{checkManCode},</if>
|
|
|
|
<if test="checkManName != null">check_man_name = #{checkManName},</if>
|
|
|
|
<if test="checkTime != null">check_time = #{checkTime},</if>
|
|
|
|
<if test="checkResult != null">check_result = #{checkResult},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
|
|
<if test="attr4 != null">attr4 = #{attr4},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
|
<if test="reason != null">reason = #{reason},</if>
|
|
|
|
<if test="productType != null">product_type = #{productType},</if>
|
|
|
|
<if test="confirmManCode != null">confirm_man_code = #{confirmManCode},</if>
|
|
|
|
<if test="confirmManName != null">confirm_man_name = #{confirmManName},</if>
|
|
|
|
</trim>
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteQcCheckTaskProduceByRecordId" parameterType="String">
|
|
|
|
update qc_check_task
|
|
|
|
set del_flag = '1'
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteQcCheckTaskProduceByRecordIds" parameterType="String">
|
|
|
|
delete from qc_check_task where record_id in
|
|
|
|
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{recordId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskCheckNoByRecordIds" parameterType="String" resultMap="QcCheckTaskProduceResult">
|
|
|
|
select check_no from qc_check_task where record_id in
|
|
|
|
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{recordId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="selectQcCheckReportIncomeList" parameterType="QcCheckReportIncome"
|
|
|
|
resultMap="QcCheckReportIncomeResult">
|
|
|
|
select t.*,pow.shift_id from (
|
|
|
|
select qct.record_id, qct.check_no, qct.income_batch_no,
|
|
|
|
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
|
|
|
|
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status,
|
|
|
|
qct.check_time, qct.check_result, qct.check_type,'首件检验' check_name,
|
|
|
|
CONVERT(varchar(10),qct.create_time, 120) createTimeStr,
|
|
|
|
qct.confirm,qct.confirm_man_name
|
|
|
|
from qc_check_task qct
|
|
|
|
<where>
|
|
|
|
<if test="checkNo != null and checkNo != ''">and qct.check_no = #{checkNo}</if>
|
|
|
|
<if test="incomeBatchNo != null and incomeBatchNo != ''">and qct.income_batch_no = #{incomeBatchNo}</if>
|
|
|
|
<if test="orderNo != null and orderNo != ''">and qct.order_no = #{orderNo}</if>
|
|
|
|
<if test="materialCode != null and materialCode != ''">and qct.material_code = #{materialCode}</if>
|
|
|
|
<if test="materialName != null and materialName != ''">and qct.material_name like concat('%',
|
|
|
|
#{materialName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">and qct.supplier_code = #{supplierCode}</if>
|
|
|
|
<if test="supplierName != null and supplierName != ''">and qct.supplier_name like concat('%',
|
|
|
|
#{supplierName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="checkLoc != null and checkLoc != ''">and qct.check_loc = #{checkLoc}</if>
|
|
|
|
<if test="checkStatus != null and checkStatus != ''">and qct.check_status = #{checkStatus}</if>
|
|
|
|
<if test="checkManCode != null and checkManCode != ''">and qct.check_man_code = #{checkManCode}</if>
|
|
|
|
<if test="checkManName != null and checkManName != ''">and qct.check_man_name like concat('%',
|
|
|
|
#{checkManName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="checkResult != null and checkResult != ''">and qct.check_result = #{checkResult}</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>
|
|
|
|
<if test="checkTimeStart != null ">and CONVERT(varchar(30),qct.create_time, 120) >= #{checkTimeStart}</if>
|
|
|
|
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.create_time, 120)</if>
|
|
|
|
and qct.check_type = 'checkTypeSC'
|
|
|
|
</where>
|
|
|
|
union ALL
|
|
|
|
select
|
|
|
|
'','','',
|
|
|
|
qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
|
|
|
|
qct.supplier_code, qct.supplier_name, qct.income_time,'','',
|
|
|
|
null,'', qct.check_type,'巡检检验' check_name,CONVERT(varchar(10),qct.create_time, 120) createTimeStr,
|
|
|
|
qct.confirm,qct.confirm_man_name
|
|
|
|
from qc_check_task qct
|
|
|
|
<where>
|
|
|
|
<if test="checkNo != null and checkNo != ''">and qct.check_no = #{checkNo}</if>
|
|
|
|
<if test="incomeBatchNo != null and incomeBatchNo != ''">and qct.income_batch_no = #{incomeBatchNo}</if>
|
|
|
|
<if test="orderNo != null and orderNo != ''">and qct.order_no = #{orderNo}</if>
|
|
|
|
<if test="materialCode != null and materialCode != ''">and qct.material_code = #{materialCode}</if>
|
|
|
|
<if test="materialName != null and materialName != ''">and qct.material_name like concat('%',
|
|
|
|
#{materialName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">and qct.supplier_code = #{supplierCode}</if>
|
|
|
|
<if test="supplierName != null and supplierName != ''">and qct.supplier_name like concat('%',
|
|
|
|
#{supplierName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="checkLoc != null and checkLoc != ''">and qct.check_loc = #{checkLoc}</if>
|
|
|
|
<if test="checkStatus != null and checkStatus != ''">and qct.check_status = #{checkStatus}</if>
|
|
|
|
<if test="checkManCode != null and checkManCode != ''">and qct.check_man_code = #{checkManCode}</if>
|
|
|
|
<if test="checkManName != null and checkManName != ''">and qct.check_man_name like concat('%',
|
|
|
|
#{checkManName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="checkResult != null and checkResult != ''">and qct.check_result = #{checkResult}</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>
|
|
|
|
<if test="checkTimeStart != null ">and CONVERT(varchar(30),qct.create_time, 120) >= #{checkTimeStart}</if>
|
|
|
|
<if test="checkTimeEnd != null ">and #{checkTimeEnd} > CONVERT(varchar(30),qct.create_time, 120)</if>
|
|
|
|
and qct.check_type = 'checkTypeSCXJ'
|
|
|
|
</where>
|
|
|
|
GROUP BY qct.order_no, qct.material_code, qct.material_name, qct.quality, qct.unit,
|
|
|
|
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_type,CONVERT(varchar(10),qct.create_time, 120),
|
|
|
|
qct.confirm,qct.confirm_man_name
|
|
|
|
) t
|
|
|
|
left join pro_order_workorder pow on pow.workorder_code = t.order_no
|
|
|
|
where 1=1
|
|
|
|
<if test="checkType != null ">
|
|
|
|
and t.check_type = #{checkType}
|
|
|
|
</if>
|
|
|
|
order by t.order_no,t.createTimeStr desc
|
|
|
|
</select>
|
|
|
|
<select id="getOrderWorksW2" resultType="com.op.quality.domain.QcCheckTaskProduce">
|
|
|
|
select
|
|
|
|
pow.factory_code factoryCode,
|
|
|
|
pow.workorder_code workorderCode,
|
|
|
|
pow.product_code materialCode,
|
|
|
|
pow.product_name materialName,
|
|
|
|
pow.quantity_split quality,
|
|
|
|
pow.unit,
|
|
|
|
be.workshop_code supplierCode,
|
|
|
|
be.workshop_name supplierName,
|
|
|
|
pow.product_date incomeTime,
|
|
|
|
pow.workorder_name checkLoc,
|
|
|
|
pow.prod_type productType
|
|
|
|
from pro_order_workorder pow
|
|
|
|
left join base_equipment be on be.equipment_code = pow.workorder_name and be.equipment_type_code = 'equ_type_bzx'
|
|
|
|
where pow.del_flag = '0'
|
|
|
|
and pow.status = #{status} and pow.parent_order = '0'
|
|
|
|
and (pow.product_date = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
or pow.product_date = CONVERT(varchar(10),DATEADD(DAY, -1, GETDATE()), 120))
|
|
|
|
</select>
|
|
|
|
<select id="getOrderWorksW3" resultType="com.op.quality.domain.QcCheckTaskProduce">
|
|
|
|
select
|
|
|
|
pow.factory_code factoryCode,
|
|
|
|
pow.workorder_code workorderCode,
|
|
|
|
pow.product_code materialCode,
|
|
|
|
pow.product_name materialName,
|
|
|
|
pow.quantity_split quality,
|
|
|
|
pow.unit,
|
|
|
|
be.workshop_code supplierCode,
|
|
|
|
be.workshop_name supplierName,
|
|
|
|
pow.product_date incomeTime,
|
|
|
|
pow.workorder_name checkLoc,
|
|
|
|
pow.prod_type productType,
|
|
|
|
qct.check_no
|
|
|
|
from pro_order_workorder pow
|
|
|
|
left join base_equipment be on be.equipment_code = pow.workorder_name and be.equipment_type_code = 'equ_type_bzx'
|
|
|
|
left join qc_check_task qct on qct.order_no = pow.workorder_code and qct.check_type='checkTypeCP' and qct.del_flag = '0'
|
|
|
|
where pow.del_flag = '0'
|
|
|
|
and pow.status = #{status} and pow.parent_order = '0'
|
|
|
|
and (pow.product_date = CONVERT(varchar(10),GETDATE(), 120)
|
|
|
|
or pow.product_date = CONVERT(varchar(10),DATEADD(DAY, -1, GETDATE()), 120))
|
|
|
|
and qct.check_no is null
|
|
|
|
</select>
|
|
|
|
<select id="getLastXJTask" resultType="com.op.quality.domain.QcCheckTaskProduce">
|
|
|
|
select top 1
|
|
|
|
qct.factory_code factoryCode,
|
|
|
|
qct.order_no workorderCode,
|
|
|
|
qct.material_code materialCode,
|
|
|
|
qct.material_name materialName,
|
|
|
|
qct.quality,
|
|
|
|
qct.unit,
|
|
|
|
qct.supplier_code supplierCode,
|
|
|
|
qct.supplier_name supplierName,
|
|
|
|
qct.income_time incomeTime,
|
|
|
|
qct.create_time createTime,
|
|
|
|
qct.check_loc checkLoc,
|
|
|
|
qct.product_type productType,
|
|
|
|
qct.confirm_man_code confirmManCode,
|
|
|
|
qct.confirm_man_name confirmManName
|
|
|
|
from qc_check_task qct
|
|
|
|
where qct.check_type = #{checkType} and qct.del_flag = '0'
|
|
|
|
and qct.del_flag = '0' and qct.order_no = #{workorderCode}
|
|
|
|
<!--and CONVERT(varchar(10),qct.income_time, 120) = CONVERT(varchar(10),GETDATE(), 120)-->
|
|
|
|
order by qct.create_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|