Compare commits
1 Commits
21a1d339d5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 6acb7b4b40 |
@@ -104,14 +104,12 @@ public class MesRollStandbyController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空指定机架所有备辊,同时回退轧辊状态
|
||||
* 清空指定产线+机架的全部下批轧辊
|
||||
* DELETE /mill/standby/clear?lineId=xxx&standNo=1%23
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mill:standby:remove')")
|
||||
@Log(title = "下批轧辊(待换上)", businessType = BusinessType.DELETE)
|
||||
@Log(title = "下批轧辊", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/clear")
|
||||
public AjaxResult clearByStand(@RequestParam Long lineId, @RequestParam String standNo)
|
||||
{
|
||||
public AjaxResult clear(Long lineId, @RequestParam String standNo) {
|
||||
return toAjax(mesRollStandbyService.clearByStand(lineId, standNo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,14 @@ public class MesRollStandbyVo {
|
||||
private String rollNo;
|
||||
private String rollType;
|
||||
private String position;
|
||||
/** 辊位中文标签(上支撑辊/上工作辊/下工作辊/下支撑辊) */
|
||||
private String positionLabel;
|
||||
private BigDecimal diameter;
|
||||
private BigDecimal roughness;
|
||||
private BigDecimal crown;
|
||||
private Date readyTime;
|
||||
private String remark;
|
||||
private Date createTime;
|
||||
|
||||
public Long getStandbyId() { return standbyId; }
|
||||
public void setStandbyId(Long standbyId) { this.standbyId = standbyId; }
|
||||
@@ -37,6 +41,9 @@ public class MesRollStandbyVo {
|
||||
public String getPosition() { return position; }
|
||||
public void setPosition(String position) { this.position = position; }
|
||||
|
||||
public String getPositionLabel() { return positionLabel; }
|
||||
public void setPositionLabel(String positionLabel) { this.positionLabel = positionLabel; }
|
||||
|
||||
public BigDecimal getDiameter() { return diameter; }
|
||||
public void setDiameter(BigDecimal diameter) { this.diameter = diameter; }
|
||||
|
||||
@@ -48,4 +55,10 @@ public class MesRollStandbyVo {
|
||||
|
||||
public Date getReadyTime() { return readyTime; }
|
||||
public void setReadyTime(Date readyTime) { this.readyTime = readyTime; }
|
||||
|
||||
public String getRemark() { return remark; }
|
||||
public void setRemark(String remark) { this.remark = remark; }
|
||||
|
||||
public Date getCreateTime() { return createTime; }
|
||||
public void setCreateTime(Date createTime) { this.createTime = createTime; }
|
||||
}
|
||||
|
||||
@@ -36,10 +36,9 @@ public interface MesRollInfoMapper {
|
||||
int updateCurrentDia(@Param("rollId") Long rollId, @Param("currentDia") BigDecimal currentDia);
|
||||
|
||||
/**
|
||||
* 条件更新轧辊状态 — 仅当当前状态为 oldStatus 时才更新为 newStatus
|
||||
* 用于清空备辊时安全回退:避免把已上机的轧辊状态改错
|
||||
* 条件更新:仅当辊当前状态等于 onlyIfStatus 时才更新(用于避免误覆盖已 Online 的辊)
|
||||
*/
|
||||
int updateStatusByRollNoIfStatus(@Param("rollNo") String rollNo,
|
||||
@Param("newStatus") String newStatus,
|
||||
@Param("oldStatus") String oldStatus);
|
||||
@Param("status") String status,
|
||||
@Param("onlyIfStatus") String onlyIfStatus);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.mill.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.mill.domain.MesRollStandby;
|
||||
import com.ruoyi.mill.domain.MesRollStandbyVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@@ -67,7 +68,7 @@ public interface MesRollStandbyMapper
|
||||
* @param standNo 机架号
|
||||
* @return 备辊列表 (VO)
|
||||
*/
|
||||
public List<MesRollStandby> selectByStand(@Param("lineId") Long lineId, @Param("standNo") String standNo);
|
||||
public List<MesRollStandbyVo> selectByStand(@Param("lineId") Long lineId, @Param("standNo") String standNo);
|
||||
|
||||
/**
|
||||
* 清空指定机架的所有备辊记录
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.mill.mapper.MesRollStandbyMapper;
|
||||
import com.ruoyi.mill.domain.MesRollStandby;
|
||||
import com.ruoyi.mill.domain.MesRollStandbyVo;
|
||||
import com.ruoyi.mill.service.IMesRollStandbyService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
@@ -113,9 +114,9 @@ public class MesRollStandbyServiceImpl implements IMesRollStandbyService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean clearByStand(Long lineId, String standNo) {
|
||||
// 先查出所有辊号再清空
|
||||
List<MesRollStandby> list = mesRollStandbyMapper.selectByStand(lineId, standNo);
|
||||
List<MesRollStandbyVo> list = mesRollStandbyMapper.selectByStand(lineId, standNo);
|
||||
int rows = mesRollStandbyMapper.clearByStand(lineId, standNo);
|
||||
for (MesRollStandby vo : list) {
|
||||
for (MesRollStandbyVo vo : list) {
|
||||
if (StringUtils.isNotBlank(vo.getRollNo())) {
|
||||
// 只有仍处于 Standby 状态时才回退为 Offline(换辊后已变 Online 的不动)
|
||||
rollInfoMapper.updateStatusByRollNoIfStatus(vo.getRollNo(), "Offline", "Standby");
|
||||
|
||||
@@ -171,13 +171,10 @@
|
||||
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}
|
||||
SET status = #{status}, update_time = NOW()
|
||||
WHERE del_flag = 0 AND roll_no = #{rollNo} AND status = #{onlyIfStatus}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -118,13 +118,33 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectByStand" resultMap="MesRollStandbyResult">
|
||||
<include refid="selectMesRollStandbyVo"/>
|
||||
where line_id = #{lineId} and stand_no = #{standNo}
|
||||
<select id="selectByStand" resultType="com.ruoyi.mill.domain.MesRollStandbyVo">
|
||||
SELECT
|
||||
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 '上工作辊'
|
||||
WHEN roll_type = 'WR' AND position = 'DOWN' THEN '下工作辊'
|
||||
WHEN roll_type = 'BR' AND position = 'DOWN' THEN '下支撑辊'
|
||||
ELSE CONCAT(position, roll_type)
|
||||
END AS position_label,
|
||||
diameter, roughness, crown, ready_time, remark, create_time
|
||||
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>
|
||||
|
||||
<delete id="clearByStand">
|
||||
delete from mes_roll_standby
|
||||
where line_id = #{lineId} and stand_no = #{standNo}
|
||||
</delete>
|
||||
<!-- 逻辑删除指定产线+机架所有下批轧辊(清空) -->
|
||||
<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