1、仓库管理系统doc资料仓库管理信息系统目 录一、功能模块图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) st
2、ring 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 =
3、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, Use
4、rinfo); /将结果放入数据适配器,返回元祖个数 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(您真的要退出
5、本系统吗?, 提示, 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 M
6、ain() 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();
7、 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(obje
8、ct 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 FileNa
9、me = 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) LayoutM
10、di(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
11、(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 货物入库ToolStrip
12、MenuItem_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();
13、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
14、 修改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
15、(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.Parame
16、ters.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 货物入库() Initi
17、alizeComponent(); 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 (textBo
18、x6.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 securit
19、y=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 + , + textB
20、ox10.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(ob
21、ject 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.Sh
22、owDialog(); 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=.;i
23、ntegrated 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()执行语句,并返回受影响行数 Message
24、Box.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) s
25、tring 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() + ,
26、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 = sql
27、drGoodsInprice.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 + ,GoodsSpe
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1