倉儲物資管理系統-數據庫課程設計_第1頁
倉儲物資管理系統-數據庫課程設計_第2頁
倉儲物資管理系統-數據庫課程設計_第3頁
倉儲物資管理系統-數據庫課程設計_第4頁
倉儲物資管理系統-數據庫課程設計_第5頁
已閱讀5頁,還剩20頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、 成 績11信計2013-2014(一)數據庫原理及應用課程設計設計題目 倉儲物資管理系統 設計時間 2013.12.31-2014.1.4 學生姓名 張政偉 學生學號 20110402124 所在班級 11精算 指導教師 董曉瑋 徐州工程學院數學與物理科學學院目 錄1 可行性研究32 需求分析32.1 任務概述32.1.1 目標32.1.2 運行環境32.2 數據需求32.2.1 數據流條目32.2.2 數據庫描述42.3 功能需求42.3.1 功能劃分42.3.2 功能描述43 概要設計44 邏輯設計55 界面設計和代碼75.1登陸界面設計75.2注冊界面與代碼95.3修改密碼105.4系

2、統主界面設計和代碼115.5查詢信息管理界面設計135.6添加信息查詢界面設計145.7出入庫信息表設計185.8刪改信息設計246總結25參考文獻251 可行性研究倉庫管理系統是為了實現企業產品管理的系統化、規范化和自動化,從而提高企業管理效率而設計的。它完全取代了原來一直用人工管理的工作方式,避免了由于管理人員的工作疏忽以及管理質量問題所造成的各種錯誤,為及時、準確、高效的完成倉庫管理提供了強有力的工具和管理手段。倉庫管理系統是一個中小型數據庫管理系統,它界面美觀、操作簡單、安全性高,基本滿足了倉庫管理的要求。本系統的開發語言采用的是C#,開發環境采用的是Visual studio 200

3、8,數據庫采用SQL Server 2005,具有一般系統的數據功能,如數據查詢,修改和刪除等。倉庫管理系統在運行階段,效果好,數據準確性高,提高了工作效率,同時也實現了倉庫管理計算機化。2 需求分析 2.1 任務概述經過調查,對倉庫管理的業務流程進行分析。庫存的變化通常是通過入庫、出庫操作來進行。系統對每個入庫操作均要求用戶填寫入庫單,對每個出庫操作均要求用戶填寫出庫單。在出入庫操作同時可以進行增加、刪除和修改等操作。用戶可以隨時進行各種查詢、統計、報表打印、賬目核對等工作。另外,也可以用圖表形式來反映查詢結果。2.1.1 目標 (1)界面設計要求盡量友好、美觀,應提供登錄界面,并考慮用戶權

4、限問題;(2)對各種信息應提供錄入、修改、刪除和查詢功能;(3)具有對商品的基本信息和流動信息進行統計的功能;(4)具有數據備份與恢復、幫助等功能;(5)能夠新增、修改和刪除用戶信息;2.1.2 運行環境 Windows 98/2000/XP/2003操作系統下,安裝并配置軟件Microsoft SQL Server 2000數據庫管理系統。 2.2 數據需求 2.2.1 數據流條目 根據我們的進行的調查和分析,系統中各種功能所需的數據項和數據結構如下:商品信息:商品編號,商品名,商品單價;職工信息:職工號,職工姓名,性別,電話,住址;供貨商信息:供應商姓名,地址,電話,單位等;入庫信息:入庫

5、編號,商品編號,商品名稱,單價,數量,總價,供應商;出庫信息:出庫編號,商品編號,商品名稱,單價,數量,總價,經手人;2.2.2 數據庫描述 使用SQL SERVER2000作為后臺數據庫,就可以行使基于網絡連接的用戶認證。從而給不同的子系統分配不同的數據庫使用角色,讓他們彼此之間使用的數據庫隔離開來,以達到較高的安全性。2.3 功能需求根據對各大超市進行的調查和分析,倉庫管理系統應該具有以下功能:倉庫中的貨物信息的錄入、修改、刪除和查詢。倉庫的信息的的錄入、修改、刪除、查詢和統計。管理者的信息的錄入、修改、刪除和查詢。供貨商的信息的錄入、修改、刪除、查詢和統計。貨物流動信息的錄入、修改、刪除

6、和查詢。2.3.1 功能劃分 倉庫管理系統主要實現以下四方面的功能:A. 登陸b. 注冊c. 查詢d. 修改2.3.2 功能描述 倉庫管理包括登陸、注冊、查詢、修改四方面功能。登陸,分為普通管理員登陸和超級管理員登陸。查詢,分為員工查詢,倉庫查詢和物品查詢。修改,主要實現添加,修改和刪除。3 概要設計 對系統功能分析中的各項功能進行集中、分塊,按照結構化程序設計的要求,得到如下圖所示的系統功能模塊圖。員工查詢倉庫查詢商品查詢注冊倉庫管理系統登錄普通管理員超級管理員查詢修改添加修改刪除4 邏輯設計根據數據庫需求分析,本系統的數據庫邏輯結構設計如下。商品信息設計入庫單信息設計3 出庫單信息設計職工

7、信息設計倉庫信息設計供貨商信息表5 界面設計和代碼5.1登陸界面設計 public partial class Fmlogin : Form public Fmlogin() InitializeComponent(); private void BUT_Y_Click(object sender, EventArgs e) string username = tbuser.Text; string password = tbpw.Text; string connstring = "Data Source=.zhaojuan-PCSQLEXPRESS;AttachDbFilenam

8、e=F:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" SqlConnection conn = new SqlConnection(connstring);/獲取用戶名和密碼匹配的行的數量的sql語句 string sql = string.Format("select count(*) from usertable where username='0'and password='1'", username

9、, password); try if (comboBox1.Text = "超級管理員"&&tbuser.Text="admin") conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); int num = (int)comm.ExecuteScalar(); if (num > 0) this.Hide(); Fmmenu f1 = new Fmmenu(); f1.ShowDialog(); else MessageBox.Show("用戶名或密碼或身份錯

10、誤,請重新輸入!","登錄失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else if (comboBox1.Text ="普通管理員") conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); int num = (int)comm.ExecuteScalar(); if (num > 0) this.Hide(); Fmmenu f1 = new Fmmenu(); f1.刪改信息ToolStripMenuIt

11、em.Enabled = false; f1.ShowDialog(); else MessageBox.Show("用戶名或密碼或身份錯誤,請重新輸入!","登錄失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else MessageBox.Show("用戶名或密碼或身份錯誤,請重新輸入!","登錄失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); catch (Exception eee)

12、 MessageBox.Show(eee.Message, "數據庫操作錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); finally conn.Close(); private void BUT_z_Click(object sender, EventArgs e) Fmregister f2 = new Fmregister(); f2.ShowDialog(); 5.2注冊界面與代碼 private void button1_Click(object sender, EventArgs e) if (t

13、bpw.Text = tB2_repw.Text) string connstring = "Data Source=.zhaojuan-PCSQLEXPRESS;AttachDbFilename=F:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" SqlConnection conn = new SqlConnection(connstring); ; try conn.Open();SqlCommand comm = new SqlCommand

14、("register", conn); comm.CommandType = CommandType.StoredProcedure;comm.Parameters.AddWithValue("username", tbuser.Text.Trim();comm.Parameters.AddWithValue("password", tbpw.Text.Trim(); comm.Parameters.AddWithValue("workerID", tB_worker.Text.Trim(); int count

15、= comm.ExecuteNonQuery();/執行命令,返回的行數 if (count > 0) MessageBox.Show("注冊成功!可以登錄!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("注冊失敗!","錯誤!",MessageBoxButtons.OK,MessageBoxIcon.Information); catch(Exception ) MessageBox.Show

16、("操作數據失敗!可能用戶名重復或您不是本公司職員!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); finally conn.Close(); else MessageBox.Show("注冊失敗!重復密碼錯誤!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); private void but_return_Click(object sender, EventArgs e

17、) this.Close();5.3修改密碼private void but_Y_Click(object sender, EventArgs e) if (tBsure.Text = tBNpass.Text) string connstring = "Data Source=zhaojuan-PCSQLEXPRESS;AttachDbFilename=D:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True" SqlConnection conn = new SqlConnection(connstring); try conn

18、.Open(); SqlCommand comm = new SqlCommand("updatepass", conn);comm.CommandType=CommandType.StoredProcedure;comm.Parameters.AddWithValue("username", tBuser.Text);comm.Parameters.AddWithValue("password", tBpass.Text); comm.Parameters.AddWithValue("newpass", tBNp

19、ass.Text); int count = comm.ExecuteNonQuery(); if (count > 0) MessageBox.Show("修改密碼成功"); tBuser.Text = "" tBpass.Text = "" tBNpass.Text = ""tBsure.Text = "" tBuser.Focus(); else MessageBox.Show("數據庫操作失敗", "修改密碼失敗", MessageBoxBu

20、ttons.OK, MessageBoxIcon.Exclamation); catch MessageBox.Show("操作數據失敗!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); finally conn.Close(); else MessageBox.Show("確認密碼與新密碼不符", "修改密碼失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); tBuser.Text

21、= "" tBpass.Text = "" tBNpass.Text = "" tBsure.Text = "" tBuser.Focus(); private void button1_Click(object sender, EventArgs e) this.Close();5.4系統主界面設計和代碼 public partial class Fmmenu : Form public Fmmenu() InitializeComponent(); private void 職員ToolStripMenuIte

22、m_Click(object sender, EventArgs e) putinto_w w = new putinto_w(); w.ShowDialog(); private void 查詢所有ToolStripMenuItem_Click(object sender, EventArgs e) allinformation s = new allinformation(); s.ShowDialog(); private void 按倉庫ToolStripMenuItem_Click(object sender, EventArgs e) BY_WHID bw = new BY_WHI

23、D(); bw.ShowDialog(); private void 供貨商ToolStripMenuItem_Click(object sender, EventArgs e) putinto_sup su = new putinto_sup(); su.ShowDialog(); private void 倉庫信息ToolStripMenuItem_Click(object sender, EventArgs e) putinto_WH wh = new putinto_WH(); wh.ShowDialog(); private void 商品信息ToolStripMenuItem_Cl

24、ick(object sender, EventArgs e) putin_G g = new putin_G();g.ShowDialog(); private void 入庫ToolStripMenuItem_Click(object sender, EventArgs e) putin pi = new putin(); pi.ShowDialog(); private void 出庫ToolStripMenuItem_Click(object sender, EventArgs e) putout po = new putout(); po.ShowDialog(); private

25、void 刪改信息ToolStripMenuItem_Click(object sender, EventArgs e) updataANDdelete ud = new updataANDdelete(); ud.ShowDialog(); private void 提醒ToolStripMenuItem_Click(object sender, EventArgs e) remind re = new remind(); re.ShowDialog(); private void 修改密碼ToolStripMenuItem_Click(object sender, EventArgs e)

26、 updatapass up = new updatapass(); up.ShowDialog(); private void 關于ToolStripMenuItem_Click(object sender, EventArgs e) About ab = new About(); ab.ShowDialog(); private void 按供貨商ToolStripMenuItem_Click(object sender, EventArgs e) BY_SUP bs = new BY_SUP(); bs.ShowDialog(); 5.5查詢信息管理界面設計 public partial

27、 class allinformation : Form public allinformation() InitializeComponent(); private void allinformation_Load(object sender, EventArgs e) this.view_putoutTableAdapter.Fill(this.wMS_DBDataSet4.View_putout); this.view_putinTableAdapter.Fill(this.wMS_DBDataSet3.view_putin); this.supplierTableAdapter.Fil

28、l(this.wMS_DBDataSet2.Supplier); this.workerTableAdapter.Fill(this.wMS_DBDataSet1.Worker); this.gOODSTableAdapter.Fill(this.wMS_DBDataSet.GOODS);private void fillByToolStripButton_Click(object sender, EventArgs e) try this.gOODSTableAdapter.FillBy(this.wMS_DBDataSet.GOODS); catch (System.Exception e

29、x) System.Windows.Forms.MessageBox.Show(ex.Message); try this.workerTableAdapter.FillBy1(this.wMS_DBDataSet1.Worker); catch (System.Exception ex) System.Windows.Forms.MessageBox.Show(ex.Message); try this.view_putoutTableAdapter.FillBy(this.wMS_DBDataSet4.View_putout); catch (System.Exception ex) Sy

30、stem.Windows.Forms.MessageBox.Show(ex.Message); try this.supplierTableAdapter.FillBy(this.wMS_DBDataSet2.Supplier); catch (System.Exception ex) System.Windows.Forms.MessageBox.Show(ex.Message); try this.view_putinTableAdapter.FillBy(this.wMS_DBDataSet3.view_putin); catch (System.Exception ex) System

31、.Windows.Forms.MessageBox.Show(ex.Message); 5.6添加信息查詢界面設計根據上圖可知添加信息分為三類,人員信心,倉庫信息,和商品信息,此外,人員信息分為職工類和供貨商類,因添加界面和代碼,格式大抵相同,所以只展示部分界面,進入添加設計如下:1.添加商品信息 public partial class putin_G : Form public putin_G() InitializeComponent(); private void but_Y_Click(object sender, EventArgs e) string connstring = &

32、quot;Data Source=.zhaojuan-PCSQLEXPRESS;AttachDbFilename=F:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" SqlConnection conn = new SqlConnection(connstring); try conn.Open(); SqlCommand comm = new SqlCommand("insertgoods", conn); comm.CommandTyp

33、e = CommandType.StoredProcedure; comm.Parameters.AddWithValue("goods_ID", tB1_G_ID.Text.Trim(); comm.Parameters.AddWithValue("goods_name", tB2_G_name.Text.Trim(); comm.Parameters.AddWithValue("goods_price", tB3_G_price.Text.Trim(); comm.Parameters.AddWithValue("min

34、num", tB5_G_minnum.Text.Trim(); int count = comm.ExecuteNonQuery();/執行命令,返回的行數 if (count > 0) MessageBox.Show("添加成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("添加失敗!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.In

35、formation); catch (Exception) MessageBox.Show("操作數據失敗!可能商品已存在!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); finally conn.Close(); private void button1_Click(object sender, EventArgs e) this.Close(); 2錄入倉庫信息public partial class putinto_WH : Form public putinto_WH()

36、InitializeComponent(); private void but_Y_Click(object sender, EventArgs e)string connstring = "Data Source=.zhaojuan-PCSQLEXPRESS;AttachDbFilename=F:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"SqlConnection conn = new SqlConnection(connstring); tr

37、y conn.Open(); SqlCommand comm = new SqlCommand("insertWH", conn); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("WH_ID", tB1_WH_ID.Text.Trim(); comm.Parameters.AddWithValue("WHname", tB2_WHname.Text.Trim(); comm.Parameters.AddWithValue(&q

38、uot;workerID", tB3_workerID.Text.Trim(); comm.Parameters.AddWithValue("WHphone", tB4_WHphone.Text.Trim(); comm.Parameters.AddWithValue("address", tB5_address.Text.Trim(); int count = comm.ExecuteNonQuery();/執行命令,返回的行數 if (count > 0) MessageBox.Show("添加成功!", &quo

39、t;成功", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("添加失敗!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception) MessageBox.Show("操作數據失敗!可能倉庫已存在!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information)

40、; finally conn.Close(); private void button1_Click(object sender, EventArgs e) this.Close(); 3錄入職員信息(代碼只展示不同部分 Try conn.Open(); SqlCommand comm = new SqlCommand("insertworker", conn); comm.CommandType=CommandType.StoredProcedure comm.Parameters.AddWithValue("workerID",tB1_ID.Text

41、.Trim();comm.Parameters.AddWithValue("workerName",tB2_name.Text.Trim();comm.Parameters.AddWithValue("Sex", tB3_sex.Text.Trim();comm.Parameters.AddWithValue("phone", tB4_phone.Text.Trim();comm.Parameters.AddWithValue("workerPost",tB5_POST.Text.Trim();int count

42、= comm.ExecuteNonQuery();/執行命令,返回的行數5.7出入庫信息表設計1出庫表界面設計 public partial class putout : Form public putout() InitializeComponent(); private void button1_Click(object sender, EventArgs e) this.Close(); private void but_Y_Click(object sender, EventArgs e) string show_str1 = string.Empty; string show_str

43、2 = string.Empty; string dt1 = dateTimePicker1.Value.ToString(); string dt2=dateTimePicker2.Value.Date.ToString(); string connstring = "Data Source=.zhaojuan-PCSQLEXPRESS;AttachDbFilename=F:倉庫管理系統倉庫管理系統WMS_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" SqlConnection

44、 conn = new SqlConnection(connstring); try conn.Open(); SqlCommand comm = new SqlCommand("SPputout", conn); comm.CommandType = CommandType.StoredProcedure;/聲明,引號中的內容是存儲過程名 comm.Parameters.AddWithValue("putoutID", tB_puID.Text.Trim(); comm.Parameters.AddWithValue("goodsID&quo

45、t;, tB_GID.Text.Trim(); string sql = string.Format("select Goods_name,Goods_price from GOODS where Goods_ID='0'", tB_GID.Text.Trim(); SqlCommand comm1 = new SqlCommand(sql, conn); SqlDataReader sdr = comm1.ExecuteReader(); while (sdr.Read() show_str1 = string.Format("0",

46、sdr0.ToString(); show_str2 = string.Format("0", sdr1.ToString(); sdr.Close();/關閉SQLdatareader sdr.Dispose(); this.tB_Gname.Text = show_str1; this.tB_Gprice.Text = show_str2;/將查詢結果顯示在文本框 comm.Parameters.AddWithValue("num", float.Parse(tB_Gnum.Text.Trim(); comm.Parameters.AddWithVa

47、lue("JSR", tB_JSR.Text.Trim(); comm.Parameters.AddWithValue("checker", tB_check.Text.Trim(); comm.Parameters.AddWithValue("time", dt1); tB_value.Text = (float.Parse(tB_Gnum.Text) * float.Parse(tB_Gprice.Text).ToString(); comm.Parameters.AddWithValue("totalvalue&quo

48、t;, tB_value.Text); comm.Parameters.AddWithValue("WH_ID", tB_WH.Text.Trim(); comm.Parameters.AddWithValue("producetime", dt2); int count = comm.ExecuteNonQuery();/執行命令,返回的行數 if (count > 0) MessageBox.Show("出庫成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.

49、Information); else MessageBox.Show("出庫失敗!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); catch MessageBox.Show("操作數據失敗!可能填寫錯誤!", "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Information); finally conn.Close(); 2入庫表界面設計(代碼展示不同部分) private void but_Y_Click(object sender, EventArgs e) string show_str1 = string.Empty; string show_str2 = string.Empty; string dt1 = dateTimeNow.Value.Date.ToString(); DateTime dt2 = dateTimeGpro.Value.Date; DateTime dt3 = dateTimeGqgp.Value.Date; TimeSpan dt4 = dt3 - dt2; st

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論