仓库管理系统(汇编).doc

上传人:scccc 文档编号:13380802 上传时间:2021-12-24 格式:DOC 页数:21 大小:842.50KB
返回 下载 相关 举报
仓库管理系统(汇编).doc_第1页
第1页 / 共21页
仓库管理系统(汇编).doc_第2页
第2页 / 共21页
仓库管理系统(汇编).doc_第3页
第3页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《仓库管理系统(汇编).doc》由会员分享,可在线阅读,更多相关《仓库管理系统(汇编).doc(21页珍藏版)》请在三一文库上搜索。

1、仓库管理信息系统一、 功能模块图 3二、 登陆 3三、主界面 5四、对仓库进行管理 81库存查询 82、货物入库 93、删除产品信息 114、修改产品信息 13五、用户管理 151、添加用户 152、查看用户 163、修改用户密码 18六、总结 20、功能模块图登陆对仓库进行管理管理人员信息管理添查加看二、登陆用户知登陆密码:退出实习代码如下:namespace仓库信息管理系统1 public partial class Log in : Formpublic Log in()stri ng user name =用户名.Text.Trim();取岀账号string pw =密码.Text.T

2、rim();/取岀密码string constr = "data source=(local);" + "Initial Catalog=仓库管理信息系统;"+ "Integrated Security=SSPI;"/设置连接字符串SqlCo nn ection mycon = new SqlCo nn ecti on (co nstr); 实例化连接对象SqlComma nd mycom = myco n. CreateComma nd();创建 SQL 命令执行对象stri ng s1 = "select UserNam

3、e,UserRight from Useri nfo where UserName='" + user name +"' and UserRight='" + pw + "'"/ 编写 SQL 命令mycom.Comma ndText = s1;II执行SQL命令SqlDataAdapter myDA = new SqlDataAdapter();II实例化数据适配器myDA.SelectComma nd = mycom;II让适配器执行SELECT命令DataSet myDS = new DataSe();II

4、实例化结果数据集int n = myDA.Fill(myDS, "Userinfo"); 将结果放入数据适配器,返回元祖个数if (n 匸 0) |MessageBoxShow("欢迎使用! ");/登录成功Main main = new Main ();this.Hide();mai n.Show(); |elseMessageBoxShow("用户名或密码有错。请重新输入!");用户名.Text =""清空账号密码.Text =""II清空密码?用户名.Focus();II光标括设置在账号上

5、private void btExit_Click( object sender,EventArgs e)if側essageBox.Show("您真的要退岀本系统吗?","提示",MessageBoxButt on s.OKCa ncel, MessageBoxIcon.I nformatio n) = DialogResult.OK)Application .Exit();elsethis.btLog in.En abled = true;this.Hide();Log in logi n =new Log in ();logi n.Show(); 三

6、、主界面实现代码如下:namespace仓库信息管理系统1public partial class Main : Formprivate int childFormNumber = 0; public Mai n()Form childForm = new Form();childForm.MdiPare nt = this;childForm.Text ="窗口 " + childFormNumber+;childForm.Show();private void OpenFile(object sender,EventArgs e)OpenF ileDialog ope

7、nF ileDialog = new OpenF ileDialog();ope nFileDialog.I nitialDirectory =En viro nmen t.GetFolderPath(E nviro nmen t.SpecialFolder.Pers onal);openFileDialog.Filter ="文本文件(*txt)|*txt| 所有文件(*)|*" if (ope nFileDialog.ShowDialog( this) = DialogResult.OK)private void SaveAsToolStripMenultem Clic

8、k( object sender,EventArgs e) SaveFileDialog saveFileDialog = n ew SaveFileDialog(); saveFileDialog.I nitialDirectory =En viro nmen t.GetFolderPath(E nviro nmen t.SpecialFolder.Pers on al); saveFileDialog.Filter ="文本文件(*.txt)|*.txt| 所有文件(*)|*" if (saveFileDialog.ShowDialog( this) = DialogR

9、esult.OK) 1stri ng FileName = saveFileDialog.FileName;private void ExitToolsStripMenultem_Click( object sender,EventArgs e)this.Close();private void CascadeToolStripMenultem Click( object sender, EventArgs e)LayoutMdi( MdiLayout .Cascade);private void TileVerticalToolStripMenultem_Click( object send

10、er,EventArgs e)LayoutMdi( MdiLayout .TileVertical);private void TileHorizontalToolStripMenuItem_Click( object sender,EventArgs e)LayoutMdi( MdiLayout .TileHorizontal); private void ArrangelconsToolStripMenultem_Click( object sender, EventArgs e)private void 供货商设置 ToolStripMenultem_Click( object send

11、er. EventArgs e) | Iprivate void 库存查询 ToolStripMenultem Click( object sender, EventArgs e)库存查询btLook = new库存查询();btLook.ShowDialog();private void 货物入库 ToolStripMenultem Click( object sender, EventArgs e)修改产品信息RK= new修改产品信息();RK.ShowDialog();private void 删除产品信息 ToolStripMenuItem Click( object sender,

12、 EventArgs e) 删除SC = new删除();SC.ShowDialog();private void 修改产品信息 ToolStripMenuItem Click( object sender, EventArgs e)修改 cs XG = new 修改 cs();XG.ShowDialog();private void 添加用户 ToolStripMenultem Click( object sender, EventArgs e)添力廿U TJU = new添力廿U();TJU.ShowDialog();private void 查看用户 ToolStripMenuItem

13、Click( object sender, EventArgs e) 查看U CKU = new查看U();CKU.ShowDialog();private void 修改用户密码 ToolStripMenultem Click( object sender. EventArgs e) 修改U XGU = new修改U();XGU.ShowDialog();四、对仓库进行管理1、库存查询代码实现:private void btLook_Click( object sender, EventArgs e)if(txtLKWord.Text ="")MessageBoxShow

14、("请输入货物名称");elseSqlConnection con = new SqlConnection("Data Source=(local);Database=库管理信息系统;Integrated Security=SSPI;Uid=sa;Pwd=");SqlComma nd cmd = n ew SqlComma nd("Select GoodsID as 货物编号,GoodsName as货物名称,"+ "StoreName as 仓库名称,GoodsSpec as 货物规格,GoodsUnit as计量单位,&

15、quot;+ "GoodsNum as 货物数量,GoodsInPrice as 进货价格,GoodsOutPrice as 岀货价格,"+ "Editer as 修改人,EditDate as 修改日期"+ " from Goods info where GoodsID = GOODSID", con);SqlDataAdapter adp = new SqlDataAdapter(cmd);cmd.Parameters.AddWithValue("GOODSID" , txtLKWord.Text);DataS

16、et ds = new DataSetQ;con. Ope n();adp.Fill(ds,"仓库管理信息系统");dataGridView1.DataSource = ds.TablesO; / 检查你的 DataSet 是否有数据/*MessageBox.Show(ds.TablesO.Rows.Cou nt.ToStr in g(); con .Close();*/2、货物入库代码实现:public partial class 货物入库 :Formpublic货物入库() IIn itializeComp onen t();private void butt on 1

17、 Click( object sen der, Eve ntArgs e) if (textBoxl.Text ="") MessageBoxShow("货物编号不能为空"); elseif (textBox2.Text ="") MessageBox.Show("货物名称不能为空");elseif (textBox3.Text ="") MessageBoxShow("仓库名称不能为空");elseif (textBox4.Text ="") Messa

18、geBoxShow("货物规格不能为空");elseif (textBox6.Text ="”) MessageBoxShow("货物数量不能为空");elseif (textBox7.Text ="") MessageBoxShow("进货价格不能为空");elseif (textBox8.Text ="") MessageBoxShow("岀货价格不能为空");elseif (textBox9.Text ="") MessageBoxShow

19、("修改人不能为空");elseif (textBox10.Text ="") MessageBoxShow("修改日期不能为空"); else一string Sql = "server=.;integrated security=sspi;database库管理信息系统"SqlC onn ecti on con = new SqlC onn ecti on( Sql); stri ng cmd = "INSERT INTO Goods info VALUES("' + textBox1

20、.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text

21、+ "','" + textBox9.Text + "','" + textBox10.Text + "')"newSqlCommandcomSqlCommand(cmd, con);con .Ope n();/ 关闭if (com.ExecuteN on Query() != 0)/com.ExecuteN on Query() 执行语句,并返回受影响行数MessageBox.Show("注册成功!");elseMessageBox.Show("注册不成功!&qu

22、ot;)co n.Close();/ 关闭private void label8 Click( object sender,EventArgs e) private void textBox1 TextChanged(object sender, EventArgs eprivate void butt on 2_Click( object sen der, Eve ntArgs eif (MessageBoxShow("返回主页?","提示", MessageBoxButtons.OKCancel,MessageBoxIc on.ln formati

23、on) = DialogResult.OK)this.Hide();else private void butt on 3_Click( object sen der, Eve ntArgs e)this.Hide();货物入库RK = new货物入库();RK.ShowDialog();3、删除产品信息代码实现:namespace仓库信息管理系统1public partial class 删除 :Form |public 删除()if (MessageBox Show("是否删除该编号信息?","提示", MessageBoxButt on s.OKC

24、a ncel, MessageBoxIc on.ln formati on) = DialogResult.OK)string Sql = "server=.;integrated security=sspi;database仓库管理信息系统 " SqlC onn ecti on con = n ew SqlC onn ecti on( Sql);stri ng cmd = "delete from Goods info where GoodsID='" + textBoxl.Text.ToStri ng() + SqlCommand com =

25、 new SqlCommand(cmd, con);con .Open();/关闭if (com.ExecuteNonQuery() != 0) /com.ExecuteNonQuery()执行语句,并返回受影响行数 MessageBox.Show("删除成功!");elseMessageBox.Show("该编号不存在,请输入正确的编号!");co n. Close(); 关闭4、修改产品信息代码实现:namespace仓库信息管理系统1public partial class 修改 cs : FormLpublic 修改 cs()string con

26、str = "data source=(local);" + "Initial Catalog=仓库管理信息系统;"+ "Integrated Security=SSPI;"/设置连接字符串SqlCo nn ection mycon = new SqlCo nn ecti on (co nstr); 实例化连接对象mycon. Ope n();if (textBox1.Text !="")SqlComma nd mycom = new SqlComma nd("select * from Goods in

27、fo where GoodsID='"+ textBoxl.Text.ToStr in g() + ""', myco n);SqlDataReadersqldr = mycom.ExecuteReader();sqldr.Read();textBox2.Text = sqldr "GoodsName".ToStri ng(); textBox3.Text = sqldr "StoreName".ToStri ng(); textBox4.Text = sqldr "GoodsSpec".

28、ToStri ng(); textBox5.Text = sqldr "Goods Un it" .ToStri ng(); textBox6.Text = sqldr "GoodsNum".ToStri ng(); textBox7.Text = sqldr "Goods In price" .ToStr in g(); textBox8.Text = sqldr "GoodsOutprice".ToStri ng(); textBox9.Text = sqldr "Editer".ToStr

29、 in g(); textBox10.Text = sqldr "EditDate".ToStri ng(); myc on .Close();butt on 2.E nabled = true;private void 修改 cs Load(object sender, EventArgs e) Lprivate void butt on 3_Click( object sen der, Eve ntArgs e)stri ng con str = "server=.;i ntegrated security=sspi;database仓库管理信息系统 &quo

30、t;设置连接字符串SqlCo nn ection mycon = new SqlCo nn ecti on (co nstr); 实例化连接对象stri ng str3 = "update Goods info set GoodsName='"+ textBox2.Text + "',StoreName='" +textBox3.Text + "',GoodsSpec='" + textBox4.Text + "',Goods Un it='" + textB

31、ox5.Text + "',GoodsNum='" +textBox6.Text + "',GoodsI nprice="' + textBox7.Text + "',GoodsOutprice='" + textBox8.Text + "',Editer='" +textBox9.Text + "',EditDate='" + textBox10.Text + "' where GoodsID=&

32、#39;" + textBoxl.Text.ToStri ng() + ""'SqlComma nd com = new SqlComma nd(str3, myc on);mycon. Ope n();if (com.ExecuteNo nQuery() != 0)MessageBoxShow("修改成功!");elseif (textBox2.Text = " " | textBox3.Text = " " | textBox4.Text =""|textBox6.Text

33、="" |textBox7.Text= ""|textBox8.Text="" |textBox9.Text= ""|textBox10.Text="")MessageBoxShow("修改不成功);myc on.Close(); 关闭 Lprivate void butt on 2_Click( object sen der,Eve ntArgs e)this.Hide(); |五、用户管理1、添加用户代码实现:namespace仓库信息管理系统1public partial cla

34、ss 添力廿 U : Formpublic 添加 U()string pw1 = textBox2.Text.Trim();string pw2 = textBox3.Text.Trim();if (pw1 = pw2)string Sql = "server=.;integrated security=sspi;database仓库管理信息系统 "SqlC onn ecti on con = n ew SqlC onn ecti on( Sql);stri ng cmd = "INSERT INTO Useri nfo VALUES('"+ t

35、extBox1.Text + "','" +textBox2.Text + "')"SqlCommand com = new SqlCommand(cmd, con);con .Open();/关闭if (com.ExecuteNonQuery() != 0) /com.ExecuteNonQuery()执行语句,并返回受影响行数elseMessageBoxShow("2次输入的密码不同,请重新输入 ");this.Hide();添加U TJU = new添加U();TJU.ShowDialog();2、查看用

36、户哙查看用户O 1| 回 l|w代码实现:namespace仓库信息管理系统1public partial class 查看 U : Formpublic 查看 U()SqlConnection con = new SqlConnection("Data Source=(local);Database库管理信息系 统;In tegrated Security=SSPI;Uid=sa;Pwd=");SqlCommand cmd = new SqlCommand("Select UserName as 用户名,UserRight as 密码 from Useri nf

37、o ", con);dataGridView1.Show();SqlDataAdapter adp = new SqlDataAdapter(cmd);DataSet ds = new DataSet);con. Ope n();adp.Fill(ds,"仓库管理信息系统“);dataGridView1.DataSource = ds.TablesO; / 检查你的 DataSet 是否有数据 private void butt on 2_Click( object sen der, Eve ntArgs e)3、修改用户密码代码实现:namespace仓库信息管理系统1p

38、ublic partial class 修改 U : Formpublic 修改 U()string user = textBox1.Text.Trim();string pw = textBox2.Text.Trim();if (user =""|pw ="")stri ng con str = "data source=(local);" + "Ini tial Catalog=仓库管理信息系统;"+ "In tegratedSecurity=SSPI;"/设置连接字符串SqlConnect

39、ion mycon = new SqlConnection(constr);实例化连接对象SqlComma nd mycom = myc on. CreateComma nd();创建SQL命令执行对象string s1 = "select UserName,UserRight from Userinfo where UserName='" + user + "' and UserRight='" + pw + "'"编写 SQL 命令mycom.Comma ndText = s1;/ 执行 SQL 命

40、令SqlDataAdapter myDA = new SqlDataAdapter();/实例化数据适配器myDA.SelectComma nd = mycom;让适配器执行SELECT命令DataSet myDS = new DataSet;);/实例化结果数据集int n = myDA.Fill(myDS, "Userinfo"); 将结果放入数据适配器,返回元祖个数if (n != 0)string pw1 = textBox3.Text.Trim();string pw2 = textBox4.Text.Trim();if (pw2 = pw1)stri ng st

41、r3 = "updateUseri nfo set UserRight='" + textBox3.Text + "'whereUserName='" + textBoxl.Text.ToStri ng() +;SqlComma nd com = n ew SqlComma nd(str3, mycon);mycon. Ope n();if (com.ExecuteNo nQuery() != 0)MessageBoxShow("修改成功!"); /*MessageBox.Show("修改不成功!&q

42、uot;); mycon .Close(); 关闭*/textBoxl.Text =""清空账号textBox2.Text =""清空密码?textBox3.Text =""textBox4.Text =""textBox1.Focus();光标括设置在账号上MessageBox.Show("确认输入的密码不一致,请重新输入"); this.Hide();修改U XGU = new修改U();XGU.ShowDialog();elseMessageBoxShow(“用户名或密码有错。请重新输入!");textBoxl.Text =""清空账号textBox2.Text =""清空密码?textBox3.Text =""textBox4.Text =""textBox1.Focus();光标括设置在账号上this.Hide();六、总结该系统通过增、删、改、查功能管理仓库产品信息,和用户信息 通过自己设计系统,了解了日常生活中接触到的系统软件的大致设 计,激发了对C#软件系统软件开发的浓厚兴趣。发现生活中的考试 软件及管理软件都可以设计出来。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1