最新毕业论文家电维修配件仓库管理系统

发布时间:



河北经贸大学毕业论文

毕业设计家电配件仓库管理系统


专业名称: 计算机科学与技术 级: 计算机一班 学生姓名: 肖瑞祥 指导老师: 蒋建伟 完成时间: 20125



随着经济的不断繁荣以及加入WTO后市场环境的变化,对企业的生产经营提出了更高的要求,企业必须综合利用各种先进制造技术,在网络与信息技术的支持下,改进现在的生产经营模式和组织结构,才能在市场竞争中赢得更多的份额。
本毕业设计的内容是设计并且实现一个基于web技术的仓库配件j2EE,使struts2+spring+hibernate等多种框架的结合使用,在Windows系统下用Myeclipse 8.5作为开发工具,MySQL作为数据库,Tomcat 6.0作为应用服务器,使用JAVA语言开发,页面采取JSP动态页面开发技术。该系统界面简单、操作方便,容易维护。

关键词:S.S.H(Struts ,Hibernate ,Spring,JAVA , JSP


1绪论………………………………………………………………………1

1.1 课题研究的背景……………………………………………………………1 1.2 课题研究的意义……………………………………………………………2 2开发技术简介……………………………………………………………3

2.1 系统的开发环境……………………………………………………………3

2.1.1 MyEclipse……………………………………………………………3 2.1.2 数据库简介…………………………………………………………3 2.1.3 Tomcat………………………………………………………………4 2.2.1 JSP技术与MVC模式以及系统的基本框架………………………4 2.2.2 S.S.H框架优点………………………………………………………5 2.2 系统开发的思想与技术……………………………………………………4 3 系统总体设计…………………………………………………………………9 3.1总体功能模块………………………………………………………………9 3.2超级管理员功能模块………………………………………………………9 3.3仓库管理员功能模块………………………………………………………10 3.4仓库保管员功能模块………………………………………………………10 3.5维修工程师功能模块………………………………………………………11 4.1系统和数据库的配置………………………………………………………12 4.2概念模型设计………………………………………………………………13 4.3数据库表的设计……………………………………………………………13 5.1系统功能实现的主要框架…………………………………………………16

5.1.1 S.S.H框架……………………………………………………………16 5.1.2 hibernate配置文件…………………………………………………16 5.1.3 struts配置文件…………………………………………………… 18 5.1.4 Spring配置文件……………………………………………………
19 4 系统详细设计与实现…………………………………………………………12
5 系统功能的实现………………………………………………………………16 5.2系统功能实现的主要模块…………………………………………………22




5.2.1登陆页面……………………………………………………………22 5.2.2超级管理员…………………………………………………………24 5.2.3仓库管理员…………………………………………………………31 5.2.4仓库保管员…………………………………………………………58 5.2.5维修工程师…………………………………………………………67 6 系统的运行与调试……………………………………………………………73 6.1配置服务器…………………………………………………………………73 6.2添加项目输出………………………………………………………………74 6.3运行项目……………………………………………………………………75 结束语………………………………………………………………………………76 ………………………………………………………………………………77 参考文献……………………………………………………………………………78

1.绪论
1.1 课题研究的背景
随着我国经济的飞速发展,各种类型的电器公司企业迅速崛起,规模不断的扩大,电器产品数量急剧增加,维修配件也在急剧增加。面对庞大的配件信息量,如何管理好配件库存品,对于企业来说是十分重要的。之前,家用电器很少,配件的储存量也十分有限,基本上都是通过纯手工的方式来管理配件的存货量。如今,面对庞大的配件信息量,好多企业都有自己的配件仓库管理模式管理配件,但是并不完善。大多数企业只是单独的一个仓库管理系统,并没有把顾客的需求同配件生产量联系起来,有些配件供不应求,有些配件的库存量却很大,这时就需要一套更加完整的系统来帮助企业管理,把现有的需求量都回馈给配件生产商,有的配件缺货说明需求量大,要及时补充增量生产此类配件,有的配件库存量大,要减缓此类配件的生产速度,达成需求平衡的良好局面,避免造成资源的大量浪费。
70年代开始,计算机技术开始应用到物流领域。随着物流市场和物流信息化的发展,物流软件市场也应运而生并迅速发展起来,国内外出现了一大批物流软件供应商和物流软件。“物流软件作为管理软件,较其它应用软件呈现先进性、高效性、可靠性和安全性等特点;较其它管理软件,如ERP(Enterprise Resource Planning,具有以下特点:实施风险小,实施迅速;效益显著、见效快。
根据物流软件结构分类,就目前物流软件所使用的应用范围来说,物流软件包括如下几个子系统:WMS(Warehouse Management System,仓库管理系统TMS(Transportation Management System运输管理系统。OMS(Order Management System,SMS(Service Management System,服务管理系统。其中,WMS主要提供了一整套仓库业务以及作业管理系统。通过仓库管理系统可以实现库位分配自动化和智能化;提高仓库作业效率和速度,提供准确的库存信息,并使之与实际库存变化同步。
国内的很多企业,由于信息的记录、收集、汇总、处理分析还处于比较低的水平,记录中信息分散、格式随意、应用单一,收集中不及时、
不全面、不完善、保留不科学,汇总时口径不一、主题多元、结果不一,处理分析方法落后、效率低下、只有短期,难以支持趋势等。 1.2课题研究的意义
仓库管理系统是通过入库业务、出库业务、库存调拨、库存调整,结合批次管理、物料对应、库存盘点、质检管理、实时库存管理等功能综合运用的管理系统,对库存业务的物流和成本管理全过程进行有效控制和跟踪,实现完善的企业仓库信息管理。仓库管理系统的投入,将使仓库的管理更加正规化,为产品的出入库管理部门和销售部门提供了方便,降低了仓库的损耗。企业可以对售出的产品进行跟踪服务,同时也免去了销售人员按以往惯例亲自前往用户处去核实货物情况的麻烦,高了办事效率,节省了费用,而且还避免了不必要的业务纠纷,维护了企业长期与用户建立的良好信誉。
2.系统的开发环境与技术简介
2.1 系统开发环境
2.1.1 MyEclipse 在开发本平台中所用到的开发工具就是是知名的java项目开发工MyEclipseMyEclipse企业级工作平台(MyEclipse Enterprise Workbench ,简称MyEclipse)是对Eclipse IDE的一种扩展,利用MyEclipse,我们可以在数据库和J2EE的开发、发布,以及在应用程序服务器的整合当中极大地提高系统的工作效率。MyEclipse是一个功能非常丰富的J2EE集成开发环境,包括了完备的编码、调试、测试和发HTML, Struts, JSP, CSS, Javascript, SQL, Hibernate
在结构上,MyEclipse的特征可以被分为7类: J2EE模型,WEB开发工具,EJB开发工具,应用程序服务器的连接器,J2EE项目部署服务,数据库服务,MyEclipse整合帮助。
对于以上每一种功能上的类别,Eclipse中都有相应的功能部件,并通过一系列的插件来实现它们。MyEclipse结构上的这种模块化,可以让我们在不影响其他模块的情况下,对任一模块进行单独的扩展和升级。
简单而言,MyEclipseEclipse的插件,也是一款功能强大的J2EE集成开发环境,支持代码编写、配置、测试以及除错。 2.1.2 数据库简介
数据库使用的是MySQL开源数据库。
MySQL的特性:使用CC++编写,并使用了多种编译器进行测试,保证源代码的可移植性 支持AIXFreeBSDHP-UXMac OSOpenBSDOS/2 WrapSolarisWindows等多种操作系统 。为多种编程语言提供API。这些编程语言包括CC++EiffelJavaPerlPHPPythonRubyTcl等。支持多线程充分利用CPU资源。优化的SQL查询算法,有效地提高查询速度。既能够作为一个单独的应用程序应用在客户端服务器网络环境中,也能够作为一个库而嵌入到其他的软件中提供多语言
支持,常见的编码如中文的GB2312BIG5,日文的Shift_JIS等都可以用作数据表名和数据列名。提供TCP/IPODBCJDBC等多种数据库连接途径。提供用于管理、检查、优化数据库操作的管理工具。可以处理拥有上千万条记录的大型数据库。
MySQL的应用:与其他的大型数据库例如OracleDB2SQL Server等相比,MySQL自有它的不足之处,如规模小、功能有限MySQL Cluster的功能和效率都相对比较差)等,但是这丝毫也没有减少它受欢迎的程度。对于一般的个人使用者和中小型企业来说,MySQL提供的功能已经绰绰有余,而且由于MySQL是开放源码软件,因此可以大大降低总体成本。
2.1.3 Tomcat Tomcat 很受广大程序员的喜欢,因为它运行时占用的系统资源小,扩展性好,支持负载平衡与邮件服务等开发应用系统常用的功能;而且它还在不断的改进和完善中,任何一个感兴趣的程序员都可以更改它或在其中加入新的功能。

Tomcat 是一个轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP 程序的首选。Apache 务器,可利用它响应对HTML 页面的访问请求。实际上Tomcat 部分是Apache 服务器的扩展,但它是独立运行的,所以当你运行tomcat 时,它实际上作为一个与Apache 独立的进程单独运行的。

这里的诀窍是,当配置正确时,Apache HTML页面服务,而Tomcat 实际上运行JSP 页面和Servlet另外,TomcatIISApacheWeb服务器一样,具有处理HTML页面的功能,另外它还是一ServletJSP器,独立的Servlet容器是Tomcat的默认模式。 2.2 系统开发的思想与技术
2.2.1 JSP术与MVC模式及系的基本

本系统采用jsp技术,基于MVC模式开发,使用SSH框架struts2springhibernate)来增加系统的开发速度。所谓的MVC模式是"Model-View-Controller"的缩写,中文翻译为"模式-视图-控制
"。程序就是用struts2hibernate这两个框架来实现模型层和控制器这两层,jsp实现视图这一层。一般来说程序就是在数据库和页面之间起桥梁作用的,jsp页面请求先到action再到dao再回到action回到jsp页面,action主要处理来自页面的请求,dao主要是和数据库的交互,struts2主要用在action,处理来自页面的请求,处理完请求后跳转回页面。Hibernate主要用在dao,包括对数据库的增、删、改、查的操作,spring控制程序的流程。 2.2.2 S.S.H框架的优点
S.S.H框架是J2EE应用中struts2+spring+hibernate三大免费开源框架的结合使用, 它可以看成工具,也是中间件。他是用来提高我们的开发效率,提高我们软件产品的可维护性、可扩展性乃至敏捷性的。他们里面有很多优秀的设计理念及模式应用。比如,struts属于MVC框架,关键是要了解MVC的概念及大致原理;而hibernate属于ORM统,属于持久层的解决方案,同样需要对ORM的概念及原理有一个总体的了解。而spring属于应用程序框架,其核心是IOC容器以及AOP,Spring中还集成了很多适用东西,比如对JDBC的封装、自己的MVC对动态语言的简洁访问等,

它由以下3个框架构成: 1.Struts2框架
Struts2Apache组织的一个开放源码项目。Struts2是一个比较好的MVC框架,提供了对开发MVC系统的底层支持,它采用的主要技术ServletJSPCustom tag library。其基本构成如图2.1所示。









2.1 Struts框架工作流程
2.Spring框架
Spring 的核心是个轻量级(Lightweight)的容器(Container它是实现IoCInversion of Control容器、非侵入性No intrusive的框架,并提供AOPAspect-oriented programming概念的实现方式,提供对持久层(Persistence、事务(Transaction)的支持,提供MVC Web 框架的实现,并对一些常用的企业服务APIApplication Interface)提供一致的模型封装,是一个全方位的应用程序框架Application framework,除此之外,对于现存的各种框架(StrutsJSFHibernate 等)Spring 也提供了与它们相整合的方案。

Spring框架由以下7个部分组成


2.2 Spring框架构成

3.Hibernate框架
Hibernate 是一个开放源码的 ORM 持久层框架。作为优秀的持久层框架实现,Hibernate 框架提供了强大、高性能的对象到关系型数据库的持久化服务,开发人员可以使用面向对象的设计进行持久层开发。简单的说,Hibernate 只是一个将持久化类与数据库表相映射的工具,每个持久化类实例均对应于数据库表中的一个数据行而已。用户只需直接使用面向对象的方法操作此持久化类实例,即可完成对数据库表数据的插入、删除、修改、读取等操作。


2.3 Hibernate框架



3.系统总体设计 3.1 总体功能模块

家电配件仓库管理系统分超级管理员、维修工程师、仓库管理员和仓库保管员四个角色。总功能如图3-1所示。

3-1.系统功能需求分析 3.2 超级管理员功能模块

超级管理员功能包括:对仓库管理员、维修工程师、仓库保管员的管理,如图3-2所示。


3-2.超级管理员功能图 3.3 仓库管理员功能模块

仓库管理员主要功能包括:商品管理、配件入库管理、配件出库管理、库存管理。仓库管理员的功能图如图3-3所示。

3-3.仓库管理员的功能图 3.4 仓库保管员功能模块

仓库保管员主要功能:从仓库管理员收到单据,对商品进行出库、
入库操作。仓库保管员功能模块如图3-4所示

3-4.仓库保管员功能图 3.5 维修工程师功能模块

维修工程师主要功能:向仓库管理员申请家电货物配件。维修工程师功能模块如图3-5所示。




3-5.维修工程师功能图


4系统详细设计与实现
4.1 系统和数据库的配置
系统按通用的B/S(浏览器、服务器)模式进行设计(如图4-1

数据库在一个信息管理系统中占有非常重要的地位,数据库结构设计的好坏将直接对应用系统的效率,以及实现的效果产生影响。合理的数据库结构设计可以提高数据存储的效率,保证数据的完整和一致。 4.2 概念模型设计
概念模型设计的典型方法是用E-R图方法,即用实体-联系模型表示。E-R方法是用E-R图来描述显示世界,E-R图包含三个基本成分:实体、联系、属性。它直观易懂,能够比较准确地反映现实世界的信息联系,从概念上表示一个数据库的信息组织情况。 本系统E-R图如下


4.3 数据库表的设计
数据库的内容以及表的设计直接影响到开发的系统的质量,好的设计可以达到方便易用的功能。
根据系统的要求,我们采用的数据库是MySQL。具体信息如下。

4.3.1 t_user表的设计 id address birthday createtime password phone role indate truename username sex pay

4.3.2 t_product表的设计 id bianhao changjia leixing name pici t_product表是仓库管理员管理仓库货物的表,如图4.3.2所示:

数据类型 bigint varchar varchar varchar varchar varchar 字段大小 20 255 255 255 255 255 货物ID 货物在仓库里的编号 厂家 货物类型 货物名称 货物批次
说明
t_user表是所有用户的信息表,如图4.3.1所示:

数据类型 bigint varchar date date varchar varchar varchar date varchar varchar varchar varchar 字段大小 20 255 255 255 255 255 255 255 255 255 255 255 说明
用户编号(主键 用户姓名 出生日期 创建日期 用户密码 联系电话 在系统中的角色 入职日期 实际姓名 用户名 性别 薪资
字段名称
字段名称

xinghao zhiliang

varchar varchar 255 255 货物型号 货物质量
4.3.3 t_jiehuo表的设计 id fahuoren rukushijian shuliang productid userid user2id t_jiehuo表是仓库保管员的接货信息的表,如图4.3.3所示:

数据类型 bigint varchar varchar int bigint bigint bigint 字段大小 20 255 255 255 11 20 20 20 货物ID 发货人 接货状态 入库时间 货物数量
货物在仓库里的编号 仓库管理员 仓库保管员
说明
字段名称
jiehuozhuangtai varchar

4.3.4 t_chuhuo表的设计
id chuhuoshijian shuliang productid userid user2id user3id

4.3.5 t_kucun表的设计

t_kucun表是仓库管理员和保管员查看仓库内货物信息的表,t_chuhuo表是仓库保管员的出货信息表,如图4.3.4所示:

数据类型 bigint varchar int bigint bigint bigint bigint 字段大小 20 255 255 11 20 20 20 20 货物ID 出货时间 接货状态 货物数量
货物在仓库里的编号 仓库管理员 仓库保管员 维修工程师
说明
字段名称
jiehuozhuangtai varchar
4.3.5所示:


字段名称 id shuliang productid

4.3.6 t_shenqing表的设计

字段名称 id shuliang productid userid user2id



5.系统功能实现
数据类型 bigint varchar bigint bigint bigint 字段大小 20 255 255 20 20 20 货物ID 接货状态 货物数量
货物在仓库里的编号 仓库管理员 仓库保管员
说明
t_shenqing表是维修工程师向仓库管理员申请货物配件的表,数据类型 bigint int bigint 字段大小 20 11 20 货物ID 货物数量
货物在仓库里的编号
说明
如图4.3.6所示:
jiehuozhuangtai varchar
5.1 系统功能实现的主要框架

5.1.1 S.S.H框架
SSH框架就是struts2,spring,hibernate的简称,运用3个框架的集成协作使用,可以有效的提高代码编写的效率,从而有效的降低程序开发的周期。
5.1.2 hibernate配置文件
<hibernate-configuration>




<session-factory>
<property name="proxool.pool_alias">DBPoolproperty>

<property name="proxool.xml">proxool.xmlproperty> <property name="connection.provider_class">

org.hibernate.connection.ProxoolConnectionProvider property>






<property name="show_sql">trueproperty> <property name="format_sql">trueproperty>




<property
name="dialect">org.hibernate.dialect.MySQLDialectproperty>






<property
name="current_session_context_class">threadproperty>



<property
name="hibernate.hbm2ddl.auto">updateproperty>





<mapping class="bishe.model.User"/> <mapping class="bishe.model.Jiehuo"/> <mapping class="bishe.model.Kucun"/> <mapping class="bishe.model.Chuhuo"/> <mapping class="bishe.model.Product"/> <mapping class="bishe.model.Shenqing"/> <mapping class="bishe.model.Tixing"/>



session-factory>
hibernate-configuration>
这是Hibernate的配置文件,在该文件中name="proxool.xml">proxool.xml首先加载了连接池的一个配置,就是加载了数据库的连接信息,name="show_sql">truename="format_sql">true表示控制台打印SQL语句,并格式SQL语句,name="dialect">org.hibernate.dialect.MySQLDialectproperty>
表示当前数据库的语言是MYSQL <mapping class="bishe.model.User"/>




<mapping class="bishe.model.Jiehuo"/> <mapping class="bishe.model.Kucun"/> <mapping class="bishe.model.Chuhuo"/> <mapping class="bishe.model.Product"/> <mapping class="bishe.model.Shenqing"/> <mapping class="bishe.model.Tixing"/>
都表示当前数据库建立起来的表和类之间的映射关系,比如class="bbs.model.User"/>表示User类和t_user表之间的建立起来的对应关系,其他也都类似

5.1.3 struts配置文件
<struts>

<package name="index" namespace="/"

<constant name="struts.objectFactory" value="spring" /> <constant name="struts.i18n.encoding" value="UTF-8" />
extends="struts-default">

<action name="index" method="index"
class="manageAction" >
<result name="success1">index.jspresult> <result name="success2">login.jspresult> action>

<action name="method" class="manageAction">



<result type="dispatcher">${url}result> <result name="redirect"

type="redirect">${url}result>


action>
package>

struts>

这是struts的配置文件,该文件的作用主要起到来自JSP的请求的跳转分配的作用.struts配置文件是个总的配置文件。
5.1.4 spring配置文件
Spring 在本项目中主要用到了IOC的功能,就是把对象实例化 <
<bean id="userDao" class="bishe.dao.impl.UserDaoImpl" >


<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>
<bean id="jiehuoDao" class="bishe.dao.impl.JiehuoDaoImpl" >

<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>

<bean id="kucunDao" class="bishe.dao.impl.KucunDaoImpl" >

<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>

<bean id="chuhuoDao" class="bishe.dao.impl.ChuhuoDaoImpl" >

<property name="sessionFactory"><ref
bean="sessionFactory" />property>



bean>

<bean id="productDao"
class="bishe.dao.impl.ProductDaoImpl" >


<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>

<bean id="shenqingDao"
class="bishe.dao.impl.ShenqingDaoImpl" >


<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>

<bean id="tixingDao" class="bishe.dao.impl.TixingDaoImpl" >

<property name="sessionFactory"><ref
bean="sessionFactory" />property>

bean>
本段代码是把DAO实例化的代码,通过springIOC模式
<bean id="manageAction" class="bishe.action.ManageAction" scope="prototype">


<property name="userDao"><ref bean="userDao"
/>property>


<property name="jiehuoDao"><ref bean="jiehuoDao"
/>property>


<property name="kucunDao"><ref bean="kucunDao"
/>property>


<property name="chuhuoDao"><ref bean="chuhuoDao"
/>property>


<property name="productDao"><ref bean="productDao"
/>property>

<property name="shenqingDao"><ref bean="shenqingDao"
/>property>


<property name="tixingDao"><ref bean="tixingDao"
/>property>



bean>
本段代码是把ManageAction实例化的代码,原理也是springIOC式。

Spring的其他配置:


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">



<property name="configLocation">

<value>classpath:hibernate.cfg.xmlvalue>
property>

bean>

<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">



<property name="sessionFactory">

<ref bean="sessionFactory"/>
property>

bean>

<tx:advice id="txAdvice"
transaction-manager="transactionManager">





<tx:attributes>

<tx:method name="insert*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/>
tx:attributes>
tx:advice>

<aop:config>

<aop:pointcut id="allManagerMethod"
expression="execution(* bishe.dao.*.*(.."/>


<aop:advisor pointcut-ref="allManagerMethod"
advice-ref="txAdvice"/>

aop:config>

5.2 系统功能实现的主要模块

5.2.1 登陆页面

登录代码:



// 用户登录操作

public String login( throws IOException {
HttpServletRequest request = ServletActionContext.getRequest(;



String username = request.getParameter("username"; String password = request.getParameter("password"; String role = request.getParameter("role"; User user = userDao.selectBean(" where username = '" + username



+ "' and password= '" + password + "' and userlock=0 and role="





+ role; if (user != null {

HttpSession session = request.getSession(; session.setAttribute("manage", user; this.setUrl("index"; return "redirect"; } else {
HttpServletResponse response = ServletActionContext.getResponse(;





response.setCharacterEncoding("gbk"; response



.getWriter( .print(

"";


}
} return null;

本段代码是程序的登陆代码,首先从获取从页面输入的用户名和密码还有用户的登陆角色,然后调用userDao.selectBean方法,从数据库里取出该条记录进行判断,如果该条记录存在,则说明用户登陆成功,同时把用户信息存在session里面方便调用,如果记录为空,则跳转到登陆页面,同时提醒用户错误信息。

5.2.2 超级管理员 登陆界面:


超级管理员的操作:
1.添加用户,如图所示:


代码如下:
// 添加用户操作

public void useradd2( throws IOException {
HttpServletRequest request = ServletActionContext.getRequest(;



String username = request.getParameter("username"; String truename = request.getParameter("truename"; String address = request.getParameter("address"; String phone = request.getParameter("phone"; String xingbie = request.getParameter("xingbie"; String chushengnianyue = request.getParameter("chushengnianyue";



String ruzhiriqi = request.getParameter("ruzhiriqi"; String xinzi = request.getParameter("xinzi"; String role = request.getParameter("role";
User bean = userDao.selectBean(" where username='"+username+"' ";



if(bean==null{

bean = new User(; bean.setCreatetime(new Date(; bean.setPassword("111111"; bean.setRole(1; bean.setTruename(truename; bean.setUsername(username; bean.setAddress(address; bean.setPhone(phone; bean.setXingbie(xingbie; bean.setChushengnianyue(chushengnianyue; bean.setRuzhiriqi(ruzhiriqi; bean.setXinzi(xinzi; bean.setRole(Integer.parseInt(role; userDao.insertBean(bean; HttpServletResponse response = ServletActionContext.getResponse(;





response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan("操作成功", "method!userlist", "userlist";





out.flush(; out.close(; }else{
HttpServletResponse response = ServletActionContext.getResponse(;





response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan("该用户名已经存在,操作失败", "method!userlist", "userlist";




}
} out.flush(; out.close(;

2.删除用户,超级管理员只能重新设置普通用户密码,如图所示:






代码如下:
// 删除用户操作
public void userdelete( throws IOException {
HttpServletRequest request = ServletActionContext.getRequest(;



User bean = userDao.selectBean(" where id= "


+ request.getParameter("id"; bean.setUsername(bean.getUsername(+"_delete"; bean.setUserlock(1; userDao.updateBean(bean; HttpServletResponse response = ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan2("操作成功", "method!userlist", "userlist";


} out.flush(; out.close(;

3.修改用户,如图所示:





代码如下:
// 修改密码操作
public void changepwd2( throws IOException {
HttpServletRequest request = ServletActionContext.getRequest(;

HttpServletResponse response = ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; HttpSession session = request.getSession(; User u = (User session.getAttribute("manage"; String password1 = request.getParameter("password1"; String password2 = request.getParameter("password2"; String password3 = request.getParameter("password3"; User bean = userDao.selectBean(" where username= '" + u.getUsername(





+ "' and password= '" + password1 + "'"; if (!password2.equals(password3 {
out.print(Util.tiaozhuan2("两次输入密码不一致",
"houtai", "orderlist";





out.flush(; out.close(; } else if (bean != null {

bean.setPassword(password2; userDao.updateBean(bean; out.print(Util.tiaozhuan2("操作成功", "houtai", "orderlist";





out.flush(; out.close(; } else {
out.print(Util.tiaozhuan2("原密码错误", "houtai", "orderlist";


}
} out.flush(; out.close(; 4.查询用户所有信息,如图所示:




// 用户列表查询
public String userlist10( {
HttpServletRequest request =
ServletActionContext.getRequest(;



sb.append("userlock=0 and role!=0 order by id desc "; String where = sb.toString(;

}

if (truename != null && !"".equals(truename {

sb.append("truename like '%" + truename + "%'"; sb.append(" and "; sb2.append("truename like '%" + truename + "%'"; sb2.append(" and "; request.setAttribute("truename", truename;
}

if (username != null && !"".equals(username {

sb.append("username like '%" + username + "%'"; sb.append(" and "; sb2.append("username like '%" + username + "%'"; sb2.append(" and "; request.setAttribute("username", username;

StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";

String username = request.getParameter("username"; String truename = request.getParameter("truename";




sb2.append(" userlock=0 and role!=0 "; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage = Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";

}
int total = userDao.selectBeanCount(where2; request.setAttribute("list", userDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where;

} request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!userlist10"; this.setUrl("user/userlist10.jsp"; return SUCCESS; 5.2.3 仓库管理员 登陆界面:


仓库管理员的操作:
1.对仓库中的货物进行增、删、改、查,如图所示:

代码如下:



// 货物列表
public String productlist( {
HttpServletRequest request = ServletActionContext.getRequest(;





StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";




sb.append("productlock=0 order by id desc "; String where = sb.toString(; sb2.append(" productlock=0 "; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage = Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";

}

// 货物查询
public String productlist10( { int total = productDao.selectBeanCount(where2; request.setAttribute("list", productDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where;

} request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!productlist"; this.setUrl("product/productlist.jsp"; return SUCCESS;

HttpServletRequest request = ServletActionContext.getRequest(;


sb.append("productlock=0 order by id desc ";

}

if (name != null && !"".equals(name {

sb.append("name like '%" + name + "%'"; sb.append(" and "; sb2.append("name like '%" + name + "%'"; sb2.append(" and "; request.setAttribute("name", name;
}

if (bianhao != null && !"".equals(bianhao {

sb.append("bianhao like '%" + bianhao + "%'"; sb.append(" and "; sb2.append("bianhao like '%" + bianhao + "%'"; sb2.append(" and "; request.setAttribute("bianhao", bianhao;

StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";

String name = request.getParameter("name"; String bianhao = request.getParameter("bianhao";




String where = sb.toString(; sb2.append(" productlock=0 "; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage = Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";


} // 添加货物操作
public void productadd2( throws IOException {
HttpServletRequest request = int total = productDao.selectBeanCount(where2; request.setAttribute("list", productDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where;

} request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!productlist10"; this.setUrl("product/productlist10.jsp"; return SUCCESS; ServletActionContext.getRequest(;



String changjia = request.getParameter("changjia"; String leixing = request.getParameter("leixing"; String name = request.getParameter("name"; String pici = request.getParameter("pici";




String xinghao = request.getParameter("xinghao"; String zhiliang = request.getParameter("zhiliang"; Product bean = new Product(; bean.setChangjia(changjia; bean.setLeixing(leixing; bean.setName(name; bean.setPici(pici; bean.setXinghao(xinghao; bean.setZhiliang(zhiliang; bean.setBianhao(Util.getTime2(; productDao.insertBean(bean; HttpServletResponse response = ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan("操作成功", "method!productlist", "productlist";

// 删除货物操作
public void productdelete( throws IOException {
HttpServletRequest request =
} out.flush(; out.close(; ServletActionContext.getRequest(;





Product bean = productDao.selectBean(" where id= "

Kucun kucun = kucunDao.selectBean(" where product.id=
+ request.getParameter("id"; "+bean.getId(;




if(kucun.getShuliang(>0{
HttpServletResponse response = ServletActionContext.getResponse(;





response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan2("该商品有库存,删除失败", "method!productlist", "productlist";



}
kucunDao.deleteBean(kucun; bean.setProductlock(1; productDao.updateBean(bean; HttpServletResponse response = out.flush(; out.close(; return; ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan2("操作成功", "method!productlist", "productlist";


} out.flush(; out.close(; 2.接货管理、查询,如图所示:

代码如下:

// 接货列表

public String jiehuolist( {
HttpServletRequest request = ServletActionContext.getRequest(;



sb.append(" user.id="+user.getId(+" order by id desc "; String where = sb.toString(; sb2.append(" user.id="+user.getId(; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage =

StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";

HttpSession session = request.getSession(; User user = (Usersession.getAttribute("manage";

Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";



}


}

// 接货查询
public String jiehuolist10( {
HttpServletRequest request = int total = jiehuoDao.selectBeanCount(where2; request.setAttribute("list", jiehuoDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where; request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!jiehuolist"; this.setUrl("jiehuo/jiehuolist.jsp"; return SUCCESS; ServletActionContext.getRequest(;



StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";
if (bianhao != null && !"".equals(bianhao {

sb.append(" product.bianhao like '%" + bianhao + "%'"; sb.append(" and "; sb2.append(" product.bianhao like '%" + bianhao +

String bianhao = request.getParameter("bianhao"; String name = request.getParameter("name"; String leixing = request.getParameter("leixing";
"%'";



if (leixing != null && !"".equals(leixing {

sb.append(" product.leixing like '%" + leixing + "%'"; sb.append(" and "; sb2.append(" product.leixing like '%" + leixing +
}

if (name != null && !"".equals(name {

sb.append(" product.name like '%" + name + "%'"; sb.append(" and "; sb2.append(" product.name like '%" + name + "%'"; sb2.append(" and "; request.setAttribute("name", name;
}



sb2.append(" and "; request.setAttribute("bianhao", bianhao; "%'";



sb.append(" user.id="+user.getId(+" order by id desc "; String where = sb.toString(; sb2.append(" user.id="+user.getId(; String where2 = sb2.toString(;

} HttpSession session = request.getSession(; User user = (Usersession.getAttribute("manage";



sb2.append(" and "; request.setAttribute("leixing", leixing;





int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage = Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";

// 添加接货操作
public void jiehuoadd2( throws IOException {
HttpServletRequest request =
} int total = jiehuoDao.selectBeanCount(where2; request.setAttribute("list", jiehuoDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where;

} request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!jiehuolist10"; this.setUrl("jiehuo/jiehuolist10.jsp"; return SUCCESS; ServletActionContext.getRequest(;



String fahuoren = request.getParameter("fahuoren"; String product = request.getParameter("product"; String user2 = request.getParameter("user2"; HttpSession session = request.getSession(; User user = (Usersession.getAttribute("manage";






Jiehuo bean = new Jiehuo(; bean.setFahuoren(fahuoren; bean.setJiehuozhuangtai("未确认"; bean.setProduct(productDao.selectBean(" where id= "+product;




bean.setUser(user; bean.setUser2(userDao.selectBean(" where id= "+user2;
jiehuoDao.insertBean(bean;
HttpServletResponse response = ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; out.print(Util.tiaozhuan("操作成功", "method!jiehuolist", "jiehuolist";


} out.flush(; out.close(; // 删除接货操作

public void jiehuodelete( throws IOException {
HttpServletRequest request = ServletActionContext.getRequest(;

HttpServletResponse response = ServletActionContext.getResponse(;



response.setCharacterEncoding("utf-8"; PrintWriter out = response.getWriter(; Jiehuo bean = jiehuoDao.selectBean(" where id= "


+ request.getParameter("id"; if(bean.getJiehuozhuangtai(.equals("未确认"{






jiehuoDao.deleteBean(bean; out.print(Util.tiaozhuan2("操作成功", "method!jiehuolist", "jiehuolist";



}else{ out.print(Util.tiaozhuan2("操作失败,该商品已经确认接货", "method!jiehuolist", "jiehuolist";

}
out.flush(; out.close(; } 3.出货管理、查询,如图所示:
代码如下:
// 出货列表

public String chuhuolist( {
HttpServletRequest request = ServletActionContext.getRequest(;



StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";





sb.append(" user.id="+user.getId(+" order by id desc "; String where = sb.toString(; sb2.append(" user.id="+user.getId(; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage =


HttpSession session = request.getSession(; User user = (Usersession.getAttribute("manage"; Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";


} int total = chuhuoDao.selectBeanCount(where2; request.setAttribute("list", chuhuoDao.selectBeanList(

(currentpage - 1 * pagesize, pagesize, where;

} request.setAttribute("totalCount", total; request.setAttribute("ps", pagesize; request.setAttribute("pn", currentpage; request.setAttribute("url", "method!chuhuolist"; this.setUrl("chuhuo/chuhuolist.jsp"; return SUCCESS;




// 出货查询
public String chuhuolist10( {
HttpServletRequest request = ServletActionContext.getRequest(;



if (bianhao != null && !"".equals(bianhao {

sb.append(" product.bianhao like '%" + bianhao + "%'"; sb.append(" and "; sb2.append(" product.bianhao like '%" + bianhao +

StringBuffer sb = new StringBuffer(; sb.append(" where ";
StringBuffer sb2 = new StringBuffer(; sb2.append(" where ";

String name = request.getParameter("name"; String leixing = request.getParameter("leixing"; String bianhao = request.getParameter("bianhao"; "%'";



}
if (name != null && !"".equals(name {

sb.append(" product.name like '%" + name + "%'"; sb.append(" and "; sb2.append(" product.name like '%" + name + "%'"; sb2.append(" and ";



sb2.append(" and "; request.setAttribute("bianhao", bianhao;


request.setAttribute("name", name;
}

if (leixing != null && !"".equals(leixing {

sb.append(" product.leixing like '%" + leixing + "%'"; sb.append(" and "; sb2.append(" product.leixing like '%" + leixing + "%'";



sb.append(" user.id="+user.getId(+" order by id desc "; String where = sb.toString(; sb2.append(" user.id="+user.getId(; String where2 = sb2.toString(;

int currentpage = 1; int pagesize = 20; if (request.getParameter("pageNum" != null {
currentpage =

} HttpSession session = request.getSession(; User user = (Usersession.getAttribute("manage";



sb2.append(" and "; request.setAttribute("leixing", leixing; Integer.parseInt(request.getParameter("pageNum";


pagesize = Integer.parseInt(request.getParameter("numPerPage";



}

最新毕业论文家电维修配件仓库管理系统

相关推荐