酸轧数据同步,轧辊新增产线新增各种产线
This commit is contained in:
@@ -2,26 +2,28 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.mes.roll.mapper.MesRollChangeMapper">
|
||||
|
||||
<!-- 查询指定机架最新一次换辊记录(即当前在机轧辊) -->
|
||||
<!-- 查询指定产线+机架最新一次换辊记录(即当前在机轧辊) -->
|
||||
<select id="selectLatestByStand" resultType="com.klp.mes.roll.domain.vo.MesRollChangeVo">
|
||||
SELECT change_id, change_no, change_time, stand_no, change_type, change_status, operator,
|
||||
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,
|
||||
remark, create_time
|
||||
FROM mes_roll_change
|
||||
WHERE del_flag = 0
|
||||
AND stand_no = #{standNo}
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
ORDER BY change_time DESC, change_id DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 按辊位查最新非空换辊记录(支持部分换辊) -->
|
||||
<select id="selectLatestByStandAndPosition" resultType="com.klp.mes.roll.domain.vo.MesRollChangeVo">
|
||||
SELECT change_id, change_no, change_time, stand_no, operator,
|
||||
SELECT change_id, line_id, change_no, change_time, stand_no, 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
|
||||
FROM mes_roll_change
|
||||
WHERE del_flag = 0 AND stand_no = #{standNo}
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
<choose>
|
||||
<when test="posType == 'upperWr'">AND upper_wr_no IS NOT NULL AND upper_wr_no != ''</when>
|
||||
<when test="posType == 'lowerWr'">AND lower_wr_no IS NOT NULL AND lower_wr_no != ''</when>
|
||||
@@ -35,24 +37,25 @@
|
||||
<!-- 组合查询各辊位当前实际在机状态(每个位置独立取最新非空记录) -->
|
||||
<select id="selectCurrentStateByStand" resultType="map">
|
||||
SELECT
|
||||
(SELECT upper_wr_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND upper_wr_no IS NOT NULL AND upper_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperWrNo,
|
||||
(SELECT upper_wr_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND upper_wr_no IS NOT NULL AND upper_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperWrDia,
|
||||
(SELECT lower_wr_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND lower_wr_no IS NOT NULL AND lower_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerWrNo,
|
||||
(SELECT lower_wr_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND lower_wr_no IS NOT NULL AND lower_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerWrDia,
|
||||
(SELECT upper_br_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND upper_br_no IS NOT NULL AND upper_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperBrNo,
|
||||
(SELECT upper_br_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND upper_br_no IS NOT NULL AND upper_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperBrDia,
|
||||
(SELECT lower_br_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND lower_br_no IS NOT NULL AND lower_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerBrNo,
|
||||
(SELECT lower_br_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 AND lower_br_no IS NOT NULL AND lower_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerBrDia,
|
||||
(SELECT MAX(change_time) FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0) AS changeTime
|
||||
(SELECT upper_wr_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND upper_wr_no IS NOT NULL AND upper_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperWrNo,
|
||||
(SELECT upper_wr_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND upper_wr_no IS NOT NULL AND upper_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperWrDia,
|
||||
(SELECT lower_wr_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND lower_wr_no IS NOT NULL AND lower_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerWrNo,
|
||||
(SELECT lower_wr_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND lower_wr_no IS NOT NULL AND lower_wr_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerWrDia,
|
||||
(SELECT upper_br_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND upper_br_no IS NOT NULL AND upper_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperBrNo,
|
||||
(SELECT upper_br_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND upper_br_no IS NOT NULL AND upper_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS upperBrDia,
|
||||
(SELECT lower_br_no FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND lower_br_no IS NOT NULL AND lower_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerBrNo,
|
||||
(SELECT lower_br_dia FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if> AND lower_br_no IS NOT NULL AND lower_br_no != '' ORDER BY change_time DESC, change_id DESC LIMIT 1) AS lowerBrDia,
|
||||
(SELECT MAX(change_time) FROM mes_roll_change WHERE stand_no = #{standNo} AND del_flag = 0 <if test="lineId != null">AND line_id = #{lineId}</if>) AS changeTime
|
||||
</select>
|
||||
|
||||
<!-- 查询同机架在本次换辊之后最近一次换辊的时间 -->
|
||||
<!-- 查询同产线+机架在本次换辊之后最近一次换辊的时间 -->
|
||||
<select id="selectNextChangeTime" resultType="java.util.Date">
|
||||
SELECT MIN(change_time)
|
||||
FROM mes_roll_change
|
||||
WHERE del_flag = 0
|
||||
AND stand_no = #{standNo}
|
||||
AND change_time > #{changeTime}
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
SELECT status, COUNT(*) AS cnt
|
||||
FROM mes_roll_info
|
||||
WHERE del_flag = 0
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
GROUP BY status
|
||||
</select>
|
||||
|
||||
@@ -15,6 +16,7 @@
|
||||
SELECT roll_no FROM mes_roll_info
|
||||
WHERE del_flag = 0
|
||||
AND status != 'Scrapped'
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
<if test="rollType != null and rollType != ''">
|
||||
AND roll_type = #{rollType}
|
||||
</if>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.mes.roll.mapper.MesRollStandbyMapper">
|
||||
|
||||
<!-- 按机架查询下批轧辊,附带辊位中文标签 -->
|
||||
<!-- 按产线+机架查询下批轧辊,附带辊位中文标签 -->
|
||||
<select id="selectByStand" resultType="com.klp.mes.roll.domain.vo.MesRollStandbyVo">
|
||||
SELECT
|
||||
standby_id, stand_no, roll_no, roll_type, position,
|
||||
standby_id, line_id, stand_no, roll_no, roll_type, position,
|
||||
CASE
|
||||
WHEN roll_type = 'BR' AND position = 'UP' THEN '上支撑辊'
|
||||
WHEN roll_type = 'WR' AND position = 'UP' THEN '上工作辊'
|
||||
@@ -17,17 +17,19 @@
|
||||
FROM mes_roll_standby
|
||||
WHERE del_flag = 0
|
||||
AND stand_no = #{standNo}
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
ORDER BY
|
||||
FIELD(roll_type, 'BR', 'WR', 'WR', 'BR'),
|
||||
FIELD(position, 'UP', 'UP', 'DOWN', 'DOWN')
|
||||
</select>
|
||||
|
||||
<!-- 逻辑删除指定机架所有下批轧辊(清空) -->
|
||||
<!-- 逻辑删除指定产线+机架所有下批轧辊(清空) -->
|
||||
<update id="clearByStand">
|
||||
UPDATE mes_roll_standby
|
||||
SET del_flag = 1
|
||||
WHERE del_flag = 0
|
||||
AND stand_no = #{standNo}
|
||||
<if test="lineId != null">AND line_id = #{lineId}</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user