管理信息系统ERP系统库存子系统设计课设代码.docx
《管理信息系统ERP系统库存子系统设计课设代码.docx》由会员分享,可在线阅读,更多相关《管理信息系统ERP系统库存子系统设计课设代码.docx(21页珍藏版)》请在冰点文库上搜索。
管理信息系统ERP系统库存子系统设计课设代码
主界面程序
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSJZU;
namespaceSJZU.SWEIMS.GUI.SWEIMS
{
publicpartialclassFrm_Main:
Form
{
publicFrm_Main()
{
InitializeComponent();
}
privatevoidFrm_Main_Load(objectsender,EventArgse)
{
toolStripStatusLabel6.Text=DateTime.Now.ToString();
}
privatevoid查询分析ToolStripMenuItem3_Click(objectsender,EventArgse)
{
Frm_Warehouse_Queryfrm_Warehouse_Query=newFrm_Warehouse_Query();
frm_Warehouse_Query.ShowDialog();
}
privatevoid添加仓库信息ToolStripMenuItem_Click(objectsender,EventArgse)
{
Frm_Warehouse_Addfrm_Warehouse_Add=newFrm_Warehouse_Add();
frm_Warehouse_Add.ShowDialog();
}
privatevoid修改仓库信息ToolStripMenuItem_Click(objectsender,EventArgse)
{
Frm_Warehouse_Updatefrm_Warehouse_Update=newFrm_Warehouse_Update();
frm_Warehouse_Update.ShowDialog();
}
privatevoid删除仓库信息ToolStripMenuItem_Click(objectsender,EventArgse)
{
Frm_Warehouse_Deletefrm_Warehouse_Delete=newFrm_Warehouse_Delete();
frm_Warehouse_Delete.ShowDialog();
}
}
}
仓库信息添加界面
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSJZU.SWEIMS.BusinessModel;
usingSJZU.SWEIMS.BusinessLogic;
namespaceSJZU.SWEIMS.GUI.SWEIMS
{
publicpartialclassFrm_Warehouse_Add:
Form
{
publicFrm_Warehouse_Add()
{
InitializeComponent();
}
privatevoidFrm_Warehouse_Add_Load(objectsender,EventArgse)
{
}
//添加按钮事件
privatevoidbtnAdd_Click(objectsender,EventArgse)
{
if(string.IsNullOrEmpty(txtWarehouseCode.Text.Trim()))
{
MessageBox.Show("请将数据完整输入!
","提示",MessageBoxButtons.OK);
}
else
{
WarehouseManagewarehouseManage=newWarehouseManage();
WarehouseTablewarehouseTable=newWarehouseTable();
warehouseTable.WarehouseCode=(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;
warehouseTable.Director=(string)txtDirector.Text;
warehouseTable.CreateBy=(string)txtCreateBy.Text;
warehouseTable.CreateTime=int.Parse(dtpCreateTime.Value.ToString("yyyyMMdd"));
warehouseTable.Summary=(string)txtSummary.Text;
inti=warehouseManage.AddWarehouseTable(warehouseTable);
if(i>0)
{
MessageBox.Show("已插入"+i+"条记录!
","提示",MessageBoxButtons.OK);
}
else
{
MessageBox.Show("插入失败!
","提示",MessageBoxButtons.OK);
}
}
}
//取消按钮事件
privatevoidbtnCanel_Click(objectsender,EventArgse)
{
txtWarehouseCode.Text=null;
txtWarehouseName.Text=null;
txtProperty.Text=null;
txtDepartment.Text=null;
txtAddress.Text=null;
txtTel.Text=null;
txtDirector.Text=null;
txtCreateBy.Text=null;
txtSummary.Text=null;
}
//退出按钮事件
privatevoidbtnExit_Click(objectsender,EventArgse)
{
this.Close();
}
}
}
仓库信息删除界面
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSJZU.SWEIMS.BusinessLogic;
namespaceSJZU.SWEIMS.GUI.SWEIMS
{
publicpartialclassFrm_Warehouse_Delete:
Form
{
publicFrm_Warehouse_Delete()
{
InitializeComponent();
}
//点开删除界面时,向下拉菜单中加载可选的仓库编号
privatevoidFrm_Warehouse_Delete_Load(objectsender,EventArgse)
{
AddWarehouseCode();
}
privatevoidAddWarehouseCode()
{
cboWarehouseCode.DataSource=newWarehouseManage().GetWarehouseCode();
cboWarehouseCode.DisplayMember="WAREHOUSECODE";
}
//查询选择的仓库信息
privatevoidbtnQuery_Click(objectsender,EventArgse)
{
if(string.IsNullOrEmpty(cboWarehouseCode.Text))
{
MessageBox.Show("请选择出库单编号!
");
}
else
{
dgvWarehouseDetails.DataSource=newWarehouseManage().GetWarehouseTable(cboWarehouseCode.Text);
}
}
//删除选中的仓库
privatevoidbtnDelete_Click(objectsender,EventArgse)
{
if(string.IsNullOrEmpty(cboWarehouseCode.Text))
{
MessageBox.Show("请选择出库单编号!
");
}
else
{
inti=newWarehouseManage().DeleteWarehouse(cboWarehouseCode.Text);
MessageBox.Show("已经删除"+i+"条记录!
");
dgvWarehouseDetails.DataSource=null;
AddWarehouseCode();
}
}
//点击退出,关闭窗口
privatevoidbtnExit_Click(objectsender,EventArgse)
{
this.Close();
}
}
}
仓库信息更新界面
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSJZU.SWEIMS.BusinessModel;
usingSJZU.SWEIMS.BusinessLogic;
usingSystem.Data.SqlClient;
usingSJZU.SWEIMS.DBUtility;
namespaceSJZU.SWEIMS.GUI.SWEIMS
{
publicpartialclassFrm_Warehouse_Update:
Form
{
WarehouseManagewarehouseManage=newWarehouseManage();
SqlDataAdapteradapter;
DataTabletable;
publicFrm_Warehouse_Update()
{
InitializeComponent();
}
privatevoidFrm_Warehouse_Update_Load(objectsender,EventArgse)
{
cboWarehouseCode.DataSource=warehouseManage.GetWarehouseCode();
cboWarehouseCode.DisplayMember="WAREHOUSECODE";
}
//查询仓库信息
privatevoidbtnQuery_Click(objectsender,EventArgse)
{
if(string.IsNullOrEmpty(cboWarehouseCode.Text))
{
MessageBox.Show("请选择要查询的仓库编号!
");
}
else
{
stringwarehouseCode=cboWarehouseCode.Text;
stringstrsql="select*fromWAREHOUSEwhereWAREHOUSECODE="+warehouseCode;
stringconnectionString=SQLHelper._connectionString;
SqlConnectionconn=newSqlConnection(connectionString);
adapter=newSqlDataAdapter(strsql,conn);
SqlCommandBuilderbuilder=newSqlCommandBuilder(adapter);
adapter.InsertCommand=builder.GetInsertCommand();
adapter.DeleteCommand=builder.GetDeleteCommand();
adapter.UpdateCommand=builder.GetUpdateCommand();
table=newDataTable();
adapter.Fill(table);
dgvWarehouseDetails.DataSource=table;
}
}
privatevoidbtnUpdate_Click(objectsender,EventArgse)
{
dgvWarehouseDetails.EndEdit();
try
{
adapter.Update(table);
MessageBox.Show("保存成功!
");
}
catch(SqlExceptionerr)
{
MessageBox.Show(err.Message,"保存成功!
");
}
}
privatevoidbtnExit_Click(objectsender,EventArgse)
{
this.Close();
}
}
}
仓库信息查询界面
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSJZU.SWEIMS.BusinessModel;
usingSJZU.SWEIMS.BusinessLogic;
namespaceSJZU.SWEIMS.GUI.SWEIMS
{
publicpartialclassFrm_Warehouse_Query:
Form
{
publicFrm_Warehouse_Query()
{
InitializeComponent();
}
privatevoidFrm_Warehouse_Query_Load(objectsender,EventArgse)
{
}
//按选择的条件查询仓库信息
privatevoidbtnQuery_Click(objectsender,EventArgse)
{
intstartTime=int.Parse(dtpStart.Value.ToString("yyyyMMdd"));
intendTime=int.Parse(dtpEnd.Value.ToString("yyyyMMdd"));
if(startTime>endTime)
{
MessageBox.Show("开始时间不能晚于结束时间!
");
}
else
{
//按时间查询,仓库编号和负责人都不是查询条件
if(cbWarehouseCode.Checked==false&&cbDirector.Checked==false)
{
dgvWarehouseDetails.DataSource=newWarehouseManage().GetWarehouseTable(startTime,endTime);
}
//按时间和仓库编号查询
elseif(cbWarehouseCode.Checked==true&&cbDirector.Checked==false)
{
stringwarehouseCode=txtWarehouseCode.Text;
if(string.IsNullOrEmpty(warehouseCode.Trim()))
{
MessageBox.Show("请输入仓库编号!
");
}
else
{
dgvWarehouseDetails.DataSource=newWarehouseManage().GetWarehouseTable(startTime,endTime,warehouseCode);
}
}
//按时间和负责人查询
elseif(cbWarehouseCode.Checked==false&&cbDirector.Checked==true)
{
stringdirector=txtDirector.Text;
if(string.IsNullOrEmpty(director.Trim()))
{
MessageBox.Show("请输入负责人!
");
}
else
{
dgvWarehouseDetails.DataSource=newWarehouseManage().GetWarehouseTable(startTime,endTime,director,9);
}
}
//按时间,仓库编号,负责人查询
elseif(cbWarehouseCode.Checked==true&&cbDirector.Checked==true)
{
stringwarehouseCode=txtWarehouseCode.Text;
stringdirector=txtDirector.Text;
if(string.IsNullOrEmpty(warehouseCode.Trim())||string.IsNullOrEmpty(director.Trim()))
{
MessageBox.Show("所选条件不能为空!
");
}
else
{
dgvWarehouseDetails.DataSource=newWarehouseManage().GetWarehouseTable(startTime,endTime,warehouseCode,director);
}
}
}
}
privatevoidbtnExit_Click(objectsender,EventArgse)
{
this.Close();
}
}
}
逻辑层代码
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Text;
usingSystem.Data.SqlClient;
usingSJZU.SWEIMS.DBUtility;
usingSJZU.SWEIMS.BusinessModel;
usingSystem.Data;
namespaceSJZU.SWEIMS.BusinessLogic
{
publicclassWarehouseManage
{
//向数据库WAREHOUSE表中添加仓库数据
publicintAddWarehouseTable(WarehouseTablewarehouseTable)
{
stringstrsql="insertintoWAREHOUSE(WAREHOUSECODE,"
+"WAREHOUSENAME,"
+"PROPERTY,"
+"DEPARTMENT,"
+"ADDRESS,"
+"TEL,"
+"DIRECTOR,"
+"CREATEBY,"
+"CREATETIME,"
+"SUMMARY)"
+"VALUES(@WAREHOUSECODE,"
+"@WAREHOUSENAME,"
+"@PROPERTY,"
+"@DEPARTMENT,"
+"@ADDRESS,"
+"@TEL,"
+"@DIRECTOR,"
+"@CREATEBY,"
+"@CREATETIME,"
+"@SUMMARY)";
SqlParameter[]commandParms=newSqlParameter[]{newSqlParameter("@WAREHOUSECODE",warehouseTable.WarehouseCode),
newSqlParameter("@WAREHOUSENAME",warehouseTable.WarehouseName),
newSqlParameter("@PROPERTY",warehouseTable.Property),
newSqlParameter("@DEPARTMENT",warehouseTable.Department),
newSqlParameter("@ADDRESS",warehouseTable.Address),
newSqlParameter("@TEL",warehouseTable.Tel),
newSqlParameter("@DIRECTOR",warehouseTable.