仓库管理系统doc资料.docx
《仓库管理系统doc资料.docx》由会员分享,可在线阅读,更多相关《仓库管理系统doc资料.docx(29页珍藏版)》请在冰豆网上搜索。
仓库管理系统doc资料
仓库管理信息系统
目录
一、功能模块图……………………………………………………3
二、登陆……………………………………………………………3
三、主界面…………………………………………………………5
四、对仓库进行管理………………………………………………8
1、库存查询………………………………………………………8
2、货物入库………………………………………………………9
3、删除产品信息…………………………………………………11
4、修改产品信息…………………………………………………13
五、用户管理………………………………………………………15
1、添加用户………………………………………………………15
2、查看用户………………………………………………………16
3、修改用户密码…………………………………………………18
六、总结…………………………………………………………20
一、功能模块图
二、登陆
实习代码如下:
namespace仓库信息管理系统1
{
publicpartialclassLogin:
Form
{
publicLogin()
{
InitializeComponent();
}
privatevoidbtLogin_Click(objectsender,EventArgse)
{
stringusername=用户名.Text.Trim();//取出账号
stringpw=密码.Text.Trim();//取出密码
stringconstr="datasource=(local);"+"InitialCatalog=仓库管理信息系统;"+"IntegratedSecurity=SSPI;";//设置连接字符串
SqlConnectionmycon=newSqlConnection(constr);//实例化连接对象
SqlCommandmycom=mycon.CreateCommand();//创建SQL命令执行对象
strings1="selectUserName,UserRightfromUserinfowhereUserName='"+username+"'andUserRight='"+pw+"'";//编写SQL命令
mycom.CommandText=s1;//执行SQL命令
SqlDataAdaptermyDA=newSqlDataAdapter();//实例化数据适配器
myDA.SelectCommand=mycom;//让适配器执行SELECT命令
DataSetmyDS=newDataSet();//实例化结果数据集
intn=myDA.Fill(myDS,"Userinfo");//将结果放入数据适配器,返回元祖个数
if(n!
=0)
{
MessageBox.Show("欢迎使用!
");//登录成功
Mainmain=newMain();
this.Hide();
main.Show();
}
else
{
MessageBox.Show("用户名或密码有错。
请重新输入!
");
用户名.Text="";//清空账号
密码.Text="";//清空密码?
用户名.Focus();//光标括设置在账号上
}
}
privatevoidbtExit_Click(objectsender,EventArgse)
{
if(MessageBox.Show("您真的要退出本系统吗?
","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information)==DialogResult.OK)
{
Application.Exit();
}
else
{
this.btLogin.Enabled=true;
this.Hide();
Loginlogin=newLogin();
login.Show();
}
}
}
}
三、主界面
实现代码如下:
namespace仓库信息管理系统1
{
publicpartialclassMain:
Form
{
privateintchildFormNumber=0;
publicMain()
{
InitializeComponent();
}
privatevoidShowNewForm(objectsender,EventArgse)
{
FormchildForm=newForm();
childForm.MdiParent=this;
childForm.Text="窗口"+childFormNumber++;
childForm.Show();
}
privatevoidOpenFile(objectsender,EventArgse)
{
OpenFileDialogopenFileDialog=newOpenFileDialog();
openFileDialog.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Filter="文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
if(openFileDialog.ShowDialog(this)==DialogResult.OK)
{
stringFileName=openFileDialog.FileName;
}
}
privatevoidSaveAsToolStripMenuItem_Click(objectsender,EventArgse)
{
SaveFileDialogsaveFileDialog=newSaveFileDialog();
saveFileDialog.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.Personal);
saveFileDialog.Filter="文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
if(saveFileDialog.ShowDialog(this)==DialogResult.OK)
{
stringFileName=saveFileDialog.FileName;
}
}
privatevoidExitToolsStripMenuItem_Click(objectsender,EventArgse)
{
this.Close();
}
privatevoidCascadeToolStripMenuItem_Click(objectsender,EventArgse)
{
LayoutMdi(MdiLayout.Cascade);
}
privatevoidTileVerticalToolStripMenuItem_Click(objectsender,EventArgse)
{
LayoutMdi(MdiLayout.TileVertical);
}
privatevoidTileHorizontalToolStripMenuItem_Click(objectsender,EventArgse)
{
LayoutMdi(MdiLayout.TileHorizontal);
}
privatevoidArrangeIconsToolStripMenuItem_Click(objectsender,EventArgse)
{
LayoutMdi(MdiLayout.ArrangeIcons);
}
privatevoidCloseAllToolStripMenuItem_Click(objectsender,EventArgse)
{
foreach(FormchildForminMdiChildren)
{
childForm.Close();
}
}
privatevoid供货商设置ToolStripMenuItem_Click(objectsender,EventArgse)
{
}
privatevoid库存查询ToolStripMenuItem_Click(objectsender,EventArgse)
{
库存查询btLook=new库存查询();
btLook.ShowDialog();
}
privatevoid货物入库ToolStripMenuItem_Click(objectsender,EventArgse)
{
修改产品信息RK=new修改产品信息();
RK.ShowDialog();
}
privatevoid删除产品信息ToolStripMenuItem_Click(objectsender,EventArgse)
{
删除SC=new删除();
SC.ShowDialog();
}
privatevoid修改产品信息ToolStripMenuItem_Click(objectsender,EventArgse)
{
修改csXG=new修改cs();
XG.ShowDialog();
}
privatevoid添加用户ToolStripMenuItem_Click(objectsender,EventArgse)
{
添加UTJU=new添加U();
TJU.ShowDialog();
}
privatevoid查看用户ToolStripMenuItem_Click(objectsender,EventArgse)
{
查看UCKU=new查看U();
CKU.ShowDialog();
}
privatevoid修改用户密码ToolStripMenuItem_Click(objectsender,EventArgse)
{
修改UXGU=new修改U();
XGU.ShowDialog();
}
}
}
四、对仓库进行管理
1、库存查询
代码实现:
privatevoidbtLook_Click(objectsender,EventArgse)
{
if(txtLKWord.Text=="")
{
MessageBox.Show("请输入货物名称");
}
else
{
SqlConnectioncon=newSqlConnection("DataSource=(local);Database=仓库管理信息系统;IntegratedSecurity=SSPI;Uid=sa;Pwd=");
SqlCommandcmd=newSqlCommand("SelectGoodsIDas货物编号,GoodsNameas货物名称,"
+"StoreNameas仓库名称,GoodsSpecas货物规格,GoodsUnitas计量单位,"
+"GoodsNumas货物数量,GoodsInPriceas进货价格,GoodsOutPriceas出货价格,"
+"Editeras修改人,EditDateas修改日期"
+"fromGoodsinfowhereGoodsID=@GOODSID",con);
SqlDataAdapteradp=newSqlDataAdapter(cmd);
cmd.Parameters.AddWithValue("@GOODSID",txtLKWord.Text);
DataSetds=newDataSet();
con.Open();
adp.Fill(ds,"仓库管理信息系统");
dataGridView1.DataSource=ds.Tables[0];//检查你的DataSet是否有数据
/*MessageBox.Show(ds.Tables[0].Rows.Count.ToString());
con.Close();
*/
}
}
2、货物入库
代码实现:
publicpartialclass货物入库:
Form
{
public货物入库()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
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
{
stringSql="server=.;integratedsecurity=sspi;database=仓库管理信息系统";
SqlConnectioncon=newSqlConnection(Sql);
stringcmd="INSERTINTOGoodsinfoVALUES('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"','"+textBox5.Text+"','"+textBox6.Text+"','"+textBox7.Text+"','"+textBox8.Text+"','"+textBox9.Text+"','"+textBox10.Text+"')";
SqlCommandcom=newSqlCommand(cmd,con);
con.Open();//关闭
if(com.ExecuteNonQuery()!
=0)//com.ExecuteNonQuery()执行语句,并返回受影响行数
{
MessageBox.Show("注册成功!
");
}
else
{
MessageBox.Show("注册不成功!
");
con.Close();//关闭
}
}
}
}
}
}
}
}
}
}
}
privatevoidlabel8_Click(objectsender,EventArgse)
{
}
privatevoidtextBox1_TextChanged(objectsender,EventArgse)
{
}
privatevoidbutton2_Click(objectsender,EventArgse)
{
if(MessageBox.Show("返回主页?
","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information)==DialogResult.OK)
{this.Hide();
}
else{}
}
privatevoidbutton3_Click(objectsender,EventArgse)
{
this.Hide();
货物入库RK=new货物入库();
RK.ShowDialog();
}
}
3、删除产品信息
代码实现:
namespace仓库信息管理系统1
{
publicpartialclass删除:
Form
{
public删除()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
if(MessageBox.Show("是否删除该编号信息?
","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information)==DialogResult.OK)
{
stringSql="server=.;integratedsecurity=sspi;database=仓库管理信息系统";
SqlConnectioncon=newSqlConnection(Sql);
stringcmd="deletefromGoodsinfowhereGoodsID='"+textBox1.Text.ToString()+"'";
SqlCommandcom=newSqlCommand(cmd,con);
con.Open();//关闭
if(com.ExecuteNonQuery()!
=0)//com.ExecuteNonQuery()执行语句,并返回受影响行数
MessageBox.Show("删除成功!
");
else
MessageBox.Show("该编号不存在,请输入正确的编号!
");
con.Close();//关闭
}
}
privatevoidbutton2_Click(objectsender,EventArgse)
{
this.Hide();
}
}
}
4、修改产品信息
代码实现:
namespace仓库信息管理系统1
{
publicpartialclass修改cs:
Form
{
public修改cs()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
stringconstr="datasource=(local);"+"InitialCatalog=仓库管理信息系统;"+"IntegratedSecurity=SSPI;";//设置连接字符串
SqlConnectionmycon=newSqlConnection(constr);//实例化连接对象
mycon.Open();
if(textBox1.Text!
="")
{
SqlCommandmycom=newSqlCommand("select*fromGoodsinfowhereGoodsID='"+textBox1.Text.ToString()+"'",mycon);
SqlDataReadersqldr=mycom.ExecuteReader();
sqldr.Read();
textBox2.Text=sqldr["GoodsName"].ToString();
textBox3.Text=sqldr["StoreName"].ToString();
textBox4.Text=sqldr["GoodsSpec"].ToString();
textBox5.Text=sqldr["GoodsUnit"].ToString();
textBox6.Text=sqldr["GoodsNum"].ToString();
textBox7.Text=sqldr["GoodsInprice"].ToString();
textBox8.Text=sqldr["GoodsOutprice"].ToString();
textBox9.Text=sqldr["Editer"].ToString();
textBox10.Text=sqldr["EditDate"].ToString();
mycon.Close();
button2.Enabled=true;
}
else
{
MessageBox.Show("请先输入产品编码");
}
}
privatevoid修改cs_Load(objectsender,EventArgse)
{
}
privatevoidbutton3_Click(objectsender,EventArgse)
{
stringconstr="server=.;integratedsecurity=sspi;database=仓库管理信息系统";//设置连接字符串
SqlConnectionmycon=newSqlConnection(constr);//实例化连接对象
stringstr3="updateGoodsinfosetGoodsName='"+textBox2.Text+"',StoreName='"+textBox3.Text+"',GoodsSpe