1、仓库管理信息系统目 录 一、功效模块图……………………………………………………3 二、登陆……………………………………………………………3 三、主界面 …………………………………………………………5 四、对仓库进行管理 ………………………………………………8 1、库存查询 ………………………………………………………8 2、货物入库 ………………………………………………………9 3、删除产品信息 …………………………………………………11 4、修改产品信息 …………………………………………………13 五、用户管理………………………………………………………15 1、添加用户……
2、…………………………………………………15 2、查看用户………………………………………………………16 3、修改用户密码 …………………………………………………18 六、总结 …………………………………………………………20 一、功效模块图 登陆 对仓库进行管理 管理人员信息管理 修改密码 查询产品 信息删除 修改信息 添加产品 查看管理员 添加管理员 二、登陆 实习代码以下: namespace 仓库信息管理系统1 { public partial clas
3、s Login : Form { public Login() { InitializeComponent(); } private void btLogin_Click(object sender, EventArgs e) { string username = 用户名.Text.Trim(); //取出账号 string pw = 密码.Text.Trim(); //取出密码
4、 string constr = "data source=(local);" + "Initial Catalog=仓库管理信息系统;" + "Integrated Security=SSPI;"; //设置连接字符串 SqlConnection mycon = new SqlConnection(constr); //实例化连接对象 SqlCommand mycom = mycon.CreateCommand(); //创建SQL命令实施对象
5、 string s1 = "select UserName,UserRight from Userinfo where UserName='" + username + "' and UserRight='" + pw + "'"; //编写SQL命令 mycom.CommandText = s1; //实施SQL命令 SqlDataAdapter myDA = new SqlDataAdapter(); //实例化数据
6、适配器 myDA.SelectCommand = mycom; //让适配器实施SELECT命令 DataSet myDS = new DataSet(); //实例化结果数据集 int n = myDA.Fill(myDS, "Userinfo"); //将结果放入数据适配器,返回元祖个数 if (n != 0) { MessageBox.Show
7、"欢迎使用!"); //登录成功 Main main = new Main(); this.Hide(); main.Show(); } else { MessageBox.Show("用户名或密码有错。请重新输入!"); 用户名.Text = ""; //清空账号 密码.Text = ""; //清空
8、密码? 用户名.Focus(); //光标括设置在账号上 } } private void btExit_Click(object sender, EventArgs e) { if (MessageBox.Show("您真要退出本系统吗?", "提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
9、 { Application.Exit(); } else { this.btLogin.Enabled = true; this.Hide(); Login login = new Login(); login.Show();
10、 } } } } 三、主界面 实现代码以下: namespace 仓库信息管理系统1 { public partial class Main : Form { private int childFormNumber = 0; public Main() { InitializeComponent(); } private void ShowNewForm(object sender, EventA
11、rgs e) { Form childForm = new Form(); childForm.MdiParent = this; childForm.Text = "窗口 " + childFormNumber++; childForm.Show(); } private void OpenFile(object sender, EventArgs e) { OpenFileDialog op
12、enFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); openFileDialog.Filter = "文本文件(*.txt)|*.txt|全部文件(*.*)|*.*"; if (openFileDialog.ShowDialog(this) == DialogResult.OK)
13、 { string FileName = openFileDialog.FileName; } } private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Enviro
14、nment.GetFolderPath(Environment.SpecialFolder.Personal); saveFileDialog.Filter = "文本文件(*.txt)|*.txt|全部文件(*.*)|*.*"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = saveFileDialog.FileName; } }
15、 private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void CascadeToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.Cascade); } private void TileV
16、erticalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); } private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileHorizontal); } pr
17、ivate void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.ArrangeIcons); } private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form childForm in MdiChildren)
18、 { childForm.Close(); } } private void 供货商设置ToolStripMenuItem_Click(object sender, EventArgs e) { } private void 库存查询ToolStripMenuItem_Click(object sender, EventArgs e) { 库存查询 btLook = new 库
19、存查询(); btLook.ShowDialog(); } private void 货物入库ToolStripMenuItem_Click(object sender, EventArgs e) { 修改产品信息 RK=new 修改产品信息(); RK.ShowDialog(); } private void 删除产品信息ToolStripMenuItem_Click(object sender, EventArgs e)
20、 { 删除 SC = new 删除(); SC.ShowDialog(); } private void 修改产品信息ToolStripMenuItem_Click(object sender, EventArgs e) { 修改cs XG = new 修改cs(); XG.ShowDialog(); } private void 添加用户ToolStripMenuItem_Click(o
21、bject sender, EventArgs e) { 添加U TJU = new 添加U(); TJU.ShowDialog(); } private void 查看用户ToolStripMenuItem_Click(object sender, EventArgs e) { 查看U CKU = new 查看U(); CKU.ShowDialog(); } private void
22、 修改用户密码ToolStripMenuItem_Click(object sender, EventArgs e) { 修改U XGU = new 修改U(); XGU.ShowDialog(); } } } 四、对仓库进行管理 1、库存查询 代码实现: private void btLook_Click(object sender, EventArgs e) { if (txtLKWord.Text == "")
23、 { MessageBox.Show("请输入货物名称"); } else { SqlConnection con = new SqlConnection("Data Source=(local);Database=仓库管理信息系统;Integrated Security=SSPI;Uid=sa;Pwd="); SqlCommand cmd = new SqlCommand("Select Goo
24、dsID as 货物编号,GoodsName as 货物名称," + "StoreName as 仓库名称,GoodsSpec as 货物规格,GoodsUnit as 计量单位," + "GoodsNum as 货物数量,GoodsInPrice as 进货价格,GoodsOutPrice as 出货价格," + "Editer as 修改人,EditDate as 修改日期"
25、 + " from Goodsinfo where GoodsID = @GOODSID", con); SqlDataAdapter adp = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue("@GOODSID", txtLKWord.Text); DataSet ds = new DataSet();
26、 con.Open(); adp.Fill(ds, "仓库管理信息系统"); dataGridView1.DataSource = ds.Tables[0]; // 检验你 DataSet 是否有数据 /*MessageBox.Show(ds.Tables[0].Rows.Count.ToString()); con.Close(); */
27、 } } 2、货物入库 代码实现: public partial class 货物入库 : Form { public 货物入库() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "")
28、 { MessageBox.Show(" 货物编号不能为空"); } else { if (textBox2.Text == " ") { MessageBox.Show("货物名称不能为空"); } else { if (textBox3.Text == "") { Message
29、Box.Show("仓库名称不能为空"); } else { if (textBox4.Text == "") { MessageBox.Show("货物规格不能为空"); } else { if (textBox6.Text == "")
30、 { MessageBox.Show("货物数量不能为空"); } else { if (textBox7.Text == "") { MessageBox.Show("进货价格不能为空"); } else
31、 { if (textBox8.Text == "") { MessageBox.Show("出货价格不能为空"); } else { if (textBox9.Text == "")
32、 { MessageBox.Show("修改人不能为空"); } else { if (textBox10.Text == "") { MessageBox.Show("修改日期不能为空
33、"); } else { string Sql = "server=.;integrated security=sspi;database=仓库管理信息系统";
34、 SqlConnection con = new SqlConnection(Sql); string cmd = "INSERT INTO Goodsinfo VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "',
35、'" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')"; SqlCommand com = new SqlCommand(cmd, con); con.Open();//关闭 if (c
36、om.ExecuteNonQuery() != 0)//com.ExecuteNonQuery()实施语句,并返回受影响行数 { MessageBox.Show("注册成功!"); } else
37、 { MessageBox.Show("注册不成功!"); con.Close();//关闭 } }
38、 } } } } } } } } } private void label8_Click(object sender, EventArgs
39、 e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { if (MessageBox.Show("返回主页?", "提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) ==
40、 DialogResult.OK) { this.Hide(); } else { } } private void button3_Click(object sender, EventArgs e) { this.Hide(); 货物入库 RK = new 货物入库(); RK.ShowDialog(); } } 3、删除产品信息
41、 代码实现: namespace 仓库信息管理系统1 { public partial class 删除 : Form { public 删除() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("是否删除该编号信息?", "提醒", MessageBoxButtons.
42、OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { string Sql = "server=.;integrated security=sspi;database=仓库管理信息系统"; SqlConnection con = new SqlConnection(Sql); string cmd = "delete from Goodsinfo where GoodsID='" + textBox1.T
43、ext.ToString() + "'"; SqlCommand com = new SqlCommand(cmd, con); con.Open();//关闭 if (com.ExecuteNonQuery() != 0)//com.ExecuteNonQuery()实施语句,并返回受影响行数 MessageBox.Show("删除成功!"); else MessageBox.S
44、how("该编号不存在,请输入正确编号!"); con.Close();//关闭 } } private void button2_Click(object sender, EventArgs e) { this.Hide(); } } } 4、修改产品信息 代码实现: namespace 仓库信息管理系统1 { public partial class 修改cs : Form {
45、 public 修改cs() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string constr = "data source=(local);" + "Initial Catalog=仓库管理信息系统;" + "Integrated Security=SSPI;"; //设置连接字符串
46、 SqlConnection mycon = new SqlConnection(constr); //实例化连接对象 mycon.Open(); if (textBox1.Text != "") { SqlCommand mycom = new SqlCommand("select * from Goodsinfo where GoodsID='" + textBox1.Text.ToString() + "'", mycon);
47、 SqlDataReader sqldr = mycom.ExecuteReader(); sqldr.Read(); textBox2.Text = sqldr["GoodsName"].ToString(); textBox3.Text = sqldr["StoreName"].ToString(); textBox4.Text = sqldr["GoodsSpec"].ToString(); textBox5.Text
48、 = sqldr["GoodsUnit"].ToString(); textBox6.Text = sqldr["GoodsNum"].ToString(); textBox7.Text = sqldr["GoodsInprice"].ToString(); textBox8.Text = sqldr["GoodsOutprice"].ToString(); textBox9.Text = sqldr["Editer"].ToString();
49、 textBox10.Text = sqldr["EditDate"].ToString(); mycon.Close(); button2.Enabled = true; } else { MessageBox.Show("请先输入产品编码"); } } private void 修改cs_Load(object sender, Ev
50、entArgs e) { } private void button3_Click(object sender, EventArgs e) { string constr = "server=.;integrated security=sspi;database=仓库管理信息系统"; //设置连接字符串 SqlConnection mycon = new SqlConnection(constr); //实例化连接对象






