feat(mill): 新增二级-三级钢卷异常挂接与撤回功能

- 新增钢卷异常信息管理模块,包含实体类、服务接口、控制器和MyBatis映射文件
- 新增二级-三级钢卷异常挂接/撤回关系管理模块,支持挂接和撤回操作
- 在WmsCoilAbnormal实体类中新增sourceSystem字段,用于标识异常数据来源
- 实现bindToThird方法:将二级异常数据挂接到三级系统,自动匹配钢卷并创建关联关系
- 实现withdrawFromThird方法:从三级系统撤回已挂接的异常数据,更新关联状态
- 提供完整的CRUD接口和权限控制,支持异常数据的增删改查和导出功能
This commit is contained in:
2026-06-03 15:30:50 +08:00
parent 80d33d9a3b
commit 0b02122015
14 changed files with 1588 additions and 1 deletions

View File

@@ -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.MillCoilAbnormal;
import com.ruoyi.mill.service.IMillCoilAbnormalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 钢卷异常信息Controller
*
* @author ruoyi
* @date 2026-06-03
*/
@RestController
@RequestMapping("/mill/abnormal")
public class MillCoilAbnormalController extends BaseController
{
@Autowired
private IMillCoilAbnormalService millCoilAbnormalService;
/**
* 查询钢卷异常信息列表
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:list')")
@GetMapping("/list")
public TableDataInfo list(MillCoilAbnormal millCoilAbnormal)
{
startPage();
List<MillCoilAbnormal> list = millCoilAbnormalService.selectMillCoilAbnormalList(millCoilAbnormal);
return getDataTable(list);
}
/**
* 导出钢卷异常信息列表
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:export')")
@Log(title = "钢卷异常信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MillCoilAbnormal millCoilAbnormal)
{
List<MillCoilAbnormal> list = millCoilAbnormalService.selectMillCoilAbnormalList(millCoilAbnormal);
ExcelUtil<MillCoilAbnormal> util = new ExcelUtil<MillCoilAbnormal>(MillCoilAbnormal.class);
util.exportExcel(response, list, "钢卷异常信息数据");
}
/**
* 获取钢卷异常信息详细信息
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:query')")
@GetMapping(value = "/{abnormalId}")
public AjaxResult getInfo(@PathVariable("abnormalId") Long abnormalId)
{
return success(millCoilAbnormalService.selectMillCoilAbnormalByAbnormalId(abnormalId));
}
/**
* 新增钢卷异常信息
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:add')")
@Log(title = "钢卷异常信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MillCoilAbnormal millCoilAbnormal)
{
return toAjax(millCoilAbnormalService.insertMillCoilAbnormal(millCoilAbnormal));
}
/**
* 修改钢卷异常信息
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:edit')")
@Log(title = "钢卷异常信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MillCoilAbnormal millCoilAbnormal)
{
return toAjax(millCoilAbnormalService.updateMillCoilAbnormal(millCoilAbnormal));
}
/**
* 删除钢卷异常信息
*/
@PreAuthorize("@ss.hasPermi('mill:abnormal:remove')")
@Log(title = "钢卷异常信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{abnormalIds}")
public AjaxResult remove(@PathVariable Long[] abnormalIds)
{
return toAjax(millCoilAbnormalService.deleteMillCoilAbnormalByAbnormalIds(abnormalIds));
}
}

View File

@@ -0,0 +1,129 @@
package com.ruoyi.mill.controller;
import java.util.List;
import java.util.Map;
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.MillCoilAbnormalRelation;
import com.ruoyi.mill.service.IMillCoilAbnormalRelationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 二级-三级钢卷异常挂接/撤回关系Controller
*
* @author ruoyi
* @date 2026-06-03
*/
@RestController
@RequestMapping("/mill/relation")
public class MillCoilAbnormalRelationController extends BaseController
{
@Autowired
private IMillCoilAbnormalRelationService millCoilAbnormalRelationService;
/**
* 查询二级-三级钢卷异常挂接/撤回关系列表
*/
@PreAuthorize("@ss.hasPermi('mill:relation:list')")
@GetMapping("/list")
public TableDataInfo list(MillCoilAbnormalRelation millCoilAbnormalRelation)
{
startPage();
List<MillCoilAbnormalRelation> list = millCoilAbnormalRelationService.selectMillCoilAbnormalRelationList(millCoilAbnormalRelation);
return getDataTable(list);
}
/**
* 导出二级-三级钢卷异常挂接/撤回关系列表
*/
@PreAuthorize("@ss.hasPermi('mill:relation:export')")
@Log(title = "二级-三级钢卷异常挂接/撤回关系", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MillCoilAbnormalRelation millCoilAbnormalRelation)
{
List<MillCoilAbnormalRelation> list = millCoilAbnormalRelationService.selectMillCoilAbnormalRelationList(millCoilAbnormalRelation);
ExcelUtil<MillCoilAbnormalRelation> util = new ExcelUtil<MillCoilAbnormalRelation>(MillCoilAbnormalRelation.class);
util.exportExcel(response, list, "二级-三级钢卷异常挂接/撤回关系数据");
}
/**
* 获取二级-三级钢卷异常挂接/撤回关系详细信息
*/
@PreAuthorize("@ss.hasPermi('mill:relation:query')")
@GetMapping(value = "/{relationId}")
public AjaxResult getInfo(@PathVariable("relationId") Long relationId)
{
return success(millCoilAbnormalRelationService.selectMillCoilAbnormalRelationByRelationId(relationId));
}
/**
* 新增二级-三级钢卷异常挂接/撤回关系
*/
@PreAuthorize("@ss.hasPermi('mill:relation:add')")
@Log(title = "二级-三级钢卷异常挂接/撤回关系", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MillCoilAbnormalRelation millCoilAbnormalRelation)
{
return toAjax(millCoilAbnormalRelationService.insertMillCoilAbnormalRelation(millCoilAbnormalRelation));
}
/**
* 修改二级-三级钢卷异常挂接/撤回关系
*/
@PreAuthorize("@ss.hasPermi('mill:relation:edit')")
@Log(title = "二级-三级钢卷异常挂接/撤回关系", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MillCoilAbnormalRelation millCoilAbnormalRelation)
{
return toAjax(millCoilAbnormalRelationService.updateMillCoilAbnormalRelation(millCoilAbnormalRelation));
}
/**
* 删除二级-三级钢卷异常挂接/撤回关系
*/
@PreAuthorize("@ss.hasPermi('mill:relation:remove')")
@Log(title = "二级-三级钢卷异常挂接/撤回关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{relationIds}")
public AjaxResult remove(@PathVariable Long[] relationIds)
{
return toAjax(millCoilAbnormalRelationService.deleteMillCoilAbnormalRelationByRelationIds(relationIds));
}
/**
* 挂接:将二级异常数据新增到三级异常表
*/
@PreAuthorize("@ss.hasPermi('mill:relation:bind')")
@Log(title = "二级异常挂接到三级", businessType = BusinessType.INSERT)
@PostMapping("/bind/{secondAbnormalId}")
public AjaxResult bind(@PathVariable Long secondAbnormalId)
{
Long relationId = millCoilAbnormalRelationService.bindToThird(secondAbnormalId, getUsername());
return success(relationId);
}
/**
* 撤回:逻辑删除三级异常表中的挂接数据
*/
@PreAuthorize("@ss.hasPermi('mill:relation:withdraw')")
@Log(title = "二级异常从三级撤回", businessType = BusinessType.UPDATE)
@PostMapping("/withdraw/{relationId}")
public AjaxResult withdraw(@PathVariable Long relationId, @RequestBody Map<String, String> body)
{
String operateRemark = body != null ? body.get("operateRemark") : null;
return toAjax(millCoilAbnormalRelationService.withdrawFromThird(relationId, getUsername(), operateRemark));
}
}

View File

@@ -0,0 +1,345 @@
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;
/**
* 钢卷异常信息对象 mill_coil_abnormal
*
* @author ruoyi
* @date 2026-06-03
*/
public class MillCoilAbnormal extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long abnormalId;
/** 当前钢卷号 */
@Excel(name = "当前钢卷号")
private String currentCoilNo;
/** 产线名称 */
@Excel(name = "产线名称")
private String productionLine;
/** 位置(上下,操作侧,中间,驱动侧) */
@Excel(name = "位置", readConverterExp = "上=下,操作侧,中间,驱动侧")
private String position;
/** 缺陷长度 */
@Excel(name = "缺陷长度")
private BigDecimal length;
/** 缺陷开始位置 */
@Excel(name = "缺陷开始位置")
private BigDecimal startPosition;
/** 缺陷结束位置 */
@Excel(name = "缺陷结束位置")
private BigDecimal endPosition;
/** 缺陷代码S=表面缺陷、E=边部问题、M=尺寸问题、G=收卷问题) */
@Excel(name = "缺陷代码", readConverterExp = "S==表面缺陷、E=边部问题、M=尺寸问题、G=收卷问题")
private String defectCode;
/** 缺陷类型(更详细的缺陷分类,如划痕、边裂、厚度超标等) */
@Excel(name = "缺陷类型", readConverterExp = "更=详细的缺陷分类,如划痕、边裂、厚度超标等")
private String defectType;
/** 缺陷率百分比如0.05表示5% */
@Excel(name = "缺陷率", readConverterExp = "百=分比如0.05表示5%")
private BigDecimal defectRate;
/** 缺陷重量单位kg */
@Excel(name = "缺陷重量", readConverterExp = "单=位kg")
private BigDecimal defectWeight;
/** 程度(轻微、重度、严重) */
@Excel(name = "程度", readConverterExp = "轻=微、重度、严重")
private String degree;
/** 判级 */
@Excel(name = "判级")
private String judgeLevel;
/** 判级人 */
@Excel(name = "判级人")
private String judgeBy;
/** 判级时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "判级时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date judgeTime;
/** 主标记1=是0=否) */
@Excel(name = "主标记", readConverterExp = "1==是0=否")
private Long mainMark;
/** 整卷标记1=是0=否) */
@Excel(name = "整卷标记", readConverterExp = "1==是0=否")
private Long wholeCoilMark;
/** 删除标志0=正常1=已删除) */
private Integer delFlag;
/** 上下板面 */
@Excel(name = "上下板面")
private String plateSurface;
/** 附件路径(多个用英文逗号分隔) */
@Excel(name = "附件路径", readConverterExp = "多=个用英文逗号分隔")
private String attachmentFiles;
/** 匹配到的三级系统钢卷ID */
@Excel(name = "匹配到的三级系统钢卷ID")
private Long thirdCoilId;
public void setAbnormalId(Long abnormalId)
{
this.abnormalId = abnormalId;
}
public Long getAbnormalId()
{
return abnormalId;
}
public void setCurrentCoilNo(String currentCoilNo)
{
this.currentCoilNo = currentCoilNo;
}
public String getCurrentCoilNo()
{
return currentCoilNo;
}
public void setProductionLine(String productionLine)
{
this.productionLine = productionLine;
}
public String getProductionLine()
{
return productionLine;
}
public void setPosition(String position)
{
this.position = position;
}
public String getPosition()
{
return position;
}
public void setLength(BigDecimal length)
{
this.length = length;
}
public BigDecimal getLength()
{
return length;
}
public void setStartPosition(BigDecimal startPosition)
{
this.startPosition = startPosition;
}
public BigDecimal getStartPosition()
{
return startPosition;
}
public void setEndPosition(BigDecimal endPosition)
{
this.endPosition = endPosition;
}
public BigDecimal getEndPosition()
{
return endPosition;
}
public void setDefectCode(String defectCode)
{
this.defectCode = defectCode;
}
public String getDefectCode()
{
return defectCode;
}
public void setDefectType(String defectType)
{
this.defectType = defectType;
}
public String getDefectType()
{
return defectType;
}
public void setDefectRate(BigDecimal defectRate)
{
this.defectRate = defectRate;
}
public BigDecimal getDefectRate()
{
return defectRate;
}
public void setDefectWeight(BigDecimal defectWeight)
{
this.defectWeight = defectWeight;
}
public BigDecimal getDefectWeight()
{
return defectWeight;
}
public void setDegree(String degree)
{
this.degree = degree;
}
public String getDegree()
{
return degree;
}
public void setJudgeLevel(String judgeLevel)
{
this.judgeLevel = judgeLevel;
}
public String getJudgeLevel()
{
return judgeLevel;
}
public void setJudgeBy(String judgeBy)
{
this.judgeBy = judgeBy;
}
public String getJudgeBy()
{
return judgeBy;
}
public void setJudgeTime(Date judgeTime)
{
this.judgeTime = judgeTime;
}
public Date getJudgeTime()
{
return judgeTime;
}
public void setMainMark(Long mainMark)
{
this.mainMark = mainMark;
}
public Long getMainMark()
{
return mainMark;
}
public void setWholeCoilMark(Long wholeCoilMark)
{
this.wholeCoilMark = wholeCoilMark;
}
public Long getWholeCoilMark()
{
return wholeCoilMark;
}
public void setDelFlag(Integer delFlag)
{
this.delFlag = delFlag;
}
public Integer getDelFlag()
{
return delFlag;
}
public void setPlateSurface(String plateSurface)
{
this.plateSurface = plateSurface;
}
public String getPlateSurface()
{
return plateSurface;
}
public void setAttachmentFiles(String attachmentFiles)
{
this.attachmentFiles = attachmentFiles;
}
public String getAttachmentFiles()
{
return attachmentFiles;
}
public void setThirdCoilId(Long thirdCoilId)
{
this.thirdCoilId = thirdCoilId;
}
public Long getThirdCoilId()
{
return thirdCoilId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("abnormalId", getAbnormalId())
.append("currentCoilNo", getCurrentCoilNo())
.append("productionLine", getProductionLine())
.append("position", getPosition())
.append("length", getLength())
.append("startPosition", getStartPosition())
.append("endPosition", getEndPosition())
.append("defectCode", getDefectCode())
.append("defectType", getDefectType())
.append("defectRate", getDefectRate())
.append("defectWeight", getDefectWeight())
.append("degree", getDegree())
.append("judgeLevel", getJudgeLevel())
.append("judgeBy", getJudgeBy())
.append("judgeTime", getJudgeTime())
.append("mainMark", getMainMark())
.append("wholeCoilMark", getWholeCoilMark())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("plateSurface", getPlateSurface())
.append("attachmentFiles", getAttachmentFiles())
.append("thirdCoilId", getThirdCoilId())
.toString();
}
}

View File

@@ -0,0 +1,177 @@
package com.ruoyi.mill.domain;
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;
/**
* 二级-三级钢卷异常挂接/撤回关系对象 mill_coil_abnormal_relation
*
* @author ruoyi
* @date 2026-06-03
*/
public class MillCoilAbnormalRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 关系ID */
private Long relationId;
/** 二级系统异常ID */
@Excel(name = "二级系统异常ID")
private Long secondAbnormalId;
/** 三级系统钢卷ID */
@Excel(name = "三级系统钢卷ID")
private Long thirdCoilId;
/** 【关键】三级表的异常ID */
@Excel(name = "【关键】三级表的异常ID")
private Long thirdAbnormalId;
/** 匹配时使用的钢卷号 */
@Excel(name = "匹配时使用的钢卷号")
private String currentCoilNo;
/** 状态1=已挂接2=已撤回 */
@Excel(name = "状态1=已挂接2=已撤回")
private Long bindStatus;
/** 挂接时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "挂接时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date bindTime;
/** 撤回时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "撤回时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date withdrawTime;
/** 操作人 */
@Excel(name = "操作人")
private String operateUser;
/** 操作备注(撤回原因) */
@Excel(name = "操作备注", readConverterExp = "撤=回原因")
private String operateRemark;
public void setRelationId(Long relationId)
{
this.relationId = relationId;
}
public Long getRelationId()
{
return relationId;
}
public void setSecondAbnormalId(Long secondAbnormalId)
{
this.secondAbnormalId = secondAbnormalId;
}
public Long getSecondAbnormalId()
{
return secondAbnormalId;
}
public void setThirdCoilId(Long thirdCoilId)
{
this.thirdCoilId = thirdCoilId;
}
public Long getThirdCoilId()
{
return thirdCoilId;
}
public void setThirdAbnormalId(Long thirdAbnormalId)
{
this.thirdAbnormalId = thirdAbnormalId;
}
public Long getThirdAbnormalId()
{
return thirdAbnormalId;
}
public void setCurrentCoilNo(String currentCoilNo)
{
this.currentCoilNo = currentCoilNo;
}
public String getCurrentCoilNo()
{
return currentCoilNo;
}
public void setBindStatus(Long bindStatus)
{
this.bindStatus = bindStatus;
}
public Long getBindStatus()
{
return bindStatus;
}
public void setBindTime(Date bindTime)
{
this.bindTime = bindTime;
}
public Date getBindTime()
{
return bindTime;
}
public void setWithdrawTime(Date withdrawTime)
{
this.withdrawTime = withdrawTime;
}
public Date getWithdrawTime()
{
return withdrawTime;
}
public void setOperateUser(String operateUser)
{
this.operateUser = operateUser;
}
public String getOperateUser()
{
return operateUser;
}
public void setOperateRemark(String operateRemark)
{
this.operateRemark = operateRemark;
}
public String getOperateRemark()
{
return operateRemark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("relationId", getRelationId())
.append("secondAbnormalId", getSecondAbnormalId())
.append("thirdCoilId", getThirdCoilId())
.append("thirdAbnormalId", getThirdAbnormalId())
.append("currentCoilNo", getCurrentCoilNo())
.append("bindStatus", getBindStatus())
.append("bindTime", getBindTime())
.append("withdrawTime", getWithdrawTime())
.append("operateUser", getOperateUser())
.append("operateRemark", getOperateRemark())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@@ -36,6 +36,7 @@ public class WmsCoilAbnormal extends BaseEntity {
private Integer wholeCoilMark;
private String attachmentFiles;
private Integer delFlag;
private Integer sourceSystem;
// 关联字段
private String coilNo; // 从 wms_material_coil 带出

View File

@@ -0,0 +1,61 @@
package com.ruoyi.mill.mapper;
import java.util.List;
import com.ruoyi.mill.domain.MillCoilAbnormal;
/**
* 钢卷异常信息Mapper接口
*
* @author ruoyi
* @date 2026-06-03
*/
public interface MillCoilAbnormalMapper
{
/**
* 查询钢卷异常信息
*
* @param abnormalId 钢卷异常信息主键
* @return 钢卷异常信息
*/
public MillCoilAbnormal selectMillCoilAbnormalByAbnormalId(Long abnormalId);
/**
* 查询钢卷异常信息列表
*
* @param millCoilAbnormal 钢卷异常信息
* @return 钢卷异常信息集合
*/
public List<MillCoilAbnormal> selectMillCoilAbnormalList(MillCoilAbnormal millCoilAbnormal);
/**
* 新增钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
public int insertMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal);
/**
* 修改钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
public int updateMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal);
/**
* 删除钢卷异常信息
*
* @param abnormalId 钢卷异常信息主键
* @return 结果
*/
public int deleteMillCoilAbnormalByAbnormalId(Long abnormalId);
/**
* 批量删除钢卷异常信息
*
* @param abnormalIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMillCoilAbnormalByAbnormalIds(Long[] abnormalIds);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.mill.mapper;
import java.util.List;
import com.ruoyi.mill.domain.MillCoilAbnormalRelation;
/**
* 二级-三级钢卷异常挂接/撤回关系Mapper接口
*
* @author ruoyi
* @date 2026-06-03
*/
public interface MillCoilAbnormalRelationMapper
{
/**
* 查询二级-三级钢卷异常挂接/撤回关系
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 二级-三级钢卷异常挂接/撤回关系
*/
public MillCoilAbnormalRelation selectMillCoilAbnormalRelationByRelationId(Long relationId);
/**
* 查询二级-三级钢卷异常挂接/撤回关系列表
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 二级-三级钢卷异常挂接/撤回关系集合
*/
public List<MillCoilAbnormalRelation> selectMillCoilAbnormalRelationList(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 新增二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
public int insertMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 修改二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
public int updateMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 删除二级-三级钢卷异常挂接/撤回关系
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 结果
*/
public int deleteMillCoilAbnormalRelationByRelationId(Long relationId);
/**
* 批量删除二级-三级钢卷异常挂接/撤回关系
*
* @param relationIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMillCoilAbnormalRelationByRelationIds(Long[] relationIds);
}

View File

@@ -0,0 +1,80 @@
package com.ruoyi.mill.service;
import java.util.List;
import com.ruoyi.mill.domain.MillCoilAbnormalRelation;
/**
* 二级-三级钢卷异常挂接/撤回关系Service接口
*
* @author ruoyi
* @date 2026-06-03
*/
public interface IMillCoilAbnormalRelationService
{
/**
* 查询二级-三级钢卷异常挂接/撤回关系
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 二级-三级钢卷异常挂接/撤回关系
*/
public MillCoilAbnormalRelation selectMillCoilAbnormalRelationByRelationId(Long relationId);
/**
* 查询二级-三级钢卷异常挂接/撤回关系列表
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 二级-三级钢卷异常挂接/撤回关系集合
*/
public List<MillCoilAbnormalRelation> selectMillCoilAbnormalRelationList(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 新增二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
public int insertMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 修改二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
public int updateMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation);
/**
* 批量删除二级-三级钢卷异常挂接/撤回关系
*
* @param relationIds 需要删除的二级-三级钢卷异常挂接/撤回关系主键集合
* @return 结果
*/
public int deleteMillCoilAbnormalRelationByRelationIds(Long[] relationIds);
/**
* 删除二级-三级钢卷异常挂接/撤回关系信息
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 结果
*/
public int deleteMillCoilAbnormalRelationByRelationId(Long relationId);
/**
* 挂接:将二级异常数据新增到三级异常表,并创建关联关系
*
* @param secondAbnormalId 二级异常ID
* @param operateUser 操作人
* @return 新建的关联关系ID
*/
public Long bindToThird(Long secondAbnormalId, String operateUser);
/**
* 撤回:逻辑删除三级异常表中的挂接数据,更新关联关系状态
*
* @param relationId 关联关系ID
* @param operateUser 操作人
* @param operateRemark 撤回原因
* @return 结果
*/
public int withdrawFromThird(Long relationId, String operateUser, String operateRemark);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.mill.service;
import java.util.List;
import com.ruoyi.mill.domain.MillCoilAbnormal;
/**
* 钢卷异常信息Service接口
*
* @author ruoyi
* @date 2026-06-03
*/
public interface IMillCoilAbnormalService
{
/**
* 查询钢卷异常信息
*
* @param abnormalId 钢卷异常信息主键
* @return 钢卷异常信息
*/
public MillCoilAbnormal selectMillCoilAbnormalByAbnormalId(Long abnormalId);
/**
* 查询钢卷异常信息列表
*
* @param millCoilAbnormal 钢卷异常信息
* @return 钢卷异常信息集合
*/
public List<MillCoilAbnormal> selectMillCoilAbnormalList(MillCoilAbnormal millCoilAbnormal);
/**
* 新增钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
public int insertMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal);
/**
* 修改钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
public int updateMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal);
/**
* 批量删除钢卷异常信息
*
* @param abnormalIds 需要删除的钢卷异常信息主键集合
* @return 结果
*/
public int deleteMillCoilAbnormalByAbnormalIds(Long[] abnormalIds);
/**
* 删除钢卷异常信息信息
*
* @param abnormalId 钢卷异常信息主键
* @return 结果
*/
public int deleteMillCoilAbnormalByAbnormalId(Long abnormalId);
}

View File

@@ -0,0 +1,199 @@
package com.ruoyi.mill.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mill.mapper.MillCoilAbnormalRelationMapper;
import com.ruoyi.mill.domain.MillCoilAbnormal;
import com.ruoyi.mill.domain.MillCoilAbnormalRelation;
import com.ruoyi.mill.domain.KlpCoilInfo;
import com.ruoyi.mill.domain.WmsCoilAbnormal;
import com.ruoyi.mill.service.IMillCoilAbnormalRelationService;
import com.ruoyi.mill.service.IMillCoilAbnormalService;
import com.ruoyi.mill.service.IKlpCoilService;
import com.ruoyi.mill.service.IWmsCoilAbnormalService;
/**
* 二级-三级钢卷异常挂接/撤回关系Service业务层处理
*
* @author ruoyi
* @date 2026-06-03
*/
@Service
public class MillCoilAbnormalRelationServiceImpl implements IMillCoilAbnormalRelationService
{
@Autowired
private MillCoilAbnormalRelationMapper millCoilAbnormalRelationMapper;
@Autowired
private IMillCoilAbnormalService millCoilAbnormalService;
@Autowired
private IKlpCoilService klpCoilService;
@Autowired
private IWmsCoilAbnormalService wmsCoilAbnormalService;
/**
* 查询二级-三级钢卷异常挂接/撤回关系
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 二级-三级钢卷异常挂接/撤回关系
*/
@Override
public MillCoilAbnormalRelation selectMillCoilAbnormalRelationByRelationId(Long relationId)
{
return millCoilAbnormalRelationMapper.selectMillCoilAbnormalRelationByRelationId(relationId);
}
/**
* 查询二级-三级钢卷异常挂接/撤回关系列表
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 二级-三级钢卷异常挂接/撤回关系
*/
@Override
public List<MillCoilAbnormalRelation> selectMillCoilAbnormalRelationList(MillCoilAbnormalRelation millCoilAbnormalRelation)
{
return millCoilAbnormalRelationMapper.selectMillCoilAbnormalRelationList(millCoilAbnormalRelation);
}
/**
* 新增二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
@Override
public int insertMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation)
{
millCoilAbnormalRelation.setCreateTime(DateUtils.getNowDate());
return millCoilAbnormalRelationMapper.insertMillCoilAbnormalRelation(millCoilAbnormalRelation);
}
/**
* 修改二级-三级钢卷异常挂接/撤回关系
*
* @param millCoilAbnormalRelation 二级-三级钢卷异常挂接/撤回关系
* @return 结果
*/
@Override
public int updateMillCoilAbnormalRelation(MillCoilAbnormalRelation millCoilAbnormalRelation)
{
return millCoilAbnormalRelationMapper.updateMillCoilAbnormalRelation(millCoilAbnormalRelation);
}
/**
* 批量删除二级-三级钢卷异常挂接/撤回关系
*
* @param relationIds 需要删除的二级-三级钢卷异常挂接/撤回关系主键
* @return 结果
*/
@Override
public int deleteMillCoilAbnormalRelationByRelationIds(Long[] relationIds)
{
return millCoilAbnormalRelationMapper.deleteMillCoilAbnormalRelationByRelationIds(relationIds);
}
/**
* 删除二级-三级钢卷异常挂接/撤回关系信息
*
* @param relationId 二级-三级钢卷异常挂接/撤回关系主键
* @return 结果
*/
@Override
public int deleteMillCoilAbnormalRelationByRelationId(Long relationId)
{
return millCoilAbnormalRelationMapper.deleteMillCoilAbnormalRelationByRelationId(relationId);
}
@Override
public Long bindToThird(Long secondAbnormalId, String operateUser)
{
MillCoilAbnormal secondAbnormal = millCoilAbnormalService.selectMillCoilAbnormalByAbnormalId(secondAbnormalId);
if (secondAbnormal == null)
{
throw new RuntimeException("二级异常记录不存在");
}
String coilNo = secondAbnormal.getCurrentCoilNo();
if (coilNo == null || coilNo.isEmpty())
{
throw new RuntimeException("二级异常记录的钢卷号为空,无法匹配三级钢卷");
}
KlpCoilInfo coilInfo = klpCoilService.queryByCoilNo(coilNo);
if (coilInfo == null)
{
throw new RuntimeException("在三级系统中未找到钢卷号[" + coilNo + "]对应的钢卷信息");
}
Long thirdCoilId = coilInfo.getCoilId();
WmsCoilAbnormal wmsAbnormal = new WmsCoilAbnormal();
wmsAbnormal.setCoilId(thirdCoilId);
wmsAbnormal.setProductionLine(secondAbnormal.getProductionLine());
wmsAbnormal.setPosition(secondAbnormal.getPosition());
wmsAbnormal.setPlateSurface(secondAbnormal.getPlateSurface());
wmsAbnormal.setLength(secondAbnormal.getLength());
wmsAbnormal.setStartPosition(secondAbnormal.getStartPosition());
wmsAbnormal.setEndPosition(secondAbnormal.getEndPosition());
wmsAbnormal.setDefectCode(secondAbnormal.getDefectCode());
wmsAbnormal.setDefectType(secondAbnormal.getDefectType());
wmsAbnormal.setDefectRate(secondAbnormal.getDefectRate());
wmsAbnormal.setDefectWeight(secondAbnormal.getDefectWeight());
wmsAbnormal.setDegree(secondAbnormal.getDegree());
wmsAbnormal.setJudgeLevel(secondAbnormal.getJudgeLevel());
wmsAbnormal.setJudgeBy(secondAbnormal.getJudgeBy());
wmsAbnormal.setJudgeTime(secondAbnormal.getJudgeTime());
wmsAbnormal.setMainMark(secondAbnormal.getMainMark() != null ? secondAbnormal.getMainMark().intValue() : null);
wmsAbnormal.setWholeCoilMark(secondAbnormal.getWholeCoilMark() != null ? secondAbnormal.getWholeCoilMark().intValue() : null);
wmsAbnormal.setAttachmentFiles(secondAbnormal.getAttachmentFiles());
wmsAbnormal.setRemark(secondAbnormal.getRemark());
wmsAbnormal.setCreateBy(operateUser);
wmsAbnormal.setCreateTime(DateUtils.getNowDate());
wmsAbnormal.setSourceSystem(2);
wmsCoilAbnormalService.insertWmsCoilAbnormal(wmsAbnormal);
Long thirdAbnormalId = wmsAbnormal.getAbnormalId();
if (thirdAbnormalId == null)
{
throw new RuntimeException("插入三级异常表失败未获取到异常ID");
}
MillCoilAbnormalRelation relation = new MillCoilAbnormalRelation();
relation.setSecondAbnormalId(secondAbnormalId);
relation.setThirdCoilId(thirdCoilId);
relation.setThirdAbnormalId(thirdAbnormalId);
relation.setCurrentCoilNo(coilNo);
relation.setBindStatus(1L);
relation.setBindTime(DateUtils.getNowDate());
relation.setOperateUser(operateUser);
relation.setCreateTime(DateUtils.getNowDate());
millCoilAbnormalRelationMapper.insertMillCoilAbnormalRelation(relation);
return relation.getRelationId();
}
@Override
public int withdrawFromThird(Long relationId, String operateUser, String operateRemark)
{
MillCoilAbnormalRelation relation = millCoilAbnormalRelationMapper.selectMillCoilAbnormalRelationByRelationId(relationId);
if (relation == null)
{
throw new RuntimeException("关联关系记录不存在");
}
if (relation.getBindStatus() != null && relation.getBindStatus() == 2L)
{
throw new RuntimeException("该记录已撤回,不能重复操作");
}
Long thirdAbnormalId = relation.getThirdAbnormalId();
if (thirdAbnormalId != null)
{
wmsCoilAbnormalService.deleteWmsCoilAbnormalById(thirdAbnormalId);
}
relation.setBindStatus(2L);
relation.setWithdrawTime(DateUtils.getNowDate());
relation.setOperateUser(operateUser);
relation.setOperateRemark(operateRemark);
return millCoilAbnormalRelationMapper.updateMillCoilAbnormalRelation(relation);
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.mill.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mill.mapper.MillCoilAbnormalMapper;
import com.ruoyi.mill.domain.MillCoilAbnormal;
import com.ruoyi.mill.service.IMillCoilAbnormalService;
/**
* 钢卷异常信息Service业务层处理
*
* @author ruoyi
* @date 2026-06-03
*/
@Service
public class MillCoilAbnormalServiceImpl implements IMillCoilAbnormalService
{
@Autowired
private MillCoilAbnormalMapper millCoilAbnormalMapper;
/**
* 查询钢卷异常信息
*
* @param abnormalId 钢卷异常信息主键
* @return 钢卷异常信息
*/
@Override
public MillCoilAbnormal selectMillCoilAbnormalByAbnormalId(Long abnormalId)
{
return millCoilAbnormalMapper.selectMillCoilAbnormalByAbnormalId(abnormalId);
}
/**
* 查询钢卷异常信息列表
*
* @param millCoilAbnormal 钢卷异常信息
* @return 钢卷异常信息
*/
@Override
public List<MillCoilAbnormal> selectMillCoilAbnormalList(MillCoilAbnormal millCoilAbnormal)
{
return millCoilAbnormalMapper.selectMillCoilAbnormalList(millCoilAbnormal);
}
/**
* 新增钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
@Override
public int insertMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal)
{
millCoilAbnormal.setCreateTime(DateUtils.getNowDate());
return millCoilAbnormalMapper.insertMillCoilAbnormal(millCoilAbnormal);
}
/**
* 修改钢卷异常信息
*
* @param millCoilAbnormal 钢卷异常信息
* @return 结果
*/
@Override
public int updateMillCoilAbnormal(MillCoilAbnormal millCoilAbnormal)
{
millCoilAbnormal.setUpdateTime(DateUtils.getNowDate());
return millCoilAbnormalMapper.updateMillCoilAbnormal(millCoilAbnormal);
}
/**
* 批量删除钢卷异常信息
*
* @param abnormalIds 需要删除的钢卷异常信息主键
* @return 结果
*/
@Override
public int deleteMillCoilAbnormalByAbnormalIds(Long[] abnormalIds)
{
return millCoilAbnormalMapper.deleteMillCoilAbnormalByAbnormalIds(abnormalIds);
}
/**
* 删除钢卷异常信息信息
*
* @param abnormalId 钢卷异常信息主键
* @return 结果
*/
@Override
public int deleteMillCoilAbnormalByAbnormalId(Long abnormalId)
{
return millCoilAbnormalMapper.deleteMillCoilAbnormalByAbnormalId(abnormalId);
}
}