194 lines
11 KiB
XML
194 lines
11 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.ruoyi.mill.mapper.MesRollChangeMapper">
|
|
|
|
<resultMap type="MesRollChange" id="MesRollChangeResult">
|
|
<result property="changeId" column="change_id" />
|
|
<result property="lineId" column="line_id" />
|
|
<result property="changeNo" column="change_no" />
|
|
<result property="changeTime" column="change_time" />
|
|
<result property="standNo" column="stand_no" />
|
|
<result property="changeType" column="change_type" />
|
|
<result property="changeStatus" column="change_status" />
|
|
<result property="operator" column="operator" />
|
|
<result property="upperWrNo" column="upper_wr_no" />
|
|
<result property="upperWrDia" column="upper_wr_dia" />
|
|
<result property="lowerWrNo" column="lower_wr_no" />
|
|
<result property="lowerWrDia" column="lower_wr_dia" />
|
|
<result property="upperBrNo" column="upper_br_no" />
|
|
<result property="upperBrDia" column="upper_br_dia" />
|
|
<result property="lowerBrNo" column="lower_br_no" />
|
|
<result property="lowerBrDia" column="lower_br_dia" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<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="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectMesRollChangeVo">
|
|
select change_id, line_id, change_no, change_time, stand_no, change_type, change_status, operator, upper_wr_no, upper_wr_dia, lower_wr_no, lower_wr_dia, upper_br_no, upper_br_dia, lower_br_no, lower_br_dia, del_flag, create_by, create_time, update_by, update_time, remark from mes_roll_change
|
|
</sql>
|
|
|
|
<select id="selectMesRollChangeList" parameterType="MesRollChange" resultMap="MesRollChangeResult">
|
|
<include refid="selectMesRollChangeVo"/>
|
|
<where>
|
|
<if test="lineId != null "> and line_id = #{lineId}</if>
|
|
<if test="changeNo != null and changeNo != ''"> and change_no = #{changeNo}</if>
|
|
<if test="changeTime != null "> and change_time = #{changeTime}</if>
|
|
<if test="standNo != null and standNo != ''"> and stand_no = #{standNo}</if>
|
|
<if test="changeType != null and changeType != ''"> and change_type = #{changeType}</if>
|
|
<if test="changeStatus != null and changeStatus != ''"> and change_status = #{changeStatus}</if>
|
|
<if test="operator != null and operator != ''"> and operator = #{operator}</if>
|
|
<if test="upperWrNo != null and upperWrNo != ''"> and upper_wr_no = #{upperWrNo}</if>
|
|
<if test="upperWrDia != null "> and upper_wr_dia = #{upperWrDia}</if>
|
|
<if test="lowerWrNo != null and lowerWrNo != ''"> and lower_wr_no = #{lowerWrNo}</if>
|
|
<if test="lowerWrDia != null "> and lower_wr_dia = #{lowerWrDia}</if>
|
|
<if test="upperBrNo != null and upperBrNo != ''"> and upper_br_no = #{upperBrNo}</if>
|
|
<if test="upperBrDia != null "> and upper_br_dia = #{upperBrDia}</if>
|
|
<if test="lowerBrNo != null and lowerBrNo != ''"> and lower_br_no = #{lowerBrNo}</if>
|
|
<if test="lowerBrDia != null "> and lower_br_dia = #{lowerBrDia}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectMesRollChangeByChangeId" parameterType="Long" resultMap="MesRollChangeResult">
|
|
<include refid="selectMesRollChangeVo"/>
|
|
where change_id = #{changeId}
|
|
</select>
|
|
|
|
<insert id="insertMesRollChange" parameterType="MesRollChange" useGeneratedKeys="true" keyProperty="changeId">
|
|
insert into mes_roll_change
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="lineId != null">line_id,</if>
|
|
<if test="changeNo != null">change_no,</if>
|
|
<if test="changeTime != null">change_time,</if>
|
|
<if test="standNo != null">stand_no,</if>
|
|
<if test="changeType != null">change_type,</if>
|
|
<if test="changeStatus != null">change_status,</if>
|
|
<if test="operator != null">operator,</if>
|
|
<if test="upperWrNo != null">upper_wr_no,</if>
|
|
<if test="upperWrDia != null">upper_wr_dia,</if>
|
|
<if test="lowerWrNo != null">lower_wr_no,</if>
|
|
<if test="lowerWrDia != null">lower_wr_dia,</if>
|
|
<if test="upperBrNo != null">upper_br_no,</if>
|
|
<if test="upperBrDia != null">upper_br_dia,</if>
|
|
<if test="lowerBrNo != null">lower_br_no,</if>
|
|
<if test="lowerBrDia != null">lower_br_dia,</if>
|
|
<if test="delFlag != null">del_flag,</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="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="lineId != null">#{lineId},</if>
|
|
<if test="changeNo != null">#{changeNo},</if>
|
|
<if test="changeTime != null">#{changeTime},</if>
|
|
<if test="standNo != null">#{standNo},</if>
|
|
<if test="changeType != null">#{changeType},</if>
|
|
<if test="changeStatus != null">#{changeStatus},</if>
|
|
<if test="operator != null">#{operator},</if>
|
|
<if test="upperWrNo != null">#{upperWrNo},</if>
|
|
<if test="upperWrDia != null">#{upperWrDia},</if>
|
|
<if test="lowerWrNo != null">#{lowerWrNo},</if>
|
|
<if test="lowerWrDia != null">#{lowerWrDia},</if>
|
|
<if test="upperBrNo != null">#{upperBrNo},</if>
|
|
<if test="upperBrDia != null">#{upperBrDia},</if>
|
|
<if test="lowerBrNo != null">#{lowerBrNo},</if>
|
|
<if test="lowerBrDia != null">#{lowerBrDia},</if>
|
|
<if test="delFlag != null">#{delFlag},</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="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateMesRollChange" parameterType="MesRollChange">
|
|
update mes_roll_change
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="lineId != null">line_id = #{lineId},</if>
|
|
<if test="changeNo != null">change_no = #{changeNo},</if>
|
|
<if test="changeTime != null">change_time = #{changeTime},</if>
|
|
<if test="standNo != null">stand_no = #{standNo},</if>
|
|
<if test="changeType != null">change_type = #{changeType},</if>
|
|
<if test="changeStatus != null">change_status = #{changeStatus},</if>
|
|
<if test="operator != null">operator = #{operator},</if>
|
|
<if test="upperWrNo != null">upper_wr_no = #{upperWrNo},</if>
|
|
<if test="upperWrDia != null">upper_wr_dia = #{upperWrDia},</if>
|
|
<if test="lowerWrNo != null">lower_wr_no = #{lowerWrNo},</if>
|
|
<if test="lowerWrDia != null">lower_wr_dia = #{lowerWrDia},</if>
|
|
<if test="upperBrNo != null">upper_br_no = #{upperBrNo},</if>
|
|
<if test="upperBrDia != null">upper_br_dia = #{upperBrDia},</if>
|
|
<if test="lowerBrNo != null">lower_br_no = #{lowerBrNo},</if>
|
|
<if test="lowerBrDia != null">lower_br_dia = #{lowerBrDia},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</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="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where change_id = #{changeId}
|
|
</update>
|
|
|
|
<delete id="deleteMesRollChangeByChangeId" parameterType="Long">
|
|
delete from mes_roll_change where change_id = #{changeId}
|
|
</delete>
|
|
|
|
<delete id="deleteMesRollChangeByChangeIds" parameterType="String">
|
|
delete from mes_roll_change where change_id in
|
|
<foreach item="changeId" collection="array" open="(" separator="," close=")">
|
|
#{changeId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 查询指定机架当前各辊位状态(最近一次换辊记录) -->
|
|
<select id="selectCurrentStateByStand" resultType="map">
|
|
SELECT change_time AS changeTime,
|
|
upper_wr_no AS upperWrNo,
|
|
upper_wr_dia AS upperWrDia,
|
|
lower_wr_no AS lowerWrNo,
|
|
lower_wr_dia AS lowerWrDia,
|
|
upper_br_no AS upperBrNo,
|
|
upper_br_dia AS upperBrDia,
|
|
lower_br_no AS lowerBrNo,
|
|
lower_br_dia AS lowerBrDia
|
|
FROM mes_roll_change
|
|
WHERE line_id = #{lineId} AND stand_no = #{standNo}
|
|
ORDER BY change_id DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<!-- 查询指定机架+辊位的最新换辊记录 -->
|
|
<select id="selectLatestByStandAndPosition" resultMap="MesRollChangeResult">
|
|
<include refid="selectMesRollChangeVo"/>
|
|
FROM mes_roll_change
|
|
WHERE line_id = #{lineId} AND stand_no = #{standNo}
|
|
AND (
|
|
(#{posType} = 'upperWr' AND upper_wr_no IS NOT NULL)
|
|
OR (#{posType} = 'lowerWr' AND lower_wr_no IS NOT NULL)
|
|
OR (#{posType} = 'upperBr' AND upper_br_no IS NOT NULL)
|
|
OR (#{posType} = 'lowerBr' AND lower_br_no IS NOT NULL)
|
|
)
|
|
ORDER BY change_id DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<!-- 统计某次换辊以来的钢卷产量 -->
|
|
<select id="selectCoilStats" resultType="map">
|
|
SELECT COALESCE(SUM(exit_length), 0) AS workLength,
|
|
COUNT(*) AS coilCount,
|
|
COALESCE(SUM(actual_weight), 0) AS totalWeight
|
|
FROM mill_production_actual
|
|
WHERE del_flag = 0
|
|
AND start_time >= #{startTime}
|
|
<if test="endTime != null">AND start_time <= #{endTime}</if>
|
|
</select>
|
|
</mapper>
|