仓库管理系统_第1页
仓库管理系统_第2页
仓库管理系统_第3页
仓库管理系统_第4页
仓库管理系统_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

仓库管理信息系统目 录一、功能模块图3二、登陆3三、主界面 5四、对仓库进行管理 81、库存查询 82、货物入库 93、删除产品信息 114、修改产品信息 13五、用户管理151、添加用户152、查看用户163、修改用户密码 18六、总结 20一、功能模块图登陆对仓库进行管理管理人员信息管理修改密码查询产品信息删除修改信息添加产品查看管理员添加管理员二、登陆实习代码如下:namespace 仓库信息管理系统1 public partial class Login : Form public Login() InitializeComponent(); private void btLogin_Click(object sender, EventArgs e) string username = 用户名.Text.Trim(); /取出账号 string pw = 密码.Text.Trim(); /取出密码 string constr = data source=(local); + Initial Catalog=仓库管理信息系统; + Integrated Security=SSPI; /设置连接字符串 SqlConnection mycon = new SqlConnection(constr); /实例化连接对象 SqlCommand mycom = mycon.CreateCommand(); /创建SQL命令执行对象 string s1 = select UserName,UserRight from Userinfo where UserName= + username + and UserRight= + pw + ; /编写SQL命令 mycom.CommandText = s1; /执行SQL命令 SqlDataAdapter myDA = new SqlDataAdapter(); /实例化数据适配器 myDA.SelectCommand = mycom; /让适配器执行SELECT命令 DataSet myDS = new DataSet(); /实例化结果数据集 int n = myDA.Fill(myDS, Userinfo); /将结果放入数据适配器,返回元祖个数 if (n != 0) MessageBox.Show(欢迎使用!); /登录成功 Main main = new Main(); this.Hide(); main.Show(); else MessageBox.Show(用户名或密码有错。请重新输入!); 用户名.Text = ; /清空账号 密码.Text = ; /清空密码? 用户名.Focus(); /光标括设置在账号上 private void btExit_Click(object sender, EventArgs e) if (MessageBox.Show(您真的要退出本系统吗?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = DialogResult.OK) Application.Exit(); else this.btLogin.Enabled = true; this.Hide(); Login login = new Login(); login.Show(); 三、主界面实现代码如下:namespace 仓库信息管理系统1 public partial class Main : Form private int childFormNumber = 0; public Main() InitializeComponent(); private void ShowNewForm(object sender, EventArgs e) Form childForm = new Form(); childForm.MdiParent = this; childForm.Text = 窗口 + childFormNumber+; childForm.Show(); private void OpenFile(object sender, EventArgs e) OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); openFileDialog.Filter = 文本文件(*.txt)|*.txt|所有文件(*.*)|*.*; if (openFileDialog.ShowDialog(this) = DialogResult.OK) string FileName = openFileDialog.FileName; private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); saveFileDialog.Filter = 文本文件(*.txt)|*.txt|所有文件(*.*)|*.*; if (saveFileDialog.ShowDialog(this) = DialogResult.OK) string FileName = saveFileDialog.FileName; private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) this.Close(); private void CascadeToolStripMenuItem_Click(object sender, EventArgs e) LayoutMdi(MdiLayout.Cascade); private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e) LayoutMdi(MdiLayout.TileVertical); private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e) LayoutMdi(MdiLayout.TileHorizontal); private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e) LayoutMdi(MdiLayout.ArrangeIcons); private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e) foreach (Form childForm in MdiChildren) childForm.Close(); private void 供货商设置ToolStripMenuItem_Click(object sender, EventArgs e) private void 库存查询ToolStripMenuItem_Click(object sender, EventArgs e) 库存查询 btLook = new 库存查询(); btLook.ShowDialog(); private void 货物入库ToolStripMenuItem_Click(object sender, EventArgs e) 修改产品信息 RK=new 修改产品信息(); RK.ShowDialog(); private void 删除产品信息ToolStripMenuItem_Click(object sender, EventArgs e) 删除 SC = new 删除(); SC.ShowDialog(); private void 修改产品信息ToolStripMenuItem_Click(object sender, EventArgs e) 修改cs XG = new 修改cs(); XG.ShowDialog(); private void 添加用户ToolStripMenuItem_Click(object 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 修改用户密码ToolStripMenuItem_Click(object sender, EventArgs e) 修改U XGU = new 修改U(); XGU.ShowDialog(); 四、对仓库进行管理1、库存查询代码实现:private void btLook_Click(object sender, EventArgs e) if (txtLKWord.Text = ) MessageBox.Show(请输入货物名称); else SqlConnection con = new SqlConnection(Data Source=(local);Database=仓库管理信息系统;Integrated Security=SSPI;Uid=sa;Pwd=); SqlCommand cmd = new SqlCommand(Select GoodsID as 货物编号,GoodsName as 货物名称, + StoreName as 仓库名称,GoodsSpec as 货物规格,GoodsUnit as 计量单位, + GoodsNum as 货物数量,GoodsInPrice as 进货价格,GoodsOutPrice as 出货价格, + Editer as 修改人,EditDate as 修改日期 + from Goodsinfo where GoodsID = GOODSID, con); SqlDataAdapter adp = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue(GOODSID, txtLKWord.Text); DataSet ds = new DataSet(); con.Open(); adp.Fill(ds, 仓库管理信息系统); dataGridView1.DataSource = ds.Tables0; / 检查你的 DataSet 是否有数据 /*MessageBox.Show(ds.Tables0.Rows.Count.ToString(); con.Close(); */ 2、货物入库代码实现: public partial class 货物入库 : Form public 货物入库() InitializeComponent(); private void button1_Click(object sender, EventArgs e) if (textBox1.Text = ) MessageBox.Show( 货物编号不能为空); else if (textBox2.Text = ) MessageBox.Show(货物名称不能为空); else if (textBox3.Text = ) MessageBox.Show(仓库名称不能为空); else if (textBox4.Text = ) MessageBox.Show(货物规格不能为空); else if (textBox6.Text = ) MessageBox.Show(货物数量不能为空); else if (textBox7.Text = ) MessageBox.Show(进货价格不能为空); else if (textBox8.Text = ) MessageBox.Show(出货价格不能为空); else if (textBox9.Text = ) MessageBox.Show(修改人不能为空); else if (textBox10.Text = ) MessageBox.Show(修改日期不能为空); else string Sql = server=.;integrated security=sspi;database=仓库管理信息系统; SqlConnection con = new SqlConnection(Sql); string cmd = INSERT INTO Goodsinfo VALUES( + textBox1.Text + , + textBox2.Text + , + textBox3.Text + , + textBox4.Text + , + textBox5.Text + , + textBox6.Text + , + textBox7.Text + , + textBox8.Text + , + textBox9.Text + , + textBox10.Text + ); SqlCommand com = new SqlCommand(cmd, con); con.Open();/关闭 if (com.ExecuteNonQuery() != 0)/com.ExecuteNonQuery()执行语句,并返回受影响行数 MessageBox.Show(注册成功!); else MessageBox.Show(注册不成功!); con.Close();/关闭 private void label8_Click(object sender, EventArgs e) private void textBox1_TextChanged(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e) if (MessageBox.Show(返回主页?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = DialogResult.OK) this.Hide(); else private void button3_Click(object sender, EventArgs e) this.Hide(); 货物入库 RK = new 货物入库(); RK.ShowDialog(); 3、删除产品信息代码实现:namespace 仓库信息管理系统1 public partial class 删除 : Form public 删除() InitializeComponent(); private void button1_Click(object sender, EventArgs e) if (MessageBox.Show(是否删除该编号信息?, 提示, MessageBoxButtons.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.Text.ToString() + ; SqlCommand com = new SqlCommand(cmd, con); con.Open();/关闭 if (com.ExecuteNonQuery() != 0)/com.ExecuteNonQuery()执行语句,并返回受影响行数 MessageBox.Show(删除成功!); else MessageBox.Show(该编号不存在,请输入正确的编号!); con.Close();/关闭 private void button2_Click(object sender, EventArgs e) this.Hide(); 4、修改产品信息代码实现:namespace 仓库信息管理系统1 public partial class 修改cs : Form public 修改cs() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string constr = data source=(local); + Initial Catalog=仓库管理信息系统; + Integrated Security=SSPI; /设置连接字符串 SqlConnection mycon = new SqlConnection(constr); /实例化连接对象 mycon.Open(); if (textBox1.Text != ) SqlCommand mycom = new SqlCommand(select * from Goodsinfo where GoodsID= + textBox1.Text.ToString() + , mycon); SqlDataReader sqldr = mycom.ExecuteReader(); sqldr.Read(); textBox2.Text = sqldrGoodsName.ToString(); textBox3.Text = sqldrStoreName.ToString(); textBox4.Text = sqldrGoodsSpec.ToString(); textBox5.Text = sqldrGoodsUnit.ToString(); textBox6.Text = sqldrGoodsNum.ToString(); textBox7.Text = sqldrGoodsInprice.ToString(); textBox8.Text = sqldrGoodsOutprice.ToString(); textBox9.Text = sqldrEditer.ToString(); textBox10.Text = sqldrEditDate.ToString(); mycon.Close(); button2.Enabled = true; else MessageBox.Show(请先输入产品编码); private void 修改cs_Load(object sender, EventArgs e) private void button3_Click(object sender, EventArgs e) string constr = server=.;integrated security=sspi;database=仓库管理信息系统; /设置连接字符串 SqlConnection mycon = new SqlConnection(constr); /实例化连接对象 string str3 = update Goodsinfo set GoodsName= + textBox2.Text + ,StoreName= + textBox3.Text + ,GoodsSpec= + textBox4.Text + ,GoodsUnit= + textBox5.Text + ,GoodsNum= + textBox6.Text + ,GoodsInprice= + textBox7.Text + ,GoodsOutprice= + textBox8.Text + ,Editer= + textBox9.Text + ,EditDate= + textBox10.Text + where GoodsID= + textBox1.Text.ToString() + ; SqlCommand com = new SqlCommand(str3, mycon); mycon.Open(); if (com.ExecuteNonQuery() != 0) MessageBox.Show(修改成功!); else if (textBox2.Text = | textBox3.Text = | textBox4.Text = |textBox6.Text=|textBox7.Text=|textBox8.Text=|textBox9.Text=|textBox10.Text=) MessageBox.Show(修改不成功!); mycon.Close();/关闭 private void button2_Click(object sender, EventArgs e) this.Hide(); 五、用户管理1、添加用户代码实现:namespace 仓库信息管理系统1 public partial class 添加U : Form public 添加U() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string pw1 = textBox2.Text.Trim(); string pw2 = textBox3.Text.Trim(); if (pw1 = pw2) string Sql = server=.;integrated security=sspi;database=仓库管理信息系统; SqlConnection con = new SqlConnection(Sql); string cmd = INSERT INTO Userinfo VALUES( + textBox1.Text + , + textBox2.Text + ); SqlCommand com = new SqlCommand(cmd, con); con.Open();/关闭 if (com.ExecuteNonQuery() != 0)/com.ExecuteNonQuery()执行语句,并返回受影响行数 MessageBox.Show(注册成功!); else MessageBox.Show(注册不成功!); con.Close();/关闭 else MessageBox.Show(2次输入的密码不同,请重新输入); this.Hide(); 添加U TJU = new 添加U(); TJU.ShowDialog(); private void button2_Click(object sender, EventArgs e) this.Hide(); 2、查看用户代码实现: namespace 仓库信息管理系统1 public partial class 查看U : Form public 查看U() InitializeComponent(); private void button1_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(Data Source=(local);Database=仓库管理信息系统;Integrated Security=SSPI;Uid=sa;Pwd=); SqlCommand cmd = new SqlCommand(Select UserName as 用户名,UserRight as 密码 from Userinfo , con); dataGridView1.Show(); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); con.Open(); adp.Fill(ds, 仓库管理信息系统); dataGridView1.DataSource = ds.Tables0; / 检查你的 DataSet 是否有数据 private

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论