管理信息系统ERP系统库存子系统设计课设代码_第1页
管理信息系统ERP系统库存子系统设计课设代码_第2页
管理信息系统ERP系统库存子系统设计课设代码_第3页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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;public partial class Frm_Main: Form _public Frm_Main() _In itializeComp onen t();private void Frm_Main_Load( object sender, Ev

2、entArgs e)toolStripStatusLabel6.Text =DateTime.Now.ToStri ng();private void 查询分析 ToolStripMenultem3_Click( object sender,Eve ntArgs e)Frm_Warehouse_Querfrm_Warehouse_Query = newFrm_Warehouse_Quer();frm_Warehouse_Query.ShowDialog(); 一 一private void 添加仓库信息 ToolStripMenultem_Click( object sender, Eve n

3、tArgs e)Frm_Warehouse_Addrm_Warehouse_Add = newFrm_Warehouse_Ad(d;frm_Warehouse_Add.ShowDialog(); 一 一private void 修改仓库信息 ToolStripMenultem_Click( object sender, Eve ntArgs e)Frm_Warehouse_Updatfrm_Warehouse_Update = new Frm_Warehouse_Update);frm_Warehouse_Update.ShowDialog();private void 删除仓库信息 Tool

4、StripMenultem_Click( object sender,Eve ntArgs e)Frm_Warehouse_Delete frm_Warehouse_Delete = newFrm_Warehouse_Delete(); frm_Warehouse_Delete.ShowDialog(); 一 一仓库信息添加界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;usin

5、g System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;public partial class Frm_Warehouse_Add Formpublic Frm_Warehouse_Add() 一 一In itializeComp onen t();private void Frm_Warehouse_Add_Load(bject sender, EventArgs e)/添加按钮事件private void btnAdd_Click( object sender, Even

6、tArgs e)if ( stringsNullOrEmpty(txtWarehouseCode.Text.Trim()MessageBoxShow(”请将数据完整输入!,提示, MessageBoxButt on s.OK);elseWarehouseMa nagwarehouseMa nage = new WarehouseMan agWarehouseTable warehouseTable = new WarehouseTable() warehouseTable.WarehouseCode =(string )txtWarehouseCode.Text;warehouseTable.

7、WarehouseName =string )txtProperty.Text;string )txtAddress.Text;string )txtTel.Text;string )txtDirector.Text; string )txtCreateBy.Text;yyyyMMdd);string )txtSummary.Text;(string )txtWarehouseName.Text; warehouseTable.Property =( warehouseTable.Departme nt =(string )txtDepartment.Text; warehouseTable.

8、Address =( warehouseTable.Tel =( warehouseTable.Director =( warehouseTable.CreateBy =( warehouseTable.CreateTime = int .Parse(dtpCreateTime.Value.ToString( warehouseTable.Summary =( int i = warehouseMa nage.AddWarehouseTable(warehouseTable);if (i 0)MessageBoxShow(” 已插入+ i +条记录!,提示,MessageBoxButt on

9、s.OK);elseMessageBoxShow(” 插入失败!,提示, MessageBoxButt on s.OK);/取消按钮事件object sender,Eve ntArgs e)private void btnCan el_Click(null ; null ; null ;null ;txtWarehouseCode.Text = txtWarehouseName.Text = txtProperty.Text = txtDepartme nt.Text =nullnull ;nullnulltxtAddress.Text = txtTel.Text = txtDirector.

10、Text = txtCreateBy.Text =txtSummary.Text =null ;/退出按钮事件private void btnExit_Click(object sender,EventArgs 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

11、.SWEIMS.BusinessLogic;public partial class Frm_Warehouse_Delete : Formpublic Frm_Warehouse_Delete() 一 一In itializeComp onen t();点开删除界面时,向下拉菜单中加载可选的仓库编号private void Frm_Warehouse_Delete_Load(object sender, EventArgse)AddWarehouseCode();private void AddWarehouseCode() newcboWarehouseCode.DataSource =W

12、arehouseMa nag().GetWarehouseCode(); cboWarehouseCode.DisplayMember =WAREHOUSECQDE/查询选择的仓库信息private void btnQuery_Click( object sender, EventArgs e) _if ( string .IsNullQrEmpty(cboWarehouseCode.Text)MessageBo)6how(”请选择出库单编号!);elsedgvWarehouseDetails.DataSource =newWarehouseMa nage.GetWarehouseTable(

13、cboWarehouseCode.Text);/删除选中的仓库private void btnDelete_Click(object sender, EventArgs e) _if ( string .IsNullQrEmpty(cboWarehouseCode.Text)MessageBo)6how(”请选择出库单编号!);elseint i = newWarehouseMa nage.DeleteWarehouse(cboWarehouseCode.Text);MessageBo)6how(” 已经删除+i+条记录!);dgvWarehouseDetails.DataSource =nu

14、ll ;AddWarehouseCode();点击退出,关闭窗口private void btnExit_Click(object sender, EventArgs 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;

15、using SJZU.SWEIMS.BusinessLogic;using System.Data.SqlClient;using SJZU.SWEIMS.DBUtility;public partial class Frm_Warehouse_Update Form 一 一WarehouseMa nagwarehouseMa nage = new WarehouseMa nagSqlDataAdapter adapter;DataTable table;public Frm_Warehouse_Update()In itializeComp onen t();private void Frm

16、_Warehouse_Update_Loadobject sender, EventArgse)cboWarehouseCode.DataSource =warehouseMa nage.GetWarehouseCode();cboWarehouseCode.DisplayMember =WAREHOUSECQDE/查询仓库信息private void btnQuery_Click( object sender, EventArgs e) _if ( string .IsNullQrEmpty(cboWarehouseCode.Text)MessageBo)6how(”请选择要查询的仓库编号!

17、);elsestri ng warehouseCode = cboWarehouseCode.Text;stri ng strsql = select * from WAREHOUSE whereWAREHQUSECQDE+=warehouseCode;stri ng connection Stri ng= SQLHelper._c onnection Stri ng;SqlConnection conn = newSqlConnection (connectionString);adapter =new SqlDataAdapter (strsql, conn);SqlComma ndBui

18、lder builder =newSqlComma ndBuilder(adapter);adaptern sertComma nd = builder.Get In sertComma nd(); adapter.DeleteComma nd = builder.GetDeleteComma nd(); adapter.UpdateComma nd = builder.GetUpdateComma nd(); table =new DataTable ();adapter.Fill(table);dgvWarehouseDetails.DataSource = table;private v

19、oid btnUpdate_Click( object sender, EventArgs e) _dgvWarehouseDetails.E ndEdit();tryadapter.Update(table);MessageBo)6how(” 保存成功!);catch ( SqlException err)MessageBo)6how(err.Message,保存成功!);private void btnExit_Click(object sender,EventArgs e) _this .Close();仓库信息查询界面using System;using System.Collecti

20、ons.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;public partial class Frm_Warehouse_Query Form 一 一public Frm_Warehouse_Query() 一 一In itializeComp onen t();privat

21、e void Frm_Warehouse_Query_Loadobject sender, EventArgse)/按选择的条件查询仓库信息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 endTime)MessageBo)6how(开始时间不能晚于结束时间!);els

22、e/按时间查询,仓库编号和负责人都不是查询条件if (cbWarehouseCode.Checked = false &cbDirector.Checked = false )dgvWarehouseDetails.DataSource =newWarehouseMa nag(e.GetWarehouseTable(startTime, en dTime);/按时间和仓库编号查询else if (cbWarehouseCode.Checked = true &cbDirector.Checked = false )stri ng warehouseCode = txtWarehouseCode

23、.Text;if ( stringsNullOrEmpty(warehouseCode.Trim()MessageBo)6how(请输入仓库编号!);elsedgvWarehouseDetails.DataSource =newWarehouseMa nag(e.GetWarehouseTable(startTime, en dTime, warehouseCode);/按时间和负责人查询else if (cbWarehouseCode.Checked = false & cbDirector.Checked = true )stri ng director = txtDirector.Tex

24、t;if ( stringsNullOrEmpty(director.Trim()MessageBo)6how(” 请输入负责人!);elsedgvWarehouseDetails.DataSource =newWarehouseMa nag(e.GetWarehouseTable(startTime, en dTime, director,9);/按时间,仓库编号,负责人查询else if (cbWarehouseCode.Checked = true & cbDirector.Checked = true )stri ng warehouseCode = txtWarehouseCode.

25、Text; stri ng director = txtDirector.Text;if ( stringsNullOrEmpty(warehouseCode.Trim() | stringsNullOrEmpty(director.Trim()MessageBo)6how(”所选条件不能为空!);elsedgvWarehouseDetails.DataSource =newWarehouseMa nag(e.GetWarehouseTable(startTime, en dTime, warehouseCode,director);private void btnExit_Click( ob

26、ject sender,EventArgs e)this .Close();逻辑层代码using System;using System.Collections.Generic;using System.Text;using System.Data.SqlClient;using SJZU.SWEIMS.DBUtility;using SJZU.SWEIMS.BusinessModel; using System.Data;n amespaceSJZU.SWEIMS.Busi nessLogic public class WarehouseManage /向数据库WAREHOU表中添加仓库数据

27、public int AddWarehouseTable( WarehouseTable warehouseTable)stri ng strsql =+II+in sert into WAREHOUSE(WAREHOUSECODE, WAREHOUSENAME, PROPERTY, DEPARTMENT, ADDRESS,TEL, DIRECTOR, CREATEBY, CREATETIME, SUMMARY)VALUES(WAREHOUSECODE, WAREHOUSENAME, PROPERTY, DEPARTMENT, ADDRESS,TEL, DIRECTOR, CREATEBY,

28、CREATETIME, SUMMAR Y)SqIParameter commandParms = new SqlParameter newSqlParameter (WAREHOUSEC,ODfiehouseTable.WarehouseCode),new SqIParameter (WAREHOUSENAME warehouseTable.WarehouseName),new SqlParameter (PROPERTY warehouseTable.Property),new SqlParameter (DEPARTMENT warehouseTable.Departme nt),newS

29、qlParameter (ADDRES,warehouseTable.Address),newSqlParameter (TELwarehouseTable.Tel),new SqlParameter (DIRECTOR warehouseTable.Director),new SqlParameter (CREATEB,Y warehouseTable.CreateBy),newSqlParameter (CREATETIM,warehouseTable.CreateTime),newSqlParameter (SUMMARY3rehouseTable.Summary);int i = SQ

30、LHelper.ExecuteSql(strsql,commandParms); return i;/取得仓库编号public DataTable GetWarehouseCode()stri ng strSql = select WAREHOUSECODE from WAREHOUSE return SQLHelper.Query(strSql).TablesO;/根据仓库编号查询仓库详细信息public DataTable GetWarehouseTable( string warehouseCode)stri ng strSql = select * from WAREHOUwEere

31、WAREHOUSECODE =WAREHOUSECODESqlParameter commandParms = new SqlParameter new SqlParameter (WAREHOUSEC,ODEehouseCode) ;return SQLHelper.Query(strSql, comma ndParms).TablesO;/根据仓库编号删除仓库信息public int DeleteWarehouse( string warehouseCode)stri ng strSql = delete from WAREHOUSE where WAREHOUSECODE =WAREHO

32、USECODESqlParameter commandParms = new SqlParameter new SqlParameter (WAREHOUSEC,ODEehouseCode) ;return SQLHelper.ExecuteSql(strSql, comma ndParms);/根据时间阶段查询仓库信息public DataTable GetWarehouseTable( int startTime, int endTime)stri ng strSql = select * from WAREHOUWEere CREATETIME= startTime and CREATE

33、TIME = en dTimeSqlParameter commandParms = new SqlParameter new SqlParameter (startTime , startTime), new SqlParameter (endTime en dTime) ;return SQLHelper.Query(strSql, comma ndParms).TablesO;/根据时间阶段和仓库编号查询public DataTable GetWarehouseTable( int startTime, int endTime,stri ng warehouseCode)stri ng

34、strSql = select * from WAREHOUwEere CREATETIME= startTime and CREATETIM= en dTimea nd WAREHOUSECODE=warehouse CodeSqlParameter commandParms = new SqlParameter new SqlParameter (startTime , startTime), new SqlParameter (endTime endTime), new SqlParameter (warehouseCode warehouseCode);return SQLHelper

35、.Query(strSql, comma ndParms).TablesO;/根据时间阶段和负责人查询public DataTable GetWarehouseTable( int startTime, intendTime, string director, int i)stri ng strSql = select * from WAREHOUwEere CREATETIME= startTime and CREATETIME = en dTime and DIRECTOR=directorSqlParameter commandParms = new SqlParameter new S

36、qlParameter (startTime , startTime), new SqlParameter (endTime endTime), new SqlParameter (director , director) ;return SQLHelper.Query(strSql, comma ndParms).TablesO;/根据时间阶段,仓库编号和负责人查询public DataTable GetWarehouseTable( int startTime, int endTime,string warehouseCode, string director)stri ng strSql = select * from WAREHOUwEere CREATETIME= startTime and CREATETIME = en dTime and WAREHOUSECODE=warehouseCode and DIRECTOR =director;SqlParameter commandParms = new SqlParameter new SqlParameter (startTime , startTime), new SqlParameter (end

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论