医药销售系统》java课程设计报告.docx
《医药销售系统》java课程设计报告.docx》由会员分享,可在线阅读,更多相关《医药销售系统》java课程设计报告.docx(35页珍藏版)》请在冰豆网上搜索。
医药销售系统》java课程设计报告
《面向对象程序设计》
实验报告
题目医药销售系统
学院商学院
专业信息管理与信息系统
班级***班
学号201052275***
学生姓名***
指导教师***
编写日期2013年1月5号
一、需求分析
根据课题调查和分析用户的业务活动、信息和处理的需求,以及各种数据之间的约束条件关系,形成以下的系统的需求说明。
1.1功能需求(功能划分,功能描述)
①Login.java实现注册和登录功能。
注册,将用户姓名和密码写入数据库用户表(Users),并反馈给注册用户。
登录,按照用户填写的用户名和密码,在数据库中查找相关信息,如果匹配则提示登录成功,并转至药品管理系统的管理界面。
否则提示登录失败。
②ManageMain.java实现用户管理界面功能选择。
在功能选择界面中可以选择添加、删除、修改、查询和统计药品信息,并且可以选择售出药品。
③InsMedicineInfo.java实现添加药品信息功能。
在这一模块中,可以将药品信息填写保存到数据库药品信息表(MedicineInfo)中。
并返回操作状态。
④DelMedicineInfo.java实现分别按药品编号或药品名称删除指定药品信息,被删除的药品信息将从药品信息表中删除。
并返回操作状态。
⑤UpdMedicineInfo.java实现按药品编号更新药品信息功能。
被修改的药品信息在数据库中也被相应修改。
并返回操作状态。
⑥QueMedicineInfo.java实现分别按药品编号或药品进价范围查询药品信息。
数据库中符合条件的药品信息将被显示在查询界面的文本域中。
⑦StaMedicineInfo.java实现统计数据库中药品信息。
统计的药品信息将显示在统计药品信息界面,以表格的形式呈现。
⑧SalMedicineInfo.java实现出售药品功能。
填写药品编号和售出数量,并生成订单信息。
出售药品订单信息将被存入到数据库药品订单信息表(WholesaleInfo)中。
1.2性能需求(软件适应性和移植性等)
①在Windows平台测试无误。
②使用SQLServer2008数据库。
③可用于一般的药品信息管理。
1.3数据需求(数据之间的依赖和约束关系)
本药品信息管理系统共有三张表,一张为独立的用户信息表(Users),用于管理用户信息。
其余两张为药品信息表(MedicineInfo)和订单信息表(WholesaleInfo)。
二、系统运行环境
本课题是在SQLServer2008、netbeans6.9.1环境下运行的。
三、系统总体设计
3.1登录界面
注册信息
用户登录
登录界面
3.2系统功能
药品管理系统药品管理功能
添加药品信息
删除药品信息
修改药品信息
查询药品信息
统计药品信息
出售药品功能
四、数据库设计
4.1概念结构设计
用户表
用户名<主键>
用户密码
药品信息表
药品编号<主键>
药品名称
药品通称
药品规格
药品类别
药品进价
药品批发价
药品库存量
药品订单表
订单编号<主键>
药品编号<外键>
批发药品数量
外键约束
4.2逻辑结构设计
Users
Username
Userpassword
MedicineInfo
medNumber
medName
medShortName
medNors
medCate
medInPrice
medWholesale
medCount
WholesaleInfo
wsNumber
medNumber
wsMedCount
4.3物理结构设计
4.3.1用户信息表Uses
SQL:
/*==============================================================*/
/*Table:
Users*/
/*==============================================================*/
createtableUsers(
usernamevarchar(10)notnull,
userpasswordvarchar(20)null,
constraintPK_USERSprimarykey(username)
)
go
InsertintoUsersvalues(‘aa’,’bb’);
ifexists(select1
fromsysobjects
whereid=object_id('Users')
andtype='U')
droptableUsers
go
4.3.2药品信息表MedicineInfo
SQL:
/*==============================================================*/
/*Table:
MedicineInfo*/
/*==============================================================*/
createtableMedicineInfo(
medNumbervarchar(8)notnull,
medNamevarchar(40)notnull,
medShortNamevarchar(10)null,
medNorsvarchar(4)null,
medCatevarchar(20)null,
medInPricefloatnotnull,
medWholesalePricefloatnotnull,
medCountintnotnull,
constraintPK_MEDICINEINFOprimarykey(medNumber)
)
go
insertintoMedicineInfovalues('95270001','葵花牌感冒灵颗粒','葵感','16*2','感冒药',24.7,25.8,1000);
insertintoMedicineInfovalues('95270002','双黄连口服液','双黄连液','12*1','感冒药',29.2,30.1,1000);
insertintoMedicineInfovalues('95270003','阿莫西林','莫西','1*1','消炎药',30,32.1,1000);
insertintoMedicineInfovalues('95270004','吗丁啉','吗丁啉','1*1','胃肠道药',18.2,20,498);
insertintoMedicineInfovalues('95270005','对乙酰氨基酚','扑热息痛','1*1','感冒药',24.7,25.8,698);
insertintoMedicineInfovalues('95270006','川贝枇杷膏','枇杷膏','1*1','止咳药',21,22.8,900);
ifexists(select1
fromsys.sysreferencesrjoinsys.sysobjectsoon(o.id=r.constidando.type='F')
wherer.fkeyid=object_id('WholesaleInfo')ando.name='FK_WHOLESAL_REFERENCE_MEDICINE')
altertableWholesaleInfo
dropconstraintFK_WHOLESAL_REFERENCE_MEDICINE
go
ifexists(select1
fromsysobjects
whereid=object_id('MedicineInfo')
andtype='U')
droptableMedicineInfo
go
4.3.3订单信息表WholesaleInfo
SQL:
/*==============================================================*/
/*Table:
WholeInfo*/
/*==============================================================*/
createtableWholesaleInfo(
wsNumbervarchar(8)notnull,
medNumbervarchar(8)null,
wsMedCountintnotnull,
constraintPK_WHOLESALEINFOprimarykey(wsNumber)
)
go
ifexists(select1
fromsys.sysreferencesrjoinsys.sysobjectsoon(o.id=r.constidando.type='F')
wherer.fkeyid=object_id('WholesaleInfo')ando.name='FK_WHOLESAL_REFERENCE_MEDICINE')
altertableWholesaleInfo
dropconstraintFK_WHOLESAL_REFERENCE_MEDICINE
go
ifexists(select1
fromsysobjects
whereid=object_id('WholesaleInfo')
andtype='U')
droptableWholesaleInfo
go
altertableWholesaleInfo
addconstraintFK_WHOLESAL_REFERENCE_MEDICINEforeignkey(medNumber)
referencesMedicineInfo(medNumber)
go
五、程序模块设计
5.1运行界面及其效果图
1.功能选择界面
点击“增加”按钮,跳转到增加药品信息界面;
点击“删除”按钮,跳转到删除药品信息界面;
点击“修改”按钮,跳转到修改药品信息界面;
点击“查询”按钮,跳转到查询药品信息界面;
点击“统计”按钮,跳转到统计药品信息界面;
点击“出售”按钮,跳转到出售药品信息界面。
2.删除药品信息界面
按药品编号删除药拼信息:
按药品名称删除药品信息:
3.查询药品信息界面
按药品编号查询药品信息:
按药品进价范围查询药品信息:
4.出售药品信息界面
出售成功并生成订单写入到数据库药品订单信息表(WholesaleInfo)中:
5.2程序代码
ManageMain.java
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.*;
publicclassManageMainextendsJFrame{
privatestaticfinallongserialVersionUID=1L;
JLabeltitle=newJLabel("----请选择您的操作----");
JLabelinsMedicineInfo=newJLabel("增加药品信息:
");
JButtonbtInsInfo=newJButton("增加");
JLabeldelMedicineInfo=newJLabel("删除药品信息:
");
JButtonbtDelInfo=newJButton("删除");
JLabelupdMedicineInfo=newJLabel("修改药品信息:
");
JButtonbtUpdInfo=newJButton("修改");
JLabelqueMedicineInfo=newJLabel("查询药品信息:
");
JButtonbtQueInfo=newJButton("查询");
JLabelstaMedicineInfo=newJLabel("统计药品信息:
");
JButtonbtStaInfo=newJButton("统计");
JLabelsalMedicineInfo=newJLabel("出售药品管理:
");
JButtonbtSalInfo=newJButton("出售");
publicManageMain(){
super("药店管理系统--功能");
this.title.setSize(200,30);
this.title.setLocation(200,10);
this.insMedicineInfo.setSize(100,30);
this.insMedicineInfo.setLocation(80,50);
this.btInsInfo.setSize(60,30);
this.btInsInfo.setLocation(190,50);
this.delMedicineInfo.setSize(100,30);
this.delMedicineInfo.setLocation(260,50);
this.btDelInfo.setSize(60,30);
this.btDelInfo.setLocation(360,50);
this.updMedicineInfo.setSize(100,30);
this.updMedicineInfo.setLocation(80,90);
this.btUpdInfo.setSize(60,30);
this.btUpdInfo.setLocation(190,90);
this.queMedicineInfo.setSize(100,90);
this.queMedicineInfo.setLocation(260,60);
this.btQueInfo.setSize(60,30);
this.btQueInfo.setLocation(360,90);
this.staMedicineInfo.setSize(100,30);
this.staMedicineInfo.setLocation(80,130);
this.btStaInfo.setSize(60,30);
this.btStaInfo.setLocation(190,130);
this.salMedicineInfo.setSize(100,30);
this.salMedicineInfo.setLocation(260,130);
this.btSalInfo.setSize(60,30);
this.btSalInfo.setLocation(360,130);
this.setLayout(null);
this.getContentPane().add(title);
this.getContentPane().add(insMedicineInfo);
this.getContentPane().add(btInsInfo);
this.getContentPane().add(delMedicineInfo);
this.getContentPane().add(btDelInfo);
this.getContentPane().add(updMedicineInfo);
this.getContentPane().add(btUpdInfo);
this.getContentPane().add(queMedicineInfo);
this.getContentPane().add(btQueInfo);
this.getContentPane().add(staMedicineInfo);
this.getContentPane().add(btStaInfo);
this.getContentPane().add(salMedicineInfo);
this.getContentPane().add(btSalInfo);
//------添加药品信息注册事件------//
btInsInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
InsMedicineInfoinsmedicineinfo=newInsMedicineInfo();
insmedicineinfo.show();
}
});
//------删除药品信息注册事件------//
this.btDelInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
DelMedicineInfodelmedicineinfo=newDelMedicineInfo();
delmedicineinfo.show();
}
});
//------修改药品信息注册事件------//
this.btUpdInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
UpdMedicineInfoupdmedicineinfo=newUpdMedicineInfo();
updmedicineinfo.show();
}
});
//------查询药品信息注册事件------//
this.btQueInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
QueMedicineInfoquemedicineinfo=newQueMedicineInfo();
quemedicineinfo.show();
}
});
//------统计药品信息注册事件------//
this.btStaInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
StaMedicineInfostamedicineinfo=newStaMedicineInfo();
stamedicineinfo.show();
}
});
//------出售药品信息注册事件------//
this.btSalInfo.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
SalMedicineInfosalmedicineinfo=newSalMedicineInfo();
salmedicineinfo.show();
}
});
this.setSize(550,230);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
publicstaticvoidmain(Stringargs[]){
newManageMain();
}
}
DelMedicineInfo.java
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.sql.Connection;
importjava.sql.DriverManager;
importjava.sql.Statement;
importjavax.swing.*;
publicclassDelMedicineInfoextendsJFrame{
privatestaticfinallongserialVersionUID=1L;
JLabellabTitle=newJLabel("----请选择删除药品信息的方法----");
JLabellabMedNumber=newJLabel("请输入药品编号:
");
JTextFieldtxtMedNumber=newJTextField();
JButtonbtnMedNumber=newJButton("确定");
JLabellabMedName=newJLabel("请输入药品名称:
");
JTextFieldtxtMedName=newJTextField();
JButtonbtnMedName=newJButton("确定");
JButtonbtnQuit=newJButton("取消");
publicDelMedicineInfo(){
super("药店管