Java项目:进销存管理系统

作者主页:Java毕设网

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

一、项目介绍

库存管理系统。主要功能包括:
货品出入库:货品入库、货品出库、库存查询;
基础资料:货品信息、供货商信息、分公司信息;
系统管理:用户管理、角色管理、数据字典、菜单管理、国标管理、部门管理;

系统监控:系统日志;

二、环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

三、技术栈

1. 后端:jeecg

四、使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中dbconfig.properties配置文件中的数据库配置改为自己的配置
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行

五、运行截图


六、相关代码

登录控制器

public class admin_servlet extends HttpServlet
{
	public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException 
	{
        String type=req.getParameter("type");
		
		if(type.endsWith("adminMana"))
		{
			adminMana(req, res);
		}
		if(type.endsWith("adminAdd"))
		{
			adminAdd(req, res);
		}
		if(type.endsWith("adminDel"))
		{
			adminDel(req, res);
		}
	}
	
	public void adminMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
	{
		List adminList=new ArrayList();
		String sql="select * from t_admin";
		Object[] params={};
		DB mydb=new DB();
		try
		{
			mydb.doPstm(sql, params);
			ResultSet rs=mydb.getRs();
			while(rs.next())
			{
				TAdmin admin=new TAdmin();
				admin.setUserId(rs.getInt("userId"));
				admin.setUserName(rs.getString("userName"));
				admin.setUserPw(rs.getString("userPw"));
				adminList.add(admin);
		    }
			rs.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		mydb.closed();
		
		req.setAttribute("adminList", adminList);
		req.getRequestDispatcher("admin/admin/adminMana.jsp").forward(req, res);
	}
	public void adminAdd(HttpServletRequest req,HttpServletResponse res)
	{
		String userName=req.getParameter("userName");
		String userPw=req.getParameter("userPw");
		String sql="insert into t_admin(userName,userPw) values(?,?)";
		Object[] params={userName,userPw};
		DB mydb=new DB();
		mydb.doPstm(sql, params);
		mydb.closed();
		
		req.setAttribute("message", "操作成功");
		req.setAttribute("path", "admin?type=adminMana");
		
        String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}
	
	public void adminDel(HttpServletRequest req,HttpServletResponse res)
	{
		String sql="delete from t_admin where userId="+Integer.parseInt(req.getParameter("userId"));
		Object[] params={};
		DB mydb=new DB();
		mydb.doPstm(sql, params);
		mydb.closed();
		
		req.setAttribute("message", "操作成功");
		req.setAttribute("path", "admin?type=adminMana");
		
        String targetURL = "/common/success.jsp";
		dispatch(targetURL, req, res);
	}

	public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response) 
	{
		RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
		try 
		{
		    dispatch.forward(request, response);
		    return;
		} 
		catch (ServletException e) 
		{
                    e.printStackTrace();
		} 
		catch (IOException e) 
		{
			
		    e.printStackTrace();
		}
	}
	public void init(ServletConfig config) throws ServletException 
	{
		super.init(config);
	}
	
	public void destroy() 
	{
		
	}
}

货物管理控制器

/**   
 * @Title: Controller
 * @Description: 货品表
 * @author onlineGenerator
 * @date 2014-03-19 17:21:13
 * @version V1.0   
 *
 */
@Controller
@RequestMapping("/tBGoodsController")
public class TBGoodsController extends BaseController {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(TBGoodsController.class);

	@Autowired
	private TBGoodsServiceI tBGoodsService;
	@Autowired
	private SystemService systemService;
	private String message;
	
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}


	/**
	 * 货品表列表 页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "tBGoods")
	public ModelAndView tBGoods(HttpServletRequest request) {
		return new ModelAndView("buss/goods/tBGoodsList");
	}

	/**
	 * 选择货品
	 * 
	 * @return
	 */
	@RequestMapping(params = "tBGoodsSelect")
	public String goods() {
		return "buss/goods/tBGoodsSelect";
	}
	
	/**
	 * 货品显示列表
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 */
	@RequestMapping(params = "datagridGoods")
	public void datagridGoods(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
		CriteriaQuery cq = new CriteriaQuery(TBGoodsEntity.class, dataGrid);
		this.systemService.getDataGridReturn(cq, true);
		TagUtil.datagrid(response, dataGrid);
	}
	
	/**
	 * easyui AJAX请求数据
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "datagrid")
	public void datagrid(TBGoodsEntity tBGoods,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
		CriteriaQuery cq = new CriteriaQuery(TBGoodsEntity.class, dataGrid);
		//查询条件组装器
		com.bjpowernode.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tBGoods, request.getParameterMap());
		try{
		//自定义追加查询条件
		}catch (Exception e) {
			throw new BusinessException(e.getMessage());
		}
		cq.add();
		this.tBGoodsService.getDataGridReturn(cq, true);
		TagUtil.datagrid(response, dataGrid);
	}

	/**
	 * 删除货品表
	 * 
	 * @return
	 */
	@RequestMapping(params = "doDel")
	@ResponseBody
	public AjaxJson doDel(TBGoodsEntity tBGoods, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		tBGoods = systemService.getEntity(TBGoodsEntity.class, tBGoods.getId());
		message = "货品表删除成功";
		try{
			tBGoodsService.delete(tBGoods);
			systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
		}catch(Exception e){
			e.printStackTrace();
			message = "货品表删除失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}
	
	/**
	 * 批量删除货品表
	 * 
	 * @return
	 */
	 @RequestMapping(params = "doBatchDel")
	@ResponseBody
	public AjaxJson doBatchDel(String ids,HttpServletRequest request){
		AjaxJson j = new AjaxJson();
		message = "货品表删除成功";
		try{
			for(String id:ids.split(",")){
				TBGoodsEntity tBGoods = systemService.getEntity(TBGoodsEntity.class, 
				id
				);
				tBGoodsService.delete(tBGoods);
				systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
			}
		}catch(Exception e){
			e.printStackTrace();
			message = "货品表删除失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}


	/**
	 * 添加货品表
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doAdd")
	@ResponseBody
	public AjaxJson doAdd(TBGoodsEntity tBGoods,TBStockEntity tBStock, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		message = "货品表添加成功";
		try{
			tBStock.setTotalcount("0");
			tBGoodsService.save(tBGoods, tBStock);
			systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
		}catch(Exception e){
			e.printStackTrace();
			message = "货品表添加失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}
	
	/**
	 * 更新货品表
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doUpdate")
	@ResponseBody
	public AjaxJson doUpdate(TBGoodsEntity tBGoods, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		message = "货品表更新成功";
		TBGoodsEntity t = tBGoodsService.get(TBGoodsEntity.class, tBGoods.getId());
		try {
			MyBeanUtils.copyBeanNotNull2Bean(tBGoods, t);
			tBGoodsService.saveOrUpdate(t);
			systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "货品表更新失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}
	

	/**
	 * 货品表新增页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goAdd")
	public ModelAndView goAdd(TBGoodsEntity tBGoods, HttpServletRequest req) {
		if (StringUtil.isNotEmpty(tBGoods.getId())) {
			tBGoods = tBGoodsService.getEntity(TBGoodsEntity.class, tBGoods.getId());
			req.setAttribute("tBGoodsPage", tBGoods);
		}
		return new ModelAndView("buss/goods/tBGoods-add");
	}
	/**
	 * 货品表编辑页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goUpdate")
	public ModelAndView goUpdate(TBGoodsEntity tBGoods, HttpServletRequest req) {
		if (StringUtil.isNotEmpty(tBGoods.getId())) {
			tBGoods = tBGoodsService.getEntity(TBGoodsEntity.class, tBGoods.getId());
			req.setAttribute("tBGoodsPage", tBGoods);
		}
		return new ModelAndView("buss/goods/tBGoods-update");
	}
}

七、如果也想学习本系统,下面领取。关注并回复:005ssh

  • 19
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值