基于java+ssm+vue的仓库在线管理系统

项目介绍

如今的时代,是有史以来最好的时代,随着计算机的发展到现在的移动终端的发展,国内目前信息技术已经在世界上遥遥领先,让人们感觉到处于信息大爆炸的社会。信息时代的信息处理肯定不能用之前的手工处理这样的解决方法,必须采用计算机来处理这些信息,因为传统方法对应计算机处理的信息效率上真的相差甚远。

本次使用Java技术开发的仓库在线管理系统,就是运用计算机来管理仓库物品出入库信息,该系统是可以实现物品管理,出入库管理,公告管理,供货方管理,员工管理等功能。

仓库在线管理系统使用计算机处理相关信息,主要是在数据的传输上能达到即可传递,数据不管是想要获取或者输入,都可以及时反馈,极大的提高了效率,使用的MySQL数据库也能让数据更能安全的存储。

4.2功能模块设计
本小节运用功能结构图来描述管理员具备的详细的功能,对管理员的功能结构图绘制结果如图4.1所示。管理员对员工信息,物品信息,公告信息,出入库信息等信息的管理。
在这里插入图片描述
本小节运用功能结构图来描述员工具备的详细的功能,对员工的功能结构图绘制结果如图4.2所示。员工查看物品,查看公告,对物品进行入库操作或出库操作,查询物品出入库明细信息。
在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SSM
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序ue/爬虫/c#/asp.net

系统实现

5.1 管理员功能实现
5.1.1 物品信息管理
管理员点击导航栏的物品信息管理链接就进入物品信息管理界面。物品信息管理界面如图5.1所示。本功能允许管理员对物品的基本资料进行修改,添加,查询,删除。
在这里插入图片描述

图5.1 物品信息管理界面

5.1.2 员工管理
管理员点击导航栏的员工管理链接就进入员工管理界面。员工管理界面如图5.2所示。本功能允许管理员对员工基础资料进行修改,查询,添加,删除。
在这里插入图片描述

图5.2 员工管理界面

5.1.3 公告信息管理
管理员点击导航栏的公告信息管理链接就进入公告信息管理界面。公告信息管理界面如图5.3所示。本功能允许管理员更改公告,添加公告等。
在这里插入图片描述

图5.3 公告信息管理界面

5.2 员工功能实现
5.2.1 物品信息查看
员工在物品信息查看界面可以对物品的信息进行查询和查看。物品信息查看界面如图5.4所示。员工需要了解各个物品的库存以及供货方等信息。
在这里插入图片描述

图5.4 物品信息查看界面

5.2.2 出入库管理
员工点击导航栏的出入库管理链接就进入出入库管理界面。出入库管理界面如图5.5所示。本功能允许员工对物品进行入库,对物品进行出库等操作。
在这里插入图片描述

图5.5 出入库管理界面

5.2.3 出入库列表管理
员工点击导航栏的出入库列表管理链接就进入出入库列表管理界面。出入库列表管理界面如图5.6所示。本功能允许员工根据物品的名称获取物品出入库的详情信息,包括供货方,经手人,操作数量等信息,同时可以新增物品出入库的详情信息。
在这里插入图片描述

图5.6 出入库列表管理界面

5.2.4 个人信息
员工点击导航栏的个人信息链接就进入个人信息界面。个人信息界面如图5.7所示。本功能允许员工对自己的个人信息进行查看,同时修改员工自己的介绍信息。
在这里插入图片描述

图5.7 个人信息界面

核心代码

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 出入库
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/shangpinChuruInout")
public class ShangpinChuruInoutController {
    private static final Logger logger = LoggerFactory.getLogger(ShangpinChuruInoutController.class);

    @Autowired
    private ShangpinChuruInoutService shangpinChuruInoutService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    // 列表详情的表级联service
    @Autowired
    private ShangpinChuruInoutListService shangpinChuruInoutListService;
//    @Autowired
//    private YonghuService yonghuService;
    @Autowired
    private ShangpinService shangpinService;
    @Autowired
    private YonghuService yonghuService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("员工".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = shangpinChuruInoutService.queryPage(params);

        //字典表数据转换
        List<ShangpinChuruInoutView> list =(List<ShangpinChuruInoutView>)page.getList();
        for(ShangpinChuruInoutView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ShangpinChuruInoutEntity shangpinChuruInout = shangpinChuruInoutService.selectById(id);
        if(shangpinChuruInout !=null){
            //entity转view
            ShangpinChuruInoutView view = new ShangpinChuruInoutView();
            BeanUtils.copyProperties( shangpinChuruInout , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ShangpinChuruInoutEntity shangpinChuruInout, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,shangpinChuruInout:{}",this.getClass().getName(),shangpinChuruInout.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_uuid_number", shangpinChuruInout.getShangpinChuruInoutUuidNumber())
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
            .eq("shangpin_danwei", shangpinChuruInout.getShangpinDanwei())
            .eq("shangpin_jingshouren", shangpinChuruInout.getShangpinJingshouren())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutEntity==null){
            shangpinChuruInout.setInsertTime(new Date());
            shangpinChuruInout.setCreateTime(new Date());
            shangpinChuruInoutService.insert(shangpinChuruInout);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody ShangpinChuruInoutEntity shangpinChuruInout, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,shangpinChuruInout:{}",this.getClass().getName(),shangpinChuruInout.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .notIn("id",shangpinChuruInout.getId())
            .andNew()
            .eq("shangpin_churu_inout_uuid_number", shangpinChuruInout.getShangpinChuruInoutUuidNumber())
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
            .eq("shangpin_danwei", shangpinChuruInout.getShangpinDanwei())
            .eq("shangpin_jingshouren", shangpinChuruInout.getShangpinJingshouren())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutEntity==null){
            shangpinChuruInoutService.updateById(shangpinChuruInout);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }
    /**
    * 出库
    */
    @RequestMapping("/outShangpinChuruInoutList")
    public R outShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("outShangpinChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取出入库名称并判断是否存在
        String shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


    //取当前表的级联表并判断是否前台传入

        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");


        Set<String> ids = map.keySet();

        List<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                Integer value = w.getShangpinKucunNumber()-map.get(String.valueOf(w.getId()));
                if(value <0){
                    return R.error(511,"出库数量大于库存数量");
                }
                w.setShangpinKucunNumber(value);
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(1);
            shangpinChuruInoutEntity.setShangpinDanwei(String.valueOf(params.get("shangpinDanwei")));//???????????????
            shangpinChuruInoutEntity.setShangpinJingshouren(String.valueOf(params.get("shangpinJingshouren")));//???????????????
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());

        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        if(insertShangpinChuruInout){
            //级联表
            ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                    shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                    shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                    shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                    shangpinChuruInoutListEntity.setInsertTime(new Date());
                    shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }
        return R.ok();
    }

    /**
    *入库
    */
    @RequestMapping("/inShangpinChuruInoutList")
    public R inShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("inShangpinChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        //params:{"map":{"1":2,"2":3},"wuziOutinName":"订单1"}

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取当前表名称并判断
        String shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


        //取当前表的级联表并判断是否前台传入

        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");

        Set<String> ids = map.keySet();

        List<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                w.setShangpinKucunNumber(w.getShangpinKucunNumber()+map.get(String.valueOf(w.getId())));
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(2);
            shangpinChuruInoutEntity.setShangpinDanwei(String.valueOf(params.get("shangpinDanwei")));//?????????????????
            shangpinChuruInoutEntity.setShangpinJingshouren(String.valueOf(params.get("shangpinJingshouren")));//?????????????????
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());


        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        if(insertShangpinChuruInout){
            //级联表
            ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                shangpinChuruInoutListEntity.setInsertTime(new Date());
                shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }

        return R.ok();
    }
    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        shangpinChuruInoutService.deleteBatchIds(Arrays.asList(ids));
        shangpinChuruInoutListService.delete(new EntityWrapper<ShangpinChuruInoutListEntity>().in("shangpin_churu_inout_id",ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<ShangpinChuruInoutEntity> shangpinChuruInoutList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity();
//                            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(data.get(0));                    //出入库流水号 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutName(data.get(0));                    //出入库名称 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(Integer.valueOf(data.get(0)));   //出入库类型 要改的
//                            shangpinChuruInoutEntity.setShangpinDanwei(data.get(0));                    //收货单位 要改的
//                            shangpinChuruInoutEntity.setShangpinJingshouren(data.get(0));                    //经手人 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");//照片
//                            shangpinChuruInoutEntity.setInsertTime(date);//时间
//                            shangpinChuruInoutEntity.setCreateTime(date);//时间
                            shangpinChuruInoutList.add(shangpinChuruInoutEntity);


                            //把要查询是否重复的字段放入map中
                                //出入库流水号
                                if(seachFields.containsKey("shangpinChuruInoutUuidNumber")){
                                    List<String> shangpinChuruInoutUuidNumber = seachFields.get("shangpinChuruInoutUuidNumber");
                                    shangpinChuruInoutUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> shangpinChuruInoutUuidNumber = new ArrayList<>();
                                    shangpinChuruInoutUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("shangpinChuruInoutUuidNumber",shangpinChuruInoutUuidNumber);
                                }
                        }

                        //查询是否重复
                         //出入库流水号
                        List<ShangpinChuruInoutEntity> shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber = shangpinChuruInoutService.selectList(new EntityWrapper<ShangpinChuruInoutEntity>().in("shangpin_churu_inout_uuid_number", seachFields.get("shangpinChuruInoutUuidNumber")));
                        if(shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ShangpinChuruInoutEntity s:shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber){
                                repeatFields.add(s.getShangpinChuruInoutUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [出入库流水号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        shangpinChuruInoutService.insertBatch(shangpinChuruInoutList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }






}

论文参考

在这里插入图片描述

目 录
第一章 绪论 1
1.1 研究背景 1
1.2 研究意义 1
1.3 研究内容 2
第二章 开发环境与技术 3
2.1 Java语言 3
2.2 JDK简介 3
2.3 Eclipse开发工具 4
第三章 系统分析 5
3.1可行性分析 5
3.1.1运行可行性分析 5
3.1.2技术可行性分析 5
3.1.3经济可行性分析 5
3.2系统流程分析 6
3.3 系统性能分析 8
3.3.1系统的安全性 8
3.3.2系统易维护性 8
3.3.3系统可扩展性 8
3.4系统功能分析 9
第四章 系统设计 11
4.1界面设计原则 11
4.2功能模块设计 11
4.3数据库设计 13
4.3.1数据库E-R图 13
4.3.2 数据库表结构 16
第五章 系统实现 19
5.1 管理员功能实现 19
5.1.1 物品信息管理 19
5.1.2 员工管理 19
5.1.3 公告信息管理 20
5.2 员工功能实现 20
5.2.1 物品信息查看 20
5.2.2 出入库管理 21
5.2.3 出入库列表管理 21
5.2.4 个人信息 22
第六章 系统测试 23
6.1 测试方案 23
6.2 系统测试用例 25
6.2.1 登录功能测试 25
6.2.2 注册功能测试 25
6.3 测试的结果 26
结 论 27
参考文献 28
致 谢 29

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值