版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、倉儲管理系統(tǒng)代碼【李彩享、字朝龍】一、窗體(frmLogin)登錄的代碼程序using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WMSpublicpartialclassfrmLogin : Form publicstati
2、cstring M_str_name; /記錄登錄用戶名字publicstaticstring M_str_pwd; /記錄登錄用戶密碼publicstaticstring M_str_right; /記錄登錄用戶的權(quán)限public frmLogin() InitializeComponent(); privatevoid frmLogin_Load(object sender, EventArgs e) /啟動窗口時(shí)加載用戶名 DbOperator db = newDbOperator();SqlConnection cnn = db.GetCon();SqlCommand cmd = ne
3、wSqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = select UserName from tbUserInfo ; / cmd.Connection = cnn; cnn.Open();SqlDataReader dr; dr = cmd.ExecuteReader();if (dr.HasRows) while (dr.Read()cmbUserList.Items.Add(drUserName.ToString().Trim();/在控件中顯示用戶名 cmbUserList.Sorted=true;
4、else MessageBox.Show(表中無記錄!, 提示?, MessageBoxButtons.YesNo, MessageBoxIcon.Information); dr.Close(); cnn.Close(); privatevoid btnCancel_Click(object sender, EventArgs e) if (MessageBox.Show(你確定要退出嗎?, 提示?, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK)this.Close();else cmbUser
5、List.Focus();return; privatevoid btnLoad_Click(object sender, EventArgs e)/用存儲過程實(shí)現(xiàn)驗(yàn)證登錄 DbOperator db = newDbOperator();SqlConnection cnn = db.GetCon();SqlCommand cmd = newSqlCommand(); cmd.Connection = cnn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = proc_Login;SqlParameter paUs
6、er = newSqlParameter(); paUser.ParameterName = User_Name; paUser.SqlDbType = SqlDbType.VarChar; paUser.Size = 50; paUser.Value = cmbUserList.Text.Trim(); cmd.Parameters.Add(paUser);SqlParameter paPwd = newSqlParameter(); paPwd.ParameterName = User_Pwd; paPwd.SqlDbType = SqlDbType.VarChar; paPwd.Size
7、 = 20; paPwd.Value = txtPwd.Text.Trim(); cmd.Parameters .Add (paPwd );SqlParameter paRe = newSqlParameter(); paRe.ParameterName = re; paRe.SqlDbType = SqlDbType.Int; paRe.Value = 0; paRe.Direction = System.Data.ParameterDirection.Output;/設(shè)置 cmd.Parameters.Add (paRe ); cnn.Open (); cmd.ExecuteNonQuer
8、y ();int Re = int.Parse(cmd.Parametersre.Value.ToString();if (Re = 1) frmMain frm = newfrmMain(); frm.Show(); elseMessageBox.Show(用戶名或密碼錯(cuò)誤!, 提示); cnn.Close(); privatevoid cmbUserList_SelectedIndexChanged(object sender, EventArgs e) DbOperator db = newDbOperator();SqlConnection cnn = db.GetCon();SqlC
9、ommand cmd = newSqlCommand();SqlDataReader sqlread = db.getread(select UserName,Power from tbUserInfo where UserName= + cmbUserList.Text.Trim ().ToString () + );if (sqlread.Read() labPower.Text = sqlreadPower.ToString(); M_str_right = labPower.Text; sqlread.Close(); cnn.Close(); cnn.Dispose(); priva
10、tevoid frmLogin_FormClosing(object sender, FormClosingEventArgs e) Application.Exit(); privatevoid txtPwd_KeyPress(object sender, KeyPressEventArgs e) if (e.KeyChar = 13) btnLoad.Focus(); privatevoid cboxUName_KeyPress(object sender, KeyPressEventArgs e) if (e.KeyChar = 13) txtPwd.Focus(); 二、主界面系統(tǒng)代碼
11、using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WMSpublicpartialclassfrmMain : Form public frmMain() InitializeComponent(); privatevoi
12、d 商品采購查選ToolStripMenuItem_Click(object sender, EventArgs e) frmGoodsCGSelect frm = newfrmGoodsCGSelect(); frm.Show(); privatevoid 退?出?系統(tǒng)3ToolStripMenuItem_Click(object sender, EventArgs e) if (MessageBox.Show(你確定要退出嗎?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK)this.C
13、lose(); privatevoid 重新登錄ToolStripMenuItem_Click(object sender, EventArgs e) frmLogin frm1 = newfrmLogin(); frm1.ShowDialog(); privatevoid 商品類別設(shè)置ToolStripMenuItem_Click(object sender, EventArgs e)frmGoodsClassSet frm2 = newfrmGoodsClassSet(); frm2.Show();privatevoid 商品信息設(shè)置ToolStripMenuItem_Click(obje
14、ct sender, EventArgs e) frmGoodsInfo frm3 = newfrmGoodsInfo(); frm3.Show(); privatevoid 供應(yīng)商設(shè)置ToolStripMenuItem_Click(object sender, EventArgs e) frmSupplierInfo frm4 = newfrmSupplierInfo(); frm4.Show(); privatevoid 倉庫設(shè)置ToolStripMenuItem1_Click(object sender, EventArgs e) frmStoreInfo frm5 = newfrmSt
15、oreInfo(); frm5.Show(); privatevoid 庫存盤點(diǎn)toolStripMenuItem23_Click(object sender, EventArgs e) frmKCPD frm6 = newfrmKCPD(); frm6.Show(); privatevoid 采購入庫atoolStripMenuItem20_Click(object sender, EventArgs e) frmCGRK frm = newfrmCGRK(); frm.Show(); privatevoid toolStripMenuItem12_Click(object sender,
16、EventArgs e) frmGoodsInfo frm = newfrmGoodsInfo(); frm.Text = 商品信息查詢; frm.ShowDialog(); privatevoid toolStripMenuItem22_Click(object sender, EventArgs e) frmCKGL frm = newfrmCKGL(); frm.Show(); privatevoid toolStripMenuItem8_Click(object sender, EventArgs e) frmGoodsCGSelect frm = newfrmGoodsCGSelec
17、t(); frm.Text = 商品采購統(tǒng)計(jì); frm.Show(); privatevoid toolStripMenuItem15_Click(object sender, EventArgs e) frmGoodsInfo frm = newfrmGoodsInfo(); frm.Text = 當(dāng)前庫存查詢; frm.Show(); privatevoid 更改密碼ToolStripMenuItem_Click(object sender, EventArgs e) frmSetUser frm = newfrmSetUser(); frm.Show(); privatevoid 權(quán)限管
18、理ToolStripMenuItem_Click(object sender, EventArgs e) frmSetUsers frm = newfrmSetUsers(); frm.Show(); privatevoid 用戶管理ToolStripMenuItem_Click(object sender, EventArgs e) frmSetUsers frm = newfrmSetUsers(); frm.Show(); privatevoid toolStripMenuItem9_Click(object sender, EventArgs e) frmSelectSupplier
19、frm = newfrmSelectSupplier(); frm.Show(); 三、商品類別設(shè)置代碼using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WMSpublicpartialclassfrmGoodsClass
20、Set : Form public frmGoodsClassSet() InitializeComponent(); privatevoid frmGoodsClassSet_Load(object sender, EventArgs e) LoadGC(); grpbClass.Enabled = false; privatevoid dgvGClass_CellClick(object sender, DataGridViewCellEventArgs e) ShowGC(); privatevoid LoadGC()/將客戶表顯示在DataGridView中 DbOperator cl
21、sC = newDbOperator();SqlConnection cnn = clsC.GetCon();SqlCommand cmd = newSqlCommand(); cmd.CommandText = select ClassID as 類別編號,ClassName as 類別名稱,ClassUnit as 參考單位, + KCSX as 庫存上限,KCXX as 庫存下限 from tbGoodsClass; cmd.CommandType = CommandType.Text; cmd.Connection = cnn;SqlDataAdapter da = newSqlDat
22、aAdapter(); da.SelectCommand = cmd;DataSet ds = newDataSet(); da.Fill(ds,tbGoods); dgvGClass.DataSource = ds; dgvGClass.DataSource = ds.Tables0; dgvGClass.Columns0.Visible = true ;/隱藏ID列 da.Dispose(); cmd.Dispose(); cnn.Dispose(); privatevoid ShowGC() if (dgvGClass.RowsdgvGClass.CurrentCell.RowIndex
23、.Cells0.Value.ToString() != ) txtGoodsClassID.Text = dgvGClass.RowsdgvGClass.CurrentCell.RowIndex.Cells0.Value.ToString();txtClassName.Text = dgvGClass.RowsdgvGClass.CurrentCell.RowIndex.Cells1.Value.ToString(); txtClassUnit.Text = dgvGClass.RowsdgvGClass.CurrentCell.RowIndex.Cells2.Value.ToString()
24、;txtKCSX.Text = dgvGClass.RowsdgvGClass.CurrentCell.RowIndex.Cells3.Value.ToString();txtKCXX.Text = dgvGClass.RowsdgvGClass.CurrentCell.RowIndex.Cells4.Value.ToString(); privatevoid OperateRecord(string sSQL)/記錄的添加、修改、刪除 DbOperator clsC = newDbOperator();SqlConnection cnn = clsC.GetCon();SqlCommand
25、cmd = newSqlCommand(); cmd.CommandText = sSQL; cmd.CommandType = CommandType.Text; cmd.Connection = cnn; cnn.Open(); cmd.ExecuteNonQuery(); cnn.Close(); cnn.Dispose(); cmd.Dispose(); privatevoid btnClear_Click(object sender, EventArgs e)/清空文本框 txtGoodsClassID.Text = ; txtClassName.Text = ; txtClassU
26、nit.Text = ; txtKCSX.Text = ; txtKCXX.Text = ; txtGoodsClassID.Focus(); privatevoid btnExit_Click(object sender, EventArgs e)/退出按鈕 if (MessageBox.Show(你確定要退出嗎?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK)this.Close(); privatevoid btnAdd_Click(object sender, EventArgs
27、e)/實(shí)現(xiàn)添加功能 if (btnAdd.Text = 添加)/單擊添加 grpbClass.Enabled = true;/允許編輯 btnAdd.Text = 保存; btnXG.Enabled = false; btnDelete.Enabled = false; btnReturn.Enabled = true ; txtGoodsClassID.Text = ; txtClassName.Text = ; txtClassUnit.Text = ; txtKCSX.Text = ; txtKCXX.Text = ; txtGoodsClassID.Focus();else/單擊保存s
28、tring s = Insert Into tbGoodsClass(ClassID,ClassName,ClassUnit,KCSX,KCXX) Values; s += ( + txtGoodsClassID.Text.Trim() + , + txtClassName.Text.Trim() + , + txtClassUnit.Text.Trim() + , + txtKCSX.Text.Trim() + , + txtKCXX.Text.Trim() + ); OperateRecord(s); grpbClass.Enabled = false; btnAdd.Text = 添加;
29、 btnXG.Enabled = true; btnDelete.Enabled = true; btnReturn.Enabled = true; LoadGC();privatevoid btnDelete_Click(object sender, EventArgs e)/實(shí)現(xiàn)刪功能 if (txtGoodsClassID.Text != )if (MessageBox.Show(您確實(shí)要刪除 + txtClassName.Text + 的類別嗎?, 刪除類別, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResul
30、t.Yes)string s = Delete from tbGoodsClass where ClassID= + txtGoodsClassID.Text + ; OperateRecord(s); LoadGC();/重新加載客戶表 elseMessageBox.Show(您未選中要刪除的商品類別!, 錯(cuò)誤, MessageBoxButtons.OK, MessageBoxIcon.Error); privatevoid btnXG_Click(object sender, EventArgs e) if (btnXG.Text = 修T改?)/單擊修改 grpbClass.Enable
31、d = true;/允許編輯 btnXG.Text = 保存; btnAdd.Enabled = false; btnDelete.Enabled = false; btnReturn.Enabled = false; txtGoodsClassID.Enabled = false; txtClassName.Focus(); else/單擊保存 string s = Update tbGoodsClass SET ; s += ClassName= + txtClassName.Text.Trim() + ,ClassUnit= + txtClassUnit.Text.Trim() + ,K
32、CSX= + txtKCSX.Text.Trim() + ,KCXX= + txtKCXX.Text.Trim() + ;s += where ClassID= + txtGoodsClassID. Text + ; OperateRecord(s); grpbClass.Enabled = false; btnXG.Text = 修改; btnAdd.Enabled = true; btnDelete.Enabled = true; btnReturn.Enabled = true; txtGoodsClassID. Enabled = true; LoadGC();/重新加載客戶表 四、商
33、品信息using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WMSpublicpartialclassfrmGoodsInfo : Form public frmGoodsInfo() InitializeComponent(
34、); privatevoid btnQuit_Click(object sender, EventArgs e) if (MessageBox.Show(你確定要退出嗎?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK)this.Close(); privatevoid ShowDGV() DbOperator db = newDbOperator();SqlConnection cnn = db.GetCon();SqlCommand cmd = newSqlCommand(); cmd.
35、CommandText = select GoodsID as 商品編號,GoodsName as 商品名稱, ClassID as 類別編號,StoreID as 倉庫編號,GPrice as 單價(jià),+GoodsUnit as 單位,KCNum as 庫存數(shù)量,KCSX as 庫存上限T,KCXX as 庫存下限,Availabe as 是否可用,BZ as 備注from tbGoodsInfo;/cmd.CommandText = select * from tbGoodsInfo; cmd.CommandType = CommandType.Text; cmd.Connection =
36、cnn;SqlDataAdapter da = newSqlDataAdapter(); da.SelectCommand = cmd;DataSet ds = newDataSet(); da.Fill(ds);/dgvGoodsInfo.DataSource = ds; dgvGoodsInfo.DataSource = ds.Tables0; dgvGoodsInfo.Columns0.Visible = true;/隱藏ID列 da.Dispose(); cmd.Dispose(); cnn.Dispose(); privatevoid btnAdd_Click(object send
37、er, EventArgs e) frmGoodsInfoSet frm = newfrmGoodsInfoSet(); frm.Show(); privatevoid btnGSelect_Click(object sender, EventArgs e) if (btnGSelect.Text = 查 詢) dgvGoodsInfo.ClearSelection();DbOperator dbo = newDbOperator();SqlConnection con = dbo.GetCon();SqlCommand com = newSqlCommand(); com.CommandTy
38、pe = CommandType.Text; com.CommandText = select GoodsID as 商品編號,GoodsName as 商品名稱, +ClassID as 類別編號,StoreID as 倉庫編號,GPrice as 單價(jià),GoodsUnit as 單位, +KCNum as 庫存數(shù)量,KCSX as 庫存上限,KCXX as 庫存下限,Availabe as 是否可用, +BZ as 備注from tbGoodsInfo where GoodsID LIKE % + txtGSelect.Text + % OR GoodsName LIKE % + txtG
39、Select.Text + % OR ClassID LIKE % + txtGSelect.Text + % OR StoreID LIKE % + txtGSelect.Text + %; com.CommandType = CommandType.Text; com.Connection = con;SqlDataAdapter da = newSqlDataAdapter(); da.SelectCommand = com;DataSet ds = newDataSet(); da.Fill(ds, tbg);/dgvGoodsInfo.DataSource = ds; dgvGood
40、sInfo.ClearSelection(); dgvGoodsInfo.DataSource = ds.Tables0; dgvGoodsInfo.Columns0.Visible = true;/隱藏ID列 da.Dispose(); com.Dispose(); con.Dispose(); privatevoid frmGoodsInfo_Load_1(object sender, EventArgs e) ShowDGV(); 五、商品信息添加代碼using System;using System.Collections.Generic;using System.ComponentM
41、odel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WMSpublicpartialclassfrmGoodsInfoSet : Form public frmGoodsInfoSet() InitializeComponent(); privatevoid frmGoodsInfoSet_Load(object sender, EventArgs e) Db
42、Operator db = newDbOperator();SqlConnection cnn = db.GetCon();SqlCommand cmd = newSqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = select distinct tbGoodsInfo.ClassID,tbStore.StoreID,tbGoodsInfo.GoodsUnit from tbGoodsInfo ,tbGoodsClass,tbStore where tbGoodsInfo.ClassID=tbGoodsClas
43、s.ClassID and tbStore.StoreID=tbGoodsInfo.StoreID; cmd.Connection = cnn; cnn.Open();SqlDataReader dr; dr = cmd.ExecuteReader();if (dr.HasRows) while (dr.Read() cmbClassID.Items.Add(drClassID.ToString().Trim(); cmbStoreID.Items.Add (drStoreID.ToString ().Trim (); cmbGUnit.Items .Add (drGoodsUnit.ToSt
44、ring ().Trim (); cmbClassID.Sorted=true ; cmbClassID.Sorted=true; cmbGUnit.Sorted = true; else MessageBox.Show(表中無記錄!, 提示, MessageBoxButtons.YesNo, MessageBoxIcon.Information); dr.Close(); cnn.Close(); cnn.Dispose(); privatevoid btnCancel_Click(object sender, EventArgs e) this.Close(); privatevoid OperateRecord(string sSQL)/記錄的添加、修改、刪除 DbOperator clsC = newDbOperator();SqlConnection cnn = clsC.GetCon();SqlCommand cmd = newSqlCommand(); cmd.CommandText = sSQL; cmd.CommandType = CommandTyp
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度醫(yī)院門診部承包經(jīng)營服務(wù)合同3篇
- 2025年度海洋工程承包勞務(wù)服務(wù)協(xié)議3篇
- 2025年物業(yè)公司物業(yè)費(fèi)收入權(quán)轉(zhuǎn)讓合同3篇
- 2025版高端景觀工程毛石材料供應(yīng)合作協(xié)議4篇
- XX公司2024年度采購協(xié)議樣本版B版
- 二零二五版數(shù)據(jù)中心網(wǎng)絡(luò)安全設(shè)備安裝協(xié)議2篇
- 二零二五年度鐵路客票運(yùn)輸合同樣本3篇
- 2024綠色照明推廣與實(shí)施合同
- 游戲化教學(xué)法在小學(xué)生閱讀能力培養(yǎng)中的應(yīng)用
- 文化背景下創(chuàng)新金融產(chǎn)品的市場反應(yīng)研究
- 2024年國家公務(wù)員考試公共基礎(chǔ)知識復(fù)習(xí)題庫及答案(共三套)
- 《社會工作實(shí)務(wù)》全冊配套完整課件3
- 單位違反會風(fēng)會書檢討書
- 2024年4月自考00832英語詞匯學(xué)試題
- 《電力用直流電源系統(tǒng)蓄電池組遠(yuǎn)程充放電技術(shù)規(guī)范》
- 《哪吒之魔童降世》中的哪吒形象分析
- 信息化運(yùn)維服務(wù)信息化運(yùn)維方案
- 汽車修理廠員工守則
- 公安交通管理行政處罰決定書式樣
- 10.《運(yùn)動技能學(xué)習(xí)與控制》李強(qiáng)
- 1神經(jīng)外科分級護(hù)理制度
評論
0/150
提交評論