diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/ProcessRouteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/ProcessRouteController.java new file mode 100644 index 00000000..5fa03cf0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/ProcessRouteController.java @@ -0,0 +1,159 @@ +package com.ruoyi.web.controller.nanjing; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.nanjing.domain.ProcessRoute; +import com.ruoyi.nanjing.service.IProcessRouteService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 工艺路线Controller + * + * @author limy + * @date 2024-10-18 + */ +@Controller +@RequestMapping("/nanjing/ProcessRoute") +public class ProcessRouteController extends BaseController +{ + private String prefix = "nanjing/ProcessRoute"; + + @Autowired + private IProcessRouteService processRouteService; + + @RequiresPermissions("nanjing:ProcessRoute:view") + @GetMapping() + public String ProcessRoute() + { + return prefix + "/ProcessRoute"; + } + + /** + * 查询工艺路线列表 + */ + @RequiresPermissions("nanjing:ProcessRoute:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ProcessRoute processRoute) + { + startPage(); + List list = processRouteService.selectProcessRouteList(processRoute); + return getDataTable(list); + } + /** + * 查询工艺路线及其关联的工序 + */ + @RequiresPermissions("nanjing:ProcessRoute:view") + @GetMapping("/detail/{RouteId}") + public String detail(@PathVariable("RouteId") Long RouteId, ModelMap mmap) { + ProcessRoute processRoute = processRouteService.selectProcessRouteById(RouteId); + mmap.put("processRoute", processRoute); + return prefix + "/detail"; + } + + /** + * 导出工艺路线列表 + */ + @RequiresPermissions("nanjing:ProcessRoute:export") + @Log(title = "工艺路线", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(ProcessRoute processRoute) + { + List list = processRouteService.selectProcessRouteList(processRoute); + ExcelUtil util = new ExcelUtil(ProcessRoute.class); + return util.exportExcel(list, "ProcessRoute"); + } + + /** + * 新增工艺路线 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存工艺路线 + */ + @RequiresPermissions("nanjing:ProcessRoute:add") + @Log(title = "工艺路线", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(ProcessRoute processRoute) + { + return toAjax(processRouteService.insertProcessRoute(processRoute)); + } + + /** + * 修改工艺路线 + */ + @GetMapping("/edit/{RouteId}") + public String edit(@PathVariable("RouteId") Long RouteId, ModelMap mmap) + { + ProcessRoute processRoute = processRouteService.selectProcessRouteById(RouteId); + mmap.put("processRoute", processRoute); + return prefix + "/edit"; + } + + /** + * 修改保存工艺路线 + */ + @RequiresPermissions("nanjing:ProcessRoute:edit") + @Log(title = "工艺路线", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(ProcessRoute processRoute) + { + return toAjax(processRouteService.updateProcessRoute(processRoute)); + } + + /** + * 删除工艺路线 + */ + @RequiresPermissions("nanjing:ProcessRoute:remove") + @Log(title = "工艺路线", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(processRouteService.deleteProcessRouteByIds(ids)); + } + + /** + * 添加工序到工艺路线 + */ + @RequiresPermissions("nanjing:ProcessRoute:addStation") + @Log(title = "工艺路线", businessType = BusinessType.INSERT) + @PostMapping("/addStation") + @ResponseBody + public AjaxResult addStation(Long routeId, Long[] stationIds) { + return toAjax(processRouteService.insertProcessRouteStation(routeId, stationIds)); + } + + /** + * 删除工艺路线中的工序 + */ + @RequiresPermissions("nanjing:ProcessRoute:removeStation") + @Log(title = "工艺路线", businessType = BusinessType.DELETE) + @PostMapping("/removeStation") + @ResponseBody + public AjaxResult removeStation(Long routeId, Long stationId) { + return toAjax(processRouteService.deleteProcessRouteStation(routeId, stationId)); + } + +} diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 38dfd0f8..f83ea343 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=JYD_shengjie + url: jdbc:sqlserver://119.45.202.115;SelectMethod=cursor;DatabaseName=JYD_shengjie username: sa - password: 123456 + password: haiwei@123 # master: # url: jdbc:sqlserver://192.168.3.109:1433;SelectMethod=cursor;DatabaseName=JYD_shengjie # username: sa diff --git a/ruoyi-admin/src/main/resources/templates/add.html b/ruoyi-admin/src/main/resources/templates/add.html new file mode 100644 index 00000000..ebdf408c --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/add.html @@ -0,0 +1,202 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+
+
+
+
+
+
+
+ + + + + diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/ProcessRoute.html b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/ProcessRoute.html new file mode 100644 index 00000000..1a5ccd08 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/ProcessRoute.html @@ -0,0 +1,111 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • + +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/add.html b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/add.html new file mode 100644 index 00000000..fea03613 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/add.html @@ -0,0 +1,194 @@ + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/edit.html b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/edit.html new file mode 100644 index 00000000..e59f4229 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/nanjing/ProcessRoute/edit.html @@ -0,0 +1,56 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRoute.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRoute.java new file mode 100644 index 00000000..63d90dbd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRoute.java @@ -0,0 +1,113 @@ +package com.ruoyi.nanjing.domain; + +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; + +import java.util.List; + +/** + * 工艺路线对象 ProcessRoute + * + * @author limy + * @date 2024-10-18 + */ +public class ProcessRoute extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工艺路线编号(主键,自增) */ + private Long RouteId; + + /** 工艺路线编号 */ + @Excel(name = "工艺路线编号") + private String RouteCode; + + /** 工艺路线名称 */ + @Excel(name = "工艺路线名称") + private String RouteName; + + /** 工艺路线说明 */ + @Excel(name = "工艺路线说明") + private String RouteDescription; + + /** 工艺路线备注 */ + @Excel(name = "工艺路线备注") + private String Remarks; + + /** 是否启用,默认启用 */ + @Excel(name = "是否启用,默认启用") + private Long IsEnabled; + + public void setRouteId(Long RouteId) + { + this.RouteId = RouteId; + } + + public Long getRouteId() + { + return RouteId; + } + public void setRouteCode(String RouteCode) + { + this.RouteCode = RouteCode; + } + + public String getRouteCode() + { + return RouteCode; + } + public void setRouteName(String RouteName) + { + this.RouteName = RouteName; + } + + public String getRouteName() + { + return RouteName; + } + public void setRouteDescription(String RouteDescription) + { + this.RouteDescription = RouteDescription; + } + + public String getRouteDescription() + { + return RouteDescription; + } + public void setRemarks(String Remarks) + { + this.Remarks = Remarks; + } + + public String getRemarks() + { + return Remarks; + } + public void setIsEnabled(Long IsEnabled) + { + this.IsEnabled = IsEnabled; + } + + public Long getIsEnabled() + { + return IsEnabled; + } + + private List stations; + public List getStations() { + return stations; + } + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("RouteId", getRouteId()) + .append("RouteCode", getRouteCode()) + .append("RouteName", getRouteName()) + .append("RouteDescription", getRouteDescription()) + .append("Remarks", getRemarks()) + .append("IsEnabled", getIsEnabled()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRouteStation.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRouteStation.java new file mode 100644 index 00000000..d4dbe787 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/ProcessRouteStation.java @@ -0,0 +1,65 @@ +package com.ruoyi.nanjing.domain; + +/** + * 工艺路线与工序关联表 + * + * @author limy + * @date 2024-10-18 + */ +public class ProcessRouteStation { + private static final long serialVersionUID = 1L; + + /** 工艺路线工序关联ID */ + private Long routeStationId; + + /** 工艺路线ID */ + private Long routeId; + + /** 工序ID */ + private Long stationId; + + /** 序号 */ + private Integer sequence; + + public Long getRouteStationId() { + return routeStationId; + } + + public void setRouteStationId(Long routeStationId) { + this.routeStationId = routeStationId; + } + + public Long getRouteId() { + return routeId; + } + + public void setRouteId(Long routeId) { + this.routeId = routeId; + } + + public Long getStationId() { + return stationId; + } + + public void setStationId(Long stationId) { + this.stationId = stationId; + } + + public Integer getSequence() { + return sequence; + } + + public void setSequence(Integer sequence) { + this.sequence = sequence; + } + + @Override + public String toString() { + return new StringBuilder().append(getClass().getSimpleName()) + .append(" [").append("routeStationId=").append(routeStationId) + .append(", routeId=").append(routeId) + .append(", stationId=").append(stationId) + .append(", sequence=").append(sequence) + .append("]").toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java index 5fb72419..89eecef7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java @@ -170,6 +170,14 @@ public class TBdSubstation extends BaseEntity @Excel(name = "PLCBlock") private Long PLCBlock; + private Integer Sequence; + public Integer getSequence() { + return Sequence; + } + + public void setSequence(Integer Sequence) { + this.Sequence = Sequence; + } public void setID(Long ID) { this.ID = ID; diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/ProcessRouteMapper.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/ProcessRouteMapper.java new file mode 100644 index 00000000..efa34252 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/ProcessRouteMapper.java @@ -0,0 +1,80 @@ +package com.ruoyi.nanjing.mapper; + +import java.util.List; +import com.ruoyi.nanjing.domain.ProcessRoute; +import com.ruoyi.nanjing.domain.ProcessRouteStation; + +/** + * 工艺路线Mapper接口 + * + * @author limy + * @date 2024-10-18 + */ +public interface ProcessRouteMapper +{ + /** + * 查询工艺路线 + * + * @param RouteId 工艺路线ID + * @return 工艺路线 + */ + public ProcessRoute selectProcessRouteById(Long RouteId); + + /** + * 查询工艺路线列表 + * + * @param processRoute 工艺路线 + * @return 工艺路线集合 + */ + public List selectProcessRouteList(ProcessRoute processRoute); + + /** + * 新增工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + public int insertProcessRoute(ProcessRoute processRoute); + + /** + * 修改工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + public int updateProcessRoute(ProcessRoute processRoute); + + /** + * 删除工艺路线 + * + * @param RouteId 工艺路线ID + * @return 结果 + */ + public int deleteProcessRouteById(Long RouteId); + + /** + * 批量删除工艺路线 + * + * @param RouteIds 需要删除的数据ID + * @return 结果 + */ + public int deleteProcessRouteByIds(String[] RouteIds); + + + + /** + * 添加工序到工艺路线 + * + * @param processRouteStation 工艺路线工序关联对象 + * @return 结果 + */ + public int insertProcessRouteStation(ProcessRouteStation processRouteStation); + + /** + * 删除工艺路线中的工序 + * + * @param processRouteStation 工艺路线工序关联对象 + * @return 结果 + */ + public int deleteProcessRouteStation(ProcessRouteStation processRouteStation); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/IProcessRouteService.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/IProcessRouteService.java new file mode 100644 index 00000000..95356669 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/IProcessRouteService.java @@ -0,0 +1,82 @@ +package com.ruoyi.nanjing.service; + +import java.util.List; +import com.ruoyi.nanjing.domain.ProcessRoute; + +/** + * 工艺路线Service接口 + * + * @author limy + * @date 2024-10-18 + */ +public interface IProcessRouteService +{ + /** + * 查询工艺路线 + * + * @param RouteId 工艺路线ID + * @return 工艺路线 + */ + public ProcessRoute selectProcessRouteById(Long RouteId); + + /** + * 查询工艺路线列表 + * + * @param processRoute 工艺路线 + * @return 工艺路线集合 + */ + public List selectProcessRouteList(ProcessRoute processRoute); + + /** + * 新增工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + public int insertProcessRoute(ProcessRoute processRoute); + + /** + * 修改工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + public int updateProcessRoute(ProcessRoute processRoute); + + /** + * 批量删除工艺路线 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteProcessRouteByIds(String ids); + + /** + * 删除工艺路线信息 + * + * @param RouteId 工艺路线ID + * @return 结果 + */ + public int deleteProcessRouteById(Long RouteId); + + + + /** + * 添加工序到工艺路线 + * + * @param routeId 工艺路线ID + * @param stationIds 工序ID数组 + * @return 结果 + */ + public int insertProcessRouteStation(Long routeId, Long[] stationIds); + + /** + * 删除工艺路线中的工序 + * + * @param routeId 工艺路线ID + * @param stationId 工序ID + * @return 结果 + */ + public int deleteProcessRouteStation(Long routeId, Long stationId); +} + diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/ProcessRouteServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/ProcessRouteServiceImpl.java new file mode 100644 index 00000000..7a438c9c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/ProcessRouteServiceImpl.java @@ -0,0 +1,130 @@ +package com.ruoyi.nanjing.service.impl; + +import java.util.List; + +import com.ruoyi.nanjing.domain.ProcessRouteStation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.nanjing.mapper.ProcessRouteMapper; +import com.ruoyi.nanjing.domain.ProcessRoute; +import com.ruoyi.nanjing.service.IProcessRouteService; +import com.ruoyi.common.core.text.Convert; + +/** + * 工艺路线Service业务层处理 + * + * @author limy + * @date 2024-10-18 + */ +@Service +public class ProcessRouteServiceImpl implements IProcessRouteService +{ + @Autowired + private ProcessRouteMapper processRouteMapper; + + /** + * 查询工艺路线 + * + * @param RouteId 工艺路线ID + * @return 工艺路线 + */ + @Override + public ProcessRoute selectProcessRouteById(Long RouteId) + { + return processRouteMapper.selectProcessRouteById(RouteId); + } + + /** + * 查询工艺路线列表 + * + * @param processRoute 工艺路线 + * @return 工艺路线 + */ + @Override + public List selectProcessRouteList(ProcessRoute processRoute) + { + return processRouteMapper.selectProcessRouteList(processRoute); + } + + /** + * 新增工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + @Override + public int insertProcessRoute(ProcessRoute processRoute) + { + return processRouteMapper.insertProcessRoute(processRoute); + } + + /** + * 修改工艺路线 + * + * @param processRoute 工艺路线 + * @return 结果 + */ + @Override + public int updateProcessRoute(ProcessRoute processRoute) + { + return processRouteMapper.updateProcessRoute(processRoute); + } + + /** + * 删除工艺路线对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteProcessRouteByIds(String ids) + { + return processRouteMapper.deleteProcessRouteByIds(Convert.toStrArray(ids)); + } + + /** + * 删除工艺路线信息 + * + * @param RouteId 工艺路线ID + * @return 结果 + */ + @Override + public int deleteProcessRouteById(Long RouteId) + { + return processRouteMapper.deleteProcessRouteById(RouteId); + } + /** + * 添加工序到工艺路线 + * + * @param routeId 工艺路线ID + * @param stationIds 工序ID数组 + * @return 结果 + */ + @Override + public int insertProcessRouteStation(Long routeId, Long[] stationIds) { + int result = 0; + for (Long stationId : stationIds) { + ProcessRouteStation processRouteStation = new ProcessRouteStation(); + processRouteStation.setRouteId(routeId); + processRouteStation.setStationId(stationId); + processRouteStation.setSequence(0); // 默认序号,您可以根据实际情况进行调整 + result += processRouteMapper.insertProcessRouteStation(processRouteStation); + } + return result; + } + /** + * 删除工艺路线中的工序 + * + * @param routeId 工艺路线ID + * @param stationId 工序ID + * @return 结果 + */ + @Override + public int deleteProcessRouteStation(Long routeId, Long stationId) { + ProcessRouteStation processRouteStation = new ProcessRouteStation(); + processRouteStation.setRouteId(routeId); + processRouteStation.setStationId(stationId); + return processRouteMapper.deleteProcessRouteStation(processRouteStation); + } + +} diff --git a/ruoyi-system/src/main/resources/mapper/nanjing/ProcessRouteMapper.xml b/ruoyi-system/src/main/resources/mapper/nanjing/ProcessRouteMapper.xml new file mode 100644 index 00000000..a11e57ac --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/nanjing/ProcessRouteMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + select RouteId, RouteCode, RouteName, RouteDescription, Remarks, IsEnabled from ProcessRoute + + + + + + + + + + + insert into ProcessRoute + + RouteId, + RouteCode, + RouteName, + RouteDescription, + Remarks, + IsEnabled, + + + #{RouteId}, + #{RouteCode}, + #{RouteName}, + #{RouteDescription}, + #{Remarks}, + #{IsEnabled}, + + + + + update ProcessRoute + + RouteCode = #{RouteCode}, + RouteName = #{RouteName}, + RouteDescription = #{RouteDescription}, + Remarks = #{Remarks}, + IsEnabled = #{IsEnabled}, + + where RouteId = #{RouteId} + + + + delete from ProcessRoute where RouteId = #{RouteId} + + + + delete from ProcessRoute where RouteId in + + #{RouteId} + + + + + + + + insert into ProcessRouteStation(RouteId, StationID, Sequence) + values (#{RouteId}, #{StationID}, #{Sequence}) + + + + + delete from ProcessRouteStation + where RouteId = #{RouteId} and StationID = #{StationID} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +