feat(mill): 添加清空指定机架所有备辊功能
- 在 MesRollStandbyController 中新增 clearByStand 接口
- 添加 DELETE /mill/standby/clear 路径用于清空指定机架备辊
- 实现同时回退轧辊状态的业务逻辑
- 添加权限校验 @PreAuthorize("@ss.hasPermi('mill:standby:remove')")
- 集成操作日志记录功能
- 更新 MesRollChangeServiceImpl 中的代码风格,统一 if 语句的大括号格式
This commit is contained in:
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -101,4 +102,16 @@ public class MesRollStandbyController extends BaseController
|
||||
{
|
||||
return toAjax(mesRollStandbyService.deleteMesRollStandbyByStandbyIds(standbyIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空指定机架所有备辊,同时回退轧辊状态
|
||||
* DELETE /mill/standby/clear?lineId=xxx&standNo=1%23
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mill:standby:remove')")
|
||||
@Log(title = "下批轧辊(待换上)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/clear")
|
||||
public AjaxResult clearByStand(@RequestParam Long lineId, @RequestParam String standNo)
|
||||
{
|
||||
return toAjax(mesRollStandbyService.clearByStand(lineId, standNo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,9 @@ public class MesRollChangeServiceImpl implements IMesRollChangeService
|
||||
public MesRollChangeVo queryCurrentByStand(Long lineId, String standNo) {
|
||||
// 组合各辊位最新状态,转换为 VO
|
||||
Map<String, Object> state = mesRollChangeMapper.selectCurrentStateByStand(lineId, standNo);
|
||||
if (state == null) return null;
|
||||
if (state == null) {
|
||||
return null;
|
||||
}
|
||||
MesRollChangeVo vo = new MesRollChangeVo();
|
||||
vo.setLineId(lineId);
|
||||
vo.setStandNo(standNo);
|
||||
@@ -170,9 +172,15 @@ public class MesRollChangeServiceImpl implements IMesRollChangeService
|
||||
|
||||
/** 安全转 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());
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -189,7 +197,9 @@ public class MesRollChangeServiceImpl implements IMesRollChangeService
|
||||
|
||||
/** 将统计结果 Map 填充到 VO */
|
||||
private void fillStatsToVo(MesRollChangeVo vo, Map<String, Object> stats) {
|
||||
if (stats == null) return;
|
||||
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")));
|
||||
|
||||
Reference in New Issue
Block a user