管理信息系統(tǒng)ERP系統(tǒng)庫存子系統(tǒng)設計課設代碼_第1頁
管理信息系統(tǒng)ERP系統(tǒng)庫存子系統(tǒng)設計課設代碼_第2頁
管理信息系統(tǒng)ERP系統(tǒng)庫存子系統(tǒng)設計課設代碼_第3頁
管理信息系統(tǒng)ERP系統(tǒng)庫存子系統(tǒng)設計課設代碼_第4頁
管理信息系統(tǒng)ERP系統(tǒng)庫存子系統(tǒng)設計課設代碼_第5頁
已閱讀5頁,還剩10頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、主界面程序using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU;namespace public partial class Frm_Main : Form public Frm_Main() InitializeComponent(); private void Frm_Main_Load(object send

2、er, EventArgs e) toolStripStatusLabel6.Text = DateTime.Now.ToString(); private void 查詢分析ToolStripMenuItem3_Click(object sender, EventArgs e) Frm_Warehouse_Query frm_Warehouse_Query = new Frm_Warehouse_Query(); frm_Warehouse_Query.ShowDialog(); private void 添加倉庫信息ToolStripMenuItem_Click(object sender

3、, EventArgs e) Frm_Warehouse_Add frm_Warehouse_Add = new Frm_Warehouse_Add(); frm_Warehouse_Add.ShowDialog(); private void 修改倉庫信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Update frm_Warehouse_Update = new Frm_Warehouse_Update(); frm_Warehouse_Update.ShowDialog(); private void

4、 刪除倉庫信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Delete frm_Warehouse_Delete = new Frm_Warehouse_Delete(); frm_Warehouse_Delete.ShowDialog(); 倉庫信息添加界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.

5、Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Add : Form public Frm_Warehouse_Add() InitializeComponent(); private void Frm_Warehouse_Add_Load(object sender, EventArgs e) /添加按鈕事件 private void btnAdd_Click(

6、object sender, EventArgs e) if (string.IsNullOrEmpty(txtWarehouseCode.Text.Trim() MessageBox.Show("請將數(shù)據(jù)完整輸入!", "提示", MessageBoxButtons.OK); else WarehouseManage warehouseManage = new WarehouseManage(); WarehouseTable warehouseTable = new WarehouseTable(); warehouseTable.Warehouse

7、Code = (string)txtWarehouseCode.Text; warehouseTable.WarehouseName = (string)txtWarehouseName.Text; warehouseTable.Property = (string)txtProperty.Text; warehouseTable.Department = (string)txtDepartment.Text; warehouseTable.Address = (string)txtAddress.Text; warehouseTable.Tel = (string)txtTel.Text;

8、warehouseTable.Director = (string)txtDirector.Text; warehouseTable.CreateBy = (string)txtCreateBy.Text; warehouseTable.CreateTime = int.Parse(dtpCreateTime.Value.ToString("yyyyMMdd"); warehouseTable.Summary = (string)txtSummary.Text; int i = warehouseManage.AddWarehouseTable(warehouseTable

9、); if (i > 0) MessageBox.Show("已插入" + i + "條記錄!", "提示", MessageBoxButtons.OK); else MessageBox.Show("插入失??!", "提示", MessageBoxButtons.OK); /取消按鈕事件 private void btnCanel_Click(object sender, EventArgs e) txtWarehouseCode.Text = null; txtWarehouseNam

10、e.Text = null; txtProperty.Text = null; txtDepartment.Text = null; txtAddress.Text = null; txtTel.Text = null; txtDirector.Text = null; txtCreateBy.Text = null; txtSummary.Text = null; /退出按鈕事件 private void btnExit_Click(object sender, EventArgs e) this.Close(); 倉庫信息刪除界面using System;using System.Coll

11、ections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Delete : Form public Frm_Warehouse_Delete() InitializeComponent(); /點開刪除界面時,向下拉菜單中加載可選的倉庫編號 pri

12、vate void Frm_Warehouse_Delete_Load(object sender, EventArgs e) AddWarehouseCode(); private void AddWarehouseCode() cboWarehouseCode.DataSource = new WarehouseManage().GetWarehouseCode(); cboWarehouseCode.DisplayMember = "WAREHOUSECODE" /查詢選擇的倉庫信息 private void btnQuery_Click(object sender,

13、 EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("請選擇出庫單編號!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(cboWarehouseCode.Text); /刪除選中的倉庫 private void btnDelete_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWa

14、rehouseCode.Text) MessageBox.Show("請選擇出庫單編號!"); else int i = new WarehouseManage().DeleteWarehouse(cboWarehouseCode.Text); MessageBox.Show("已經(jīng)刪除"+i+"條記錄!"); dgvWarehouseDetails.DataSource = null; AddWarehouseCode(); /點擊退出,關閉窗口 private void btnExit_Click(object sender, E

15、ventArgs e) this.Close(); 倉庫信息更新界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;using System.Data.SqlClient;using SJZU.SWEIM

16、S.DBUtility;namespace public partial class Frm_Warehouse_Update : Form WarehouseManage warehouseManage = new WarehouseManage(); SqlDataAdapter adapter; DataTable table; public Frm_Warehouse_Update() InitializeComponent(); private void Frm_Warehouse_Update_Load(object sender, EventArgs e) cboWarehous

17、eCode.DataSource = warehouseManage.GetWarehouseCode(); cboWarehouseCode.DisplayMember = "WAREHOUSECODE" /查詢倉庫信息 private void btnQuery_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("請選擇要查詢的倉庫編號!"); else string warehouseCode = cbo

18、WarehouseCode.Text; string strsql = "select * from WAREHOUSE where WAREHOUSECODE = " + warehouseCode; string connectionString = SQLHelper._connectionString; SqlConnection conn = new SqlConnection(connectionString); adapter = new SqlDataAdapter(strsql, conn); SqlCommandBuilder builder = new

19、 SqlCommandBuilder(adapter); adapter.InsertCommand = builder.GetInsertCommand(); adapter.DeleteCommand = builder.GetDeleteCommand(); adapter.UpdateCommand = builder.GetUpdateCommand(); table = new DataTable(); adapter.Fill(table); dgvWarehouseDetails.DataSource = table; private void btnUpdate_Click(

20、object sender, EventArgs e) dgvWarehouseDetails.EndEdit(); try adapter.Update(table); MessageBox.Show("保存成功!"); catch (SqlException err) MessageBox.Show(err.Message, "保存成功!"); private void btnExit_Click(object sender, EventArgs e) this.Close(); 倉庫信息查詢界面using System;using System.C

21、ollections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Query : Form public Frm_Warehouse_Query() InitializeComponen

22、t(); private void Frm_Warehouse_Query_Load(object sender, EventArgs e) /按選擇的條件查詢倉庫信息 private void btnQuery_Click(object sender, EventArgs e) int startTime = int.Parse(dtpStart.Value.ToString("yyyyMMdd"); int endTime = int.Parse(dtpEnd.Value.ToString("yyyyMMdd"); if (startTime >

23、; endTime) MessageBox.Show("開始時間不能晚于結束時間!"); else /按時間查詢,倉庫編號和負責人都不是查詢條件 if (cbWarehouseCode.Checked = false && cbDirector.Checked = false) dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime); /按時間和倉庫編號查詢 else if (cbWarehouseCode.Checked = t

24、rue && cbDirector.Checked = false) string warehouseCode = txtWarehouseCode.Text; if (string.IsNullOrEmpty(warehouseCode.Trim() MessageBox.Show("請輸入倉庫編號!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode); /按時間和負責人查詢 e

25、lse if (cbWarehouseCode.Checked = false && cbDirector.Checked = true) string director = txtDirector.Text; if (string.IsNullOrEmpty(director.Trim() MessageBox.Show("請輸入負責人!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, director,

26、9); /按時間,倉庫編號,負責人查詢 else if (cbWarehouseCode.Checked = true && cbDirector.Checked = true) string warehouseCode = txtWarehouseCode.Text; string director = txtDirector.Text; if (string.IsNullOrEmpty(warehouseCode.Trim() | string.IsNullOrEmpty(director.Trim() MessageBox.Show("所選條件不能為空!&quo

27、t;); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode,director); private void btnExit_Click(object sender, EventArgs e) this.Close(); 邏輯層代碼using System;using System.Collections.Generic;using System.Text;using System.Data.SqlClient;using

28、SJZU.SWEIMS.DBUtility;using SJZU.SWEIMS.BusinessModel;using System.Data;namespace public class WarehouseManage /向數(shù)據(jù)庫WAREHOUSE表中添加倉庫數(shù)據(jù) public int AddWarehouseTable(WarehouseTable warehouseTable) string strsql = "insert into WAREHOUSE(WAREHOUSECODE," + "WAREHOUSENAME," + "PROP

29、ERTY," + "DEPARTMENT," + "ADDRESS," + "TEL," + "DIRECTOR," + "CREATEBY," + "CREATETIME," + "SUMMARY)" + "VALUES(WAREHOUSECODE," + "WAREHOUSENAME," + "PROPERTY," + "DEPARTMENT," + "

30、ADDRESS," + "TEL," + "DIRECTOR," + "CREATEBY," + "CREATETIME," + "SUMMARY)" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseTable.WarehouseCode), new SqlParameter("WAREHOUSENAME", wareh

31、ouseTable.WarehouseName), new SqlParameter("PROPERTY", warehouseTable.Property) , new SqlParameter("DEPARTMENT", warehouseTable.Department), new SqlParameter("ADDRESS",warehouseTable.Address), new SqlParameter("TEL",warehouseTable.Tel), new SqlParameter("

32、DIRECTOR", warehouseTable.Director), new SqlParameter("CREATEBY", warehouseTable.CreateBy), new SqlParameter("CREATETIME",warehouseTable.CreateTime), new SqlParameter("SUMMARY",warehouseTable.Summary); int i = SQLHelper.ExecuteSql(strsql,commandParms); return i; /取

33、得倉庫編號 public DataTable GetWarehouseCode() string strSql = "select WAREHOUSECODE from WAREHOUSE" return SQLHelper.Query(strSql).Tables0; /根據(jù)倉庫編號查詢倉庫詳細信息 public DataTable GetWarehouseTable(string warehouseCode) string strSql = "select * from WAREHOUSE where WAREHOUSECODE = WAREHOUSECODE

34、" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseCode) ; return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)倉庫編號刪除倉庫信息 public int DeleteWarehouse(string warehouseCode) string strSql = "delete from WAREHOUSE where WAREHOUSECODE = WARE

35、HOUSECODE" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseCode) ; return SQLHelper.ExecuteSql(strSql, commandParms); /根據(jù)時間階段查詢倉庫信息 public DataTable GetWarehouseTable(int startTime, int endTime) string strSql = "select * from WAREHOUSE wher

36、e CREATETIME >= startTime and CREATETIME <= endTime" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", startTime), new SqlParameter("endTime", endTime) ; return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時間階段和倉庫編號查詢 public DataTable GetW

37、arehouseTable(int startTime, int endTime, string warehouseCode) string strSql = "select * from WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and WAREHOUSECODE=warehouseCode" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", start

38、Time), new SqlParameter("endTime", endTime),new SqlParameter("warehouseCode", warehouseCode); return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時間階段和負責人查詢 public DataTable GetWarehouseTable(int startTime, int endTime,string director,int i) string strSql = "select * fr

39、om WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and DIRECTOR=director" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", startTime), new SqlParameter("endTime", endTime), new SqlParameter("director", director) ; r

40、eturn SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時間階段,倉庫編號和負責人查詢 public DataTable GetWarehouseTable(int startTime, int endTime, string warehouseCode,string director) string strSql = "select * from WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and WAREHOUSECODE=warehouseCode and DIRECTOR =director" SqlParame

溫馨提示

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

評論

0/150

提交評論