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.

244 lines
12 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.mes.mapper.ProRfidProcessDetailMapper">
<resultMap type="ProRfidProcessDetail" id="ProRfidProcessDetailResult">
<result property="recordId" column="record_id"/>
<result property="workorderCode" column="workorder_code"/>
<result property="rfid" column="rfid"/>
<result property="factoryCode" column="factory_code"/>
<result property="machineCode" column="machine_code"/>
<result property="nowProcessId" column="now_process_id"/>
<result property="nextProcessId" column="next_process_id"/>
<result property="orderNum" column="order_num"/>
<result property="inTime" column="in_time"/>
<result property="outTime" column="out_time"/>
<result property="status" column="status"/>
<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="workBatchCode" column="work_batch_code"/>
<result property="bindStatus" column="bind_status"/>
</resultMap>
<sql id="selectProRfidProcessDetailVo">
select record_id, workorder_code, rfid, factory_code, machine_code, now_process_id,
next_process_id, order_num, in_time, out_time, status, remark, attr1, attr2,
attr3, attr4, create_by, create_time, update_by, update_time, work_batch_code, bind_status
from pro_rfid_process_detail
</sql>
<select id="selectProRfidProcessDetailList" parameterType="ProRfidProcessDetail"
resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
select
ppd.record_id as recordId,
ppd.workorder_code as workorderCode,
ppd.rfid,
ppd.factory_code as factoryCode,
ppd.machine_code as machineCode,
ppd.now_process_id as nowProcessId,
ppd.next_process_id as nextProcessId,
ppd.order_num as orderNum,
ppd.in_time as inTime,
ppd.out_time as outTime,
ppd.status,
ppd.remark,
ppd.attr1,
ppd.attr2,
ppd.attr3,
ppd.attr4,
ppd.create_by as createBy,
ppd.create_time as createTime,
ppd.update_by as updateBy,
ppd.update_time as updateTime,
ppd.work_batch_code as workBatchCode,
ppd.bind_status as bindStatus,
pp.process_code as nextProcessCode,
pp.process_name as nextProcessName,
ppp.process_code as nowProcessCode,
ppp.process_name as nowProcessName,
pow.order_code as orderCode,
pow.product_code as productCode,
pow.product_name as productName,
pow.product_date as productDate,
pow.shift_id as shiftId
from pro_rfid_process_detail ppd
left join pro_process pp on pp.process_id = ppd.next_process_id
left join pro_process ppp on ppp.process_id = ppd.now_process_id
left join pro_order_workorder pow on pow.workorder_code = ppd.workorder_code
<where>
<if test="workorderCode != null and workorderCode != ''">and ppd.workorder_code like concat('%',
#{workorderCode}, '%')
</if>
<if test="rfid != null and rfid != ''">and rfid like concat('%', #{rfid}, '%')</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="machineCode != null and machineCode != ''">and machine_code like concat('%', #{machineCode},
'%')
</if>
<if test="nowProcessId != null and nowProcessId != ''">and now_process_id = #{nowProcessId}</if>
<if test="nextProcessId != null and nextProcessId != ''">and next_process_id = #{nextProcessId}</if>
<if test="orderNum != null ">and order_num = #{orderNum}</if>
<if test="inTime != null ">and in_time = #{inTime}</if>
<if test="outTime != null ">and out_time = #{outTime}</if>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''">and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''">and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''">and attr4 = #{attr4}</if>
<if test="workBatchCode != null and workBatchCode != ''">and work_batch_code = #{workBatchCode}</if>
<if test="bindStatus != null and bindStatus != ''">and bind_status = #{bindStatus}</if>
</where>
order by ppd.in_time desc
</select>
<select id="selectProRfidProcessDetailByRecordId" parameterType="String" resultMap="ProRfidProcessDetailResult">
<include refid="selectProRfidProcessDetailVo"/>
where record_id = #{recordId}
</select>
<!--获取在邦rfid 工单的信息-->
<select id="getRfidInfo" resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
select
top 1
rfid.workorder_code workorderCode,
rfid.now_process_id nowProcessId,
rfid.next_process_id nextProcessId,
p.equipment machineCode,
bp.product_code productCode,
bp.product_model productModel,
w.prod_line_code prodLineCode
from pro_rfid_process_detail rfid with (NOLOCK)
left join pro_process p on p.process_id = rfid.next_process_id
left join pro_order_workorder w on w.workorder_code = rfid.workorder_code
left join base_product bp on bp.product_code = w.product_code
where rfid.bind_status = '1'
and rfid.rfid = #{rfidNo}
order by rfid.create_time desc
</select>
<select id="getStationType" resultType="java.lang.String">
select
case when equipment_type_code ='equ_type_spj' then '3'
when equipment_type_code ='equ_type_hf' then '2'
else '' end
from base_equipment
where equipment_code = #{equipmentCode}
</select>
<select id="getActuaEquips" resultType="java.lang.String">
select prod_line_code
from pro_order_workorder
where workorder_code = #{workorderCode}
</select>
<select id="getEquipNum" resultType="java.lang.Integer">
select isvalue from base_equipment_attached
where property = 'dollyNumber'
and device_code = #{machineCode}
</select>
<select id="getEquipStatus" resultType="java.lang.String">
select status from base_equipment where equipment_code = #{machineCode} and del_flag = '0'
</select>
<select id="getEquipMode" resultType="java.lang.String">
select isvalue from base_equipment_attached
where property = 'Mode'
and device_code = #{machineCode}
</select>
<insert id="insertProRfidProcessDetail" parameterType="ProRfidProcessDetail">
insert into pro_rfid_process_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="workorderCode != null and workorderCode != ''">workorder_code,</if>
<if test="rfid != null and rfid != ''">rfid,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="machineCode != null">machine_code,</if>
<if test="nowProcessId != null">now_process_id,</if>
<if test="nextProcessId != null">next_process_id,</if>
<if test="orderNum != null">order_num,</if>
<if test="inTime != null">in_time,</if>
<if test="outTime != null">out_time,</if>
<if test="status != null">status,</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="workBatchCode != null">work_batch_code,</if>
<if test="bindStatus != null">bind_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>
<if test="rfid != null and rfid != ''">#{rfid},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="machineCode != null">#{machineCode},</if>
<if test="nowProcessId != null">#{nowProcessId},</if>
<if test="nextProcessId != null">#{nextProcessId},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="inTime != null">#{inTime},</if>
<if test="outTime != null">#{outTime},</if>
<if test="status != null">#{status},</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="workBatchCode != null">#{workBatchCode},</if>
<if test="bindStatus != null">#{bindStatus},</if>
</trim>
</insert>
<update id="updateProRfidProcessDetail" parameterType="ProRfidProcessDetail">
update pro_rfid_process_detail
<trim prefix="SET" suffixOverrides=",">
<if test="workorderCode != null and workorderCode != ''">workorder_code = #{workorderCode},</if>
<if test="rfid != null and rfid != ''">rfid = #{rfid},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="machineCode != null">machine_code = #{machineCode},</if>
<if test="nowProcessId != null">now_process_id = #{nowProcessId},</if>
<if test="nextProcessId != null">next_process_id = #{nextProcessId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="inTime != null">in_time = #{inTime},</if>
<if test="outTime != null">out_time = #{outTime},</if>
<if test="status != null">status = #{status},</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="workBatchCode != null">work_batch_code = #{workBatchCode},</if>
<if test="bindStatus != null">bind_status = #{bindStatus},</if>
</trim>
where record_id = #{recordId}
</update>
<delete id="deleteProRfidProcessDetailByRecordId" parameterType="String">
delete from pro_rfid_process_detail where record_id = #{recordId}
</delete>
<delete id="deleteProRfidProcessDetailByRecordIds" parameterType="String">
delete from pro_rfid_process_detail where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>