|
|
|
<?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.MesMapper">
|
|
|
|
<!--手持指定下一机台-->
|
|
|
|
<insert id="saveRfidWithEquip">
|
|
|
|
insert into mes_next_machine
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="recordId != null">record_id,</if>
|
|
|
|
<if test="rfid != null and rfid != ''">rfid,</if>
|
|
|
|
<if test="nextMachineCode != null">next_machine_code,</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="factoryCode != null">factory_code,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="recordId != null">#{recordId},</if>
|
|
|
|
<if test="rfid != null and rfid != ''">#{rfid},</if>
|
|
|
|
<if test="nextMachineCode != null">#{nextMachineCode},</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="factoryCode != null">#{factoryCode},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
<insert id="addBatchLGInfo">
|
|
|
|
insert into pro_lg_used_log(
|
|
|
|
id,device_code,
|
|
|
|
used,used_unit,
|
|
|
|
createDate,lg_create_time,
|
|
|
|
factory_code,create_time
|
|
|
|
) values
|
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
|
(
|
|
|
|
#{item.id},#{item.deviceCode},
|
|
|
|
#{item.used},#{item.usedUnit},
|
|
|
|
#{item.createDate},#{item.lgCreateTime},
|
|
|
|
#{item.factoryCode},#{item.createTime}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<delete id="deleteDateByTableName">
|
|
|
|
delete from ${table} where #{ymdhms} > CONVERT(varchar(30),create_time, 120)
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="getWetPlanDetail" resultType="com.op.system.api.domain.dto.WCSDataItemsDTO">
|
|
|
|
select
|
|
|
|
bucket_code loadNo
|
|
|
|
from pro_wet_material_plan_detail
|
|
|
|
where material_code = #{sku} and CONVERT(varchar(10),plan_time, 120) = CONVERT(varchar(10),#{reqTime}, 120)
|
|
|
|
and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getAllEquipments" resultType="com.op.mes.domain.dto.BaseEquipmentDto">
|
|
|
|
select equipment_id equipmentId,
|
|
|
|
equipment_code equipmentCode,
|
|
|
|
equipment_name equipmentName,
|
|
|
|
equipment_type_code equipmentTypeCode,
|
|
|
|
equipment_type_name equipmentTypeName
|
|
|
|
from base_equipment
|
|
|
|
where del_flag = '0'
|
|
|
|
and status = '1'
|
|
|
|
<if test="equipmentTypeCode != null and equipmentTypeCode != ''">
|
|
|
|
and equipment_type_code = #{equipmentTypeCode}
|
|
|
|
</if>
|
|
|
|
<if test="equipmentCode != null and equipmentCode != ''">
|
|
|
|
and equipment_code like concat('%', #{equipmentCode}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="equipmentName != null and equipmentName != ''">
|
|
|
|
and equipment_name like concat('%', #{equipmentName}, '%')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="getTotalNum" resultType="com.op.system.api.domain.dto.BoardDTO">
|
|
|
|
select count(0) totalNum,
|
|
|
|
equ.equipment_type_code equTypeCode,
|
|
|
|
equ.equipment_type_name equTypeName
|
|
|
|
from mes_material_transfer_result mt
|
|
|
|
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
|
|
|
|
where CONVERT(varchar(10),mt.update_time, 120) = #{ymd} and equ.equipment_name is not null
|
|
|
|
and equ.equipment_type_code = #{equTypeCode}
|
|
|
|
<if test="shiftId != null and shiftId != ''">
|
|
|
|
and mt.shift_id = #{shiftId}
|
|
|
|
</if>
|
|
|
|
group by equ.equipment_type_code,
|
|
|
|
equ.equipment_type_name
|
|
|
|
</select>
|
|
|
|
<select id="getEveryNum" resultType="com.op.system.api.domain.dto.BoardDTO">
|
|
|
|
select count(0) totalNum,
|
|
|
|
mt.equipmentCode equCode,
|
|
|
|
equ.equipment_name equName,
|
|
|
|
equ.equipment_type_code equTypeCode
|
|
|
|
from mes_material_transfer_result mt
|
|
|
|
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
|
|
|
|
where CONVERT(varchar(10),mt.update_time, 120) = #{ymd} and equ.equipment_name is not null
|
|
|
|
and equ.equipment_type_code = #{equTypeCode}
|
|
|
|
<if test="shiftId != null and shiftId != ''">
|
|
|
|
and mt.shift_id = #{shiftId}
|
|
|
|
</if>
|
|
|
|
group by mt.equipmentCode,
|
|
|
|
equ.equipment_name,
|
|
|
|
equ.equipment_type_code
|
|
|
|
</select>
|
|
|
|
<select id="getBoardFactory" resultType="com.op.system.api.domain.SysDept">
|
|
|
|
select dept_id parentName,
|
|
|
|
dept_name deptName
|
|
|
|
from sys_dept where parent_id = '1' and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getTotalNumL" resultType="com.op.system.api.domain.dto.BoardDTO">
|
|
|
|
select count(0) totalNum,
|
|
|
|
equ.equipment_type_code equTypeCode,
|
|
|
|
equ.equipment_type_name equTypeName
|
|
|
|
from mes_material_transfer_result mt
|
|
|
|
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
|
|
|
|
where CONVERT(varchar(10),mt.create_time, 120) = #{ymd} and equ.equipment_name is not null
|
|
|
|
and equ.equipment_type_code = #{equTypeCode} and mt.status = 2
|
|
|
|
<if test="shiftId != null and shiftId != ''">
|
|
|
|
and mt.shift_id = #{shiftId}
|
|
|
|
</if>
|
|
|
|
group by equ.equipment_type_code,
|
|
|
|
equ.equipment_type_name
|
|
|
|
</select>
|
|
|
|
<select id="getEveryNumL" resultType="com.op.system.api.domain.dto.BoardDTO">
|
|
|
|
select count(0) totalNum,
|
|
|
|
mt.equipmentCode equCode,
|
|
|
|
equ.equipment_name equName,
|
|
|
|
equ.equipment_type_code equTypeCode
|
|
|
|
from mes_material_transfer_result mt
|
|
|
|
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
|
|
|
|
where CONVERT(varchar(10),mt.create_time, 120) = #{ymd} and equ.equipment_name is not null
|
|
|
|
and equ.equipment_type_code = #{equTypeCode} and mt.status = 2
|
|
|
|
<if test="shiftId != null and shiftId != ''">
|
|
|
|
and mt.shift_id = #{shiftId}
|
|
|
|
</if>
|
|
|
|
group by mt.equipmentCode,
|
|
|
|
equ.equipment_name,
|
|
|
|
equ.equipment_type_code
|
|
|
|
</select>
|
|
|
|
<!--创建新表-->
|
|
|
|
<insert id="createNewTable">
|
|
|
|
SELECT TOP 0 * INTO ${tableNew} FROM mes_material_transfer_result
|
|
|
|
</insert>
|
|
|
|
<insert id="addSapLog">
|
|
|
|
insert into sys_sap_log
|
|
|
|
(id,messsge,create_time,reqcode,method,remark,status)
|
|
|
|
values(
|
|
|
|
#{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status})
|
|
|
|
</insert>
|
|
|
|
<select id="copyBkDateByTable">
|
|
|
|
insert into ${table}
|
|
|
|
select * FROM mes_material_transfer_result
|
|
|
|
where create_time >= #{startDate} and #{endDate}>create_time
|
|
|
|
</select>
|
|
|
|
<select id="selectcxjList" resultType="java.util.Map">
|
|
|
|
SELECT * FROM [dbo].[base_equipment] WHERE equipment_type_code='equ_type_cxj'
|
|
|
|
</select>
|
|
|
|
<delete id="deleteBkDateByTable">
|
|
|
|
delete from mes_material_transfer_result
|
|
|
|
where create_time >= #{startDate} and #{endDate}>create_time
|
|
|
|
</delete>
|
|
|
|
<delete id="deleteBkDate">
|
|
|
|
delete from ${table}
|
|
|
|
where create_time >= #{startDate} and #{endDate}>create_time
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
</mapper>
|