医药销售管理系统.docx
- 文档编号:11219360
- 上传时间:2023-05-29
- 格式:DOCX
- 页数:35
- 大小:193.28KB
医药销售管理系统.docx
《医药销售管理系统.docx》由会员分享,可在线阅读,更多相关《医药销售管理系统.docx(35页珍藏版)》请在冰点文库上搜索。
医药销售管理系统
面向对象课程设计
题目医药销售系统
学院商学院
专业信息管理与信息系统
班级102
学号
学生姓名
指导教师
编写日期2013/1/5
目录
1.需求分析3
1.1功能需求(功能划分,功能描述)3
1.2性能需求(软件适应性和移植性等)3
1.3数据需求(数据之间的依赖和约束关系)3
1.4运行需求(用户界面,硬件接口,软件接口,故障处理)4
2.系统运行环境4
3.系统总体设计4
3.1登陆界面4
3.2系统功能5
4.数据库设计5
4.1概念结构设计5
4.2逻辑结构设计6
4.3物理结构设计6
4.3.1用户信息表UserInfos6
4.3.2药品信息表MedicineInfos6
4.3.3订单信息表WholesaleInfo7
5.运行结果和测试7
5.1运行界面及其效果图7
6.程序模块设计9
7.数据库代码21
7.1创建数据库:
21
7.2药品信息表:
21
7.3订单信息:
23
7.4用户表:
23
8.总结24
9.参考资料24
1.需求分析
根据课题调查和分析用户的业务活动、信息和处理的需求,以及各种数据之间的约束条件关系,形成以下的系统的需求说明。
1.1功能需求(功能划分,功能描述)
①Login.java实现注册和登录功能。
注册,将用户姓名和密码写入数据库用户表(Users),并反馈给注册用户。
登录,按照用户填写的用户名和密码,在数据库中查找相关信息如果匹配则提示登录成功,并转至药品管理系统的管理界面。
否则提示登录失败。
②ManageMain.java实现用户管理界面功能选择。
在功能选择界面中可以选择添加、删除、修改、查询和统计药品信息,并且可以选择售出药品。
③InsMedicineInfo.java实现添加药品信息功能。
在这一模块中,可以将药品信息填写保存到数据库药品信息表(MedicineInfos)中。
并返回操作状态。
④DelMedicineInfo.java实现分别按药品编号或药品名称删除指定药品信息,被删除的药品信息将从药品信息表中删除。
并返回操作状态。
⑤UpdMedicineInfo.java实现按药品编号更新药品信息功能。
被修改的药品信息在数据库中也被相应修改。
并返回操作状态。
⑥QueMedicineInfo.java实现分别按药品编号或药品进价范围查询药品信息。
数据库中符合条件的药品信息将被显示在查询界面的文本域中。
⑦StaMedicineInfo.java实现统计数据库中药品信息。
统计的药品信息将显示在统计药品信息界面,以表格的形式呈现。
⑧SalMedicineInfo.java实现出售药品功能。
填写药品编号和售出数量,并生成订单信息。
出售药品订单信息将被存入到数据库药品订单信息表(WholesaleInfo)中。
1.2性能需求(软件适应性和移植性等)
①在Windows平台测试无误。
②使用SQLServer2008数据库。
③可用于一般的药品信息管理。
1.3数据需求(数据之间的依赖和约束关系)
本药品信息管理系统共有三张表,一张为独立的用户信息表(Users),用于管理用户信息。
其余两张为药品信息表(MedicineInfo)和订单信息表(WholesaleInfo),MedicineInfo表中药品编号为主键,与WholesaleInfo表形成外键的关系,药品编号为外键,MedicineInfo为外键主表。
1.4运行需求(用户界面,硬件接口,软件接口,故障处理)
①用户界面对显卡无特别要求,一般软件显示水平即可。
②硬件接口符合一般软件需求,要求可以负载数据库处理数据信息,不至于死机。
③软件接口,用于电脑,台式或笔记本。
④需要定期对数据库进行备份,以防止数据库发生异常,如硬盘损坏或认为恶意破坏,提供备份资料,尽量减少损失。
2.系统运行环境
SQLServer2008数据库
Netbeans6.9.0
Windows平台
3.系统总体设计
3.1登陆界面
3.2系统功能
4.数据库设计
4.1概念结构设计
4.2逻辑结构设计
4.3物理结构设计
4.3.1用户信息表UserInfos
4.3.2药品信息表MedicineInfos
4.3.3订单信息表WholesaleInfo
5.运行结果和测试
5.1运行界面及其效果图
①登录和注册界面
a.注册用户
用户名和密码写入数据库
用注册的用户帐号登录,跳转到功能选择界面。
②功能选择界面
点击“增加”按钮,跳转到增加药品信息界面;
点击“删除”按钮,跳转到删除药品信息界面;
点击“修改”按钮,跳转到修改药品信息界面;
点击“查询”按钮,跳转到查询药品信息界面;
点击“统计”按钮,跳转到统计药品信息界面;
点击“出售”按钮,跳转到出售药品信息界面。
③增加药品信息界面
点击增加确定按钮,则将药品信息写入是数据库:
④修改药品信息界面
点击按药品编号修改药品信息:
⑤统计药品信息界面
6.程序模块设计
Login.java
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.sql.Connection;
importjava.sql.DriverManager;
importjava.sql.ResultSet;
importjava.sql.Statement;
importjavax.swing.*;
publicclassLoginextendsJFrame{
JLabellabelName=newJLabel("用户名:
");
JTextFieldtextName=newJTextField(20);
JLabellabelPassword=newJLabel("密码:
");
JPasswordFieldpwdPassword=newJPasswordField(20);
JButtonbtnLogin=newJButton("登录");
JButtonbtnRegist=newJButton("注册");
//------构造函数------//
publicLogin(){
super("药店管理系统--登录");
this.labelName.setSize(60,30);
this.labelName.setLocation(20,20);
this.textName.setSize(200,30);
this.textName.setLocation(100,20);
this.labelPassword.setSize(60,30);
this.labelPassword.setLocation(20,70);
this.pwdPassword.setSize(200,30);
this.pwdPassword.setLocation(100,70);
this.btnLogin.setSize(100,30);
this.btnLogin.setLocation(50,120);
this.btnRegist.setSize(100,30);
this.btnRegist.setLocation(180,120);
this.setLayout(null);
this.getContentPane().add(labelName);
this.getContentPane().add(textName);
this.getContentPane().add(labelPassword);
this.getContentPane().add(pwdPassword);
this.getContentPane().add(btnLogin);
this.getContentPane().add(btnRegist);
//------登录按钮的事件注册------//
this.btnLogin.addActionListener(newLoginButtonActionPreform(this));
//------注册按钮的事件注册,内部匿名类------//
this.btnRegist.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEvente){
StringUserName=textName.getText();
StringUserPassword=pwdPassword.getText();
try{
Stringurl="jdbc:
sqlserver:
//localhost:
1433;DatabaseName=MedicineManage";
Stringdbname="sa";
Stringdbpassword="pwd";
Stringsql="InsertIntoUsersValues('"+UserName+"','"+UserPassword+"')";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connectionconn=DriverManager.getConnection(url,dbname,dbpassword);
Statementstmt=conn.createStatement();
stmt.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"注册成功!
\n用户名:
"+UserName+"\n密码:
"+UserPassword);
}catch(Exceptionee){
ee.printStackTrace();}}});
this.setSize(330,200);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);}
//------主函数------//
publicstaticvoidmain(String[]args){
newLogin();}
publicvoidButtonLoginactionPerformed(ActionEventarg0){
StringUserName=textName.getText();
StringUserPassword=pwdPassword.getText();
try{
Stringurl="jdbc:
sqlserver:
//localhost:
1433;DatabaseName=MedicineManage";
Stringdbname="sa";
Stringdbpassword="pwd";
Stringsql="SelectuserpasswordFromUsersWhereusername='"+UserName+"'";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connectionconn=DriverManager.getConnection(url,dbname,dbpassword);
Statementstmt=conn.createStatement();
ResultSetrs=stmt.executeQuery(sql);
if(rs.next()){
Stringpwd=rs.getString("userpassword");
if(!
pwd.equals(UserPassword)){
JOptionPane.showMessageDialog(null,"登录名或密码错误。
","警告",1);
return;
}else{
ManageMainmanagemain=newManageMain();
managemain.show();
this.setVisible(false);
}
}else{
JOptionPane.showMessageDialog(null,"登录名或密码错误。
","警告",1);}
}catch(Exceptionee){
ee.printStackTrace();}}}
classLoginButtonActionPreformimplementsActionListener{
Loginl;
LoginButtonActionPreform(Loginl){
this.l=l;}
publicvoidactionPerformed(ActionEventarg0){
l.ButtonLoginactionPerformed(arg0);}}
----------------------------------------------------------------------------------------------------------------------
InsMedicineInfo.java
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.sql.*;
importjavax.swing.*;
publicclassInsMedicineInfoextendsJFrame{
privatestaticfinallongserialVersionUID=-3786410053475493055L;
JLabellabelmedNumber=newJLabel("药品编号:
");
JTextFieldtextmedNumber=newJTextField(8);
JLabellabelmedName=newJLabel("药品名称:
");
JTextFieldtextmedName=newJTextField(40);
JLabellabelmedShortNuame=newJLabel("药品通称:
");
JTextFieldtextmedShortNuame=newJTextField(10);
JLabellabelmedNors=newJLabel("药品规格:
");
JTextFieldtextmedNors=newJTextField(4);
JLabellabelmedCate=newJLabel("药品类别:
");
JTextFieldtextmedCate=newJTextField(20);
JLabellabelmedInPrice=newJLabel("药品进价:
");
JTextFieldtextmedInPrice=newJTextField(10);
JLabellabelmedWholesale=newJLabel("批发价格:
");
JTextFieldtextmedWholesale=newJTextField(10);
JLabellabelmedCount=newJLabel("药品库存:
");
JTextFieldtextmedCount=newJTextField(10);
JButtonbtnInsert=newJButton("增加");
JButtonbtnQuit=newJButton("取消");
JButtonbtnReset=newJButton("重置");
//------构造函数------//
publicInsMedicineInfo(){
super("药店管理系统--增加");
this.labelmedNumber.setSize(100,30);
this.labelmedNumber.setLocation(30,30);
this.textmedNumber.setSize(100,30);
this.textmedNumber.setLocation(140,30);
this.labelmedName.setSize(100,30);
this.labelmedName.setLocation(270,30);
this.textmedName.setSize(100,30);
this.textmedName.setLocation(380,30);
this.labelmedShortNuame.setSize(100,30);
this.labelmedShortNuame.setLocation(30,70);
this.textmedShortNuame.setSize(100,30);
this.textmedShortNuame.setLocation(140,70);
this.labelmedNors.setSize(100,30);
this.labelmedNors.setLocation(270,70);
this.textmedNors.setSize(100,30);
this.textmedNors.setLocation(380,70);
this.labelmedCate.setSize(100,30);
this.labelmedCate.setLocation(30,110);
this.textmedCate.setSize(100,30);
this.textmedCate.setLocation(140,110);
this.labelmedInPrice.setSize(100,30);
this.labelmedInPrice.setLocation(270,110);
this.textmedInPrice.setSize(100,30);
this.textmedInPrice.setLocation(380,110);
this.labelmedWholesale.setSize(100,30);
this.labelmedWholesale.setLocation(30,150);
this.textmedWholesale.setSize(100,30);
this.textmedWholesale.setLocation(140,150);
this.labelmedCount.setSize(100,30);
this.labelmedCount.setLocation(270,150);
this.textmedCount.setSize(100,30);
this.textmedCount.setLocation(380,150);
this.btnInsert.setSize(60,30);
this.btnInsert.setLocation(140,190);
this.btnReset.setSize(60,30);
this.btnReset.setLocation(210,190);
this.btnQuit.setSize(60,30);
this.btnQuit.setLocation(280,190);
this.setLayout(null);
this.getContentPane().add(labelmedNumber);
this.getContentPane().add(textmedNumber);
this.getContentPane().add(labelmedName);
this.getContentPane().add(textmedName);
this.getContentPane().add(labelmedShortNuame);
this.getContentPane().add(textmedShortNuame);
this.getContentPane().add(labelmedNors);
this.getContentPane().add(textmedNors);
this.getContentPane().add(labelmedCate);
this.getContentPane().add(textmedCate);
this.getContentPane().add(labelmedInPrice);
this.getContentPane().add(textmedInPrice);
this.getContentPane().add(labelmedWholesale);
this.getContentPane().add(textmedWholesale);
this.getContentPane().add(labelmedCount);
this.getContentPane().add(textmedCount);
this.getContentPane().add(btnInsert);
this.getContentPane().add(btnReset);
this.getContentPane().add(btnQuit);
//------增加药品信息增加按钮的注册事件------//
this.btnInsert.addActionListener(newButtonInsertActionListener(this));
//------重置添加药品的事件注册处理------//
this.btnReset.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEventarg0){
/
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 医药 销售 管理 系统