梅芳婷.docx
- 文档编号:5408181
- 上传时间:2023-05-08
- 格式:DOCX
- 页数:18
- 大小:359.52KB
梅芳婷.docx
《梅芳婷.docx》由会员分享,可在线阅读,更多相关《梅芳婷.docx(18页珍藏版)》请在冰点文库上搜索。
梅芳婷
企业销售管理系统课程设计报告
说明:
●参赛小组名单:
●项目介绍:
企业销售是企业经营的重要组成部分,它可以体现一个企业的经营情况和效益。
其中包括基本信息的的显示、商品销售管理、汇总统计与查询。
●小组内成员的分工:
◆罗婉君负责“基本信息查询”和“缺货信息查询“;
◆梅芳婷负责“商品销售管理”这一模块
◆石冰鑫负责”进货信息添加“和”统计查询“
◆王玉琴负责“用户登录”、“系统退出”及“数据库连接“
企业销售管理系统
一、需求分析:
1.功能分析:
随着行业竞争的日益激烈,提高销售管理的工作效率,加强企业内部以及整个供应链的各个环节的管理,调度,及资源配置变得极其重要。
企业销售是企业经营的重要组成部分,它可以体现一个企业的经营情况和效率。
所以对其系统化的管理必不可少。
2.运行环境:
1)系统开发平台:
MicrosoftVisualStudio2005
2)系统开发语言:
C#
3)系统后台数据库:
SQLServer2000
4)运行平台:
WindowsXP(SP2)
二、系统设计
1.系统功能结构
2.数据库设计
由于系统的数据较多,因此采取数据库存储数据,数据库命名为db_CompanyManage.在数据库中创建了3个数据表,用于存储不同的信息。
其中,tb_Goodsinfo为供应商品的信息,tb_SellGoods为商品销售信息,tb_Account为商品销售的统计状况表。
数据库的逻辑设计如下:
1)tb_Goodsinfo
商品的基本信息
2)tb_SellGoods
销售情况记录
3)tb_Account
汇总统计
3、系统文件夹组织结构
Properties为程序属性文件夹;引用为dll引用文件
夹,GoodMethod为公共类文件夹。
三.具体实现
1.公共类设计
getSqlConnection类主要实现与数据库的连接,在代码或其他公共类中可以调用etSqlConnection类连接数据库。
etSqlConnection的关键代码如下:
publicclassgetSqlConnection
{
stringG_Str_connection="DataSource=WWW-37C054AC617;InitialCatalog=db_CompanyManage;IntegratedSecurity=True";
SqlConnectionG_Con;
publicgetSqlConnection()
{
}
publicSqlConnectionGetCon()
{
G_Con=newSqlConnection(G_Str_connection);
G_Con.Open();
returnG_Con;
}
}
2.系统登录模块设计
1)系统登录模块主要是对进入系统的用户进行安全检查,以防止非法进入者。
是通过匹配预定用户名和密码是咸的,模块运行如图:
2)具体实现过程
系统登录窗体的名称为frmLogin.cs,通过输入UserName与PassWord,单击“ENTER”进入,当输入不正确时,会有相应的警告。
关键代码如下:
privatevoidENTER_Click(objectsender,EventArgse)
{
stringstrName=UserName.Text;
stringstrPassword=PassWord.Text;
if(strName=="XXX"&&strPassword=="511511")
{
frmMainfrm=newfrmMain();
frm.Show();
this.Hide();
}
else
{
MessageBox.Show("Error,Pleasecheckusernameorpassword");
UserName.Text="";
PassWord.Text="";
}
}
3.主窗体设计
1)当用户登录模块成功时,便进入了系统的主窗体。
主窗体的运行结果如下:
主窗体分为两个部分,一个是系统的菜单栏,其中包括商品销售的基本信息TheBaseinformationofGoods、商品销售的记录SellInformationofGoods、统计Account及系统介绍Aboutsystem;另一部分为退出系统按钮ExitSystemFromHere。
2)实现过程
主窗体的名称为frmMain.cs用户通过点击不同的菜单项连接不同的功能。
主要通过窗口的show事件和hide事件实现,具体实现代码略。
4、商品基本信息的显示模块设计
该模块分为两个部分,一是显示所有的商品的基本信息,二是添加商品的进货数量。
1)该模块的窗体名称为frmSellGoodinfo.cs.
a)ShowAllGoodsInformatoin主要是通过SQL的SELECT语句实现的,
关键代码如下:
privatevoidtoolStripLabel1_Click(objectsender,EventArgse)
{
CN.Hide();tCN.Hide();GN.Hide();tGN.Hide();Add.Hide();
SqlConnectionG_Con=G.GetCon();
DataSetdataset=newDataSet();
try
{
SqlDataAdapterDataAdapter=newSqlDataAdapter("SELECT*FROMtb_Goodsinfo",G_Con);
DataAdapter.Fill(dataset,"tb_Goodsinfo");
baseInfor.DataSource=dataset;
baseInfor.DataMember="tb_Goodsinfo";
}
catch(Exceptionex)
{
MessageBox.Show(ex.ToString());
}
finally
{
G_Con.Close();
G_Con.Dispose();
dataset.Dispose();
}
}
b)通过add按钮可以更改商品的现有进货数量,实现进货功能。
关键代码如下:
privatevoidAdd_Click(objectsender,EventArgse)
{
stringjg="0";
stringcg="0";
SqlConnectionG_Con=G.GetCon();
stringstrSQL="SELECTJhGoodsNum,CurrentGoodsNumFROMtb_GoodsinfoWHERECompName='"+tCN.Text+"'";
SqlCommandcommand=newSqlCommand();
command.Connection=G_Con;
command.CommandText=strSQL;
SqlDataReaderreader=command.ExecuteReader();
object[]row=newobject[reader.FieldCount];
while(reader.Read()==true)
{
reader.GetValues(row);
for(inti=0;i { if(reader.GetName(i)=="JhGoodsNum") jg=row[i].ToString(); if(reader.GetName(i)=="CurrentGoodsNum") cg=row[i].ToString(); } } G_Con.Close(); SqlConnectionG1_Con=G.GetCon(); SqlCommandcommand1=newSqlCommand(); command1.Connection=G1_Con; stringstrSQL1="Updatetb_Goodsinfoset"; strSQL1+="JhGoodsNum='"+(int.Parse(jg)+int.Parse(tGN.Text)).ToString(); strSQL1+="',CurrentGoodsNum="+(int.Parse(cg)+int.Parse(tGN.Text)).ToString(); strSQL1+="WHERECompName='"+tCN.Text+"'"; command1.CommandText=strSQL1; intn=command1.ExecuteNonQuery(); G1_Con.Close(); SqlConnectionG2_Con=G.GetCon(); DataSetdataset=newDataSet(); try { SqlDataAdapterDataAdapter=newSqlDataAdapter("SELECT*FROMtb_Goodsinfo",G2_Con); DataAdapter.Fill(dataset,"tb_Goodsinfo"); baseInfor.DataSource=dataset; baseInfor.DataMember="tb_Goodsinfo"; } catch(Exceptionex) { MessageBox.Show(ex.ToString()); } finally { G_Con.Close(); G_Con.Dispose(); dataset.Dispose(); } } 5.商品销售统计模块的设计 1)该模块主要是完成商品的交易过程,分两步完成: 一是计算,看当前库存是否满足销量需要,当小于时,发出警告;二是进行交易,同时更新库存商品数量。 2)该模块的窗体窗口名称为frmSellGood.cs.通过Comp和Deal按钮进行相关操作。 a)Comp的实现代码如下: privatevoidComp_Click(objectsender,EventArgse) { SellPrice.Text=""; GrossPrice.Text=""; stringCurrentGoodNum="0"; SqlConnectionG_Con=G.GetCon(); stringstrSQL="SELECTSellPrice,CurrentGoodsNumFROMtb_GoodsinfoWHERECompName='"+CompName.Text+"'"; SqlCommandcommand=null; command=newSqlCommand(); command.Connection=G_Con; command.CommandText=strSQL; SqlDataReaderreader=command.ExecuteReader(); object[]row=newobject[reader.FieldCount]; while(reader.Read()==true) { reader.GetValues(row); for(inti=0;i { if(reader.GetName(i)=="SellPrice") SellPrice.Text=row[i].ToString(); if(reader.GetName(i)=="CurrentGoodsNum") CurrentGoodNum=row[i].ToString(); } } if(int.Parse(CurrentGoodNum)<(int.Parse(SellGoodNum.Text))) { MessageBox.Show("inventoryshortage,Transactionfailure! "); SellGoodNum.Text="0"; } intnn=(int.Parse(SellPrice.Text))*(int.Parse(SellGoodNum.Text)); GrossPrice.Text=nn.ToString(); CurrentTime.Text=DateTime.Now.ToString(); G_Con.Close(); SqlConnectionG1_Con=G.GetCon(); stringcurnum=(int.Parse(CurrentGoodNum)-int.Parse(SellGoodNum.Text)).ToString(); SqlCommandcommand1=newSqlCommand(); command1.Connection=G1_Con; stringstrSQL1="Updatetb_Goodsinfoset"; strSQL1+="CurrentGoodsNum="+curnum; strSQL1+="WHERECompName='"+CompName.Text+"'"; command1.CommandText=strSQL1; intn=command1.ExecuteNonQuery(); } b)Deal的代码实现如下: privatevoidDeal_Click_1(objectsender,EventArgse) { SqlConnectionG_Con=G.GetCon(); DataSetdataset=newDataSet(); SqlCommandcommand=null; command=newSqlCommand(); command.Connection=G_Con; stringstrSQL="SELECTGoodsJhPrice,CurrentGoodsNumFROMtb_GoodsinfoWHERECompName='"+CompName.Text+"'"; command.CommandText=strSQL; SqlDataReaderreader=command.ExecuteReader(); object[]row=newobject[reader.FieldCount]; stringjp=""; while(reader.Read()==true) { reader.GetValues(row); for(inti=0;i { if(reader.GetName(i)=="GoodsJhPrice") jp=row[i].ToString(); } } intnn=int.Parse(GrossPrice.Text)-(int.Parse(jp))*(int.Parse(SellGoodNum.Text)); G_Con.Close(); SqlConnectionG1_Con=G.GetCon(); stringstrSQL1="INSERTINTOtb_SellGoodsVALUES("; strSQL1+="'"+CompName.Text; strSQL1+="','"+SellGoodNum.Text; strSQL1+="','"+CurrentTime.Text; strSQL1+="','"+SellPrice.Text; strSQL1+="','"+GrossPrice.Text; strSQL1+="',"+nn.ToString()+")"; SqlCommandcommand1=null; command1=newSqlCommand(); command1.Connection=G1_Con; command1.CommandText=strSQL1; intk=command1.ExecuteNonQuery(); if(k>0) { if(SellGoodNum.Text! ="0")MessageBox.Show("Gooddeal! "); else MessageBox.Show("Baddeal! "); } SqlDataAdapterDataAdapter=newSqlDataAdapter("SELECTCompName,SellGoodsNum,SellGoodTime,GrossPriceFROMtb_SellGoods",G_Con); DataAdapter.Fill(dataset,"SellGoods"); SellInformation.DataSource=dataset; SellInformation.DataMember=dataset.Tables[0].ToString(); G1_Con.Close(); SqlConnectionG2_Con=G.GetCon(); stringstrSQL4="SELECTSellPrice,GoodsNumFROMtb_GoodsinfoWHERECompName='"+CompName.Text+"'"; SqlCommandcommand2=null; command2=newSqlCommand(); command2.Connection=G2_Con; command2.CommandText=strSQL4; } 6.财务处理统计模块设计 1)该模块实现两个功能,一是对相关销售产品的汇总统计,另一方面是对缺货商品的查询。 功能一运行结果如下: 功能二运行结果如下: 2)该模块的窗体名称为frmAccount. 总体销售情况Account汇总实现代码如下: privatevoidaccountToolStripMenuItem_Click(objectsender,EventArgse) { SqlConnectionG_Con=G.GetCon(); DataSetdataset=newDataSet(); SqlDataAdapterDataAdapter=newSqlDataAdapter("SELECTCompName,SUM(SellGoodsNum)ASSumOfSellGoodsNum,SUM(GrossPrice)ASSumOfGrossPrice,SUM(MassOfProfit)ASSumOfMassOfProfitFROMtb_SellGoodsGROUPBYCompName",G_Con); DataAdapter.Fill(dataset,"SellGoods"); AccountData.DataSource=dataset; AccountData.DataMember=dataset.Tables[0].ToString(); } Stockinformation信息的查询实现代码如下: privatevoidstockInformationToolStripMenuItem_Click(objectsender,EventArgse) { strings="0"; SqlConnectionG_Con=G.GetCon(); DataSetdataset=newDataSet(); SqlDataAdapterDataAdapter=newSqlDataAdapter("SELECT*FROMtb_GoodsinfoWHERECurrentGoodsNum='"+s+"'",G_Con); DataAdapter.Fill(dataset,"SellGoods"); AccountData.DataSource=dataset; } 7.关于系统模块设计 窗口运行情况如下: 四、总结 1.首先,通过本次课程设计,加强对C#的语言的运用,对基本的语法有了一定的了解,对面向对象有了较深的认识。 2.在此基础上熟悉了.NET的运行环境,还锻炼了运用了数据库SQL的知识解决问题。 3.实验中暴露了不少问题。 分为以下几个方面: 1)小组的协作上分工、讨论上等上存在着许多不协调,需要加强与人合作的能力。 2)专业知识上的不足。 对数据库的连接、数据的导入、对相关的控件操作等存在严重的不熟练, 3)代码的编写上存在的不足 a.编程习惯及风格的问题 b.代码编写的不严谨,存在许多漏洞,对于异常处理比较少。 总之,在以后的编写程序或是完成某一项目时,需要注意以上问题,争取做得更好。 五.参考文献 [1]黄兴荣C#课程设计项目教程——实验指导与课程设计[M].清华大学出版社,2010.6.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 梅芳婷