diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProcessRecipeController.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProcessRecipeController.java new file mode 100644 index 00000000..35ed624a --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProcessRecipeController.java @@ -0,0 +1,52 @@ +package com.ruoyi.mill.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.mill.domain.MillProcessRecipe; +import com.ruoyi.mill.service.IMillProcessRecipeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import java.util.List; + +@RestController +@RequestMapping("/mill/recipe") +public class MillProcessRecipeController extends BaseController { + + @Autowired + private IMillProcessRecipeService recipeService; + + @GetMapping("/list") + public TableDataInfo list(MillProcessRecipe query) { + startPage(); + List list = recipeService.selectList(query); + return getDataTable(list); + } + + /** 不分页的全量列表(下拉选择用) */ + @GetMapping("/listAll") + public AjaxResult listAll(MillProcessRecipe query) { + return AjaxResult.success(recipeService.selectList(query)); + } + + @GetMapping("/{id}") + public AjaxResult detail(@PathVariable Long id) { + return AjaxResult.success(recipeService.selectDetailById(id)); + } + + @PostMapping + public AjaxResult add(@RequestBody MillProcessRecipe recipe) { + return toAjax(recipeService.save(recipe)); + } + + @PutMapping + public AjaxResult edit(@RequestBody MillProcessRecipe recipe) { + return toAjax(recipeService.update(recipe)); + } + + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(recipeService.deleteByIds(ids)); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProductionPlanController.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProductionPlanController.java new file mode 100644 index 00000000..8ffd86d6 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/controller/MillProductionPlanController.java @@ -0,0 +1,55 @@ +package com.ruoyi.mill.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.mill.domain.MillProductionPlan; +import com.ruoyi.mill.service.IMillProductionPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import java.util.List; + +@RestController +@RequestMapping("/mill/plan") +public class MillProductionPlanController extends BaseController { + + @Autowired + private IMillProductionPlanService planService; + + @GetMapping("/list") + public AjaxResult list(MillProductionPlan query) { + // 轧制队列不分页,按 sort_no 顺序全量返回 + List list = planService.selectList(query); + return AjaxResult.success(list); + } + + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable Long id) { + return AjaxResult.success(planService.selectById(id)); + } + + @PostMapping + public AjaxResult add(@RequestBody MillProductionPlan plan) { + return toAjax(planService.insert(plan)); + } + + @PutMapping + public AjaxResult edit(@RequestBody MillProductionPlan plan) { + return toAjax(planService.update(plan)); + } + + @DeleteMapping("/{id}") + public AjaxResult remove(@PathVariable Long id) { + return toAjax(planService.deleteById(id)); + } + + @PutMapping("/moveUp/{id}") + public AjaxResult moveUp(@PathVariable Long id) { + return toAjax(planService.moveUp(id)); + } + + @PutMapping("/moveDown/{id}") + public AjaxResult moveDown(@PathVariable Long id) { + return toAjax(planService.moveDown(id)); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessPass.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessPass.java new file mode 100644 index 00000000..92c932f4 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessPass.java @@ -0,0 +1,78 @@ +package com.ruoyi.mill.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import java.math.BigDecimal; + +/** 工艺方案道次详情 */ +public class MillProcessPass extends BaseEntity { + + private Long recipeId; + + @Excel(name = "道次") + private Integer passNo; + + @Excel(name = "入口厚度(mm)") + private BigDecimal inThick; + + @Excel(name = "出口厚度(mm)") + private BigDecimal outThick; + + @Excel(name = "宽度(mm)") + private BigDecimal width; + + @Excel(name = "轧制力(kN)") + private BigDecimal rollForce; + + @Excel(name = "入口张力(kN)") + private BigDecimal inTension; + + @Excel(name = "出口张力(kN)") + private BigDecimal outTension; + + @Excel(name = "最高速度(m/min)") + private BigDecimal maxSpeed; + + @Excel(name = "入口单位张力(N/mm²)") + private BigDecimal inUnitTension; + + @Excel(name = "出口单位张力(N/mm²)") + private BigDecimal outUnitTension; + + @Excel(name = "压下量(mm)") + private BigDecimal reduction; + + @Excel(name = "总压下量(mm)") + private BigDecimal totalReduction; + + private String delFlag; + + public Long getRecipeId() { return recipeId; } + public void setRecipeId(Long v) { this.recipeId = v; } + public Integer getPassNo() { return passNo; } + public void setPassNo(Integer v) { this.passNo = v; } + public BigDecimal getInThick() { return inThick; } + public void setInThick(BigDecimal v) { this.inThick = v; } + public BigDecimal getOutThick() { return outThick; } + public void setOutThick(BigDecimal v) { this.outThick = v; } + public BigDecimal getWidth() { return width; } + public void setWidth(BigDecimal v) { this.width = v; } + public BigDecimal getRollForce() { return rollForce; } + public void setRollForce(BigDecimal v) { this.rollForce = v; } + public BigDecimal getInTension() { return inTension; } + public void setInTension(BigDecimal v) { this.inTension = v; } + public BigDecimal getOutTension() { return outTension; } + public void setOutTension(BigDecimal v) { this.outTension = v; } + public BigDecimal getMaxSpeed() { return maxSpeed; } + public void setMaxSpeed(BigDecimal v) { this.maxSpeed = v; } + public BigDecimal getInUnitTension() { return inUnitTension; } + public void setInUnitTension(BigDecimal v) { this.inUnitTension = v; } + public BigDecimal getOutUnitTension() { return outUnitTension; } + public void setOutUnitTension(BigDecimal v){ this.outUnitTension = v; } + public BigDecimal getReduction() { return reduction; } + public void setReduction(BigDecimal v) { this.reduction = v; } + public BigDecimal getTotalReduction() { return totalReduction; } + public void setTotalReduction(BigDecimal v){ this.totalReduction = v; } + public String getDelFlag() { return delFlag; } + public void setDelFlag(String v) { this.delFlag = v; } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessRecipe.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessRecipe.java new file mode 100644 index 00000000..7e9acb54 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProcessRecipe.java @@ -0,0 +1,56 @@ +package com.ruoyi.mill.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import java.math.BigDecimal; +import java.util.List; + +/** 工艺方案主表 */ +public class MillProcessRecipe extends BaseEntity { + + @Excel(name = "方案记录号") + private String recipeNo; + + @Excel(name = "合金号") + private String alloyNo; + + @Excel(name = "道次数量") + private Integer passCount; + + @Excel(name = "原料厚度(mm)") + private BigDecimal inThick; + + @Excel(name = "成品厚度(mm)") + private BigDecimal outThick; + + @Excel(name = "成品宽度(mm)") + private BigDecimal outWidth; + + /** 0-正常 1-停用 */ + private String status; + + /** 删除标志 0-存在 2-删除 */ + private String delFlag; + + /** 关联道次列表(非数据库字段) */ + private List passList; + + public String getRecipeNo() { return recipeNo; } + public void setRecipeNo(String v) { this.recipeNo = v; } + public String getAlloyNo() { return alloyNo; } + public void setAlloyNo(String v) { this.alloyNo = v; } + public Integer getPassCount() { return passCount; } + public void setPassCount(Integer v) { this.passCount = v; } + public BigDecimal getInThick() { return inThick; } + public void setInThick(BigDecimal v) { this.inThick = v; } + public BigDecimal getOutThick() { return outThick; } + public void setOutThick(BigDecimal v) { this.outThick = v; } + public BigDecimal getOutWidth() { return outWidth; } + public void setOutWidth(BigDecimal v) { this.outWidth = v; } + public String getStatus() { return status; } + public void setStatus(String v) { this.status = v; } + public String getDelFlag() { return delFlag; } + public void setDelFlag(String v) { this.delFlag = v; } + public List getPassList() { return passList; } + public void setPassList(List v) { this.passList = v; } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProductionPlan.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProductionPlan.java new file mode 100644 index 00000000..7b819668 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/domain/MillProductionPlan.java @@ -0,0 +1,111 @@ +package com.ruoyi.mill.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import java.math.BigDecimal; + +/** 生产计划(轧制队列) */ +public class MillProductionPlan extends BaseEntity { + + @Excel(name = "计划号") + private String planNo; + + private String matSeqNo; + private String unitCode; + private String planType; + + /** 0-待生产 1-生产中 2-完成 3-撤销 */ + @Excel(name = "计划状态") + private String planStatus; + + /** Rolling / NextCoil / Idle */ + @Excel(name = "生产状态") + private String prodStatus; + + @Excel(name = "队列序号") + private Integer sortNo; + + @Excel(name = "钢卷编号") + private String inMatNo; + + @Excel(name = "采料厚度(mm)") + private BigDecimal inMatThick; + + @Excel(name = "采料宽度(mm)") + private BigDecimal inMatWidth; + + @Excel(name = "采料重量(kg)") + private BigDecimal inMatWt; + + @Excel(name = "采料长度(m)") + private BigDecimal inMatLen; + + @Excel(name = "采料内径(mm)") + private BigDecimal inMatInDia; + + @Excel(name = "采料外径(mm)") + private BigDecimal inMatDia; + + @Excel(name = "炉号") + private String pono; + + @Excel(name = "合金牌号") + private String sgSign; + + @Excel(name = "出口材料号") + private String outMatNo; + + @Excel(name = "成品厚度(mm)") + private BigDecimal outThick; + + @Excel(name = "工艺方案ID") + private Long recipeId; + + @Excel(name = "工艺方案号") + private String recipeNo; + + private String delFlag; + + public String getPlanNo() { return planNo; } + public void setPlanNo(String v) { this.planNo = v; } + public String getMatSeqNo() { return matSeqNo; } + public void setMatSeqNo(String v) { this.matSeqNo = v; } + public String getUnitCode() { return unitCode; } + public void setUnitCode(String v) { this.unitCode = v; } + public String getPlanType() { return planType; } + public void setPlanType(String v) { this.planType = v; } + public String getPlanStatus() { return planStatus; } + public void setPlanStatus(String v) { this.planStatus = v; } + public String getProdStatus() { return prodStatus; } + public void setProdStatus(String v) { this.prodStatus = v; } + public Integer getSortNo() { return sortNo; } + public void setSortNo(Integer v) { this.sortNo = v; } + public String getInMatNo() { return inMatNo; } + public void setInMatNo(String v) { this.inMatNo = v; } + public BigDecimal getInMatThick() { return inMatThick; } + public void setInMatThick(BigDecimal v) { this.inMatThick = v; } + public BigDecimal getInMatWidth() { return inMatWidth; } + public void setInMatWidth(BigDecimal v) { this.inMatWidth = v; } + public BigDecimal getInMatWt() { return inMatWt; } + public void setInMatWt(BigDecimal v) { this.inMatWt = v; } + public BigDecimal getInMatLen() { return inMatLen; } + public void setInMatLen(BigDecimal v) { this.inMatLen = v; } + public BigDecimal getInMatInDia() { return inMatInDia; } + public void setInMatInDia(BigDecimal v) { this.inMatInDia = v; } + public BigDecimal getInMatDia() { return inMatDia; } + public void setInMatDia(BigDecimal v) { this.inMatDia = v; } + public String getPono() { return pono; } + public void setPono(String v) { this.pono = v; } + public String getSgSign() { return sgSign; } + public void setSgSign(String v) { this.sgSign = v; } + public String getOutMatNo() { return outMatNo; } + public void setOutMatNo(String v) { this.outMatNo = v; } + public BigDecimal getOutThick() { return outThick; } + public void setOutThick(BigDecimal v) { this.outThick = v; } + public Long getRecipeId() { return recipeId; } + public void setRecipeId(Long v) { this.recipeId = v; } + public String getRecipeNo() { return recipeNo; } + public void setRecipeNo(String v) { this.recipeNo = v; } + public String getDelFlag() { return delFlag; } + public void setDelFlag(String v) { this.delFlag = v; } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessPassMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessPassMapper.java new file mode 100644 index 00000000..d32bf95c --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessPassMapper.java @@ -0,0 +1,10 @@ +package com.ruoyi.mill.mapper; + +import com.ruoyi.mill.domain.MillProcessPass; +import java.util.List; + +public interface MillProcessPassMapper { + List selectByRecipeId(Long recipeId); + int insertBatch(List list); + int deleteByRecipeId(Long recipeId); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessRecipeMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessRecipeMapper.java new file mode 100644 index 00000000..73bb9834 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProcessRecipeMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.mill.mapper; + +import com.ruoyi.mill.domain.MillProcessRecipe; +import java.util.List; + +public interface MillProcessRecipeMapper { + List selectList(MillProcessRecipe query); + MillProcessRecipe selectById(Long id); + MillProcessRecipe selectByRecipeNo(String recipeNo); + int insert(MillProcessRecipe recipe); + int update(MillProcessRecipe recipe); + int deleteById(Long id); + int deleteBatchByIds(Long[] ids); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProductionPlanMapper.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProductionPlanMapper.java new file mode 100644 index 00000000..39b02417 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/mapper/MillProductionPlanMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.mill.mapper; + +import com.ruoyi.mill.domain.MillProductionPlan; +import java.util.List; + +public interface MillProductionPlanMapper { + List selectList(MillProductionPlan query); + MillProductionPlan selectById(Long id); + MillProductionPlan selectByPlanNo(String planNo); + int insert(MillProductionPlan plan); + int update(MillProductionPlan plan); + int deleteById(Long id); + /** 将 sortNo >= targetSort 的记录全部 +1(上移腾位) */ + int incrementSortFrom(int targetSort); + /** 交换两条记录的 sortNo */ + int updateSortNo(Long id, int sortNo); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProcessRecipeService.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProcessRecipeService.java new file mode 100644 index 00000000..e3e42255 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProcessRecipeService.java @@ -0,0 +1,13 @@ +package com.ruoyi.mill.service; + +import com.ruoyi.mill.domain.MillProcessRecipe; +import java.util.List; + +public interface IMillProcessRecipeService { + List selectList(MillProcessRecipe query); + /** 查询方案详情(含道次列表) */ + MillProcessRecipe selectDetailById(Long id); + int save(MillProcessRecipe recipe); + int update(MillProcessRecipe recipe); + int deleteByIds(Long[] ids); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProductionPlanService.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProductionPlanService.java new file mode 100644 index 00000000..9cf8fa8b --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/IMillProductionPlanService.java @@ -0,0 +1,14 @@ +package com.ruoyi.mill.service; + +import com.ruoyi.mill.domain.MillProductionPlan; +import java.util.List; + +public interface IMillProductionPlanService { + List selectList(MillProductionPlan query); + MillProductionPlan selectById(Long id); + int insert(MillProductionPlan plan); + int update(MillProductionPlan plan); + int deleteById(Long id); + int moveUp(Long id); + int moveDown(Long id); +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProcessRecipeServiceImpl.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProcessRecipeServiceImpl.java new file mode 100644 index 00000000..e6ae5ac6 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProcessRecipeServiceImpl.java @@ -0,0 +1,76 @@ +package com.ruoyi.mill.service.impl; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.mill.domain.MillProcessPass; +import com.ruoyi.mill.domain.MillProcessRecipe; +import com.ruoyi.mill.mapper.MillProcessPassMapper; +import com.ruoyi.mill.mapper.MillProcessRecipeMapper; +import com.ruoyi.mill.service.IMillProcessRecipeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.List; + +@Service +public class MillProcessRecipeServiceImpl implements IMillProcessRecipeService { + + @Autowired private MillProcessRecipeMapper recipeMapper; + @Autowired private MillProcessPassMapper passMapper; + + @Override + public List selectList(MillProcessRecipe query) { + return recipeMapper.selectList(query); + } + + @Override + public MillProcessRecipe selectDetailById(Long id) { + MillProcessRecipe recipe = recipeMapper.selectById(id); + if (recipe != null) { + recipe.setPassList(passMapper.selectByRecipeId(id)); + } + return recipe; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int save(MillProcessRecipe recipe) { + String user = SecurityUtils.getUsername(); + recipe.setCreateBy(user); + recipe.setUpdateBy(user); + recipeMapper.insert(recipe); + savePassList(recipe); + return 1; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int update(MillProcessRecipe recipe) { + recipe.setUpdateBy(SecurityUtils.getUsername()); + recipeMapper.update(recipe); + // 先删除旧道次,再重新插入 + passMapper.deleteByRecipeId(recipe.getId()); + savePassList(recipe); + return 1; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteByIds(Long[] ids) { + for (Long id : ids) { + passMapper.deleteByRecipeId(id); + } + return recipeMapper.deleteBatchByIds(ids); + } + + private void savePassList(MillProcessRecipe recipe) { + List list = recipe.getPassList(); + if (list == null || list.isEmpty()) return; + String user = SecurityUtils.getUsername(); + for (MillProcessPass p : list) { + p.setRecipeId(recipe.getId()); + p.setCreateBy(user); + p.setUpdateBy(user); + } + passMapper.insertBatch(list); + } +} diff --git a/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProductionPlanServiceImpl.java b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProductionPlanServiceImpl.java new file mode 100644 index 00000000..99d0e039 --- /dev/null +++ b/ruoyi-mill/src/main/java/com/ruoyi/mill/service/impl/MillProductionPlanServiceImpl.java @@ -0,0 +1,80 @@ +package com.ruoyi.mill.service.impl; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.mill.domain.MillProductionPlan; +import com.ruoyi.mill.mapper.MillProductionPlanMapper; +import com.ruoyi.mill.service.IMillProductionPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.List; + +@Service +public class MillProductionPlanServiceImpl implements IMillProductionPlanService { + + @Autowired private MillProductionPlanMapper planMapper; + + @Override + public List selectList(MillProductionPlan query) { + return planMapper.selectList(query); + } + + @Override + public MillProductionPlan selectById(Long id) { + return planMapper.selectById(id); + } + + @Override + public int insert(MillProductionPlan plan) { + String user = SecurityUtils.getUsername(); + plan.setCreateBy(user); + plan.setUpdateBy(user); + // 新计划追加到队列末尾 + List all = planMapper.selectList(new MillProductionPlan()); + plan.setSortNo(all.size() + 1); + return planMapper.insert(plan); + } + + @Override + public int update(MillProductionPlan plan) { + plan.setUpdateBy(SecurityUtils.getUsername()); + return planMapper.update(plan); + } + + @Override + public int deleteById(Long id) { + return planMapper.deleteById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int moveUp(Long id) { + MillProductionPlan cur = planMapper.selectById(id); + if (cur == null || cur.getSortNo() <= 1) return 0; + // 找上一条 + MillProductionPlan query = new MillProductionPlan(); + List all = planMapper.selectList(query); + MillProductionPlan prev = all.stream() + .filter(p -> p.getSortNo() == cur.getSortNo() - 1) + .findFirst().orElse(null); + if (prev == null) return 0; + planMapper.updateSortNo(cur.getId(), prev.getSortNo()); + planMapper.updateSortNo(prev.getId(), cur.getSortNo()); + return 1; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int moveDown(Long id) { + MillProductionPlan cur = planMapper.selectById(id); + if (cur == null) return 0; + List all = planMapper.selectList(new MillProductionPlan()); + MillProductionPlan next = all.stream() + .filter(p -> p.getSortNo() == cur.getSortNo() + 1) + .findFirst().orElse(null); + if (next == null) return 0; + planMapper.updateSortNo(cur.getId(), next.getSortNo()); + planMapper.updateSortNo(next.getId(), cur.getSortNo()); + return 1; + } +} diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MillProcessPassMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MillProcessPassMapper.xml new file mode 100644 index 00000000..457b1426 --- /dev/null +++ b/ruoyi-mill/src/main/resources/mapper/mill/MillProcessPassMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO mill_process_pass ( + recipe_id, pass_no, in_thick, out_thick, width, + roll_force, in_tension, out_tension, max_speed, + in_unit_tension, out_unit_tension, reduction, total_reduction, + create_by, create_time, update_by, update_time, remark, del_flag + ) VALUES + + (#{p.recipeId}, #{p.passNo}, #{p.inThick}, #{p.outThick}, #{p.width}, + #{p.rollForce}, #{p.inTension}, #{p.outTension}, #{p.maxSpeed}, + #{p.inUnitTension}, #{p.outUnitTension}, #{p.reduction}, #{p.totalReduction}, + #{p.createBy}, NOW(), #{p.updateBy}, NOW(), #{p.remark}, '0') + + + + + UPDATE mill_process_pass SET del_flag = '2', update_time = NOW() + WHERE recipe_id = #{recipeId} + + + diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MillProcessRecipeMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MillProcessRecipeMapper.xml new file mode 100644 index 00000000..23499c75 --- /dev/null +++ b/ruoyi-mill/src/main/resources/mapper/mill/MillProcessRecipeMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + id, recipe_no, alloy_no, pass_count, in_thick, out_thick, out_width, + status, del_flag, create_by, create_time, update_by, update_time, remark + + + + + + + + + + INSERT INTO mill_process_recipe ( + recipe_no, alloy_no, pass_count, in_thick, out_thick, out_width, + status, create_by, create_time, update_by, update_time, remark, del_flag + ) VALUES ( + #{recipeNo}, #{alloyNo}, #{passCount}, #{inThick}, #{outThick}, #{outWidth}, + #{status}, #{createBy}, NOW(), #{updateBy}, NOW(), #{remark}, '0' + ) + + + + UPDATE mill_process_recipe + SET recipe_no = #{recipeNo}, + alloy_no = #{alloyNo}, + pass_count = #{passCount}, + in_thick = #{inThick}, + out_thick = #{outThick}, + out_width = #{outWidth}, + status = #{status}, + update_by = #{updateBy}, + update_time = NOW(), + remark = #{remark} + WHERE id = #{id} + + + + UPDATE mill_process_recipe SET del_flag = '2', update_time = NOW() WHERE id = #{id} + + + + UPDATE mill_process_recipe SET del_flag = '2', update_time = NOW() + WHERE id IN + #{id} + + + diff --git a/ruoyi-mill/src/main/resources/mapper/mill/MillProductionPlanMapper.xml b/ruoyi-mill/src/main/resources/mapper/mill/MillProductionPlanMapper.xml new file mode 100644 index 00000000..0469436c --- /dev/null +++ b/ruoyi-mill/src/main/resources/mapper/mill/MillProductionPlanMapper.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, plan_no, mat_seq_no, unit_code, plan_type, plan_status, prod_status, sort_no, + in_mat_no, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len, in_mat_in_dia, in_mat_dia, + pono, sg_sign, out_mat_no, out_thick, recipe_id, recipe_no, + del_flag, create_by, create_time, update_by, update_time, remark + + + + + + + + + + INSERT INTO mill_production_plan ( + plan_no, mat_seq_no, unit_code, plan_type, plan_status, prod_status, sort_no, + in_mat_no, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len, in_mat_in_dia, in_mat_dia, + pono, sg_sign, out_mat_no, out_thick, recipe_id, recipe_no, + create_by, create_time, update_by, update_time, remark, del_flag + ) VALUES ( + #{planNo}, #{matSeqNo}, #{unitCode}, #{planType}, + IFNULL(#{planStatus},'0'), IFNULL(#{prodStatus},'Idle'), IFNULL(#{sortNo},0), + #{inMatNo}, #{inMatThick}, #{inMatWidth}, #{inMatWt}, #{inMatLen}, #{inMatInDia}, #{inMatDia}, + #{pono}, #{sgSign}, #{outMatNo}, #{outThick}, #{recipeId}, #{recipeNo}, + #{createBy}, NOW(), #{updateBy}, NOW(), #{remark}, '0' + ) + + + + UPDATE mill_production_plan + SET plan_status = #{planStatus}, + prod_status = #{prodStatus}, + in_mat_no = #{inMatNo}, + in_mat_thick = #{inMatThick}, + in_mat_width = #{inMatWidth}, + in_mat_wt = #{inMatWt}, + in_mat_len = #{inMatLen}, + in_mat_in_dia= #{inMatInDia}, + in_mat_dia = #{inMatDia}, + pono = #{pono}, + sg_sign = #{sgSign}, + out_mat_no = #{outMatNo}, + out_thick = #{outThick}, + recipe_id = #{recipeId}, + recipe_no = #{recipeNo}, + update_by = #{updateBy}, + update_time = NOW(), + remark = #{remark} + WHERE id = #{id} + + + + UPDATE mill_production_plan SET del_flag = '2', update_time = NOW() WHERE id = #{id} + + + + UPDATE mill_production_plan SET sort_no = sort_no + 1 + WHERE sort_no >= #{targetSort} AND del_flag = '0' + + + + UPDATE mill_production_plan SET sort_no = #{sortNo} WHERE id = #{id} + + + diff --git a/ruoyi-ui/src/api/mill/plan.js b/ruoyi-ui/src/api/mill/plan.js new file mode 100644 index 00000000..f87f92bc --- /dev/null +++ b/ruoyi-ui/src/api/mill/plan.js @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +export function listPlan(query) { + return request({ url: '/mill/plan/list', method: 'get', params: query }) +} +export function getPlan(id) { + return request({ url: `/mill/plan/${id}`, method: 'get' }) +} +export function addPlan(data) { + return request({ url: '/mill/plan', method: 'post', data }) +} +export function updatePlan(data) { + return request({ url: '/mill/plan', method: 'put', data }) +} +export function delPlan(id) { + return request({ url: `/mill/plan/${id}`, method: 'delete' }) +} +export function moveUpPlan(id) { + return request({ url: `/mill/plan/moveUp/${id}`, method: 'put' }) +} +export function moveDownPlan(id) { + return request({ url: `/mill/plan/moveDown/${id}`, method: 'put' }) +} diff --git a/ruoyi-ui/src/api/mill/recipe.js b/ruoyi-ui/src/api/mill/recipe.js new file mode 100644 index 00000000..362d8a04 --- /dev/null +++ b/ruoyi-ui/src/api/mill/recipe.js @@ -0,0 +1,20 @@ +import request from '@/utils/request' + +export function listRecipe(query) { + return request({ url: '/mill/recipe/list', method: 'get', params: query }) +} +export function listAllRecipe(query) { + return request({ url: '/mill/recipe/listAll', method: 'get', params: query }) +} +export function getRecipeDetail(id) { + return request({ url: `/mill/recipe/${id}`, method: 'get' }) +} +export function addRecipe(data) { + return request({ url: '/mill/recipe', method: 'post', data }) +} +export function updateRecipe(data) { + return request({ url: '/mill/recipe', method: 'put', data }) +} +export function delRecipe(ids) { + return request({ url: `/mill/recipe/${ids}`, method: 'delete' }) +} diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 396f639a..2ff1dd07 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -179,6 +179,32 @@ export const constantRoutes = [ } ] }, + { + path: '/mill', + component: Layout, + hidden: true, + children: [ + { + path: 'process', + component: () => import('@/views/mill/process'), + name: 'MillProcess', + meta: { title: '工艺管理', icon: '' } + } + ] + }, + { + path: '/mill', + component: Layout, + hidden: true, + children: [ + { + path: 'plan', + component: () => import('@/views/mill/plan'), + name: 'MillPlan', + meta: { title: '生产计划', icon: '' } + } + ] + }, ] // 动态路由,基于用户权限动态去加载 diff --git a/ruoyi-ui/src/views/mill/plan.vue b/ruoyi-ui/src/views/mill/plan.vue new file mode 100644 index 00000000..fe26b2a2 --- /dev/null +++ b/ruoyi-ui/src/views/mill/plan.vue @@ -0,0 +1,485 @@ + + + + + diff --git a/ruoyi-ui/src/views/mill/process.vue b/ruoyi-ui/src/views/mill/process.vue new file mode 100644 index 00000000..cd9ab7b6 --- /dev/null +++ b/ruoyi-ui/src/views/mill/process.vue @@ -0,0 +1,432 @@ + + + + + diff --git a/sql/mill_tables.sql b/sql/mill_tables.sql new file mode 100644 index 00000000..619124d1 --- /dev/null +++ b/sql/mill_tables.sql @@ -0,0 +1,95 @@ +-- ============================================================ +-- 冷轧双机架二级控制系统业务表 +-- ============================================================ + +-- ---------------------------- +-- 1. 工艺方案主表 +-- ---------------------------- +DROP TABLE IF EXISTS `mill_process_recipe`; +CREATE TABLE `mill_process_recipe` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `recipe_no` varchar(30) NOT NULL COMMENT '方案记录号/方案名称', + `alloy_no` varchar(24) NOT NULL COMMENT '合金号(钢种)', + `pass_count` int(4) NOT NULL DEFAULT 0 COMMENT '道次数量', + `in_thick` decimal(9,3) NOT NULL DEFAULT 0.000 COMMENT '原料厚度(mm)', + `out_thick` decimal(9,3) NOT NULL DEFAULT 0.000 COMMENT '成品厚度(mm)', + `out_width` decimal(10,3) NOT NULL DEFAULT 0.000 COMMENT '成品宽度(mm)', + `status` char(1) NOT NULL DEFAULT '0' COMMENT '状态 0-正常 1-停用', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + `del_flag` char(1) NOT NULL DEFAULT '0' COMMENT '删除标志 0-存在 2-删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_recipe_no` (`recipe_no`), + KEY `idx_alloy_no` (`alloy_no`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工艺方案主表'; + +-- ---------------------------- +-- 2. 工艺方案道次详情表 +-- ---------------------------- +DROP TABLE IF EXISTS `mill_process_pass`; +CREATE TABLE `mill_process_pass` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `recipe_id` bigint(20) NOT NULL COMMENT '方案ID', + `pass_no` int(4) NOT NULL COMMENT '道次号', + `in_thick` decimal(9,3) NOT NULL DEFAULT 0.000 COMMENT '入口厚度(mm)', + `out_thick` decimal(9,3) NOT NULL DEFAULT 0.000 COMMENT '出口厚度(mm)', + `width` decimal(10,3) NOT NULL DEFAULT 0.000 COMMENT '宽度(mm)', + `roll_force` decimal(10,1) NOT NULL DEFAULT 0.0 COMMENT '轧制力(kN)', + `in_tension` decimal(10,1) NOT NULL DEFAULT 0.0 COMMENT '入口张力(kN)', + `out_tension` decimal(10,1) NOT NULL DEFAULT 0.0 COMMENT '出口张力(kN)', + `max_speed` decimal(10,1) NOT NULL DEFAULT 0.0 COMMENT '最高速度(m/min)', + `in_unit_tension` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT '入口单位张力(N/mm²)', + `out_unit_tension` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT '出口单位张力(N/mm²)', + `reduction` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT '道次压下量(mm)', + `total_reduction` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT '累计总压下量(mm)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + `del_flag` char(1) NOT NULL DEFAULT '0' COMMENT '删除标志 0-存在 2-删除', + PRIMARY KEY (`id`), + KEY `idx_recipe_id` (`recipe_id`), + KEY `idx_recipe_pass` (`recipe_id`, `pass_no`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工艺方案道次详情表'; + +-- ---------------------------- +-- 3. 生产计划表(轧制队列) +-- ---------------------------- +DROP TABLE IF EXISTS `mill_production_plan`; +CREATE TABLE `mill_production_plan` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `plan_no` varchar(30) NOT NULL COMMENT '计划号', + `mat_seq_no` varchar(3) DEFAULT '' COMMENT 'L3序号', + `unit_code` varchar(4) DEFAULT '' COMMENT '机组代码', + `plan_type` char(1) DEFAULT '' COMMENT '计划类型', + `plan_status` char(1) NOT NULL DEFAULT '0' COMMENT '计划状态 0-待生产 1-生产中 2-完成 3-撤销', + `prod_status` varchar(20) DEFAULT '' COMMENT '生产状态(Rolling/NextCoil/Idle等)', + `sort_no` int(6) NOT NULL DEFAULT 0 COMMENT '队列排序号', + `in_mat_no` varchar(20) NOT NULL COMMENT '入口钢卷号', + `in_mat_thick` decimal(9,3) DEFAULT 0.000 COMMENT '入口厚度(mm)', + `in_mat_width` decimal(10,3) DEFAULT 0.000 COMMENT '入口宽度(mm)', + `in_mat_wt` decimal(8,0) DEFAULT 0 COMMENT '入口重量(kg)', + `in_mat_len` decimal(12,3) DEFAULT 0.000 COMMENT '入口长度(m)', + `in_mat_in_dia` decimal(8,2) DEFAULT 0.00 COMMENT '入口内径(mm)', + `in_mat_dia` decimal(8,2) DEFAULT 0.00 COMMENT '入口外径(mm)', + `pono` varchar(10) DEFAULT '' COMMENT '炉号', + `sg_sign` varchar(24) DEFAULT '' COMMENT '钢种', + `out_mat_no` varchar(20) DEFAULT '' COMMENT '出口材料号', + `out_thick` decimal(9,3) DEFAULT 0.000 COMMENT '成品厚度(mm)', + `recipe_id` bigint(20) DEFAULT NULL COMMENT '绑定工艺方案ID', + `recipe_no` varchar(30) DEFAULT '' COMMENT '绑定工艺方案号', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + `del_flag` char(1) NOT NULL DEFAULT '0' COMMENT '删除标志 0-存在 2-删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_plan_no` (`plan_no`), + KEY `idx_plan_status` (`plan_status`), + KEY `idx_sort_no` (`sort_no`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='生产计划表(轧制队列)';