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.
339 lines
15 KiB
XML
339 lines
15 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.MesLineAssistantQtyMapper">
|
|
|
|
<resultMap type="MesLineAssistantQty" id="MesLineAssistantQtyResult">
|
|
<result property="id" column="id"/>
|
|
<result property="factoryCode" column="factory_code"/>
|
|
<result property="productDate" column="product_date"/>
|
|
<result property="monitorQty" column="monitor_qty"/>
|
|
<result property="groupleaderQty" column="groupLeader_qty"/>
|
|
<result property="materialQty" column="material_qty"/>
|
|
<result property="pillMgrQty" column="pill_mgr_qty"/>
|
|
<result property="pillDisQty" column="pill_dis_qty"/>
|
|
<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"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectMesLineAssistantQtyVo">
|
|
select id, factory_code, product_date, monitor_qty, groupLeader_qty,
|
|
material_qty, pill_mgr_qty, pill_dis_qty, attr1, attr2, attr3, attr4, create_by,
|
|
create_time, update_by, update_time
|
|
from mes_line_assistant_qty
|
|
</sql>
|
|
|
|
<select id="selectMesLineAssistantQtyList" parameterType="MesLineAssistantQty" resultMap="MesLineAssistantQtyResult">
|
|
<include refid="selectMesLineAssistantQtyVo"/>
|
|
<where>
|
|
<if test="factoryCode != null ">
|
|
and factory_code = #{factoryCode}
|
|
</if>
|
|
<if test="productDate != null ">
|
|
and product_date = #{productDate}
|
|
</if>
|
|
<if test="monitorQty != null ">
|
|
and monitor_qty = #{monitorQty}
|
|
</if>
|
|
<if test="groupleaderQty != null ">
|
|
and groupLeader_qty = #{groupleaderQty}
|
|
</if>
|
|
<if test="materialQty != null ">
|
|
and material_qty = #{materialQty}
|
|
</if>
|
|
<if test="pillMgrQty != null ">
|
|
and pill_mgr_qty = #{pillMgrQty}
|
|
</if>
|
|
<if test="pillDisQty != null ">
|
|
and pill_dis_qty = #{pillDisQty}
|
|
</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>
|
|
</where>
|
|
order by create_time
|
|
</select>
|
|
|
|
<select id="selectMesLineAssistantQtyById" parameterType="String"
|
|
resultMap="MesLineAssistantQtyResult">
|
|
<include refid="selectMesLineAssistantQtyVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
<select id="getHasdate" resultType="java.lang.String">
|
|
select product_date
|
|
from mes_line_assistant_qty
|
|
where product_date = #{productDate}
|
|
</select>
|
|
<select id="selectEfficiencyHourList" resultType="com.op.mes.domain.vo.MesLineAssistantQtyVo">
|
|
select pow.product_date productDate,
|
|
'小榄' factoryCode,
|
|
be.department carCode,
|
|
be.sap_code lineCode,
|
|
pow.product_name productName,
|
|
pow.workorder_code workorderCode
|
|
from pro_order_workorder pow
|
|
left join base_equipment be on be.equipment_code = pow.workorder_name
|
|
where pow.parent_order = '0'
|
|
and pow.del_flag = '0'
|
|
<if test="productDateStr != null">
|
|
and pow.product_date = #{productDateStr}
|
|
</if>
|
|
<if test="carCode != null">
|
|
and be.department like concat('%',#{carCode},'%')
|
|
</if>
|
|
<!--
|
|
<if test="lineCode != null">
|
|
and be.sap_code like concat('%',#{lineCode},'%')
|
|
</if>
|
|
<if test="productName != null">
|
|
and pow.product_name like concat('%',#{productName},'%')
|
|
</if>-->
|
|
and pow.workorder_name is not null and pow.status in('w3','w4')
|
|
</select>
|
|
<select id="getHoursByOrderCode" resultType="java.math.BigDecimal">
|
|
select sum(work_time) from mes_report_work
|
|
where workorder_code = #{workorderCode}
|
|
and del_flag ='0' and parent_order = '0'
|
|
</select>
|
|
<select id="getAssistMaps" resultType="com.op.mes.domain.MesLineAssistantQty">
|
|
select
|
|
product_date productDateStr,
|
|
monitor_qty monitorQty,
|
|
groupLeader_qty groupLeaderQty,
|
|
material_qty materialQty,
|
|
pill_mgr_qty pillMgrQty,
|
|
pill_dis_qty pillDisQty
|
|
from mes_line_assistant_qty
|
|
where product_date = #{productDateStr}
|
|
</select>
|
|
<select id="getKqHourMaps" resultType="java.math.BigDecimal">
|
|
select sum(
|
|
case when DATEDIFF ( hour , stime.time0 , etime.time0 ) is null then '0'
|
|
else DATEDIFF ( hour , stime.time0 , etime.time0 ) end) productHour
|
|
from lanju_op_cloud.dbo.sys_user su
|
|
left join lanju_op_cloud.dbo.sys_user_post sup on su.user_id = sup.user_id
|
|
left join (
|
|
select min(clock_time) time0,workno from mes_clock_record where convert(char(10),clock_time,120) = #{productDateStr} GROUP BY workno
|
|
) stime on stime.workno = su.user_name
|
|
left join (
|
|
select max(clock_time) time0,workno from mes_clock_record where convert(char(10),clock_time,120) = #{productDateStr} GROUP BY workno
|
|
) etime on etime.workno = su.user_name
|
|
where su.del_flag = '0' and sup.post_id = #{postId}
|
|
</select>
|
|
<select id="selectEfficiencyDayList" resultType="com.op.mes.domain.vo.MesDailyEfficiencyVo">
|
|
select pow.product_date productDate,
|
|
'小榄' factoryCode,
|
|
be.department carCode,
|
|
be.sap_code lineCode,
|
|
bpa.category,
|
|
pow.product_code productCode,
|
|
pow.product_name productName,
|
|
bp.umrez spec,
|
|
'件' unit,
|
|
pow.workorder_code workorderCode,
|
|
sdd.remark effUpBase,
|
|
sdd2.dict_value upGoal
|
|
from pro_order_workorder pow
|
|
left join base_equipment be on be.equipment_code = pow.workorder_name
|
|
left join base_product bp on bp.product_code = pow.product_code
|
|
left join base_product_attached bpa on concat('0000000',bpa.product_code) = pow.product_code
|
|
left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_label = bpa.category and sdd.dict_type = 'sys_category'
|
|
left join base_dict_data sdd2 on sdd2.dict_label = convert(char(4),pow.product_date,120) and sdd2.dict_type = 'year_goal'
|
|
where pow.parent_order = '0'
|
|
and pow.del_flag = '0'
|
|
<if test="productDateStr != null">
|
|
and pow.product_date = #{productDateStr}
|
|
</if>
|
|
<if test="carCode != null">
|
|
and be.department like concat('%',#{carCode},'%')
|
|
</if>
|
|
<if test="lineCode != null">
|
|
and be.sap_code like concat('%',#{lineCode},'%')
|
|
</if>
|
|
<if test="productName != null">
|
|
and pow.product_name like concat('%',#{productName},'%')
|
|
</if>
|
|
and pow.workorder_name is not null and pow.status in('w3','w4')
|
|
</select>
|
|
<select id="getPlanQtyByOrderCode" resultType="java.math.BigDecimal">
|
|
select sum(quantity_split) from pro_order_workorder
|
|
where workorder_code = #{workorderCode}
|
|
and del_flag ='0' and parent_order = '0'
|
|
</select>
|
|
<select id="getActQtyByOrderCode" resultType="java.math.BigDecimal">
|
|
select sum(quantity_feedback) from mes_report_work
|
|
where workorder_code = #{workorderCode}
|
|
and del_flag ='0' and parent_order = '0'
|
|
</select>
|
|
<select id="getStandarInfo" resultType="com.op.mes.domain.MesLineProduct">
|
|
SELECT
|
|
mlp.hour_efficiency hourEfficiency,
|
|
mlp.use_man useMan
|
|
FROM
|
|
mes_line_product mlp
|
|
left join base_equipment be on mlp.line_code = be.equipment_code
|
|
WHERE
|
|
mlp.product_code = #{productCode}
|
|
AND be.sap_code = #{lineCode}
|
|
AND mlp.del_flag = '0'
|
|
</select>
|
|
<select id="getSonActManByOrderCode" resultType="com.op.mes.domain.MesReportWork">
|
|
select use_man useMan,
|
|
sum(work_time) workTime
|
|
from mes_report_work
|
|
where del_flag ='0' and parent_order = #{workorderCode}
|
|
group by use_man
|
|
</select>
|
|
|
|
<insert id="insertMesLineAssistantQty" parameterType="MesLineAssistantQty">
|
|
insert into mes_line_assistant_qty
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,
|
|
</if>
|
|
<if test="factoryCode != null">factory_code,
|
|
</if>
|
|
<if test="productDate != null">product_date,
|
|
</if>
|
|
<if test="monitorQty != null">monitor_qty,
|
|
</if>
|
|
<if test="groupleaderQty != null">groupLeader_qty,
|
|
</if>
|
|
<if test="materialQty != null">material_qty,
|
|
</if>
|
|
<if test="pillMgrQty != null">pill_mgr_qty,
|
|
</if>
|
|
<if test="pillDisQty != null">pill_dis_qty,
|
|
</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},
|
|
</if>
|
|
<if test="factoryCode != null">#{factoryCode},
|
|
</if>
|
|
<if test="productDate != null">#{productDate},
|
|
</if>
|
|
<if test="monitorQty != null">#{monitorQty},
|
|
</if>
|
|
<if test="groupleaderQty != null">#{groupleaderQty},
|
|
</if>
|
|
<if test="materialQty != null">#{materialQty},
|
|
</if>
|
|
<if test="pillMgrQty != null">#{pillMgrQty},
|
|
</if>
|
|
<if test="pillDisQty != null">#{pillDisQty},
|
|
</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateMesLineAssistantQty" parameterType="MesLineAssistantQty">
|
|
update mes_line_assistant_qty
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="factoryCode != null">factory_code =
|
|
#{factoryCode},
|
|
</if>
|
|
<if test="productDate != null">product_date =
|
|
#{productDate},
|
|
</if>
|
|
<if test="monitorQty != null">monitor_qty =
|
|
#{monitorQty},
|
|
</if>
|
|
<if test="groupleaderQty != null">groupLeader_qty =
|
|
#{groupleaderQty},
|
|
</if>
|
|
<if test="materialQty != null">material_qty =
|
|
#{materialQty},
|
|
</if>
|
|
<if test="pillMgrQty != null">pill_mgr_qty =
|
|
#{pillMgrQty},
|
|
</if>
|
|
<if test="pillDisQty != null">pill_dis_qty =
|
|
#{pillDisQty},
|
|
</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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteMesLineAssistantQtyById" parameterType="String">
|
|
delete from mes_line_assistant_qty where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteMesLineAssistantQtyByIds" parameterType="String">
|
|
delete from mes_line_assistant_qty where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|