feat(mill): 添加换辊记录管理功能
- 新增换辊记录领域模型 MesRollChange 和 MesRollStandby - 实现换辊记录服务接口 IMesRollChangeService 和 IMesRollStandbyService - 添加换辊记录控制器 MesRollChangeController 提供 REST API - 实现换辊记录数据访问层 MesRollChangeMapper 和映射配置文件 - 添加换辊记录业务逻辑实现类 MesRollChangeServiceImpl - 实现查询当前在机轧辊和轧辊工作绩效统计功能 - 扩展轧辊信息 Mapper 支持条件更新轧辊状态操作
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
<?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">
|
||||
SELECT <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>
|
||||
@@ -171,4 +171,13 @@
|
||||
WHERE del_flag = 0 AND roll_id = #{rollId}
|
||||
</update>
|
||||
|
||||
<!-- 条件更新轧辊状态 — 仅当当前状态为 oldStatus 时才更新 -->
|
||||
<update id="updateStatusByRollNoIfStatus">
|
||||
UPDATE mes_roll_info
|
||||
SET status = #{newStatus}, update_time = NOW()
|
||||
WHERE del_flag = 0
|
||||
AND roll_no = #{rollNo}
|
||||
AND status = #{oldStatus}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?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.MesRollStandbyMapper">
|
||||
|
||||
<resultMap type="MesRollStandby" id="MesRollStandbyResult">
|
||||
<result property="standbyId" column="standby_id" />
|
||||
<result property="lineId" column="line_id" />
|
||||
<result property="standNo" column="stand_no" />
|
||||
<result property="rollNo" column="roll_no" />
|
||||
<result property="rollType" column="roll_type" />
|
||||
<result property="position" column="position" />
|
||||
<result property="diameter" column="diameter" />
|
||||
<result property="roughness" column="roughness" />
|
||||
<result property="crown" column="crown" />
|
||||
<result property="readyTime" column="ready_time" />
|
||||
<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="selectMesRollStandbyVo">
|
||||
select standby_id, line_id, stand_no, roll_no, roll_type, position, diameter, roughness, crown, ready_time, del_flag, create_by, create_time, update_by, update_time, remark from mes_roll_standby
|
||||
</sql>
|
||||
|
||||
<select id="selectMesRollStandbyList" parameterType="MesRollStandby" resultMap="MesRollStandbyResult">
|
||||
<include refid="selectMesRollStandbyVo"/>
|
||||
<where>
|
||||
<if test="lineId != null "> and line_id = #{lineId}</if>
|
||||
<if test="standNo != null and standNo != ''"> and stand_no = #{standNo}</if>
|
||||
<if test="rollNo != null and rollNo != ''"> and roll_no = #{rollNo}</if>
|
||||
<if test="rollType != null and rollType != ''"> and roll_type = #{rollType}</if>
|
||||
<if test="position != null and position != ''"> and position = #{position}</if>
|
||||
<if test="diameter != null "> and diameter = #{diameter}</if>
|
||||
<if test="roughness != null "> and roughness = #{roughness}</if>
|
||||
<if test="crown != null "> and crown = #{crown}</if>
|
||||
<if test="readyTime != null "> and ready_time = #{readyTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMesRollStandbyByStandbyId" parameterType="Long" resultMap="MesRollStandbyResult">
|
||||
<include refid="selectMesRollStandbyVo"/>
|
||||
where standby_id = #{standbyId}
|
||||
</select>
|
||||
|
||||
<insert id="insertMesRollStandby" parameterType="MesRollStandby" useGeneratedKeys="true" keyProperty="standbyId">
|
||||
insert into mes_roll_standby
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="lineId != null">line_id,</if>
|
||||
<if test="standNo != null">stand_no,</if>
|
||||
<if test="rollNo != null">roll_no,</if>
|
||||
<if test="rollType != null">roll_type,</if>
|
||||
<if test="position != null">position,</if>
|
||||
<if test="diameter != null">diameter,</if>
|
||||
<if test="roughness != null">roughness,</if>
|
||||
<if test="crown != null">crown,</if>
|
||||
<if test="readyTime != null">ready_time,</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="standNo != null">#{standNo},</if>
|
||||
<if test="rollNo != null">#{rollNo},</if>
|
||||
<if test="rollType != null">#{rollType},</if>
|
||||
<if test="position != null">#{position},</if>
|
||||
<if test="diameter != null">#{diameter},</if>
|
||||
<if test="roughness != null">#{roughness},</if>
|
||||
<if test="crown != null">#{crown},</if>
|
||||
<if test="readyTime != null">#{readyTime},</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="updateMesRollStandby" parameterType="MesRollStandby">
|
||||
update mes_roll_standby
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="lineId != null">line_id = #{lineId},</if>
|
||||
<if test="standNo != null">stand_no = #{standNo},</if>
|
||||
<if test="rollNo != null">roll_no = #{rollNo},</if>
|
||||
<if test="rollType != null">roll_type = #{rollType},</if>
|
||||
<if test="position != null">position = #{position},</if>
|
||||
<if test="diameter != null">diameter = #{diameter},</if>
|
||||
<if test="roughness != null">roughness = #{roughness},</if>
|
||||
<if test="crown != null">crown = #{crown},</if>
|
||||
<if test="readyTime != null">ready_time = #{readyTime},</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 standby_id = #{standbyId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMesRollStandbyByStandbyId" parameterType="Long">
|
||||
delete from mes_roll_standby where standby_id = #{standbyId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMesRollStandbyByStandbyIds" parameterType="String">
|
||||
delete from mes_roll_standby where standby_id in
|
||||
<foreach item="standbyId" collection="array" open="(" separator="," close=")">
|
||||
#{standbyId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectByStand" resultMap="MesRollStandbyResult">
|
||||
<include refid="selectMesRollStandbyVo"/>
|
||||
where line_id = #{lineId} and stand_no = #{standNo}
|
||||
</select>
|
||||
|
||||
<delete id="clearByStand">
|
||||
delete from mes_roll_standby
|
||||
where line_id = #{lineId} and stand_no = #{standNo}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user