|
|
|
<?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.QcCheckTaskIncomeMapper">
|
|
|
|
|
|
|
|
<resultMap type="QcCheckTaskIncome" id="QcCheckTaskIncomeResult">
|
|
|
|
<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="noOkQuality" column="noOk_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="checkType" column="check_type"/>
|
|
|
|
<result property="sampleQuality" column="sample_quality"/>
|
|
|
|
<result property="sampleCode" column="sample_code"/>
|
|
|
|
<result property="orderType" column="order_type"/>
|
|
|
|
<result property="orderTypeDesc" column="order_type_desc"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectQcCheckTaskIncomeVo">
|
|
|
|
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,
|
|
|
|
order_type,order_type_desc
|
|
|
|
from qc_check_task
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskIncomeList" parameterType="QcCheckTaskIncome" resultMap="QcCheckTaskIncomeResult">
|
|
|
|
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.noOk_quality,
|
|
|
|
qct.sample_quality, qct.type_code, qct.order_type,qct.sample_code
|
|
|
|
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="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 qct.type_code = #{typeCode}</if>
|
|
|
|
<if test="orderType != null ">and qct.order_type = #{orderType}</if>
|
|
|
|
</where>
|
|
|
|
order by qct.create_time DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskIncomeByRecordId" parameterType="String" resultMap="QcCheckTaskIncomeResult">
|
|
|
|
<include refid="selectQcCheckTaskIncomeVo"/>
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</select>
|
|
|
|
<select id="getQcListBom" resultType="com.op.quality.domain.QcBomComponent">
|
|
|
|
select product_code component,product_desc_zh componentName
|
|
|
|
from base_product
|
|
|
|
where del_flag = '0'
|
|
|
|
<if test="component != null and component != ''">and product_code like concat('%', #{component}, '%')</if>
|
|
|
|
<if test="componentName != null and componentName != ''">and product_desc_zh like concat('%', #{componentName},
|
|
|
|
'%')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getQcListSupplier" resultType="com.op.quality.domain.QcSupplier">
|
|
|
|
select supplier_code supplierCode,
|
|
|
|
zh_desc supplierName,
|
|
|
|
address,
|
|
|
|
contact_phone contactPhone
|
|
|
|
from base_supplier where active_flag = '1' and del_flag ='0'
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">and supplier_code like concat('%', #{supplierCode},
|
|
|
|
'%')
|
|
|
|
</if>
|
|
|
|
<if test="supplierName != null and supplierName != ''">and zh_desc like concat('%', #{supplierName}, '%')</if>
|
|
|
|
</select>
|
|
|
|
<select id="getQcListUser" resultType="com.op.system.api.domain.SysUser">
|
|
|
|
select user_id userId,
|
|
|
|
user_name userCode,
|
|
|
|
nick_name userName,
|
|
|
|
phonenumber
|
|
|
|
from sys_user where del_flag = '0' and status = '0'
|
|
|
|
<if test="userCode != null and userCode != ''">and user_name like concat('%', #{userCode}, '%')</if>
|
|
|
|
<if test="userName != null and userName != ''">and nick_name like concat('%', #{userName}, '%')</if>
|
|
|
|
</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="getCkeckProjectList" resultType="com.op.quality.domain.QcCheckTaskDetail">
|
|
|
|
select td.record_id recordId,
|
|
|
|
td.project_id projectId,
|
|
|
|
td.project_no projectNo,
|
|
|
|
td.rule_name ruleName,
|
|
|
|
td.property_code propertyCode,
|
|
|
|
td.check_mode checkMode,
|
|
|
|
td.check_tool checkTool,
|
|
|
|
td.unit_code unitCode,
|
|
|
|
td.check_standard checkStandard,
|
|
|
|
td.actual_value actualValue,
|
|
|
|
td.status,
|
|
|
|
td.remark,
|
|
|
|
td.create_by createBy,
|
|
|
|
td.create_time createTime,
|
|
|
|
td.update_by updateBy,
|
|
|
|
td.update_time updateTime,
|
|
|
|
td.belong_to belongTo,
|
|
|
|
td.defect_code defectCode,
|
|
|
|
td.defect_quality defectQuality,
|
|
|
|
td.sample_code sampleCode,
|
|
|
|
td.sample_quality sampleQuality,
|
|
|
|
td.sample_aql sampleAql,
|
|
|
|
td.check_level checkLevel,
|
|
|
|
qctp.upper_diff upperDiff,
|
|
|
|
qctp.down_diff downDiff,
|
|
|
|
qctp.sample,
|
|
|
|
qctp.weight
|
|
|
|
from qc_check_task_detail td
|
|
|
|
left join qc_check_type_project qctp on td.type_project_id = qctp.id
|
|
|
|
where td.belong_to = #{belongTo} and td.del_flag='0' and qctp.del_flag = '0' and td.rule_name is not null
|
|
|
|
order by qctp.sort
|
|
|
|
</select>
|
|
|
|
<select id="getQcUnitList" resultType="com.op.system.api.domain.SysDictData">
|
|
|
|
select dict_label dictLabel,
|
|
|
|
dict_value dictValue
|
|
|
|
from sys_dict_data
|
|
|
|
where dict_type = 'unit'
|
|
|
|
and status = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getBatchList" resultType="com.op.quality.domain.QcCheckTaskIncome">
|
|
|
|
select powb.batch_id batchId,
|
|
|
|
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 = #{workorderCode}
|
|
|
|
order by powb.batch_code
|
|
|
|
</select>
|
|
|
|
<select id="getTypeCode" resultType="java.lang.String">
|
|
|
|
select type_code from qc_check_type where order_code = #{checkType}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertQcCheckTaskIncome" parameterType="QcCheckTaskIncome">
|
|
|
|
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="noOkQuality != null">noOk_quality,</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="sampleQuality != null">sample_quality,</if>
|
|
|
|
<if test="orderType != null">order_type,</if>
|
|
|
|
<if test="orderTypeDesc != null">order_type_desc,</if>
|
|
|
|
<if test="sampleCode != null">sample_code,</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="noOkQuality != null">#{noOkQuality},</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="sampleQuality != null">#{sampleQuality},</if>
|
|
|
|
<if test="orderType != null">#{orderType},</if>
|
|
|
|
<if test="orderTypeDesc != null">#{orderTypeDesc},</if>
|
|
|
|
<if test="sampleCode != null">#{sampleCode},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateQcCheckTaskIncome" parameterType="QcCheckTaskIncome">
|
|
|
|
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="noOkQuality != null">noOk_quality = #{noOkQuality},</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="checkType != null">check_type = #{checkType},</if>
|
|
|
|
<if test="sampleQuality != null">sample_quality = #{sampleQuality},</if>
|
|
|
|
<if test="sampleCode != null">sample_code = #{sampleCode},</if>
|
|
|
|
</trim>
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</update>
|
|
|
|
<update id="updateQcCheckTask">
|
|
|
|
update qc_check_task
|
|
|
|
set
|
|
|
|
check_status = #{checkStatus},
|
|
|
|
check_man_code = #{checkManCode},
|
|
|
|
check_man_name =#{checkManName},
|
|
|
|
<if test="checkTime != null">check_time = #{checkTime},</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="incomeBatchNo != null">income_batch_no = #{incomeBatchNo},</if>
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
<if test="reason != null">reason = #{reason},</if>
|
|
|
|
<if test="bz != null">bz = #{bz},</if>
|
|
|
|
check_result = #{checkResult},
|
|
|
|
update_by = #{updateBy},
|
|
|
|
update_time = #{updateTime}
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</update>
|
|
|
|
<update id="updateQcCheckTaskDetails">
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
update qc_check_task_detail
|
|
|
|
set
|
|
|
|
actual_value = #{item.actualValue},
|
|
|
|
status = #{item.status},
|
|
|
|
update_by = #{item.updateBy},
|
|
|
|
update_time = #{item.updateTime},
|
|
|
|
remark = #{item.remark},
|
|
|
|
<if test="item.sampleCode != null">sample_code = #{item.sampleCode},</if>
|
|
|
|
<if test="item.sampleQuality != null">sample_quality = #{item.sampleQuality},</if>
|
|
|
|
<if test="item.sampleAql != null">sample_aql = #{item.sampleAql},</if>
|
|
|
|
<if test="item.checkLevel != null">check_level = #{item.checkLevel},</if>
|
|
|
|
defect_code = #{item.defectCode},
|
|
|
|
defect_quality = #{item.defectQuality}
|
|
|
|
where
|
|
|
|
record_id = #{item.recordId}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteQcCheckTaskIncomeByRecordId" parameterType="String">
|
|
|
|
update qc_check_task
|
|
|
|
set del_flag = '1'
|
|
|
|
where record_id = #{recordId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteQcCheckTaskIncomeByRecordIds" parameterType="String">
|
|
|
|
delete from qc_check_task where record_id in
|
|
|
|
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{recordId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
<delete id="deleteQcCheckTaskDefects">
|
|
|
|
delete from qc_check_task_defect where belong_to = #{belongId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="selectQcCheckTaskCheckNoByRecordIds" parameterType="String" resultMap="QcCheckTaskIncomeResult">
|
|
|
|
select check_no from qc_check_task where record_id in
|
|
|
|
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{recordId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="getUserByCheckType" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
|
|
|
|
select user_code userCode,
|
|
|
|
user_name userName
|
|
|
|
from qc_user_material
|
|
|
|
where material_code = #{checkType} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getCheckUser" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
|
|
|
|
select user_code userCode,
|
|
|
|
user_name userName
|
|
|
|
from qc_user_material
|
|
|
|
where material_code = #{checkType} and del_flag = '0'
|
|
|
|
<if test = "orderType!=null">
|
|
|
|
and attr1 = #{orderType}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getCkeckDefectList" resultType="com.op.quality.domain.QcCheckTaskDefect">
|
|
|
|
select
|
|
|
|
qctd.defect_code defectCode,
|
|
|
|
qctd.defect_subclass defectSubclass,
|
|
|
|
sum(qctd.noOk_quality) noOkQuality
|
|
|
|
from qc_check_task_defect qctd
|
|
|
|
where qctd.del_flag = '0' and qctd.belong_to = #{belongTo}
|
|
|
|
group by qctd.defect_code,qctd.defect_subclass
|
|
|
|
order by qctd.defect_code
|
|
|
|
</select>
|
|
|
|
<select id="getDefectType" resultType="com.op.quality.domain.QcCheckTaskDefect">
|
|
|
|
select
|
|
|
|
defect_code defectCode,
|
|
|
|
defect_subclass defectSubclass
|
|
|
|
from qc_defect_type qdt
|
|
|
|
left join qc_check_type qct on qdt.defect_type = qct.type_code
|
|
|
|
where qct.order_code = #{checkType} and qdt.del_flag = '0'
|
|
|
|
order by qdt.defect_code
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getTaskInfo" resultType="com.op.quality.domain.QcCheckTaskIncome">
|
|
|
|
select
|
|
|
|
qct.material_code materialCode,
|
|
|
|
qct.material_name materialName,
|
|
|
|
qct.supplier_code supplierCode,
|
|
|
|
qct.supplier_name supplierName,
|
|
|
|
qct.income_batch_no incomeBatchNo,
|
|
|
|
qct.quality,
|
|
|
|
qct.factory_code factoryCode,
|
|
|
|
case when pow.workorder_code_sap is not null then pow.workorder_code_sap
|
|
|
|
else qct.order_no end orderNo,
|
|
|
|
qct.create_time createTime,
|
|
|
|
qct.check_no checkNo,
|
|
|
|
qct.check_time checkTime,
|
|
|
|
qct.check_result checkResult,
|
|
|
|
qct.income_time incomeTime,
|
|
|
|
qct.check_loc checkLoc,
|
|
|
|
qct.remark
|
|
|
|
from qc_check_task qct
|
|
|
|
left join pro_order_workorder pow on pow.workorder_code = qct.order_no and pow.del_flag = '0'
|
|
|
|
where qct.record_id = #{recordId}
|
|
|
|
</select>
|
|
|
|
<select id="getCkeckTaskXJList" resultType="com.op.quality.domain.QcCheckTaskIncome">
|
|
|
|
select
|
|
|
|
record_id recordId,
|
|
|
|
check_no checkNo,
|
|
|
|
income_batch_no incomeBatchNo,
|
|
|
|
check_status checkStatus,
|
|
|
|
check_man_code checkManCode,
|
|
|
|
check_man_name checkManName,
|
|
|
|
check_time checkTime,
|
|
|
|
check_result checkResult,
|
|
|
|
create_time createTime,
|
|
|
|
check_loc checkLoc,
|
|
|
|
sample_quality sampleQuality
|
|
|
|
from qc_check_task
|
|
|
|
where del_flag = '0' and check_type = 'checkTypeSCXJ' and order_no = #{orderNo}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="addCheckUsers">
|
|
|
|
insert into qc_check_task_user(
|
|
|
|
record_id,belong_to,check_no,
|
|
|
|
check_man_code,check_man_name,
|
|
|
|
create_by,create_time,factory_code
|
|
|
|
) values
|
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
|
(
|
|
|
|
#{item.id},#{item.belongTo},#{item.checkNo},
|
|
|
|
#{item.userCode},#{item.userName},
|
|
|
|
#{item.createBy},#{item.createTime},#{item.factoryCode}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
<insert id="addQcCheckTaskDefects">
|
|
|
|
insert into qc_check_task_defect(
|
|
|
|
record_id,belong_to,belong_to_detail,
|
|
|
|
defect_code,defect_subclass,
|
|
|
|
noOk_quality,
|
|
|
|
create_by,create_time,factory_code
|
|
|
|
) values
|
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
|
(
|
|
|
|
#{item.recordId},#{item.belongTo},#{item.belongToDetail},
|
|
|
|
#{item.defectCode},#{item.defectSubclass},
|
|
|
|
#{item.noOkQuality},
|
|
|
|
#{item.createBy},#{item.createTime},#{item.factoryCode}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<!--查询原始表-->
|
|
|
|
<select id="getIncomeBatchList" resultMap="QcCheckTaskIncomeResult">
|
|
|
|
select *
|
|
|
|
from qc_income_original
|
|
|
|
where del_flag = '0'
|
|
|
|
and check_type = 'checkTypeLL'
|
|
|
|
and order_type = 'bc'
|
|
|
|
and check_status = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getCheckLocList" resultType="com.op.quality.domain.QcDefectType">
|
|
|
|
select equipment_code defectCode,
|
|
|
|
equipment_name defectSubclass
|
|
|
|
from base_equipment
|
|
|
|
where equipment_type_code='equ_type_bzx' and status = '1'
|
|
|
|
</select>
|
|
|
|
<select id="getTodayIncomeLists" resultType="java.lang.String">
|
|
|
|
select attr1
|
|
|
|
from qc_check_task
|
|
|
|
where check_type = 'checkTypeLL'
|
|
|
|
and CONVERT(varchar(10),GETDATE(), 120) = CONVERT(varchar(10),create_time, 120)
|
|
|
|
</select>
|
|
|
|
<select id="getNotices" resultType="com.op.system.api.domain.SysNoticeGroup">
|
|
|
|
select
|
|
|
|
sn.notice_title noticeTitle,
|
|
|
|
sn.notice_type noticeType,
|
|
|
|
sn.notice_content noticeContent
|
|
|
|
from sys_notice sn
|
|
|
|
where sn.notice_id = #{noticeId}
|
|
|
|
</select>
|
|
|
|
<select id="getNoticesGroup" resultType="com.op.system.api.domain.SysNoticeGroup">
|
|
|
|
select sng.notice_id noticeId,
|
|
|
|
sn.notice_title noticeTitle,
|
|
|
|
sn.notice_type noticeType,
|
|
|
|
sn.notice_content noticeContent,
|
|
|
|
btu.user_name userCode,
|
|
|
|
case when btu.wx_id is null then btu.user_name else btu.wx_id end wxId
|
|
|
|
from sys_notice_group sng
|
|
|
|
left join sys_notice sn on sng.notice_id = sn.notice_id
|
|
|
|
left join base_team_user btu on sng.group_code = btu.team_code
|
|
|
|
where sng.notice_id = #{noticeId} and sng.del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getWxId" resultType="java.lang.String">
|
|
|
|
select wx_id from sys_user where del_flag = '0' and wx_id is not null
|
|
|
|
and user_name in
|
|
|
|
<foreach item="userCode" collection="list" open="(" separator="," close=")">
|
|
|
|
#{userCode}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="getWxIdMap" resultType="com.op.system.api.domain.SysUser">
|
|
|
|
select wx_id wxId,
|
|
|
|
user_name userCode
|
|
|
|
from sys_user where del_flag = '0' and wx_id is not null
|
|
|
|
and user_name in
|
|
|
|
<foreach item="userCode" collection="list" open="(" separator="," close=")">
|
|
|
|
#{userCode}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="hasIncomeTask" resultType="com.op.quality.domain.QcCheckTaskIncome">
|
|
|
|
select material_code materialCode
|
|
|
|
from qc_check_task
|
|
|
|
where supplier_code= #{supplierCode}
|
|
|
|
and material_code= #{materialCode}
|
|
|
|
and quality = #{quality}
|
|
|
|
and income_time = #{incomeTime} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getSampleQua" resultType="String">
|
|
|
|
select sample_code
|
|
|
|
from qc_sample_rule_code
|
|
|
|
where check_level = #{checkLevel}
|
|
|
|
and #{quality}>=start_value
|
|
|
|
and end_value>= #{quality}
|
|
|
|
and del_flag='0'
|
|
|
|
</select>
|
|
|
|
<select id="getnoOkVals" resultType="java.lang.Integer">
|
|
|
|
select
|
|
|
|
<if test='sampleAql == "aql1"'>aql1</if>
|
|
|
|
<if test='sampleAql == "aql2"'>aql2</if>
|
|
|
|
<if test='sampleAql == "aql3"'>aql3</if>
|
|
|
|
<if test='sampleAql == "aql4"'>aql4</if>
|
|
|
|
<if test='sampleAql == "aql5"'>aql5</if>
|
|
|
|
<if test='sampleAql == "aql6"'>aql6</if>
|
|
|
|
<if test='sampleAql == "aql7"'>aql7</if>
|
|
|
|
<if test='sampleAql == "aql8"'>aql8</if>
|
|
|
|
<if test='sampleAql == "aql9"'>aql9</if>
|
|
|
|
<if test='sampleAql == "aql10"'>aql10</if>
|
|
|
|
<if test='sampleAql == "aql11"'>aql11</if>
|
|
|
|
<if test='sampleAql == "aql12"'>aql12</if>
|
|
|
|
<if test='sampleAql == "aql13"'>aql13</if>
|
|
|
|
<if test='sampleAql == "aql14"'>aql14</if>
|
|
|
|
<if test='sampleAql == "aql15"'>aql15</if>
|
|
|
|
<if test='sampleAql == "aql16"'>aql16</if>
|
|
|
|
<if test='sampleAql == "aql17"'>aql17</if>
|
|
|
|
<if test='sampleAql == "aql18"'>aql18</if>
|
|
|
|
<if test='sampleAql == "aql19"'>aql19</if>
|
|
|
|
<if test='sampleAql == "aql20"'>aql20</if>
|
|
|
|
<if test='sampleAql == "aql21"'>aql21</if>
|
|
|
|
<if test='sampleAql == "aql22"'>aql22</if>
|
|
|
|
<if test='sampleAql == "aql23"'>aql23</if>
|
|
|
|
<if test='sampleAql == "aql24"'>aql24</if>
|
|
|
|
<if test='sampleAql == "aql25"'>aql25</if>
|
|
|
|
<if test='sampleAql == "aql26"'>aql26</if>
|
|
|
|
from qc_sample_rule_aql
|
|
|
|
where del_flag='0' and sample_code like concat(#{sampleCode},'%')
|
|
|
|
</select>
|
|
|
|
<select id="getUserIdList" resultType="com.op.system.api.domain.SysUser">
|
|
|
|
select user_name userCode,
|
|
|
|
nick_name userName
|
|
|
|
from sys_user where dept_id = #{deptId} and del_flag='0'
|
|
|
|
</select>
|
|
|
|
<select id="getOaUserId" resultType="com.op.system.api.domain.SysUser">
|
|
|
|
select oa_user_id userId from sys_user WHERE user_name = #{userCode} and del_flag='0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!--批量更新原始表-->
|
|
|
|
<update id="updateIncomeBatchList">
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
update qc_income_original
|
|
|
|
set
|
|
|
|
check_status = '1',
|
|
|
|
check_time = #{time}
|
|
|
|
where
|
|
|
|
record_id = #{item}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|