资源描述
苏州科技学院
管理信息系统课程设计说明书
设计题目
药店管理系统
院 系
电子与信息工程学院
专 业
计算机科学与技术
学生姓名
徐明惠
学号
040421212
起迄日期
2008年06月31日
~
2008年07月08日
设计地点
天平学院计算中心
指导教师
班建民
职称
副教授
职称
1。设计目的
⑴巩固数据库的基本概念,结合实际的操作和设计,使学生掌握数据库系统的基本概念、原理和技术,将理论与实际相结合,应用现有的数据建模工具和数据库管理系统软件,规范、科学地完成一个小型数据库的设计与实现.
⑵巩固C#程序设计基础知识:主要包括语言基础、窗体界面设计、文本文件操作、数据库访问、数据绑定等。注意要养成良好的编码习惯:包括缩进、遵循命名规范等.
结合软件工程知识了解一个实用系统的面向对象设计方法:功能描述——系统设计——模块设计—-类设计(本例中仅窗体类)。
⑶培养学生调查研究、查阅技术文献、资料、手册以及编写技术文献的能力,把理论与实践相结合,提高其实际动手能力和创新能力。
⑷学会从用户的角度考虑界面构成,合理划分模块功能,使系统结构清晰、易于设计和维护。
2.系统描述
药店管理管理系统要求实现对药品的进、销、存(包括药品的入库、库存查询及出库)进行计算机管理。该系统主要包括以下内容:
⑴操作员身份验证
⑵进货要求更新库存表(添加新行),打印入库单(本设计仅包括入库表单,不打印),入库单表只许新增,不许修改和删除。
⑶库存要求查询功能,要求灵活地按照各字段模糊查询
⑷销售要求更新库存表(减少数量,数量为0时删除库存记录),打印出库单(本设计仅包括出库表单,不打印),出库单表只许新增,不许修改和删除。
⑸简单财务功能:(本设计不包含)
3。系统分析与设计
3.1系统总体设计
其总体结构设计如下图:
身份验证
修改密码
入库
库存
出 库
DBMS
文件
主模块
图3。1 系统总体结构
3.2模块分析与设计
⑴身份验证模块
用户名密码无误方可进入主模块。
⑵系统主模块
调用各子模块。
⑶入库子模块
提供以下五种功能:
①浏览入库单据信息;
②添加入库单据,可以由操作员录入药品信息,提供撤消编辑功能;
③保存新记录到数据库入库单表,并更新库存表;
④自动计算该药品的总金额;
⑤不许编辑已经保存到数据库的入库单信息。
⑷库存子模块
提供灵活的库存查询功能,并显示查找结果;
提供从库存界面直接出库的方便操作.
⑸出库子模块
提供灵活的出库查询功能,并显示查找结果(进行模糊查询)
⑹身份修改子模块
可以根据需要修改用户名和密码
3.3数据结构
⑴药品信息的相关数据表结构
①入库单数据表结构
列名
数据类型
长度
允许空
序号(主键)
int(标识列,自动增量1,种子1)
4
否
入库单编号
Char
20
是
来货单位
Nchar
50
是
药品名称
Nchar
50
是
类别
Nchar
10
是
规格
Nchar
10
是
单位
Nchar
10
是
数量
Int
4
是
单价
decimal
9
是
总计
decimal
9
是
付款方式
Nchar
10
是
经办人
Nchar
10
是
入库日期
Nchar
10
是
产地
Nchar
50
是
生产日期
Nchar
10
是
有效期
Nchar
10
是
②库存数据表结构
列名
数据类型
长度
允许空
序号(主键)
int(标识列,自动增量1,种子1)
4
否
来货单位
Nchar
50
是
药品名称
Nchar
50
是
类别
Nchar
10
是
规格
Nchar
10
是
单位
Nchar
10
是
产地
Nchar
50
是
入库日期
Nchar
10
是
生产日期
Nchar
10
是
数量
Int
4
是
单价
decimal
9
是
总计
decimal
9
是
有效期
Nchar
10
是
③出库单数据表结构
列名
数据类型
长度
允许空
序号(主键)
出库单编号
Char
20
否
购买单位
Nchar
50
是
药品名称
Nchar
50
是
类别
Nchar
10
是
规格
Nchar
10
是
单位
Nchar
10
是
数量
Int
4
是
单价
decimal
9
是
总计
decimal
9
是
付款方式
Nchar
10
是
经办人
Nchar
10
是
出库日期
Nchar
10
是
产地
Nchar
50
是
生产日期
Nchar
10
是
有效期
Nchar
10
是
⑵窗体类数据结构
包括六个窗体:身份验证窗体,系统主模块窗体,入库窗体,库存窗体,出库窗体,身份修改窗体。
3。4算法分析
总计=单价*数量
this.textBoxzongji.Text = (Convert.ToDecimal(this.textBoxdanjia。Text) * Convert.ToDecimal(this.textBoxshuliang.Text)).ToString();
4。各功能模块主要界面
4。1身份验证模块
身份验证设计界面图如下:
图4.1 身份验证设计界面
4。2主模块
主模块设计界面图如下:
图4。2 主模块设计界面
4。3入库子模块
入库子模块设计界面如下图:
图4。3 入库子模块界面
4.4库存子模块
库存子模块设计界面图如下:
图4。4 库存子模块设计界面
4。5出库子模块
出库子模块设计界面图如下:
图4。5 出库子模块界面
4.6身份修改子模块
库存子模块设计界面图如下:
图4.6 身份修改模块界面
5。程序主要代码
5.1登录的代码
namespace kechengsheji
{
public partial class Form1 : Form
{
private SqlConnection conn;
private SqlCommand com;
public int i = 0;
private SqlDataReader reader
public Form1()
{
InitializeComponent();
conn = new SqlConnection(”server=(local);database=coursedesign;integrated security=true");
com = new SqlCommand("”,conn );
com.CommandText = ("select * from mima ” );
}
private void 登录button_Click(object sender, EventArgs e)
{
string name;
string pwd;
conn.Open();
reader = com.ExecuteReader();
if (reader.Read())
{
name = reader[0].ToString();
pwd = reader[1]。ToString();
if (textBoxMima.Text。Trim() == pwd.Trim() && textBoxname.Text.Trim() == name.Trim())
{
formzhuchangti myform2 = new formzhuchangti();
myform2.Show();
}
else
{
{
MessageBox。Show(”密码或用户名错误!”);
textBoxname.Text = "”;
textBoxMima.Text = ””;
i++;
this。Show();
}
if (i 〉= 3)
{
MessageBox。Show(this, "你的输入错误大于3次!关闭", ”提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
this。Close();
}
}
reader.Close();
conn.Close();
}
}
private void 取消button_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
5。2药品进销存系统的设计的代码
namespace kechengsheji
{
public partial class formzhuchangti : Form
{
private SqlConnection conn;
private SqlCommand com;
private SqlDataReader reader;
public formzhuchangti()
{
InitializeComponent();
conn = new SqlConnection(”server=(local);database=coursedesign;integrated security=true”);
com = new SqlCommand("", conn);
com.CommandText = ("select * from mima ");
}
private void button2_Click(object sender, EventArgs e)
{
Form5 myform5=new Form5() ;
myform5 .Show ();
}
private void 入库ToolStripMenuItem_Click(object sender, EventArgs e)
{
Formruku myform3 = new Formruku();
myform3.MdiParent = this;
myform3.Show();
}
private void 库存ToolStripMenuItem_Click(object sender, EventArgs e)
{
Formkucun myform4 = new Formkucun();
myform4。MdiParent = this;
myform4.Show();
}
private void 出库ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form5 myform5 = new Form5();
myform5.MdiParent = this;
myform5.Show();
}
private void form2_Load(object sender, EventArgs e)
{
conn.Open();
reader = com。ExecuteReader();
if (reader.Read())
{
this.toolStripStatusLabel2.Text = DateTime.Now.ToString();
this。toolStripStatusLabel1.Text = "操作员:" + reader[0]。ToString();
}
reader。Close();
conn。Close();
}
private void 修改用户信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
Formxiugai myform6 = new Formxiugai();
myform6.MdiParent = this;
myform6。Show();
}
}
}
5.3入库单代码的设置
namespace kechengsheji
{
public partial class Formruku : Form
{
private SqlConnection conn;
private SqlCommand com;
public Formruku()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void bindingNavigator1_RefreshItems(object sender, EventArgs e)
{
}
private void Form3_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“courseDesignDataSet。input”中。您可以根据需要移动或移除它。
this.inputTableAdapter.Fill(this.courseDesignDataSet。input);
textBoxbiaohao.DataBindings.Add(new Binding(”text", inputBindingSource, ”入库单编号”));
textBoxlaihuodanwei.DataBindings。Add(new Binding(”text", inputBindingSource, ”来货单位”));
textBoxyaopinmingcheng。DataBindings。Add(new Binding(”text”, inputBindingSource, "药品名称”));
textBoxguige。DataBindings。Add(new Binding(”text”, inputBindingSource, ”规格"));
textBoxchandi。DataBindings.Add(new Binding(”text”, inputBindingSource, "产地"));
textBoxshengchanriqi。DataBindings.Add(new Binding("text”, inputBindingSource, "生产日期”));
textBoxdanjia.DataBindings。Add(new Binding("text”, inputBindingSource, "单价"));
textBoxzongji。DataBindings。Add(new Binding("text”, inputBindingSource, "总计"));
comboBoxfukuanfangshi.DataBindings。Add(new Binding("text", inputBindingSource, ”付款方式"));
textBoxruluriqi。DataBindings.Add(new Binding(”text”, inputBindingSource, "入库日期”));
textBoxyouxiaoqi.DataBindings.Add(new Binding("text”, inputBindingSource, ”有效期”));
textBoxdanwei.DataBindings.Add(new Binding(”text”, inputBindingSource, "单位"));
textBoxshuliang。DataBindings.Add(new Binding("text”, inputBindingSource, ”数量"));
textBoxjingbanren.DataBindings。Add(new Binding("text", inputBindingSource, ”经办人"));
comboBoxleibie.DataBindings。Add(new Binding(”text", inputBindingSource, ”类别”));
this.toolStripStatusLabel2。Text = "第" + bindingNavigatorPositionItem.Text + "页”;
this。toolStripStatusLabel4。Text = "共" + bindingNavigatorCountItem。Text + ”页入库单”;
}
private void button1_Click(object sender, EventArgs e)
{
this.textBoxzongji。Text = (Convert。ToDecimal(this.textBoxdanjia。Text) * Convert。ToDecimal(this。textBoxshuliang.Text)).ToString();
}
private void bindingNavigatorMoveNextItem1_Click(object sender, EventArgs e)
{
}
private void toolStripStatusLabel1_Click(object sender, EventArgs e)
{
}
private void toolStripStatusLabel2_Click(object sender, EventArgs e)
{
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
}
private void bindingNavigatorAddNewItem1_Click(object sender, EventArgs e)
{
textBoxbiaohao.Text = "I” + DateTime。Now.ToString ();
textBoxruluriqi.Text = DateTime。Now.ToString();
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
this。inputBindingSource.EndEdit();
this。inputTableAdapter。Update(this。courseDesignDataSet.input);
conn = new SqlConnection(”server=(local);database=coursedesign;integrated security=true”);
com = new SqlCommand("”, conn);
com .CommandText ="insert into store values(”+textBoxbiaohao .Text
+",’”+textBoxlaihuodanwei 。Text+",'”+textBoxyaopinmingcheng .Text+",’"+textBoxguige .Text+”,'”+textBoxchandi 。Text+”,'”+textBoxshengchanriqi .Text+”,'”+textBoxdanjia .Text
+”,’”+textBoxzongji .Text+",’”+textBoxyouxiaoqi 。Text+",'”+textBoxruluriqi .Text+”,’”+textBoxdanwei .Text+",’”+textBoxshuliang 。Text+",'"+textBoxjingbanren 。Text+”,’"+comboBoxleibie .Text+”,’"+comboBoxfukuanfangshi 。Text+")”;
}
private void bindingNavigatorDeleteItem1_Click(object sender, EventArgs e)
{
textBoxbiaohao。Text = ”I" + DateTime.Now.ToString();
textBoxlaihuodanwei。Text = "”;
textBoxyaopinmingcheng。Text = "”;
textBoxguige。Text = "”;
textBoxchandi。Text = "";
textBoxshengchanriqi。Text = "";
textBoxdanjia。Text = ”";
textBoxzongji。Text = "";
textBoxruluriqi.Text = DateTime.Now。ToString();
textBoxyouxiaoqi。Text = ””;
textBoxdanwei。Text = ””;
textBoxshuliang.Text = "";
textBoxjingbanren.Text = "”;
comboBoxleibie.Text = ””;
comboBoxfukuanfangshi。Text = ””;
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
textBoxbiaohao.Text = "I” + DateTime。Now。ToString();
textBoxlaihuodanwei。Text = "”;
textBoxyaopinmingcheng。Text = "";
textBoxguige.Text = ”";
textBoxchandi。Text = "";
textBoxshengchanriqi。Text = "”;
textBoxdanjia.Text = "";
textBoxzongji。Text = "";
textBoxruluriqi。Text = DateTime。Now。ToString();
textBoxyouxiaoqi。Text = ”";
textBoxdanwei.Text = ””;
textBoxshuliang。Text = "";
textBoxjingbanren。Text = ”";
comboBoxleibie。Text = ””;
comboBoxfukuanfangshi.Text = "”;
}
}
}
5。4库存查询的相关代码
namespace kechengsheji
{
public partial class Formkucun : Form
{
SqlConnection conn;
SqlCommand com;
SqlDataAdapter ad;
BindingSource sour;
DataTable ta;
public Formkucun()
{
InitializeComponent();
}
private void storeBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this。Validate();
this。storeBindingSource.EndEdit();
this.storeTableAdapter.Update(this.courseDesignDataSet。store);
}
private void Form4_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“courseDesignDataSet。store”中.您可以根据需要移动或移除它。
this。storeTableAdapter.Fill(this。courseDesignDataSet。store);
}
private void storeBindingNavigator_RefreshItems(object sender, EventArgs e)
{
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
conn = new SqlConnection(”server=(local);database=coursedesign;integrated security=true");
com = new SqlCommand("select * from store where " + chaxun.SelectedItem 。ToString () + " like ’%” + zhi。Text + ”%'", conn);
ad = new SqlDataAdapter(com);
sour = new BindingSource();
ta = new DataTable();
sour。DataSource = ta;
ad。Fill(ta);
storeDataGridView。DataSource = sour;
}
private void toolStripComboBox1_Click(object sender, EventArgs e)
{
}
private void fillByToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.storeTableAdapter.FillBy(this。courseDesignDataSet。store);
}
catch (System.Exception ex)
{
System.Windows。Forms。MessageBox.Show(ex。Message);
}
}
5.5出库相关代码
namespace kechengsheji
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void outputBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.outputBindingSource.EndEdit();
this.outputTableAdapter.Update(this.courseDesignDataSet.output);
}
private void Form5_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“courseDesignDataSet。output”中。您可以根据需要移动或移除它。
this.outputTableAdapter。Fill(this.courseDesignDataS
展开阅读全文