From b09d0a87adf4214a4c2be8fef43bab64ab7c3831 Mon Sep 17 00:00:00 2001 From: Joshi <3040996759@qq.com> Date: Tue, 9 Jun 2026 14:22:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(mill):=20=E6=B7=BB=E5=8A=A0=E6=8D=A2?= =?UTF-8?q?=E8=BE=8A=E8=AE=B0=E5=BD=95=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增换辊记录领域模型 MesRollChange 和 MesRollStandby - 实现换辊记录服务接口 IMesRollChangeService 和 IMesRollStandbyService - 添加换辊记录控制器 MesRollChangeController 提供 REST API - 实现换辊记录数据访问层 MesRollChangeMapper 和映射配置文件 - 添加换辊记录业务逻辑实现类 MesRollChangeServiceImpl - 实现查询当前在机轧辊和轧辊工作绩效统计功能 - 扩展轧辊信息 Mapper 支持条件更新轧辊状态操作 --- .../controller/MesRollChangeController.java | 128 ++++++++ .../controller/MesRollStandbyController.java | 104 +++++++ .../com/ruoyi/mill/domain/MesRollChange.java | 285 ++++++++++++++++++ .../ruoyi/mill/domain/MesRollChangeVo.java | 79 +++++ .../com/ruoyi/mill/domain/MesRollStandby.java | 194 ++++++++++++ .../ruoyi/mill/domain/MesRollStandbyVo.java | 51 ++++ .../mill/mapper/MesRollChangeMapper.java | 95 ++++++ .../ruoyi/mill/mapper/MesRollInfoMapper.java | 8 + .../mill/mapper/MesRollStandbyMapper.java | 80 +++++ .../mill/service/IMesRollChangeService.java | 80 +++++ .../mill/service/IMesRollStandbyService.java | 70 +++++ .../impl/MesRollChangeServiceImpl.java | 197 ++++++++++++ .../impl/MesRollStandbyServiceImpl.java | 126 ++++++++ .../mapper/mill/MesRollChangeMapper.xml | 193 ++++++++++++ .../mapper/mill/MesRollInfoMapper.xml | 9 + .../mapper/mill/MesRollStandbyMapper.xml | 130 ++++++++ 16 files changed, 1829 insertions(+) create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollChangeController.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollStandbyController.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChange.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChangeVo.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandby.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandbyVo.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollChangeMapper.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollStandbyMapper.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollChangeService.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollStandbyService.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollChangeServiceImpl.java create mode 100644 ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollStandbyServiceImpl.java create mode 100644 ruoyi-mill/src/main/resources/mapper/mill/MesRollChangeMapper.xml create mode 100644 ruoyi-mill/src/main/resources/mapper/mill/MesRollStandbyMapper.xml diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollChangeController.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollChangeController.java new file mode 100644 index 00000000..ec367a4b --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollChangeController.java @@ -0,0 +1,128 @@ +package com.ruoyi.mill.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.mill.domain.MesRollChange; +import com.ruoyi.mill.domain.MesRollChangeVo; +import com.ruoyi.mill.service.IMesRollChangeService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 换辊记录Controller + * + * @author ruoyi + * @date 2026-06-09 + */ +@RestController +@RequestMapping("/mill/change") +public class MesRollChangeController extends BaseController +{ + @Autowired + private IMesRollChangeService mesRollChangeService; + + /** + * 查询换辊记录列表 + */ + @PreAuthorize("@ss.hasPermi('mill:change:list')") + @GetMapping("/list") + public TableDataInfo list(MesRollChange mesRollChange) + { + startPage(); + List list = mesRollChangeService.selectMesRollChangeList(mesRollChange); + return getDataTable(list); + } + + /** + * 导出换辊记录列表 + */ + @PreAuthorize("@ss.hasPermi('mill:change:export')") + @Log(title = "换辊记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MesRollChange mesRollChange) + { + List list = mesRollChangeService.selectMesRollChangeList(mesRollChange); + ExcelUtil util = new ExcelUtil(MesRollChange.class); + util.exportExcel(response, list, "换辊记录数据"); + } + + /** + * 获取换辊记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mill:change:query')") + @GetMapping(value = "/{changeId}") + public AjaxResult getInfo(@PathVariable("changeId") Long changeId) + { + return success(mesRollChangeService.selectMesRollChangeByChangeId(changeId)); + } + + /** + * 新增换辊记录 + */ + @PreAuthorize("@ss.hasPermi('mill:change:add')") + @Log(title = "换辊记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MesRollChange mesRollChange) + { + return toAjax(mesRollChangeService.insertMesRollChange(mesRollChange)); + } + + /** + * 修改换辊记录 + */ + @PreAuthorize("@ss.hasPermi('mill:change:edit')") + @Log(title = "换辊记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MesRollChange mesRollChange) + { + return toAjax(mesRollChangeService.updateMesRollChange(mesRollChange)); + } + + /** + * 删除换辊记录 + */ + @PreAuthorize("@ss.hasPermi('mill:change:remove')") + @Log(title = "换辊记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{changeIds}") + public AjaxResult remove(@PathVariable Long[] changeIds) + { + return toAjax(mesRollChangeService.deleteMesRollChangeByChangeIds(changeIds)); + } + + // ==================== 三级业务端点 ==================== + + /** + * 查询指定产线+机架当前在机轧辊(最近一次换辊记录) + * GET /mill/change/current?lineId=xxx&standNo=1%23 + */ + @PreAuthorize("@ss.hasPermi('mill:change:query')") + @GetMapping("/current") + public AjaxResult current(Long lineId, @RequestParam String standNo) { + return success(mesRollChangeService.queryCurrentByStand(lineId, standNo)); + } + + /** + * 查询指定产线各机架各辊位实时工作绩效(工作长度/卷数/重量) + * GET /mill/change/performance?lineId=xxx + */ + @PreAuthorize("@ss.hasPermi('mill:change:list')") + @GetMapping("/performance") + public AjaxResult performance(Long lineId) { + return success(mesRollChangeService.queryRollPerformance(lineId)); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollStandbyController.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollStandbyController.java new file mode 100644 index 00000000..5da9ceb8 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MesRollStandbyController.java @@ -0,0 +1,104 @@ +package com.ruoyi.mill.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.mill.domain.MesRollStandby; +import com.ruoyi.mill.service.IMesRollStandbyService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 下批轧辊(待换上)Controller + * + * @author ruoyi + * @date 2026-06-09 + */ +@RestController +@RequestMapping("/mill/standby") +public class MesRollStandbyController extends BaseController +{ + @Autowired + private IMesRollStandbyService mesRollStandbyService; + + /** + * 查询下批轧辊(待换上)列表 + */ + @PreAuthorize("@ss.hasPermi('mill:standby:list')") + @GetMapping("/list") + public TableDataInfo list(MesRollStandby mesRollStandby) + { + startPage(); + List list = mesRollStandbyService.selectMesRollStandbyList(mesRollStandby); + return getDataTable(list); + } + + /** + * 导出下批轧辊(待换上)列表 + */ + @PreAuthorize("@ss.hasPermi('mill:standby:export')") + @Log(title = "下批轧辊(待换上)", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MesRollStandby mesRollStandby) + { + List list = mesRollStandbyService.selectMesRollStandbyList(mesRollStandby); + ExcelUtil util = new ExcelUtil(MesRollStandby.class); + util.exportExcel(response, list, "下批轧辊(待换上)数据"); + } + + /** + * 获取下批轧辊(待换上)详细信息 + */ + @PreAuthorize("@ss.hasPermi('mill:standby:query')") + @GetMapping(value = "/{standbyId}") + public AjaxResult getInfo(@PathVariable("standbyId") Long standbyId) + { + return success(mesRollStandbyService.selectMesRollStandbyByStandbyId(standbyId)); + } + + /** + * 新增下批轧辊(待换上) + */ + @PreAuthorize("@ss.hasPermi('mill:standby:add')") + @Log(title = "下批轧辊(待换上)", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MesRollStandby mesRollStandby) + { + return toAjax(mesRollStandbyService.insertMesRollStandby(mesRollStandby)); + } + + /** + * 修改下批轧辊(待换上) + */ + @PreAuthorize("@ss.hasPermi('mill:standby:edit')") + @Log(title = "下批轧辊(待换上)", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MesRollStandby mesRollStandby) + { + return toAjax(mesRollStandbyService.updateMesRollStandby(mesRollStandby)); + } + + /** + * 删除下批轧辊(待换上) + */ + @PreAuthorize("@ss.hasPermi('mill:standby:remove')") + @Log(title = "下批轧辊(待换上)", businessType = BusinessType.DELETE) + @DeleteMapping("/{standbyIds}") + public AjaxResult remove(@PathVariable Long[] standbyIds) + { + return toAjax(mesRollStandbyService.deleteMesRollStandbyByStandbyIds(standbyIds)); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChange.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChange.java new file mode 100644 index 00000000..40c23df7 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChange.java @@ -0,0 +1,285 @@ +package com.ruoyi.mill.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 换辊记录对象 mes_roll_change + * + * @author ruoyi + * @date 2026-06-09 + */ +public class MesRollChange extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long changeId; + + /** 产线ID(关联 wms_production_line.line_id) */ + @Excel(name = "产线ID", readConverterExp = "关=联,w=ms_production_line.line_id") + private Long lineId; + + /** 换辊编号 */ + @Excel(name = "换辊编号") + private String changeNo; + + /** 换辊时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "换辊时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date changeTime; + + /** 机架号: 1# / 2# */ + @Excel(name = "机架号: 1# / 2#") + private String standNo; + + /** 换辊类型: 计划换辊/紧急换辊 */ + @Excel(name = "换辊类型: 计划换辊/紧急换辊") + private String changeType; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String changeStatus; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String operator; + + /** 上工作辊编号 */ + @Excel(name = "上工作辊编号") + private String upperWrNo; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal upperWrDia; + + /** 下工作辊编号 */ + @Excel(name = "下工作辊编号") + private String lowerWrNo; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal lowerWrDia; + + /** 上支撑辊编号 */ + @Excel(name = "上支撑辊编号") + private String upperBrNo; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal upperBrDia; + + /** 下支撑辊编号 */ + @Excel(name = "下支撑辊编号") + private String lowerBrNo; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal lowerBrDia; + + /** $column.columnComment */ + private Long delFlag; + + public void setChangeId(Long changeId) + { + this.changeId = changeId; + } + + public Long getChangeId() + { + return changeId; + } + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + + public void setChangeNo(String changeNo) + { + this.changeNo = changeNo; + } + + public String getChangeNo() + { + return changeNo; + } + + public void setChangeTime(Date changeTime) + { + this.changeTime = changeTime; + } + + public Date getChangeTime() + { + return changeTime; + } + + public void setStandNo(String standNo) + { + this.standNo = standNo; + } + + public String getStandNo() + { + return standNo; + } + + public void setChangeType(String changeType) + { + this.changeType = changeType; + } + + public String getChangeType() + { + return changeType; + } + + public void setChangeStatus(String changeStatus) + { + this.changeStatus = changeStatus; + } + + public String getChangeStatus() + { + return changeStatus; + } + + public void setOperator(String operator) + { + this.operator = operator; + } + + public String getOperator() + { + return operator; + } + + public void setUpperWrNo(String upperWrNo) + { + this.upperWrNo = upperWrNo; + } + + public String getUpperWrNo() + { + return upperWrNo; + } + + public void setUpperWrDia(BigDecimal upperWrDia) + { + this.upperWrDia = upperWrDia; + } + + public BigDecimal getUpperWrDia() + { + return upperWrDia; + } + + public void setLowerWrNo(String lowerWrNo) + { + this.lowerWrNo = lowerWrNo; + } + + public String getLowerWrNo() + { + return lowerWrNo; + } + + public void setLowerWrDia(BigDecimal lowerWrDia) + { + this.lowerWrDia = lowerWrDia; + } + + public BigDecimal getLowerWrDia() + { + return lowerWrDia; + } + + public void setUpperBrNo(String upperBrNo) + { + this.upperBrNo = upperBrNo; + } + + public String getUpperBrNo() + { + return upperBrNo; + } + + public void setUpperBrDia(BigDecimal upperBrDia) + { + this.upperBrDia = upperBrDia; + } + + public BigDecimal getUpperBrDia() + { + return upperBrDia; + } + + public void setLowerBrNo(String lowerBrNo) + { + this.lowerBrNo = lowerBrNo; + } + + public String getLowerBrNo() + { + return lowerBrNo; + } + + public void setLowerBrDia(BigDecimal lowerBrDia) + { + this.lowerBrDia = lowerBrDia; + } + + public BigDecimal getLowerBrDia() + { + return lowerBrDia; + } + + public void setDelFlag(Long delFlag) + { + this.delFlag = delFlag; + } + + public Long getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("changeId", getChangeId()) + .append("lineId", getLineId()) + .append("changeNo", getChangeNo()) + .append("changeTime", getChangeTime()) + .append("standNo", getStandNo()) + .append("changeType", getChangeType()) + .append("changeStatus", getChangeStatus()) + .append("operator", getOperator()) + .append("upperWrNo", getUpperWrNo()) + .append("upperWrDia", getUpperWrDia()) + .append("lowerWrNo", getLowerWrNo()) + .append("lowerWrDia", getLowerWrDia()) + .append("upperBrNo", getUpperBrNo()) + .append("upperBrDia", getUpperBrDia()) + .append("lowerBrNo", getLowerBrNo()) + .append("lowerBrDia", getLowerBrDia()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChangeVo.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChangeVo.java new file mode 100644 index 00000000..2ada52ef --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollChangeVo.java @@ -0,0 +1,79 @@ +package com.ruoyi.mill.domain; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 换辊记录 VO — 用于前端展示在机轧辊信息及绩效统计 + */ +public class MesRollChangeVo { + + private Long lineId; + private String standNo; + + // 上工作辊 + private String upperWrNo; + private BigDecimal upperWrDia; + + // 下工作辊 + private String lowerWrNo; + private BigDecimal lowerWrDia; + + // 上支撑辊 + private String upperBrNo; + private BigDecimal upperBrDia; + + // 下支撑辊 + private String lowerBrNo; + private BigDecimal lowerBrDia; + + // 换辊时间 + private Date changeTime; + + // 绩效统计 + private BigDecimal workLength; + private Integer coilCount; + private BigDecimal totalWeight; + + public Long getLineId() { return lineId; } + public void setLineId(Long lineId) { this.lineId = lineId; } + + public String getStandNo() { return standNo; } + public void setStandNo(String standNo) { this.standNo = standNo; } + + public String getUpperWrNo() { return upperWrNo; } + public void setUpperWrNo(String upperWrNo) { this.upperWrNo = upperWrNo; } + + public BigDecimal getUpperWrDia() { return upperWrDia; } + public void setUpperWrDia(BigDecimal upperWrDia) { this.upperWrDia = upperWrDia; } + + public String getLowerWrNo() { return lowerWrNo; } + public void setLowerWrNo(String lowerWrNo) { this.lowerWrNo = lowerWrNo; } + + public BigDecimal getLowerWrDia() { return lowerWrDia; } + public void setLowerWrDia(BigDecimal lowerWrDia) { this.lowerWrDia = lowerWrDia; } + + public String getUpperBrNo() { return upperBrNo; } + public void setUpperBrNo(String upperBrNo) { this.upperBrNo = upperBrNo; } + + public BigDecimal getUpperBrDia() { return upperBrDia; } + public void setUpperBrDia(BigDecimal upperBrDia) { this.upperBrDia = upperBrDia; } + + public String getLowerBrNo() { return lowerBrNo; } + public void setLowerBrNo(String lowerBrNo) { this.lowerBrNo = lowerBrNo; } + + public BigDecimal getLowerBrDia() { return lowerBrDia; } + public void setLowerBrDia(BigDecimal lowerBrDia) { this.lowerBrDia = lowerBrDia; } + + public Date getChangeTime() { return changeTime; } + public void setChangeTime(Date changeTime) { this.changeTime = changeTime; } + + public BigDecimal getWorkLength() { return workLength; } + public void setWorkLength(BigDecimal workLength) { this.workLength = workLength; } + + public Integer getCoilCount() { return coilCount; } + public void setCoilCount(Integer coilCount) { this.coilCount = coilCount; } + + public BigDecimal getTotalWeight() { return totalWeight; } + public void setTotalWeight(BigDecimal totalWeight) { this.totalWeight = totalWeight; } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandby.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandby.java new file mode 100644 index 00000000..a52844a9 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandby.java @@ -0,0 +1,194 @@ +package com.ruoyi.mill.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 下批轧辊(待换上)对象 mes_roll_standby + * + * @author ruoyi + * @date 2026-06-09 + */ +public class MesRollStandby extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long standbyId; + + /** 产线ID(关联 wms_production_line.line_id) */ + @Excel(name = "产线ID", readConverterExp = "关=联,w=ms_production_line.line_id") + private Long lineId; + + /** 机架号: 1# / 2# */ + @Excel(name = "机架号: 1# / 2#") + private String standNo; + + /** 轧辊编号 */ + @Excel(name = "轧辊编号") + private String rollNo; + + /** WR=工作辊 / BR=支撑辊 */ + @Excel(name = "WR=工作辊 / BR=支撑辊") + private String rollType; + + /** UP=上 / DOWN=下 */ + @Excel(name = "UP=上 / DOWN=下") + private String position; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal diameter; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal roughness; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private BigDecimal crown; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private Date readyTime; + + /** $column.columnComment */ + private Long delFlag; + + public void setStandbyId(Long standbyId) + { + this.standbyId = standbyId; + } + + public Long getStandbyId() + { + return standbyId; + } + + public void setLineId(Long lineId) + { + this.lineId = lineId; + } + + public Long getLineId() + { + return lineId; + } + + public void setStandNo(String standNo) + { + this.standNo = standNo; + } + + public String getStandNo() + { + return standNo; + } + + public void setRollNo(String rollNo) + { + this.rollNo = rollNo; + } + + public String getRollNo() + { + return rollNo; + } + + public void setRollType(String rollType) + { + this.rollType = rollType; + } + + public String getRollType() + { + return rollType; + } + + public void setPosition(String position) + { + this.position = position; + } + + public String getPosition() + { + return position; + } + + public void setDiameter(BigDecimal diameter) + { + this.diameter = diameter; + } + + public BigDecimal getDiameter() + { + return diameter; + } + + public void setRoughness(BigDecimal roughness) + { + this.roughness = roughness; + } + + public BigDecimal getRoughness() + { + return roughness; + } + + public void setCrown(BigDecimal crown) + { + this.crown = crown; + } + + public BigDecimal getCrown() + { + return crown; + } + + public void setReadyTime(Date readyTime) + { + this.readyTime = readyTime; + } + + public Date getReadyTime() + { + return readyTime; + } + + public void setDelFlag(Long delFlag) + { + this.delFlag = delFlag; + } + + public Long getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("standbyId", getStandbyId()) + .append("lineId", getLineId()) + .append("standNo", getStandNo()) + .append("rollNo", getRollNo()) + .append("rollType", getRollType()) + .append("position", getPosition()) + .append("diameter", getDiameter()) + .append("roughness", getRoughness()) + .append("crown", getCrown()) + .append("readyTime", getReadyTime()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandbyVo.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandbyVo.java new file mode 100644 index 00000000..1cb27879 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MesRollStandbyVo.java @@ -0,0 +1,51 @@ +package com.ruoyi.mill.domain; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 下批轧辊(待换上)VO + */ +public class MesRollStandbyVo { + + private Long standbyId; + private Long lineId; + private String standNo; + private String rollNo; + private String rollType; + private String position; + private BigDecimal diameter; + private BigDecimal roughness; + private BigDecimal crown; + private Date readyTime; + + public Long getStandbyId() { return standbyId; } + public void setStandbyId(Long standbyId) { this.standbyId = standbyId; } + + public Long getLineId() { return lineId; } + public void setLineId(Long lineId) { this.lineId = lineId; } + + public String getStandNo() { return standNo; } + public void setStandNo(String standNo) { this.standNo = standNo; } + + public String getRollNo() { return rollNo; } + public void setRollNo(String rollNo) { this.rollNo = rollNo; } + + public String getRollType() { return rollType; } + public void setRollType(String rollType) { this.rollType = rollType; } + + public String getPosition() { return position; } + public void setPosition(String position) { this.position = position; } + + public BigDecimal getDiameter() { return diameter; } + public void setDiameter(BigDecimal diameter) { this.diameter = diameter; } + + public BigDecimal getRoughness() { return roughness; } + public void setRoughness(BigDecimal roughness) { this.roughness = roughness; } + + public BigDecimal getCrown() { return crown; } + public void setCrown(BigDecimal crown) { this.crown = crown; } + + public Date getReadyTime() { return readyTime; } + public void setReadyTime(Date readyTime) { this.readyTime = readyTime; } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollChangeMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollChangeMapper.java new file mode 100644 index 00000000..9d3d3f16 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollChangeMapper.java @@ -0,0 +1,95 @@ +package com.ruoyi.mill.mapper; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import com.ruoyi.mill.domain.MesRollChange; +import org.apache.ibatis.annotations.Param; + +/** + * 换辊记录Mapper接口 + * + * @author ruoyi + * @date 2026-06-09 + */ +public interface MesRollChangeMapper +{ + /** + * 查询换辊记录 + * + * @param changeId 换辊记录主键 + * @return 换辊记录 + */ + public MesRollChange selectMesRollChangeByChangeId(Long changeId); + + /** + * 查询换辊记录列表 + * + * @param mesRollChange 换辊记录 + * @return 换辊记录集合 + */ + public List selectMesRollChangeList(MesRollChange mesRollChange); + + /** + * 新增换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + public int insertMesRollChange(MesRollChange mesRollChange); + + /** + * 修改换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + public int updateMesRollChange(MesRollChange mesRollChange); + + /** + * 删除换辊记录 + * + * @param changeId 换辊记录主键 + * @return 结果 + */ + public int deleteMesRollChangeByChangeId(Long changeId); + + /** + * 批量删除换辊记录 + * + * @param changeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesRollChangeByChangeIds(Long[] changeIds); + + /** + * 查询指定机架当前各辊位状态(最近一次换辊记录) + * + * @param lineId 产线ID + * @param standNo 机架号 + * @return 各辊位编号+辊径+换辊时间 + */ + public Map selectCurrentStateByStand(@Param("lineId") Long lineId, @Param("standNo") String standNo); + + /** + * 查询指定机架+辊位的最新换辊记录 + * + * @param lineId 产线ID + * @param standNo 机架号 + * @param posType 辊位类型(upperWr/lowerWr/upperBr/lowerBr) + * @return 换辊记录 + */ + public MesRollChange selectLatestByStandAndPosition(@Param("lineId") Long lineId, + @Param("standNo") String standNo, + @Param("posType") String posType); + + /** + * 统计指定时间范围内的钢卷产量(长度/卷数/重量) + * + * @param startTime 起始时间 + * @param endTime 结束时间(null表示至今) + * @return 统计结果: workLength, coilCount, totalWeight + */ + public Map selectCoilStats(@Param("startTime") Date startTime, + @Param("endTime") Date endTime); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollInfoMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollInfoMapper.java index 32f419bd..6fb010bf 100644 --- a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollInfoMapper.java +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollInfoMapper.java @@ -34,4 +34,12 @@ public interface MesRollInfoMapper { int incrementGrindCount(@Param("rollId") Long rollId, @Param("diaAfter") BigDecimal diaAfter); int updateCurrentDia(@Param("rollId") Long rollId, @Param("currentDia") BigDecimal currentDia); + + /** + * 条件更新轧辊状态 — 仅当当前状态为 oldStatus 时才更新为 newStatus + * 用于清空备辊时安全回退:避免把已上机的轧辊状态改错 + */ + int updateStatusByRollNoIfStatus(@Param("rollNo") String rollNo, + @Param("newStatus") String newStatus, + @Param("oldStatus") String oldStatus); } diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollStandbyMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollStandbyMapper.java new file mode 100644 index 00000000..c3c71b9a --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MesRollStandbyMapper.java @@ -0,0 +1,80 @@ +package com.ruoyi.mill.mapper; + +import java.util.List; +import com.ruoyi.mill.domain.MesRollStandby; +import org.apache.ibatis.annotations.Param; + +/** + * 下批轧辊(待换上)Mapper接口 + * + * @author ruoyi + * @date 2026-06-09 + */ +public interface MesRollStandbyMapper +{ + /** + * 查询下批轧辊(待换上) + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 下批轧辊(待换上) + */ + public MesRollStandby selectMesRollStandbyByStandbyId(Long standbyId); + + /** + * 查询下批轧辊(待换上)列表 + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 下批轧辊(待换上)集合 + */ + public List selectMesRollStandbyList(MesRollStandby mesRollStandby); + + /** + * 新增下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + public int insertMesRollStandby(MesRollStandby mesRollStandby); + + /** + * 修改下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + public int updateMesRollStandby(MesRollStandby mesRollStandby); + + /** + * 删除下批轧辊(待换上) + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 结果 + */ + public int deleteMesRollStandbyByStandbyId(Long standbyId); + + /** + * 批量删除下批轧辊(待换上) + * + * @param standbyIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesRollStandbyByStandbyIds(Long[] standbyIds); + + /** + * 查询指定机架的所有备辊 + * + * @param lineId 产线ID + * @param standNo 机架号 + * @return 备辊列表 (VO) + */ + public List selectByStand(@Param("lineId") Long lineId, @Param("standNo") String standNo); + + /** + * 清空指定机架的所有备辊记录 + * + * @param lineId 产线ID + * @param standNo 机架号 + * @return 影响行数 + */ + public int clearByStand(@Param("lineId") Long lineId, @Param("standNo") String standNo); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollChangeService.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollChangeService.java new file mode 100644 index 00000000..031fb781 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollChangeService.java @@ -0,0 +1,80 @@ +package com.ruoyi.mill.service; + +import java.util.List; +import java.util.Map; +import com.ruoyi.mill.domain.MesRollChange; +import com.ruoyi.mill.domain.MesRollChangeVo; + +/** + * 换辊记录Service接口 + * + * @author ruoyi + * @date 2026-06-09 + */ +public interface IMesRollChangeService +{ + /** + * 查询换辊记录 + * + * @param changeId 换辊记录主键 + * @return 换辊记录 + */ + public MesRollChange selectMesRollChangeByChangeId(Long changeId); + + /** + * 查询换辊记录列表 + * + * @param mesRollChange 换辊记录 + * @return 换辊记录集合 + */ + public List selectMesRollChangeList(MesRollChange mesRollChange); + + /** + * 新增换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + public int insertMesRollChange(MesRollChange mesRollChange); + + /** + * 修改换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + public int updateMesRollChange(MesRollChange mesRollChange); + + /** + * 批量删除换辊记录 + * + * @param changeIds 需要删除的换辊记录主键集合 + * @return 结果 + */ + public int deleteMesRollChangeByChangeIds(Long[] changeIds); + + /** + * 删除换辊记录信息 + * + * @param changeId 换辊记录主键 + * @return 结果 + */ + public int deleteMesRollChangeByChangeId(Long changeId); + + /** + * 查询指定产线+机架当前在机轧辊 + * + * @param lineId 产线ID + * @param standNo 机架号 + * @return 在机轧辊 VO + */ + public MesRollChangeVo queryCurrentByStand(Long lineId, String standNo); + + /** + * 查询指定产线各机架各辊位实时工作绩效 + * + * @param lineId 产线ID + * @return 各位置类型→各机架→统计数据 + */ + public Map> queryRollPerformance(Long lineId); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollStandbyService.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollStandbyService.java new file mode 100644 index 00000000..a787fdbc --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMesRollStandbyService.java @@ -0,0 +1,70 @@ +package com.ruoyi.mill.service; + +import java.util.List; +import com.ruoyi.mill.domain.MesRollStandby; + +/** + * 下批轧辊(待换上)Service接口 + * + * @author ruoyi + * @date 2026-06-09 + */ +public interface IMesRollStandbyService +{ + /** + * 查询下批轧辊(待换上) + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 下批轧辊(待换上) + */ + public MesRollStandby selectMesRollStandbyByStandbyId(Long standbyId); + + /** + * 查询下批轧辊(待换上)列表 + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 下批轧辊(待换上)集合 + */ + public List selectMesRollStandbyList(MesRollStandby mesRollStandby); + + /** + * 新增下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + public int insertMesRollStandby(MesRollStandby mesRollStandby); + + /** + * 修改下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + public int updateMesRollStandby(MesRollStandby mesRollStandby); + + /** + * 批量删除下批轧辊(待换上) + * + * @param standbyIds 需要删除的下批轧辊(待换上)主键集合 + * @return 结果 + */ + public int deleteMesRollStandbyByStandbyIds(Long[] standbyIds); + + /** + * 删除下批轧辊(待换上)信息 + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 结果 + */ + public int deleteMesRollStandbyByStandbyId(Long standbyId); + + /** + * 清空指定机架所有备辊,同时回退轧辊状态 + * + * @param lineId 产线ID + * @param standNo 机架号 + * @return true=成功 false=无记录 + */ + public Boolean clearByStand(Long lineId, String standNo); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollChangeServiceImpl.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollChangeServiceImpl.java new file mode 100644 index 00000000..586ef066 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollChangeServiceImpl.java @@ -0,0 +1,197 @@ +package com.ruoyi.mill.service.impl; + +import java.math.BigDecimal; +import java.util.*; + +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.mill.mapper.MesRollChangeMapper; +import com.ruoyi.mill.domain.MesRollChange; +import com.ruoyi.mill.domain.MesRollChangeVo; +import com.ruoyi.mill.service.IMesRollChangeService; + +/** + * 换辊记录Service业务层处理 + * + * @author ruoyi + * @date 2026-06-09 + */ +@Service +@DataSource(DataSourceType.KLP) +public class MesRollChangeServiceImpl implements IMesRollChangeService +{ + @Autowired + private MesRollChangeMapper mesRollChangeMapper; + + /** + * 查询换辊记录 + * + * @param changeId 换辊记录主键 + * @return 换辊记录 + */ + @Override + public MesRollChange selectMesRollChangeByChangeId(Long changeId) + { + return mesRollChangeMapper.selectMesRollChangeByChangeId(changeId); + } + + /** + * 查询换辊记录列表 + * + * @param mesRollChange 换辊记录 + * @return 换辊记录 + */ + @Override + public List selectMesRollChangeList(MesRollChange mesRollChange) + { + return mesRollChangeMapper.selectMesRollChangeList(mesRollChange); + } + + /** + * 新增换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + @Override + public int insertMesRollChange(MesRollChange mesRollChange) + { + mesRollChange.setCreateTime(DateUtils.getNowDate()); + return mesRollChangeMapper.insertMesRollChange(mesRollChange); + } + + /** + * 修改换辊记录 + * + * @param mesRollChange 换辊记录 + * @return 结果 + */ + @Override + public int updateMesRollChange(MesRollChange mesRollChange) + { + mesRollChange.setUpdateTime(DateUtils.getNowDate()); + return mesRollChangeMapper.updateMesRollChange(mesRollChange); + } + + /** + * 批量删除换辊记录 + * + * @param changeIds 需要删除的换辊记录主键 + * @return 结果 + */ + @Override + public int deleteMesRollChangeByChangeIds(Long[] changeIds) + { + return mesRollChangeMapper.deleteMesRollChangeByChangeIds(changeIds); + } + + /** + * 删除换辊记录信息 + * + * @param changeId 换辊记录主键 + * @return 结果 + */ + @Override + public int deleteMesRollChangeByChangeId(Long changeId) + { + return mesRollChangeMapper.deleteMesRollChangeByChangeId(changeId); + } + + // ==================== 三级业务逻辑 ==================== + + /** 辊位类型 */ + private static final List POS_TYPES = Arrays.asList("upperWr", "lowerWr", "upperBr", "lowerBr"); + + /** 机架号 */ + private static final List STANDS = Arrays.asList("1#", "2#"); + + /** + * 查询指定产线+机架当前在机轧辊(最近一次换辊记录) + */ + @Override + public MesRollChangeVo queryCurrentByStand(Long lineId, String standNo) { + // 组合各辊位最新状态,转换为 VO + Map state = mesRollChangeMapper.selectCurrentStateByStand(lineId, standNo); + if (state == null) return null; + MesRollChangeVo vo = new MesRollChangeVo(); + vo.setLineId(lineId); + vo.setStandNo(standNo); + vo.setUpperWrNo(str(state.get("upperWrNo"))); + vo.setUpperWrDia(decimal(state.get("upperWrDia"))); + vo.setLowerWrNo(str(state.get("lowerWrNo"))); + vo.setLowerWrDia(decimal(state.get("lowerWrDia"))); + vo.setUpperBrNo(str(state.get("upperBrNo"))); + vo.setUpperBrDia(decimal(state.get("upperBrDia"))); + vo.setLowerBrNo(str(state.get("lowerBrNo"))); + vo.setLowerBrDia(decimal(state.get("lowerBrDia"))); + if (state.get("changeTime") instanceof Date) { + vo.setChangeTime((Date) state.get("changeTime")); + } + return vo; + } + + /** + * 查询指定产线各机架各辊位实时工作绩效(工作长度/卷数/重量) + */ + @Override + public Map> queryRollPerformance(Long lineId) { + Map> result = new HashMap<>(4); + for (String posType : POS_TYPES) { + Map byStand = new HashMap<>(2); + for (String standNo : STANDS) { + MesRollChange rec = mesRollChangeMapper.selectLatestByStandAndPosition(lineId, standNo, posType); + Map cell = new HashMap<>(6); + if (rec != null) { + cell.put("rollNo", getRollNoByPos(rec, posType)); + cell.put("onlineTime", rec.getChangeTime()); + Map stats = mesRollChangeMapper.selectCoilStats(rec.getChangeTime(), null); + MesRollChangeVo tmp = new MesRollChangeVo(); + fillStatsToVo(tmp, stats); + cell.put("workLength", tmp.getWorkLength()); + cell.put("coilCount", tmp.getCoilCount()); + cell.put("totalWeight", tmp.getTotalWeight()); + } + byStand.put(standNo, cell); + } + result.put(posType, byStand); + } + return result; + } + + // ==================== 辅助方法 ==================== + + /** 安全转 String */ + private String str(Object v) { + return v == null ? null : v.toString(); + } + + /** 安全转 BigDecimal */ + private BigDecimal decimal(Object v) { + if (v == null) return null; + if (v instanceof BigDecimal) return (BigDecimal) v; + if (v instanceof Number) return BigDecimal.valueOf(((Number) v).doubleValue()); + return new BigDecimal(v.toString()); + } + + /** 根据辊位类型从换辊记录中取出对应的辊号 */ + private String getRollNoByPos(MesRollChange rec, String posType) { + switch (posType) { + case "upperWr": return rec.getUpperWrNo(); + case "lowerWr": return rec.getLowerWrNo(); + case "upperBr": return rec.getUpperBrNo(); + case "lowerBr": return rec.getLowerBrNo(); + default: return null; + } + } + + /** 将统计结果 Map 填充到 VO */ + private void fillStatsToVo(MesRollChangeVo vo, Map stats) { + if (stats == null) return; + vo.setWorkLength(decimal(stats.get("workLength"))); + vo.setCoilCount(stats.get("coilCount") == null ? 0 : ((Number) stats.get("coilCount")).intValue()); + vo.setTotalWeight(decimal(stats.get("totalWeight"))); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollStandbyServiceImpl.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollStandbyServiceImpl.java new file mode 100644 index 00000000..80255429 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MesRollStandbyServiceImpl.java @@ -0,0 +1,126 @@ +package com.ruoyi.mill.service.impl; + +import java.util.List; + +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.mill.mapper.MesRollInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +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.service.IMesRollStandbyService; +import com.ruoyi.common.utils.StringUtils; + +/** + * 下批轧辊(待换上)Service业务层处理 + * + * @author ruoyi + * @date 2026-06-09 + */ +@Service +@DataSource(DataSourceType.KLP) +public class MesRollStandbyServiceImpl implements IMesRollStandbyService +{ + @Autowired + private MesRollStandbyMapper mesRollStandbyMapper; + + @Autowired + private MesRollInfoMapper rollInfoMapper; + + /** + * 查询下批轧辊(待换上) + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 下批轧辊(待换上) + */ + @Override + public MesRollStandby selectMesRollStandbyByStandbyId(Long standbyId) + { + return mesRollStandbyMapper.selectMesRollStandbyByStandbyId(standbyId); + } + + /** + * 查询下批轧辊(待换上)列表 + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 下批轧辊(待换上) + */ + @Override + public List selectMesRollStandbyList(MesRollStandby mesRollStandby) + { + return mesRollStandbyMapper.selectMesRollStandbyList(mesRollStandby); + } + + /** + * 新增下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + @Override + public int insertMesRollStandby(MesRollStandby mesRollStandby) + { + mesRollStandby.setCreateTime(DateUtils.getNowDate()); + return mesRollStandbyMapper.insertMesRollStandby(mesRollStandby); + } + + /** + * 修改下批轧辊(待换上) + * + * @param mesRollStandby 下批轧辊(待换上) + * @return 结果 + */ + @Override + public int updateMesRollStandby(MesRollStandby mesRollStandby) + { + mesRollStandby.setUpdateTime(DateUtils.getNowDate()); + return mesRollStandbyMapper.updateMesRollStandby(mesRollStandby); + } + + /** + * 批量删除下批轧辊(待换上) + * + * @param standbyIds 需要删除的下批轧辊(待换上)主键 + * @return 结果 + */ + @Override + public int deleteMesRollStandbyByStandbyIds(Long[] standbyIds) + { + return mesRollStandbyMapper.deleteMesRollStandbyByStandbyIds(standbyIds); + } + + /** + * 删除下批轧辊(待换上)信息 + * + * @param standbyId 下批轧辊(待换上)主键 + * @return 结果 + */ + @Override + public int deleteMesRollStandbyByStandbyId(Long standbyId) + { + return mesRollStandbyMapper.deleteMesRollStandbyByStandbyId(standbyId); + } + + // ==================== 三级业务逻辑 ==================== + + /** + * 清空指定机架所有备辊,同时将处于 Standby 状态的轧辊回退为 Offline + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean clearByStand(Long lineId, String standNo) { + // 先查出所有辊号再清空 + List list = mesRollStandbyMapper.selectByStand(lineId, standNo); + int rows = mesRollStandbyMapper.clearByStand(lineId, standNo); + for (MesRollStandby vo : list) { + if (StringUtils.isNotBlank(vo.getRollNo())) { + // 只有仍处于 Standby 状态时才回退为 Offline(换辊后已变 Online 的不动) + rollInfoMapper.updateStatusByRollNoIfStatus(vo.getRollNo(), "Offline", "Standby"); + } + } + return rows > 0; + } +} diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MesRollChangeMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MesRollChangeMapper.xml new file mode 100644 index 00000000..7a261fa2 --- /dev/null +++ b/ruoyi-mill/src/main/resources/mapper/mill/MesRollChangeMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into mes_roll_change + + 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, + + + #{lineId}, + #{changeNo}, + #{changeTime}, + #{standNo}, + #{changeType}, + #{changeStatus}, + #{operator}, + #{upperWrNo}, + #{upperWrDia}, + #{lowerWrNo}, + #{lowerWrDia}, + #{upperBrNo}, + #{upperBrDia}, + #{lowerBrNo}, + #{lowerBrDia}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update mes_roll_change + + line_id = #{lineId}, + change_no = #{changeNo}, + change_time = #{changeTime}, + stand_no = #{standNo}, + change_type = #{changeType}, + change_status = #{changeStatus}, + operator = #{operator}, + upper_wr_no = #{upperWrNo}, + upper_wr_dia = #{upperWrDia}, + lower_wr_no = #{lowerWrNo}, + lower_wr_dia = #{lowerWrDia}, + upper_br_no = #{upperBrNo}, + upper_br_dia = #{upperBrDia}, + lower_br_no = #{lowerBrNo}, + lower_br_dia = #{lowerBrDia}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where change_id = #{changeId} + + + + delete from mes_roll_change where change_id = #{changeId} + + + + delete from mes_roll_change where change_id in + + #{changeId} + + + + + + + + + + + + diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MesRollInfoMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MesRollInfoMapper.xml index 6dd1c90d..1f347813 100644 --- a/ruoyi-mill/src/main/resources/mapper/mill/MesRollInfoMapper.xml +++ b/ruoyi-mill/src/main/resources/mapper/mill/MesRollInfoMapper.xml @@ -171,4 +171,13 @@ WHERE del_flag = 0 AND roll_id = #{rollId} + + + UPDATE mes_roll_info + SET status = #{newStatus}, update_time = NOW() + WHERE del_flag = 0 + AND roll_no = #{rollNo} + AND status = #{oldStatus} + + diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MesRollStandbyMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MesRollStandbyMapper.xml new file mode 100644 index 00000000..091ca1b3 --- /dev/null +++ b/ruoyi-mill/src/main/resources/mapper/mill/MesRollStandbyMapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into mes_roll_standby + + 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, + + + #{lineId}, + #{standNo}, + #{rollNo}, + #{rollType}, + #{position}, + #{diameter}, + #{roughness}, + #{crown}, + #{readyTime}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update mes_roll_standby + + line_id = #{lineId}, + stand_no = #{standNo}, + roll_no = #{rollNo}, + roll_type = #{rollType}, + position = #{position}, + diameter = #{diameter}, + roughness = #{roughness}, + crown = #{crown}, + ready_time = #{readyTime}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where standby_id = #{standbyId} + + + + delete from mes_roll_standby where standby_id = #{standbyId} + + + + delete from mes_roll_standby where standby_id in + + #{standbyId} + + + + + + + delete from mes_roll_standby + where line_id = #{lineId} and stand_no = #{standNo} + +