基于SSM实现企业生资源管理系统-ERP系统

简介: 基于SSM实现企业生资源管理系统-ERP系统

项目编号:BS-XX-157

一,项目简介


这是一个生产管理ERP系统。依托科技计划重点项目“制造装备物联及生产管理系统研发”,主要包括:计划进度、设备管理、工艺监控、物料监控、人员监控、质量监控、系统管理7大模块。系统采用SSM框架开发实现,前端主要基于JQUERY-UI实现页面布局展示。


ERP(Enterprise Resource Planning,企业资源计划)系统,是进行物质资源、资金资源和信息资源集成一体化管理的企业信息管理系统,ERP统领企业全局,为管理层服务,重心在于企业决策,ERP对企业宏观管理,一个企业一套ERP,具有整合性、系统性、灵活性、实时控制性等显著特点。ERP 系统的供应链管理思想对企业提出了更高的要求,是企业在信息化社会、在知识经济时代繁荣发展的核心管理模式。

image.png

二,环境介绍


语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:SSM框架开发

前端开发技术:ajax+jquery+jquery-ui

三,系统展示


用户登陆:

image.png

计划进度管理:

image.png

计划进度管理-订单管理

image.png

计划进度管理-客户管理

image.png

计划进度管理-产品管理

image.png

计划进度管理-作业管理

image.png

计划进度管理-生产计划管理

image.png

计划进度管理-生产派工管理

image.png

设备管理—设备台账

image.png

设备管理—设备种类

image.png

设备管理—设备例检

image.png

设备管理—设备故障

image.png

设备管理—设备维修

image.png

工艺监控—工艺管理

image.png

物料监控—物料信息

image.png

系统管理—用户管理

image.png

系统管理—角色管理

image.png

image.png

四,核心代码展示


package com.megagao.production.ssm.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.megagao.production.ssm.domain.customize.ActiveUser;
import com.megagao.production.ssm.util.CollectionsFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import static com.megagao.production.ssm.common.Constants.NO_PERMISSION;
/**
 *
 * 权限判断controller
 *
 */
@RestController
public class AuthorityJudgeController {
  private static final Logger logger = LoggerFactory.getLogger(AuthorityJudgeController.class);
  @RequestMapping("*/*_judge")
  public Map<String,Object> authorityJudge(HttpServletRequest request) throws Exception{
    Subject subject = SecurityUtils.getSubject();
    ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
    //根据uri,使用shiro判断相应权限
    String uri = request.getRequestURI();
    String[] names = uri.split("/");
    String featureName = names[2];
    String operateName = names[3].split("_")[0];
    Map<String,Object> map = CollectionsFactory.newHashMap();
    if(!activeUser.getUserStatus().equals("1")){
      if (logger.isDebugEnabled()) {
        logger.debug(NO_PERMISSION, "账户已被锁定!");
      }
      map.put("msg", "您的账户已被锁定,请切换账户登录!");
    }else if(!activeUser.getRoleStatus().equals("1")){
      if (logger.isDebugEnabled()) {
        logger.debug(NO_PERMISSION, "角色已被锁定!");
      }
      map.put("msg", "当前角色已被锁定,请切换账户登录!");
    }else{
      if (logger.isDebugEnabled()) {
        logger.debug(NO_PERMISSION, "没有权限!");
      }
      if(!subject.isPermitted(featureName+":"+operateName)){
        map.put("msg", "您没有权限,请切换用户登录!");
      }
    }
    return map;
  }
}
package com.megagao.production.ssm.controller;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.megagao.production.ssm.service.FileService;
import com.megagao.production.ssm.util.DownloadUtil;
import com.megagao.production.ssm.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
 *
 * 上传图片处理
 *
 */
@Controller
public class FileController {
  @Autowired
  private FileService fileService;
  @RequestMapping(value="/file/upload", method=RequestMethod.POST)
  @ResponseBody
  public String handleFileUpload(MultipartHttpServletRequest request) throws Exception{
    Iterator<String> iterator = request.getFileNames();
    String json = null;
    while (iterator.hasNext()) {
      String fileName = iterator.next();
      MultipartFile multipartFile = request.getFile(fileName);
      Map<String,Object> result = fileService.uploadFile(multipartFile);
      json = JsonUtils.objectToJson(result);
    }
    return json;
  }
  @RequestMapping(value="/file/delete")
  @ResponseBody
  public String handleFileDelete(@RequestParam String fileName) throws Exception{
    fileService.deleteFile(fileName);
    Map<String,Object> result = new HashMap<String,Object>(); 
    result.put("data", "success");
    String json = JsonUtils.objectToJson(result);
    return json;
  }
  @RequestMapping(value="/file/download")
  public void handleFileDownload(@RequestParam String fileName, HttpServletResponse response) throws Exception{
    fileName = fileName.substring(fileName.lastIndexOf("/")+1);
    String filePath = "D:\\upload\\temp\\file\\"+fileName;
    DownloadUtil du = new DownloadUtil();
    du.download(filePath, fileName, response, false);
  }
}
package com.megagao.production.ssm.controller;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.megagao.production.ssm.service.FileService;
import com.megagao.production.ssm.util.DownloadUtil;
import com.megagao.production.ssm.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
 *
 * 上传图片处理
 *
 */
@Controller
public class FileController {
  @Autowired
  private FileService fileService;
  @RequestMapping(value="/file/upload", method=RequestMethod.POST)
  @ResponseBody
  public String handleFileUpload(MultipartHttpServletRequest request) throws Exception{
    Iterator<String> iterator = request.getFileNames();
    String json = null;
    while (iterator.hasNext()) {
      String fileName = iterator.next();
      MultipartFile multipartFile = request.getFile(fileName);
      Map<String,Object> result = fileService.uploadFile(multipartFile);
      json = JsonUtils.objectToJson(result);
    }
    return json;
  }
  @RequestMapping(value="/file/delete")
  @ResponseBody
  public String handleFileDelete(@RequestParam String fileName) throws Exception{
    fileService.deleteFile(fileName);
    Map<String,Object> result = new HashMap<String,Object>(); 
    result.put("data", "success");
    String json = JsonUtils.objectToJson(result);
    return json;
  }
  @RequestMapping(value="/file/download")
  public void handleFileDownload(@RequestParam String fileName, HttpServletResponse response) throws Exception{
    fileName = fileName.substring(fileName.lastIndexOf("/")+1);
    String filePath = "D:\\upload\\temp\\file\\"+fileName;
    DownloadUtil du = new DownloadUtil();
    du.download(filePath, fileName, response, false);
  }
}
package com.megagao.production.ssm.controller;
import com.megagao.production.ssm.util.CollectionsFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.Map;
import static com.megagao.production.ssm.common.Constants.VALIDATE_CODE;
@Controller
public class LoginController {
  /**
   * shiro ajax登录 
   */
  @RequestMapping(value = "/ajaxLogin")
  @ResponseBody
  public Map<String,Object> ajaxLogin(@RequestParam String username,
                            @RequestParam String password,
                            @RequestParam(required=false) String randomcode,
                            HttpSession session) throws Exception{
    Map<String,Object> map = CollectionsFactory.newHashMap();
    if(randomcode !=null && !randomcode.equals("")){
        //取出session的验证码(正确的验证码)
        String validateCode = (String)session.getAttribute(VALIDATE_CODE);
      //页面中输入的验证和session中的验证进行对比 
      if(validateCode!=null && !randomcode.equals(validateCode)){
        //如果校验失败,将验证码错误失败信息放入map中
        map.put("msg", "randomcode_error");
        //直接返回,不再校验账号和密码 
        return map; 
      }
      }
    Subject currentUser = SecurityUtils.getSubject();
      if (!currentUser.isAuthenticated()) {
        UsernamePasswordToken token = new UsernamePasswordToken(username, password);
          try{
              currentUser.login(token);
          }catch(UnknownAccountException ex){
            map.put("msg", "account_error");
          }catch(IncorrectCredentialsException ex){
            map.put("msg", "password_error");
          }catch(AuthenticationException ex){
            map.put("msg", "authentication_error");
          }
      }
      //返回json数据
      return map;
  }
}
package com.megagao.production.ssm.controller.system;
import java.util.List;
import com.megagao.production.ssm.domain.customize.CustomResult;
import com.megagao.production.ssm.service.PermissionService;
import com.megagao.production.ssm.domain.authority.SysRolePermission;
import com.megagao.production.ssm.domain.customize.EUDataGridResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/permission")
public class PermissionController {
  @Autowired
  private PermissionService permissionService;
  @RequestMapping("/get/{permissionId}")
  @ResponseBody
  public SysRolePermission getItemById(@PathVariable String permissionId) throws Exception{
    SysRolePermission sysRolePermission = permissionService.get(permissionId);
    return sysRolePermission;
  }
  @RequestMapping("/find")
  public String find() throws Exception{
    return "permission_list";
  }
  @RequestMapping("/get_data")
  @ResponseBody
  public List<SysRolePermission> getData() throws Exception{
    return permissionService.find();
  }
  @RequestMapping("/get_permission")
  @ResponseBody
  public SysRolePermission getPermission(String roleId) throws Exception{
    return permissionService.getByRoleId(roleId);
  }
  @RequestMapping("/add")
  public String add() throws Exception{
    return "permission_add";
  }
  @RequestMapping("/edit")
  public String edit() throws Exception{
    return "permission_edit";
  }
  @RequestMapping("/list")
  @ResponseBody
  public EUDataGridResult getItemList(Integer page, Integer rows, SysRolePermission sysRolePermission)
      throws Exception{
    EUDataGridResult result = permissionService.getList(page, rows, sysRolePermission);
    return result;
  }
  @RequestMapping(value="/insert", method=RequestMethod.POST)
  @ResponseBody
  private CustomResult insert(SysRolePermission sysRolePermission) throws Exception {
    CustomResult result = permissionService.insert(sysRolePermission);
    return result;
  }
  @RequestMapping(value="/update")
  @ResponseBody
  private CustomResult update(SysRolePermission sysRolePermission) throws Exception {
    CustomResult result = permissionService.update(sysRolePermission);
    return result;
  }
  @RequestMapping(value="/update_by_roleid")
  @ResponseBody
  private CustomResult updateByRoleId(String roleId, String permission) throws Exception {
    CustomResult result = permissionService.updateByRoleId(roleId, permission);
    return result;
  }
  @RequestMapping(value="/update_all")
  @ResponseBody
  private CustomResult updateAll(SysRolePermission sysRolePermission) throws Exception {
    CustomResult result = permissionService.updateAll(sysRolePermission);
    return result;
  }
  @RequestMapping(value="/delete")
  @ResponseBody
  private CustomResult delete(String id) throws Exception {
    CustomResult result = permissionService.delete(id);
    return result;
  }
}
package com.megagao.production.ssm.controller.system;
import java.util.List;
import com.megagao.production.ssm.domain.vo.RoleVO;
import com.megagao.production.ssm.domain.customize.CustomResult;
import com.megagao.production.ssm.domain.customize.EUDataGridResult;
import com.megagao.production.ssm.domain.authority.SysRole;
import com.megagao.production.ssm.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.validation.Valid;
@Controller
@RequestMapping("/role")
public class RoleController {
  @Autowired
  private RoleService roleService;
  @RequestMapping("/get/{roleId}")
  @ResponseBody
  public RoleVO getItemById(@PathVariable String roleId) throws Exception{
    RoleVO sysRole = roleService.get(roleId);
    return sysRole;
  }
  @RequestMapping("/find")
  public String find() throws Exception{
    return "role_list";
  }
  @RequestMapping("/permission")
  public String permission() throws Exception{
    return "role_permission";
  }
  @RequestMapping("/get_data")
  @ResponseBody
  public List<RoleVO> getData() throws Exception{
    return roleService.find();
  }
  @RequestMapping("/add")
  public String add() throws Exception{
    return "role_add";
  }
  @RequestMapping("/edit")
  public String edit() throws Exception{
    return "role_edit";
  }
  @RequestMapping("/list")
  @ResponseBody
  public EUDataGridResult getItemList(Integer page, Integer rows, RoleVO role) throws Exception{
    EUDataGridResult result = roleService.getList(page, rows, role);
    return result;
  }
  @RequestMapping(value="/insert", method=RequestMethod.POST)
  @ResponseBody
  private CustomResult insert(@Valid SysRole role, BindingResult bindingResult) throws Exception {
    CustomResult result;
    if(bindingResult.hasErrors()){
      FieldError fieldError = bindingResult.getFieldError();
      return CustomResult.build(100, fieldError.getDefaultMessage());
    }
    if(roleService.findByRoleNameAndId(role.getRoleName(), role.getRoleId()).size()>0){
      result = new CustomResult(0, "该角色名已经存在,请更换角色名!", null);
    }else if(roleService.get(role.getRoleId()) != null){
      result = new CustomResult(0, "该角色编号已经存在,请更换角色编号!", null);
    }else{
      result = roleService.insert(role);
    }
    return result;
  }
  @RequestMapping(value="/update")
  @ResponseBody
  private CustomResult update(SysRole role) throws Exception {
    CustomResult result = roleService.update(role);
    return result;
  }
  @RequestMapping(value="/update_all")
  @ResponseBody
  private CustomResult updateAll(@Valid SysRole role, BindingResult bindingResult) throws Exception {
    CustomResult result;
    if(bindingResult.hasErrors()){
      FieldError fieldError = bindingResult.getFieldError();
      return CustomResult.build(100, fieldError.getDefaultMessage());
    }
    if(roleService.findByRoleNameAndId(role.getRoleName(), role.getRoleId()).size()>0){
      result = new CustomResult(0, "该角色名已经存在,请更换角色名!", null);
    }else if(roleService.get(role.getRoleId()) != null){
      result = new CustomResult(0, "该角色编号已经存在,请更换角色编号!", null);
    }else{
      result = roleService.updateAll(role);
    }
    return result;
  }
  @RequestMapping(value="/delete")
  @ResponseBody
  private CustomResult delete(String id) throws Exception {
    CustomResult result = roleService.delete(id);
    return result;
  }
  @RequestMapping(value="/delete_batch")
  @ResponseBody
  private CustomResult deleteBatch(String[] ids) throws Exception {
    CustomResult result = roleService.deleteBatch(ids);
    return result;
  }
  //根据角色id查找
  @RequestMapping("/search_role_by_roleId")
  @ResponseBody
  public EUDataGridResult searchRoleByRoleId(Integer page, Integer rows, String searchValue) throws Exception{
    EUDataGridResult result = roleService.searchRoleByRoleId(page, rows, searchValue);
    return result;
  }
  //根据角色名查找
  @RequestMapping("/search_role_by_roleName")
  @ResponseBody
  public EUDataGridResult searchRoleByRoleName(Integer page, Integer rows, String searchValue) throws Exception{
    EUDataGridResult result = roleService.searchRoleByRoleName(page, rows, searchValue);
    return result;
  }
}

五,项目总结


本项目功能齐全,前后端交互较好,完整的实现了一个企业ERP系统应用的相关模块。

相关文章
|
2月前
|
人工智能 运维 安全
如何自己开发一套ERP系统?
本文探讨了企业自建ERP系统的可行性,分析了轻量、中型和重型ERP的区别,并指出自研ERP需明确业务需求、流程逻辑及投入成本。文章建议企业在决定自研前,应先梳理清楚管理逻辑,而非盲目追求技术方案。
|
2月前
|
存储 关系型数据库 BI
如何开发ERP系统中的财务管理板块(附架构图+流程图+代码参考)
本文深入解析ERP系统中财务管理模块的设计与实现,涵盖核心功能、业务流程、开发技巧及代码示例,助力企业打造高效、智能的财务管理系统。
|
2月前
|
SQL 存储 供应链
如何开发ERP系统中的库存管理板块(附架构图+流程图+代码参考)
本文介绍如何通过ERP系统实现企业库存管理的数字化与自动化,涵盖仓库管理、库位管理、出入库操作、库存调拨与盘点等功能设计,并提供开发技巧及代码参考,帮助企业提升库存管理效率,减少错误与资源浪费。
|
2月前
|
供应链 Python
如何开发ERP系统中的采购管理板块(附架构图+流程图+代码参考)
本文介绍如何在ERP系统中开发高效采购管理模块,涵盖采购申请、订单处理、入库与退货等关键流程,解析核心功能与业务逻辑,并提供代码参考及开发技巧,助力企业优化采购管理效率。
|
2月前
|
JavaScript
数字化转型过程中,制造型企业如何选择适合的ERP系统?
ERP系统是制造业数字化转型的核心工具,但选型需谨慎。本文从实战出发,总结制造企业如何选择真正适用的ERP系统,避免常见陷阱,助力企业实现高效管理与持续发展。
|
2月前
|
监控 数据挖掘 BI
如何开发ERP系统中的生产管理板块(附架构图+流程图+代码参考)
本文探讨了如何高效整合资源、优化生产流程,并通过ERP系统提升企业竞争力。重点分析了生产管理模块的开发,涵盖生产工单、物料操作、生产流程、统计分析及辅助功能等方面,帮助企业实现生产效率提升与成本控制。
|
2月前
|
监控 安全 调度
如何开发ERP系统中的计划管理板块(附架构图+流程图+代码参考)
本文介绍了ERP系统中计划管理模块的重要性及开发方法,涵盖生产计划、物料需求、调度优化等功能,并提供代码示例与落地建议,帮助企业提升生产效率、优化资源配置。
|
1月前
|
运维 供应链 BI
搞ERP的懂系统不懂流程,用ERP的懂流程又不会配系统?那怎么办?
随着ERP认知度提升,越来越多中小企业意识到传统管理方式的局限性。然而,盲目选型导致系统难以落地,文章深入分析了中小企业在ERP选型中的常见误区,并提出应选择灵活、易用、可扩展的“轻量ERP”,结合懂业务的服务团队,才能真正推动系统落地,助力企业数字化转型。
|
2月前
|
SQL 数据挖掘 API
如何开发ERP系统中的质量管理板块(附架构图+流程图+代码参考)
质量管理在ERP系统中的作用不仅仅是记录质量检验数据,它还涉及到从物料采购、生产过程、到最终产品的全流程管理。如何搭建一个高效、可靠的质量管理板块,成为了许多企业在进行ERP系统开发时需要重点考虑的问题。本文将详细介绍如何开发ERP系统中的质量管理板块,涵盖功能模块、业务流程、开发技巧和实现效果等方面,并提供具体的代码参考。
|
2月前
|
SQL 监控 供应链
如何开发ERP系统中的委外管理板块(附架构图+流程图+代码参考)
在ERP系统中,委外管理模块能有效提升企业生产效率、降低成本。通过工单下发、物料发放、退料、入库及数据分析等功能,实现对外部合作的全流程管理,确保信息透明与流程顺畅。本文详解模块开发技巧与实现方案,助力企业快速搭建高效委外管理体系。