实验项目:实验室设备管理系统
一、 项目管理:
阶段 时间及实验 任务 参与人员 产生文档
项目管理
实验一
确定课题,组织组员,合理
分工。
分工明细及项目进
程表
需求分析
实验一
确定软件的功能和需求、性
能需求和运行环境约束,编
制软件需求规格说明、软件
系统的确认测试准则
需求规格说明书
确认测试准则
概要设计
验一
建立软件系统的总体结构和
模块间的关系,定义各功能
模块的接口,涉及全局数据
库,规定涉及约束,制定组
装测试计划。
概要设计说明书
组装测试计划
数据库设计
实验二
根据概要设计对本软件所必
须的数据库进行分析及设计
数据库设计说明书
详细设计
实验二
对概要设计产生的功能模块
逐步细化,形成若干个可编
程的程序模块
模块测试方案
编码
实验三
根据详细设计文档将详细设
计转化为所要求的编程语言
或数据库语言的程序,并对
这些程序进行调试和程序单
元测试,验证程序模块与详
细设计文档的一致性
源程序清单
测
试
单元测试
实验三
采用白盒测试技术进行如下
测试:
1. 模块接口测试;
2. 模块局部数据结构测试;
3. 模块边界条件测试;
4. 模块中所有独立执行通
路测试;
5. 模块的各条错误处理通
路测试。
单元测试报告
综合测试
实验三
发现与接口有关的各种错误 综合测试报告
确认测试
实验三
检查软件是否满足软件需求
说明书中的确认标准
确认测试报告
项目实施
实验四
完善程序流图
书写软件使用说明书和用户
手册
项目开发总结报告
最终用户手册
二、软件需求分析
1 软件系统需求描述:
实验室设备管理系统是利用 Eclipse 作为开发工具、SQL Server2000 作为数
据库的系统。要求实现如下功能:
②所有工作由专门人员负责完成,其他人不得任意使用;
②对于已彻底损坏的作报废处理,同时详细记录有关信息;
②对于有严重问题(故障)的要即使修理,并记录修理日期、设备名、修理厂家、修理
费、责任人等;
②对于急需但又缺少的设备需以“申请表”的形式送交上级领导请求批准购买。新设备购
入后要立即进行设备登记(包括类别、设备名、型号、规格、单价、数量、购置日期、生产
厂家、购买人等),同时更新申请表的内容;
②随时对现有设备及其修理、报废情况进行统计、查询,要求能够按类别和时间段(某
日期之前)查询。
本管理系统通过计算机对实验设备进行自动管理,设备管理员可以直接在计算机实现实
验设备的信息管理,并在一定程度上实现自动化,改善了工作运行效率和效果。
2 软件系统数据流图
1) 顶层数据流图
2) 0 层数据流图
3) 一层数据流图
身份验证1
合法信息
统计查询 维修 购买 报废
审核3
查询信息
维修设备
报废设备
批准
申请设备 批准
报废设备
新设备
设备基本
信息表
维修记录
表 申请表 新设备表
报废记录
表
4)总数据流图
3 软件系统数据字典:
1、 数据流条目
① 登陆信息
输入:设备管理员
输出:身份验证 1
描述:登陆信息=用户名+密码+登陆权限
① 查询信息
输入:合法人员对设备的查询操作
输出:设备信息表
描述:查询信息=设备名/型号/类别/购置日期
设
备
管
理
员
身份验证1
统计查询
维修
购买
报废
生成报表
审核
上
级
领
导
登陆信息
无效登陆信息
设备基本信息表
维修记录表
新设备表
申请表
报废记录表
报废设备
登陆表
查询信息
维修设备
新设备
申请信息
审核信息
审核结果
报表
批准
更新
更新
合法信息
① 维修信息
输入:所需维修设备的信息
输出:确定维修设备的记录
描述:维修信息=设备名+修理日期+修理厂家+修理费+负责人
① 新设备
输入:购买设备的信息
输出:确定购买的新设备的记录
描述:新设备=类别+设备名+型号+规格+单价+数量等
① 报废设备
输入:所需报废的设备的信息
输出:报废的设备记录
描述:报废设备=类别+设备名+型号等
① 审核信息
输入:审核 3
输出:上级领导
描述:审核信息=报废设备信息/新设备购买记录
2、 加工条目
身份验证 1,统计查询 ,维修 ,购买 ,报废 ,生产报表 ,审核
3、 文件条目
① 登陆表
输入:身份验证 1
输出:身份验证 1
数据结构:用户名+密码+登陆权限
① 设备基本信息表
输入:统计查询
数据结构:类别+设备名+型号+规格等
① 维修记录表
输入:统计查询 ,维修
输出:统计查询
数据结构:设备名+修理日期+修理厂家+修理费+责任人等
① 新设备表
输入:统计查询 ,购买
输出:统计查询
数据结构:类别+设备名+型号+规格+单价+数量+生产厂家+购买人等
① 报废记录表
输入:报废 ,统计查询 ,生产报表
输出:统计查询 ,生产报表
数据结构:类别+设备名+型号等
① 申请表
输入:统计查询 ,生产报表
输出:统计查询 ,生产报表 ,购买
数据结构:设备名+型号+规格+数量+负责人
三:软件设计
1 实验室设备管理系统模块结构图
2 界面设计
实验室设备管理系统
系统功能操作 设备管理员操作 上级领导操作
用
户
登
陆
管
理
系
统
维
护
管
理
设
备
查
询
管
理
设
备
维
修
管
理
设
备
购
买
管
理
设
备
报
废
管
理
审
核
管
理
3 实验室设备管理系统数据设计
4 管理系统其中的 3 个模块的详细设计
① 上级领导操作模块
设备管理员
用户名 密码 登陆权限
管理
设备
设备名 设备号 类型
审核 上级领导
用户名 密码
②设备管理员操作模块
进入操作界面
开始
查询审核信息
等待审核?
审核操作
退出
Y
N
开始
操作界面
操作要求?
选择操作类型
设备操作管理
退出
Y
N
① 统功能操作模块
5 数据库设计
① 登陆表
列名 数据类型 长度 允许空
用户名 varchar 50 not null
密码 varchar 50 not null
登陆权限 char 10 not null
① 设备基本信息表
列名 数据类型 长度 允许空
设备型号 varchar 10 not null
设备名 varchar 20 not null
规格 varchar 10 not null
单价 float 8 null
购买日期 datetime 8 null
生产厂家 varchar 20 null
购买人 varchar 10 null
数量 Int 4 null
① 维修记录表
列名 数据类型 长度 允许空列名
用户登陆
开始
合法性检查
有效登陆信息?
身份验证
操作界面
结束
N
Y
设备型号 varchar 10 not null
设备名 varchar 20 not null
维修日期 datetime 8 null
维修厂家 varchar 30 null
维修费用 float 8 null
责任人 varchar 10 null
① 报废记录表
列名 数据类型 长度 允许空
设备型号 varchar 10 not null
设备名 varchar 20 not null
报废日期 datetime 8 null
责任人 varchar 10 null
① 申请表
列名 数据类型 长度 允许空
设备名 varchar 10 not null
日期 Datatime 8 not null
规格 varchar 10 not null
数量 int 4 null
申请人 Varchar 10 Null
四、编码与单元测试
1、各模块示意图
2、用户登录界面:
package shebeiguanli;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
/**
* <p>Title:实验室设备管理系统登录界面 </p>
* @author gengdexin
* @version
*/
public class Log extends JFrame {
/*
* 构建显示对象
*/
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JPasswordField password = new JPasswordField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel4 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel3 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
public Log() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(new Log_password_actionAdapter(this));
(xYLayout1);
(new Dimension(500, 400));
("实验室设备管理系统");
(new ("SansSerif", 0, 25));
();
("欢迎进入实验室设备管理系统");
(new ("SansSerif", 0, 20));
("姓名");
("");
(new ("SansSerif", 0, 20));
("密码");
(new ("SansSerif", 0, 20));
("开发人员:耿德新 蔺明亮 毛冬冬");
(new ("SansSerif", 0, 20));
("李章华 吕文强 顾海驹");
(new ("SansSerif", 0, 15));
();
("交流:gengdxin@");
(jLabel1, new XYConstraints(80, 10, 350, 34));
(jLabel2, new XYConstraints(92, 142, -1, -1));
(jTextField1, new XYConstraints(130, 145, 91, 26));
(jLabel3, new XYConstraints(222, 144, -1, -1));
(password, new XYConstraints(263, 144, 105, 28));
(jLabel4, new XYConstraints(50, 250, -1, -1));
(jLabel5, new XYConstraints(150, 280, -1, -1));
(jLabel6, new XYConstraints(100, 340, -1, -1));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void password_actionPerformed(ActionEvent e) {
try {
Frame1 Frame= new Frame1();
();
validID();
}
catch (Exception ew) {
(());
}
(false);
}
//连接sql
void validID() {
try {
String str1, str2;
str1 = ();
str2 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
//执行动态的sql语句
PreparedStatement pstmt = (
//依据读者的名字查询读者的信息的sql语句
"use shebeiguanli select * from 登录 where username=?");
//将读者的名字添加到具体的sql语句中
(1, str1);
//使用ResultSet中的方法executeQuery()来完成sql语句的执行
ResultSet res = ();
//使用getString()来获取sql查询的结果
if ((!()) || ("password") == null) {
(this, "查无此人", "错误",
_MESSAGE);
}else {
// if ( !(2).equals(str2)) {
if ( !(2).equals(str2)) {
(this, "密码错误", "错误",
_MESSAGE);
}else {
("正确");
do{
((1)+":" + (2));
}while (());
loader();
}
}
();
();
}
catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void loader() {
try {
Frame9 Frame= new Frame9();
();
}
catch (Exception ew) {
(());
}
}
}
class Log_password_actionAdapter implements {
Log adaptee;
Log_password_actionAdapter(Log adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
3、主界面:
package shebeiguanli;
import .*;
import .*;
import .*;
import .*;
//系统主界面
public class Frame9 extends JFrame {
JPanel contentPane;
JMenuBar jMenuBar1 = new JMenuBar();
JMenu 设备查询 = new JMenu();
JMenuItem 设备信息 = new JMenuItem();
JMenu 设备申请 = new JMenu();
JMenuItem 申请登记 = new JMenuItem();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JMenu jMenu2 = new JMenu();
JMenuItem jMenuItem7 = new JMenuItem();
JMenu jMenu3 = new JMenu();
JMenuItem jMenuItem8 = new JMenuItem();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem3 = new JMenuItem();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JMenu jMenu5 = new JMenu();
JMenuItem jMenuItem2 = new JMenuItem();
public Frame9() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(600, 500));
("实验室管理系统");
设备查询.setFont(new ("SansSerif", 0, 20));
设备查询.setText("设备查询");
设备信息.setFont(new ("SansSerif", 0, 20));
设备信息.setText("设备信息查询");
设备信息.addActionListener(new Frame9_设备信息_ActionAdapter(this));
设备申请.setFont(new ("SansSerif", 0, 20));
设备申请.setText("设备申请");
设备申请.addActionListener(new Frame9_设备申请_actionAdapter(this));
申请登记.setFont(new ("SansSerif", 0, 20));
申请登记.setText("申请登记");
申请登记.addActionListener(new Frame9_申请登记_ActionAdapter(this));
(new ("SansSerif", 0, 40));
(new Color(210, 0, 0));
();
("实验室管理系统");
(new ("Dialog", 0, 11));
();
(new ("SansSerif", 0, 20));
(false);
("维修记录");
(new ("SansSerif", 0, 20));
("维修记录登记");
(new Frame9_jMenuItem7_actionAdapter(this));
(new ("SansSerif", 0, 20));
("报废记录");
(new ("SansSerif", 0, 20));
("设备报废登记");
(new Frame9_jMenuItem8_actionAdapter(this));
设备查询.addSeparator();
(new ("SansSerif", 0, 20));
("维修记录查询");
(new Frame9_jMenuItem1_actionAdapter(this));
(new ("SansSerif", 0, 20));
("设备报废查询");
(new Frame9_jMenuItem3_actionAdapter(this));
(new ("SansSerif", 0, 40));
();
("欢迎进入");
(new ("SansSerif", 0, 40));
();
("实验室设备管理系统");
(new ("SansSerif", 0, 15));
();
("交流:gengdxin@");
(new ("SansSerif", 0, 20));
("退出系统");
(new ("SansSerif", 0, 20));
("退出");
(new Frame9_jMenuItem2_actionAdapter(this));
(new Frame9_jMenuItem2_itemAdapter(this));
设备查询.add(设备信息);
设备查询.addSeparator();
设备申请.addSeparator();
设备申请.add(申请登记);
设备申请.addSeparator();
(设备查询);
(设备申请);
(jMenu2);
(jMenu3);
(jMenu5);
();
(jMenuItem7);
();
(jMenuItem1);
();
();
(jMenuItem8);
();
(jMenuItem3);
();
(jLabel1, new XYConstraints(175, 1, -1, -1));
(jLabel3, new XYConstraints(150, 200, -1, -1));
(jLabel2, new XYConstraints(50, 100, 163, 45));
(jLabel4, new XYConstraints(180, 350, -1,-1));
();
(jMenuItem2);
();
(jMenuBar1);
}
public void 设备信息_actionPerformed(ActionEvent e) {
try {
Frame2 Frame= new Frame2();
();
}
catch (Exception ew) {
(());
}
}
public void 申请登记_actionPerformed(ActionEvent e) {
try {
Frame7 Frame= new Frame7();
();
}
catch (Exception ew) {
(());
}
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
设备信息_actionPerformed(null);
}
}
void shebei_actionPerformed(ActionEvent e) {
try {
}
catch (Exception ew) {
(());
}
}
void jMenuItem1_actionPerformed(ActionEvent e) { try {
Frame4 Frame= new Frame4();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem3_actionPerformed(ActionEvent e) {
try {
Frame6 Frame= new Frame6();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem4_actionPerformed(ActionEvent e) {
try {
Frame3 Frame= new Frame3();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem5_actionPerformed(ActionEvent e) {
try {
Frame6 Frame= new Frame6();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem6_actionPerformed(ActionEvent e) {
try {
retur Frame= new retur();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem7_actionPerformed(ActionEvent e) {
try {
Frame3 Frame= new Frame3();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem8_actionPerformed(ActionEvent e) {
try {
Frame5 Frame= new Frame5();
();
}
catch (Exception ew) {
(());
}
}
void jMenuItem2_itemStateChanged(ItemEvent e) {
(0);
}
void jMenuItem2_actionPerformed(ActionEvent e) {
(0);
}
void 设备申请_actionPerformed(ActionEvent e) {
}
}
class Frame9_设备信息_ActionAdapter implements ActionListener {
Frame9 adaptee;
Frame9_设备信息_ActionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.设备信息_actionPerformed(e);
}
}
class Frame9_申请登记_ActionAdapter implements ActionListener {
Frame9 adaptee;
Frame9_申请登记_ActionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.申请登记_actionPerformed(e);
}
}
class Frame9_jMenuItem5_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem5_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_jMenuItem7_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem7_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_jMenuItem8_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem8_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_jMenuItem1_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem1_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_jMenuItem3_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem3_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_jMenuItem2_itemAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem2_itemAdapter(Frame9 adaptee) {
= adaptee;
}
public void itemStateChanged(ItemEvent e) {
_itemStateChanged(e);
}
}
class Frame9_jMenuItem2_actionAdapter implements {
Frame9 adaptee;
Frame9_jMenuItem2_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
class Frame9_设备申请_actionAdapter implements {
Frame9 adaptee;
Frame9_设备申请_actionAdapter(Frame9 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.设备申请_actionPerformed(e);
}
}
4、设备查询:
package shebeiguanli;
/*
* <p>Title实验室设备管理系统查询页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame2 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField2 = new JTextField();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JLabel jLabel5 = new JLabel();
JTextField jTextField3 = new JTextField();
public Frame2() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(600, 500));
("实验室设备管理系统");
(new Frame2_this_hierarchyBoundsAdapter(this));
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
();
(new ("SansSerif", 0, 30));
("设备查询");
// (new ("SansSerif", 0, 20));
(new ("SansSerif", 0, 20));
("设备名称");
("");
(true);
(new ("SansSerif", 0, 20));
("设备型号");
("");
(new Frame2_jTextField2_actionAdapter(this));
(xYLayout2);
(new ("SansSerif", 0, 25));
();
("该设备详细信息");
("");
(jLabel1, new XYConstraints(200, 0, 300,50));
(jLabel2, new XYConstraints(200, 47, 231, 58));
(jLabel3, new XYConstraints(47, 102, 101, 42));
(jTextField1, new XYConstraints(128, 108, 112, 34));
(jTextField2, new XYConstraints(361, 107, 109, 36));
(jPanel1, new XYConstraints(75, 166, 453, 277));
(jScrollPane1, new XYConstraints(14, 8, 433, 221));
().add(jTextField3, null);
(jLabel5, new XYConstraints(112, 240, -1, -1));
(jLabel4, new XYConstraints(278, 111, -1, -1));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void Select() {
try {
String str1, str2;
str1 = ();
str2 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli select * from 设备基本信息 where 设备型号=? and 设备名=? ");
(2, str1);
(1, str2);
ResultSet res = ();
String id;
String name;
String guige,danjia,day,changjia,peo,num;
String outputarea=" 设备型号 " +" 设备名称 "+" 规格 "+" 单价 "+"
购买日期 "+" 生产厂家 "+" 数量 "+" 责任人 "+'\n';
if(()){
do{
id = (1);
name = (2);
guige = (3);
danjia = (4);
day=(5);
changjia = (6);
peo=(7);
num=(8);
outputarea+=" "+id+" "+name+" "+guige+" "+danjia+" "+day+"
"+changjia+" "+peo+" "+num+" "+"\n";
(outputarea);
}
while(());
}
else{
("不存在");
}
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void this_ancestorMoved(HierarchyEvent e) {
}
void jTextField2_actionPerformed(ActionEvent e) {
Select();
}
}
class Frame2_this_hierarchyBoundsAdapter extends {
Frame2 adaptee;
Frame2_this_hierarchyBoundsAdapter(Frame2 adaptee) {
= adaptee;
}
public void ancestorMoved(HierarchyEvent e) {
_ancestorMoved(e);
}
}
class Frame2_jTextField2_actionAdapter implements {
Frame2 adaptee;
Frame2_jTextField2_actionAdapter(Frame2 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
5、维修记录:
package shebeiguanli;
/*
* <p>title实验室设备管理系统维修记录页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame3 extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JTextField jTextField6 = new JTextField();
JButton jButton1 = new JButton();
public Frame3() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(500,500));
("实验室设备管理系统");
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
(new ("SansSerif", 0, 30));
(true);
("维修记录");
(new ("SansSerif", 0, 12));
("设备型号");
(new ("SansSerif", 0, 12));
("设备名");
(new ("SansSerif", 0, 12));
("维修日期");
(new ("SansSerif", 0, 12));
("维修厂家");
(new ("SansSerif", 0, 12));
("维修费用");
(new ("SansSerif", 0, 12));
("责任人");
("");
("");
("");
("");
("");
("");
(new ("SansSerif", 0, 25));
("提交");
(jLabel1, new XYConstraints(120, 0, 250, 37));
(jLabel2, new XYConstraints(166, 27, -1, -1));
(jLabel3, new XYConstraints(94, 90, -1, -1));
(jLabel4, new XYConstraints(97, 140, -1, -1));
(jLabel6, new XYConstraints(94, 240, -1, -1));
(jTextField1, new XYConstraints(173, 80, 128, 38));
(jTextField2, new XYConstraints(173, 130, 127, 40));
(jLabel5, new XYConstraints(94, 190, -1, -1));
(jTextField3, new XYConstraints(174, 180, 126, 38));
(jTextField4, new XYConstraints(174, 230, 125, 40));
(jButton1, new XYConstraints(176, 375, 121, 43));
(jLabel7, new XYConstraints(94, 290, -1, -1));
(jLabel8, new XYConstraints(94, 340, -1, -1));
(jTextField5, new XYConstraints(174, 280, 126, 38));
(jTextField6, new XYConstraints(174, 330, 126, 38));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void jTextField1_actionPerformed(ActionEvent e) {
}
void Insert() {
try {
//定义显示的字符串
String str1;
String str2;
String str3;
String str4;
String str5;
String str6;
str1 = ();
str2 = ();
str3 = ();
str4 = ();
str5 = ();
str6 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli insert into 维修记录(设备型号,设备名,维修日期,维修厂家,维修费用,责任
人)VALUES(?,?,?,?,?,?)");
(1, str1);
(2, str2);
(3, str3);
(4, str4);
(5, str5);
(6, str6);
ResultSet res = ();
();
();
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void jButton1_actionPerformed(ActionEvent e) {
Insert();
}
}
6、维修记录查询
package shebeiguanli;
/*
* <p>Title实验室设备管理系统维修查询页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame4 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField2 = new JTextField();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JLabel jLabel5 = new JLabel();
JTextField jTextField3 = new JTextField();
public Frame4() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(600, 500));
("实验室设备管理系统");
(new Frame4_this_hierarchyBoundsAdapter(this));
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
();
(new ("SansSerif", 0, 30));
("设备维修记录查询");
(new ("SansSerif", 0, 20));
("设备名称");
("");
(true);
(new ("SansSerif", 0, 20));
("设备型号");
("");
(new Frame4_jTextField2_actionAdapter(this));
(xYLayout2);
(new ("SansSerif", 0, 25));
();
("该设备维修详细信息");
("");
(jLabel1, new XYConstraints(200, 0, 300,50));
(jLabel2, new XYConstraints(200, 47, 300, 58));
(jLabel3, new XYConstraints(47, 102, 101, 42));
(jTextField1, new XYConstraints(128, 108, 112, 34));
(jTextField2, new XYConstraints(361, 107, 109, 36));
(jPanel1, new XYConstraints(75, 166, 453, 277));
(jScrollPane1, new XYConstraints(14, 8, 433, 221));
().add(jTextField3, null);
(jLabel5, new XYConstraints(112, 240, -1, -1));
(jLabel4, new XYConstraints(278, 111, -1, -1));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void Select() {
try {
String str1, str2;
str1 = ();
str2 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli select * from 维修记录 where 设备型号=? and 设备名=? ");
(2, str1);
(1, str2);
ResultSet res = ();
String id;
String name;
String money,day,changjia,peo,num;
String outputarea=" 设备型号 " +" 设备名称 "+" 维修日期 "+" 维修费用
"+" 维修厂家 "+" 责任人 "+'\n';
if(()){
do{
id = (1);
name = (2);
money = (4);
day=(5);
changjia = (6);
peo=(7);
num=(8);
outputarea+=" "+id+" "+name+" "+money+" "+day+" "+changjia+"
"+peo+"\n";
(outputarea);
}
while(());
}
else{
("不存在");
}
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void this_ancestorMoved(HierarchyEvent e) {
}
void jTextField2_actionPerformed(ActionEvent e) {
Select();
}
}
class Frame4_this_hierarchyBoundsAdapter extends {
Frame4 adaptee;
Frame4_this_hierarchyBoundsAdapter(Frame4 adaptee) {
= adaptee;
}
public void ancestorMoved(HierarchyEvent e) {
_ancestorMoved(e);
}
}
class Frame4_jTextField2_actionAdapter implements {
Frame4 adaptee;
Frame4_jTextField2_actionAdapter(Frame4 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
7、设备报废记录与查询:
package shebeiguanli;
/*
* <p>title实验室设备管理系统报废记录页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame5 extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JButton jButton1 = new JButton();
public Frame5() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(500,500));
("实验室设备管理系统");
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
(new ("SansSerif", 0, 30));
(true);
("报废记录");
(new ("SansSerif", 0, 12));
("设备型号");
(new ("SansSerif", 0, 12));
("设备名");
(new ("SansSerif", 0, 12));
("报废日期");
(new ("SansSerif", 0, 12));
("责任人");
("");
("");
("");
("");
(new ("SansSerif", 0, 25));
("提交");
(jLabel1, new XYConstraints(120, 0, 250, 37));
(jLabel2, new XYConstraints(166, 27, -1, -1));
(jLabel3, new XYConstraints(94, 90, -1, -1));
(jLabel4, new XYConstraints(97, 140, -1, -1));
(jLabel6, new XYConstraints(94, 240, -1, -1));
(jTextField1, new XYConstraints(173, 80, 128, 38));
(jTextField2, new XYConstraints(173, 130, 127, 40));
(jLabel5, new XYConstraints(94, 190, -1, -1));
(jTextField3, new XYConstraints(174, 180, 126, 38));
(jTextField4, new XYConstraints(174, 230, 125, 40));
(jButton1, new XYConstraints(176, 375, 121, 43));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void jTextField1_actionPerformed(ActionEvent e) {
}
void Insert() {
try {
//定义显示的字符串
String str1;
String str2;
String str3;
String str4;
String str5;
String str6;
str1 = ();
str2 = ();
str3 = ();
str4 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli insert into 维修记录(设备型号,设备名,报废日期,责任人)VALUES(?,?,?,?)");
(1, str1);
(2, str2);
(3, str3);
(4, str4);
ResultSet res = ();
();
();
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void jButton1_actionPerformed(ActionEvent e) {
Insert();
}
}
package shebeiguanli;
/*
* <p>Title实验室设备管理系统报废记录查询页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame6 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField2 = new JTextField();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JLabel jLabel5 = new JLabel();
JTextField jTextField3 = new JTextField();
public Frame6() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(600, 500));
("实验室设备管理系统");
(new Frame6_this_hierarchyBoundsAdapter(this));
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
();
(new ("SansSerif", 0, 30));
("设备报废记录查询");
(new ("SansSerif", 0, 20));
("设备名称");
("");
(true);
(new ("SansSerif", 0, 20));
("设备型号");
("");
(new Frame6_jTextField2_actionAdapter(this));
(xYLayout2);
(new ("SansSerif", 0, 25));
();
("该报废设备详细信息");
("");
(jLabel1, new XYConstraints(200, 0, 300,50));
(jLabel2, new XYConstraints(200, 47, 300, 58));
(jLabel3, new XYConstraints(47, 102, 101, 42));
(jTextField1, new XYConstraints(128, 108, 112, 34));
(jTextField2, new XYConstraints(361, 107, 109, 36));
(jPanel1, new XYConstraints(75, 166, 453, 277));
(jScrollPane1, new XYConstraints(14, 8, 433, 221));
().add(jTextField3, null);
(jLabel5, new XYConstraints(112, 240, -1, -1));
(jLabel4, new XYConstraints(278, 111, -1, -1));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void Select() {
try {
String str1, str2;
str1 = ();
str2 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli select * from 报废记录 where 设备型号=? and 设备名=? ");
(2, str1);
(1, str2);
ResultSet res = ();
String id;
String name;
String guige,danjia,day,changjia,peo,num;
String outputarea=" 设备型号 " +" 设备名称 "+" 报废记录 "+" 责任人 "+'\n';
if(()){
do{
id = (1);
name = (2);
day=(5);
peo=(7);
outputarea+=" "+id+" "+name+" "+day+" "+peo+" "+"\n";
(outputarea);
}
while(());
}
else{
("不存在");
}
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void this_ancestorMoved(HierarchyEvent e) {
}
void jTextField2_actionPerformed(ActionEvent e) {
Select();
}
}
class Frame6_this_hierarchyBoundsAdapter extends {
Frame6 adaptee;
Frame6_this_hierarchyBoundsAdapter(Frame6 adaptee) {
= adaptee;
}
public void ancestorMoved(HierarchyEvent e) {
_ancestorMoved(e);
}
}
class Frame6_jTextField2_actionAdapter implements {
Frame6 adaptee;
Frame6_jTextField2_actionAdapter(Frame6 adaptee) {
= adaptee;
}
public void actionPerformed(ActionEvent e) {
_actionPerformed(e);
}
}
8、设备申请:
package shebeiguanli;
/*
* <p>title实验室设备管理系统申请记录页面<p>
* @author gengdexin
*/
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
import .*;
public class Frame7 extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JButton jButton1 = new JButton();
public Frame7() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(xYLayout1);
(new Dimension(500,500));
("实验室设备管理系统");
(new ("SansSerif", 0, 25));
();
("实验室设备管理系统");
(new ("SansSerif", 0, 30));
(true);
("设备申请记录");
(new ("SansSerif", 0, 12));
("设备名");
(new ("SansSerif", 0, 12));
("规格");
(new ("SansSerif", 0, 12));
("申请日期");
(new ("SansSerif", 0, 12));
("数量");
(new ("SansSerif", 0, 12));
("申请人");
("");
("");
("");
("");
("");
(new ("SansSerif", 0, 25));
("提交");
(jLabel1, new XYConstraints(120, 0, 250, 37));
(jLabel2, new XYConstraints(140, 27, -1, -1));
(jLabel3, new XYConstraints(94, 90, -1, -1));
(jLabel4, new XYConstraints(97, 140, -1, -1));
(jLabel6, new XYConstraints(94, 240, -1, -1));
(jTextField1, new XYConstraints(173, 80, 128, 38));
(jTextField2, new XYConstraints(173, 130, 127, 40));
(jLabel5, new XYConstraints(94, 190, -1, -1));
(jTextField3, new XYConstraints(174, 180, 126, 38));
(jTextField4, new XYConstraints(174, 230, 125, 40));
(jButton1, new XYConstraints(176, 375, 121, 43));
(jLabel7, new XYConstraints(94, 290, -1, -1));
(jTextField5, new XYConstraints(174, 280, 126, 38));
}
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
void jTextField1_actionPerformed(ActionEvent e) {
}
void Insert() {
try {
//定义显示的字符串
String str1;
String str2;
String str3;
String str4;
String str5;
String str6;
str1 = ();
str2 = ();
str3 = ();
str4 = ();
str5 = ();
Connection con = null;
String url = "jdbc:odbc:shebeiguanli";
String user = "";
String password = "";
("");
con = (url,user,password);
Statement stmt =();
PreparedStatement pstmt = (
"use shebeiguanli insert into 申请记录(设备名,规格,申请日期,数量,申请
人)VALUES(?,?,?,?,?)");
(1, str1);
(2, str2);
(3, str3);
(4, str4);
(5, str5);
ResultSet res = ();
();
();
}catch (ClassNotFoundException e) {
(());
}catch (SQLException edd) {
() ;
(());
}
}
void jButton1_actionPerformed(ActionEvent e) {
Insert();
}
}
9、退出系统:
package shebeiguanli;
import .*;
import .*;
import .*;
import .*;
/**
* <p>Title:退出系统</p>
* @author gengdexin
* @version
*/
public class retur extends JFrame {
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
//Construct the frame
public retur() {
enableEvents(_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) ();
(new ("SansSerif", 0, 20));
();
("实验室管理系统");
(xYLayout1);
(new Dimension(400, 300));
("实验室管理系统");
(jLabel1, new XYConstraints(139, 1, 126, 33));
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
(e);
if (() == _CLOSING) {
(0);
}
}
}
五:软件测试
1.设计测试用例
测试方案:
本测试方案采用黑盒法设计基本的测试方案,在黑盒法测试方案中,采用等价划分技术。
测试的模块:
② 、用户登陆模块
② 、设备查询模块
② 、报废记录查询模块
② 、维修记录更新模块
② 、维修记录查询模块
② 、购买设备申请模块
② 、退出系统模块
2.软件测试结果
用例 1
用例 2
用例 3
项目/软件 实验室设备管理系统 编制时间 2009-11-2
功能模块名 用户登陆模块 用例编号 用户登录表
功能特性 用户身份验证
测试目的 验证是否输入合法的信息,允许合法登陆,阻止非法登陆
测试数据 用户名=sa 密码=000000 登陆权限=管理员
操作步骤 操作描述 数 据 期望结果 实际结果 测试状态
1
输入用户名和密码和
登陆权限.
用户名=sa 密码=123456 登
无
显示进入后的页面。
同期望结
果。
正常
2
输入用户名和密码和
登陆权限.
用户名=sa 密码=0000000
无
密码错误!
同期望结
果。
正常
3
输入用户名和密码和
登陆权限.
用户名=hh 密码=0000000
无
查无此人
同期望结
果。
正常
项目/软件 实验室设备管理系统 编制时间 2009-11-2
功能模块名 设备查询模块 用例编号 设备记录表
功能特性 查询实验室设备情况
测试数据
设备型号=S0000001 设备名=计算机 规格=IBMR66 单价=5000 购买日期=2009-11-2
生产厂家=IBM 购买人=张 数量=1
操作步骤 操作描述 数 据 期望结果 实际结果 测试状态
1
输入设备型号,设备
名
设备型号=S0000001 设备名
=计算机
设备型号=S0000001
设备名=计算机 规格
=IBMR66 单价=5000
购买日期=2009-11-2
生产厂家=IBM 购买
人=张 数量=1
同期望结
果。
正常
2
输入设备型号,设备
名
设备名=计算机
设备型号=S1100011
无记录
同期望结
果。
正常
项目/软件 实验室设备管理系统 编制时间 2009-11-2
功能模块名 报废记录查询模块 用例编号 报废记录表
功能特性 查询实验室设备报废情况
测试数据 设备型号=S0000001 设备名=计算机 报废日期=2005-5-5 责任人=张
用例 4
六: 实验小结
㈠实验内容总结
本次实验要求我们自己动手设计完成一个实验室设备管理系统,要求能对实验室设备进
行统计查询,对设备维修、报废情况的处理记录,能够申请购买新设备拨那个更新申请表等。
本系统还要求用户登陆具有一定的权限,能执行相关的操作。当设备需要报废和购买还需要
得到上级领导的审核批准。
经过两个多星期的实验,开始先对该管理系统进行需求分析,得出本次实验管理系统需
要设备管理员以及上级领导这两个角色,画出系统的顶层数据流图配备相应的数据字典。进
入软件设计阶段,将管理系统分成三个模块:系统功能模块,设备管理员操作模块和上级领
导模块,每个模块再细分成具体的操作模块。设计系统 E-R 图建立关系数据表。软件编码
阶段设计系统功能界面,并添加相应的代码,与数据库相连接,实现系统功能。软件测试与
调试时,将要测试的数据输入到相应的功能界面,测试本系统能否正常实现相应的功能,并
及时进行相应的改进。
㈠心得体会
通过对本实验室设备管理系统的设计,使我认识到软件开发的过程实际上就是描述现实
世界的过程。而由现实世界向软件模型的转化过程是其中最核心的过程。在课程设计的过程
中我们遇到了许多问题,如在需求分析阶段不能完全正确的把握住系统的功能描述,设计数
据流图时出现了很大的问题,在与同学讨论过程中,解决了这些问题。
操作步骤 操作描述 数 据 期望结果 实际结果 测试状态
1
输入设备型号,设备
名
设备型号=S0000001 设备名
=计算机 报废日期 2009-11-2
责任人=张
设备型号=S0000001
设备名=计算机 报废
日期=2005-5-5 责任
人=张
同期望结
果。
正常
2
输入设备型号,设备
名
设备名=计算机
设备型号=S1100011
无记录
同期望结
果。
正常
项目/软件 实验室设备管理系统 编制时间 2009-11-2
功能模块名 设备申请模块 用例编号 申请表
功能特性 查询所要求购买的设备信息
测试数据 设备名=空调 规格=FS45I 数量=5 申请人=刘
操作步骤 操作描述 数 据 期望结果 实际结果 测试状态
1
输入设备名,规格,
数量,申请人
设备名=空调 规格=FS45I 数
量=5 申请人=刘
在数据库申请表中添
加记录
同期望结
果。
正常
本次实验使我得到一次难得的锻炼机会,加深了对理论知识的理解,丰富了实践经验,
让我从整体的程序开发到具体软件的设计都有了一个全面的掌握,为我即将从事的工作打下
了一个坚实的基础!该系统还有许多不尽人意的地方,用户界面设计不够美观,在真正实现
数据库时候为了读取与写入方便将类型全部设为 varchar 型等等,由于时间的仓促和能力限
制这些都有待进一步改善。但本次实验提高了我实际操作能力,从以前的理论上升到实践,
从感性认识上升到理性认识,真正做到学有所用。