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.

203 lines
10 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.QcCheckUnqualifiedMapper">
<resultMap type="QcCheckUnqualified" id="QcCheckUnqualifiedResult">
<result property="id" column="id" />
<result property="taskId" column="task_id" />
<result property="status" column="status" />
<result property="nextNodeCode" column="next_node_code" />
<result property="nextNodeName" column="next_node_name" />
<result property="remark" column="remark" />
<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" />
</resultMap>
<sql id="selectQcCheckUnqualifiedVo">
select id, task_id, status, next_node_code, next_node_name, remark,
attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag
from qc_check_unqualified
</sql>
<select id="selectQcCheckUnqualifiedList" parameterType="QcCheckUnqualified" resultType="com.op.quality.domain.QcCheckUnqualified">
select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark,
qcu.create_time createTime,
qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo,
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.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode,
qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult
from qc_check_unqualified qcu
left join qc_check_task qct on qcu.task_id = qct.record_id
left join qc_check_type qtn on qtn.id = qct.check_type
<where>
<if test="taskId != null and taskId != ''"> and task_id like concat('%', #{taskId}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="orderNo != null and orderNo != ''"> and qct.order_no like concat('%', #{orderNo}, '%')</if>
<if test="checkNo != null and checkNo != ''"> and qct.check_no like concat('%', #{checkNo}, '%')</if>
<if test="nextNodeCode != null and nextNodeCode != ''"> and next_node_code = #{nextNodeCode}</if>
<if test="nextNodeName != null and nextNodeName != ''"> and next_node_name like concat('%', #{nextNodeName}, '%')</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>
and qcu.del_flag = '0'
<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>
</where>
</select>
<select id="selectQcCheckUnqualifiedById" parameterType="String" resultType="com.op.quality.domain.QcCheckUnqualified">
select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark,
qcu.create_time createTime,
qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo,
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.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode,
qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult
from qc_check_unqualified qcu
left join qc_check_task qct on qcu.task_id = qct.record_id
left join qc_check_type qtn on qtn.id = qct.check_type
where qcu.id = #{id}
</select>
<select id="getDefectList" resultType="com.op.quality.domain.QcDefectType">
select defect_code defectCode,
defect_subclass defectSubclass
from qc_defect_type
where defect_type = #{defectType} and del_flag='0'
</select>
<select id="getUnqualifiedList" resultType="com.op.quality.domain.QcCheckUnqualified">
select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark,
qcu.create_time createTime,
qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo,
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.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode,
qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult
from qc_check_unqualified qcu
left join qc_check_task qct on qcu.task_id = qct.record_id
left join qc_check_type qtn on qtn.id = qct.check_type
where qcu.id = #{id}
</select>
<select id="getLLWorkOrder" resultType="com.op.quality.domain.QcCheckTaskIncome">
select wroi.raw_order_in_id recordId,
wroi.order_no orderNo,
wroi.material_code materialCode,
wroi.material_desc materialName,
wroi.user_defined1 incomeBatchNo,
wroi.supply_code supplierCode,
wroi.receipt_amount quality,
wroi.unit,
wroi.send_spot checkLoc,
wroi.quality_status qualityStatus,
bs.zh_desc supplierName,
wroi.request_time incomeTime
from wms_raw_order_in wroi
left join base_supplier bs on bs.supplier_code = wroi.supply_code
where wroi.active_flag = '1' and wroi.quality_status = '0'
<if test="orderNo != null">and wroi.order_no like concat like ('%',#{orderNo})</if>
</select>
<select id="getWorkOrder" resultType="com.op.quality.domain.QcCheckTaskIncome">
select
workorder_code workorderCode,
workorder_code_sap orderNo,
product_code materialCode,
product_name materialName,
quantity_split quality,
unit,
product_date incomeTime
from pro_order_workorder
where status != 'w5' and parent_order != '0' and workorder_code_sap is not null
<if test="orderNo != null">and workorder_code_sap like concat like ('%',#{orderNo})</if>
order by product_date desc
</select>
<insert id="insertQcCheckUnqualified" parameterType="QcCheckUnqualified">
insert into qc_check_unqualified
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="taskId != null">task_id,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="nextNodeCode != null">next_node_code,</if>
<if test="nextNodeName != null">next_node_name,</if>
<if test="remark != null">remark,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="taskId != null">#{taskId},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="nextNodeCode != null">#{nextNodeCode},</if>
<if test="nextNodeName != null">#{nextNodeName},</if>
<if test="remark != null">#{remark},</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>
</trim>
</insert>
<update id="updateQcCheckUnqualified" parameterType="QcCheckUnqualified">
update qc_check_unqualified
<trim prefix="SET" suffixOverrides=",">
<if test="taskId != null">task_id = #{taskId},</if>
<if test="status != null">status = #{status},</if>
<if test="nextNodeCode != null">next_node_code = #{nextNodeCode},</if>
<if test="nextNodeName != null">next_node_name = #{nextNodeName},</if>
<if test="remark != null">remark = #{remark},</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>
</trim>
where id = #{id}
</update>
<update id="updateQualityStatus">
update wms_raw_order_in set quality_status = #{checkResult}
where order_no = #{orderNo}
</update>
<update id="updateWorkOrderStatus">
update pro_order_workorder set status = #{status} where workorder_code_sap = #{orderNo}
</update>
<delete id="deleteQcCheckUnqualifiedById" parameterType="String">
delete from qc_check_unqualified where id = #{id}
</delete>
<delete id="deleteQcCheckUnqualifiedByIds" parameterType="String">
delete from qc_check_unqualified where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>