java蓝宇快递打印系统.docx

上传人:b****5 文档编号:3295973 上传时间:2022-11-21 格式:DOCX 页数:103 大小:1.14MB
下载 相关 举报
java蓝宇快递打印系统.docx_第1页
第1页 / 共103页
java蓝宇快递打印系统.docx_第2页
第2页 / 共103页
java蓝宇快递打印系统.docx_第3页
第3页 / 共103页
java蓝宇快递打印系统.docx_第4页
第4页 / 共103页
java蓝宇快递打印系统.docx_第5页
第5页 / 共103页
点击查看更多>>
下载资源
资源描述

java蓝宇快递打印系统.docx

《java蓝宇快递打印系统.docx》由会员分享,可在线阅读,更多相关《java蓝宇快递打印系统.docx(103页珍藏版)》请在冰豆网上搜索。

java蓝宇快递打印系统.docx

java蓝宇快递打印系统

综合实验蓝宇快递打印系统文档

******

一综合实验问题的需求分析

1.1实验内容和实验目的

1.2问题描述

1.3设计要求和功能描述

二总体设计

2.1系统目标

2.2构建开发环境

2.3系统功能结构

三数据库设计

3.1数据库概要说明

3.2数据库E-R图

3.3数据库结构

四公共类设计

4.1公共类DAO

4.2公共类SaveUserStateTool

五程序主要系统开发

六调试与测试实验结果

七实验总结

参考文献

附录(源代码)

一综合实验问题的需求分析

1.1实验内容和实验目的

(1)开发一个快递打印系统,以支持表单内容的记录与打印。

(2)通过本次综合实验,更进一步的了解和掌握Java语言。

1.2问题描述

随着社会的发展,人们的生活节奏不断加快。

为了节约宝贵的时间,快递业务应运而生。

在快递过程中,需要填写大量的表单。

如果使用计算机来辅助填写及保存相应的记录,则能大大提高快递的效率。

因此,需要开发一个快递打印系统。

该系统应该支持快速录入关键信息,例如发件人和收件人的姓名、电话和地址等,快递物品的信息等。

并将其保存在数据库中以便以后查看。

1.3设计要求和功能描述

通过以上对快递系统的了解,要求其具备如下功能:

(1)具有安全可靠的登陆系统。

(2)能够添加快递单信息。

(3)可以修改快递单信息。

(4)可以打印快递单信息。

(5)进入系统后,可以通过“添加用户”功能添加新的用户信息。

(6)能修改密码,提高系统的安全性。

 

二总体设计

2.1系统目标

通过对系统进行深入的分析得知,本系统需要实现以下目标:

(1)操作简单方便,界面整洁大方。

(2)保证系统的安全性。

(3)方便添加和修改快递信息。

(4)完成快递单的打印功能。

(5)支持用户添加和密码修改操作。

2.2构建开发环境

操作系统:

Windows7旗舰版

JDK版本:

jdk-7u3-windows-i586

IDE版本:

IndigoServiceRelease2

开发语言:

Java

后台数据库:

SQLServer2005

分辨率:

最佳效果1024×768像素

2.3系统功能结构

在需求分析的基础上,确定了该系统需要实现的功能。

根据功能设计出该系统的功能结构图,如下图所示。

 

三数据库设计

3.1数据库概要说明

本系统采用SQLServer2005作为后台数据库。

根据需求分析和功能结构图,为整个系统设计了两个数据表,分别用于存储快递单信息和用户信息。

根据这两个表的存储信息和功能,分别设计对应的E-R图和数据表。

3.2数据库E-R图

快递单信息表tb_receiveSendMessage的E-R图,如左图所示。

用户信息表tb_user的E-R图,如右图所示。

 

3.3数据库结构

 

四公共类设计

(1)公共类DAO,用于加载数据库驱动及建立数据库连接。

具体设计如下:

packagecom.zzk.dao;

importjava.sql.Connection;

importjava.sql.DriverManager;

importjavax.swing.JOptionPane;

publicclassDAO{

privatestaticDAOdao=newDAO();//声明DAO类的静态实例

/**

*构造方法,加载数据库驱动

*/

publicDAO(){

try{

Class.forName("net.sourceforge.jtds.jdbc.Driver");//加载数据库驱动

}catch(ClassNotFoundExceptione){

JOptionPane.showMessageDialog(null,"数据库驱动加载失败,请将JTDS驱动配置到构建路径中。

\n"+e.getMessage());

}

}

/**

*获得数据库连接的方法

*

*@returnConnection

*/

publicstaticConnectiongetConn(){

try{

Connectionconn=null;//定义数据库连接

Stringurl="jdbc:

jtds:

sqlserver:

//localhost:

1433/db_ExpressPrint";//数据库db_Express的URL

Stringusername="sa";//数据库的用户名

Stringpassword="";//数据库密码

conn=DriverManager.getConnection(url,username,password);//建立连接

returnconn;//返回连接

}catch(Exceptione){

JOptionPane.showMessageDialog(null,"数据库连接失败。

\n请检查数据库用户名和密码是否正确。

"+e.getMessage());

returnnull;

}

}

}

(2)公共类SaveUserStateTool,用于保存登录用户的用户名和密码。

该类主要用于修改用户的密码。

具体实现如下:

packagecom.zzk.tool;

publicclassSaveUserStateTool{

privatestaticStringusername=null;

privatestaticStringpassword=null;

publicstaticvoidsetUsername(Stringusername){

SaveUserStateTool.username=username;

}

publicstaticStringgetUsername(){

returnusername;

}

publicstaticvoidsetPassword(Stringpassword){

SaveUserStateTool.password=password;

}

publicstaticStringgetPassword(){

returnpassword;

}

}

 

五程序主要系统开发

1.系统登录系统设计

(1)用于封装用户输入的登录信息的User设计:

(2)用于封装用户名和密码进行验证的UserDao类设计:

2.系统主界面系统设计

3.添加快递信息系统设计

4.修改快递信息系统设计

5.打印快递单与打印设置系统设计

6.添加用户窗体系统设计

7.修改用户密码窗体系统设计

 

六调试与测试实验结果

(附注:

用户使用说明及实验结果如下:

(1)程序说明

本程序使用SQLServer2005数据库开发,导入项目以后需要再对数据库进行配置,配置完数据库运行项目启动文件src/com/zzk/frame/LoginFrame.java就可以运行程序了。

(2)操作流程

(1)启动程序以后,显示蓝宇快递打印系统登录界面,如图1所示:

图1登录界面

(2)输入用户、与密码之后,进入主界面,如图2所示,系统默认用户名mr,密码mrsoft。

(3)进入主界面可以对快递单进行各种操作,如图3所示:

七实验总结

通过本次综合实验,我进一步了解和掌握了Java中类的概念和定义,继承和接口的概念和语法。

通过实验,我也进一步了解和掌握了Java中GUI的实现和用法以及数据库等基本操作。

当然,在实验的过程中,也遇到了很多问题,但在老师和同学的帮助和指导下终于解决了。

对于本次的打印系统综合实验,不仅使我认识到了自己在Java语言学习中的不足,而且增进了我对Java语言学习和编程的兴趣和能力。

也为后续Java的学习打下了一个良好的基础。

 

参考文献:

(1)《Java应用开发与实践》--刘乃琦苏畅主编。

(2)《Java从初学到精通》--辛立伟张帆编著

附录(源代码如下:

package快递打印系统;

importjava.awt.*;

importjavax.swing.*;

importjavax.swing.SwingUtilities;

importjavax.swing.WindowConstants;

importjavax.swing.ImageIcon;

import.URL;

importjava.awt.FlowLayout;

importjava.awt.print.PageFormat;

importjava.awt.print.Printable;

importjava.awt.print.PrinterJob;

importjava.util.Vector;

importjava.awt.Graphics;

importjava.util.Arrays;

importjava.sql.*;

importjava.sql.SQLException;

importjavax.swing.JOptionPane;

importjava.sql.DriverManager;

//////////////////////////////////////

 

classUser{

privateStringname=null;

privateStringpwd=null;

privateStringokPwd=null;

publicStringgetName(){

returnname;

}

publicvoidsetName(Stringname){

this.name=name;

}

publicStringgetPwd(){

returnpwd;

}

publicvoidsetPwd(Stringpwd){

this.pwd=pwd;

}

publicvoidsetOkPwd(StringokPwd){

this.okPwd=okPwd;

}

publicStringgetOkPwd(){

returnokPwd;

}

}

 

classExpressMessage{

privateintid=0;

privateStringsendName=null;

privateStringsendTelephone=null;

privateStringsendCompary=null;

privateStringsendAddress=null;

privateStringsendPostcode=null;

privateStringreceiveName=null;

privateStringreceiveTelephone=null;

privateStringreceiveCompary=null;

privateStringreceiveAddress=null;

privateStringreceivePostcode=null;

privateStringControlPosition=null;//快递单上添加信息的组件位置(坐标)

privateStringexpressSize=null;//快递单的尺寸(大小)

publicintgetId(){

returnid;

}

publicvoidsetId(intid){

this.id=id;

}

publicStringgetSendName(){

returnsendName;

}

publicvoidsetSendName(StringsendName){

this.sendName=sendName;

}

publicStringgetSendTelephone(){

returnsendTelephone;

}

publicvoidsetSendTelephone(StringsendTelephone){

this.sendTelephone=sendTelephone;

}

publicStringgetSendCompary(){

returnsendCompary;

}

publicvoidsetSendCompary(StringsendCompary){

this.sendCompary=sendCompary;

}

publicStringgetSendAddress(){

returnsendAddress;

}

publicvoidsetSendAddress(StringsendAddress){

this.sendAddress=sendAddress;

}

publicStringgetSendPostcode(){

returnsendPostcode;

}

publicvoidsetSendPostcode(StringsendPostcode){

this.sendPostcode=sendPostcode;

}

publicStringgetReceiveName(){

returnreceiveName;

}

publicvoidsetReceiveName(StringreceiveName){

this.receiveName=receiveName;

}

publicStringgetReceiveTelephone(){

returnreceiveTelephone;

}

publicvoidsetReceiveTelephone(StringrecieveTelephone){

this.receiveTelephone=recieveTelephone;

}

publicStringgetReceiveCompary(){

returnreceiveCompary;

}

publicvoidsetReceiveCompary(StringrecieveCompary){

this.receiveCompary=recieveCompary;

}

publicStringgetReceiveAddress(){

returnreceiveAddress;

}

publicvoidsetReceiveAddress(StringreceiveAddress){

this.receiveAddress=receiveAddress;

}

publicStringgetReceivePostcode(){

returnreceivePostcode;

}

publicvoidsetReceivePostcode(StringreceivePostcode){

this.receivePostcode=receivePostcode;

}

publicStringgetControlPosition(){

returnControlPosition;

}

publicvoidsetControlPosition(StringcontrolPosition){

ControlPosition=controlPosition;

}

publicStringgetExpressSize(){

returnexpressSize;

}

publicvoidsetExpressSize(StringexpressSize){

this.expressSize=expressSize;

}

}

classExpressMessageDao{

publicstaticvoidinsertExpress(ExpressMessagem){

if(m.getSendName()==null||m.getSendName().trim().equals("")){

JOptionPane.showMessageDialog(null,"寄件人信息必须填写。

");

return;

}

if(m.getSendTelephone()==null||m.getSendTelephone().trim().equals("")){

JOptionPane.showMessageDialog(null,"寄件人信息必须填写。

");

return;

}

if(m.getSendCompary()==null||m.getSendCompary().trim().equals("")){

JOptionPane.showMessageDialog(null,"寄件人信息必须填写。

");

return;

}

if(m.getSendAddress()==null||m.getSendAddress().trim().equals("||")){

JOptionPane.showMessageDialog(null,"寄件人信息必须填写。

");

return;

}

if(m.getSendPostcode()==null||m.getSendPostcode().trim().equals("")){

JOptionPane.showMessageDialog(null,"寄件人信息必须填写。

");

return;

}

if(m.getReceiveName()==null||m.getReceiveName().trim().equals("")){

JOptionPane.showMessageDialog(null,"收件人信息必须填写。

");

return;

}

if(m.getReceiveTelephone()==null||m.getReceiveTelephone().trim().equals("")){

JOptionPane.showMessageDialog(null,"收件人信息必须填写。

");

return;

}

if(m.getReceiveCompary()==null||m.getReceiveCompary().trim().equals("")){

JOptionPane.showMessageDialog(null,"收件人信息必须填写。

");

return;

}

if(m.getReceiveAddress()==null||m.getReceiveAddress().trim().equals("||")){

JOptionPane.showMessageDialog(null,"收件人信息必须填写。

");

return;

}

if(m.getReceivePostcode()==null||m.getReceivePostcode().trim().equals("")){

JOptionPane.showMessageDialog(null,"收件人信息必须填写。

");

return;

}

Connectionconn=null;//声明数据库连接

//声明PreparedStatement对象

PreparedStatementps=null;

try{

conn=DAO.getConn();//获得数据库连接

//创建PreparedStatement对象,并传递SQL语句

ps=conn

.prepareStatement("insertintotb_receiveSendMessage(sendName,sendTelephone,sendCompary,sendAddress,sendPostcode,receiveName,recieveTelephone,recieveCompary,receiveAddress,receivePostcode,ControlPosition,expressSize)values(?

?

?

?

?

?

?

?

?

?

?

?

)");

ps.setString(1,m.getSendName());//为参数赋值

ps.setString(2,m.getSendTelephone());

ps.setString(3,m.getSendCompary());

ps.setString(4,m.getSendAddress());

ps.setString(5,m.getSendPostcode());

ps.setString(6,m.getReceiveName());//为参数赋值

ps.setString(7,m.getReceiveTelephone());

ps.setString(8,m.getReceiveCompary());

ps.setString(9,m.getReceiveAddress());

ps.setString(10,m.getReceivePostcode());

ps.setString(11,m.getControlPosition());//为参数赋值

ps.setString(12,m.getExpressSize());

intflag=ps.executeUpdate();

if(flag>0){

JOptionPane.showMessageDialog(null,"添加成功。

");

}else{

JOptionPane.showMessageDialog(null,"添加失败。

");

}

}catch(Exceptionex){

JOpti

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1