管理信息系统ERP系统库存子系统设计课设代码

2018-10-31 13:49

主界面程序

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 SJZU.SWEIMS.GUI.SWEIMS {

public partial class Frm_Main : Form {

public Frm_Main() {

InitializeComponent(); }

private void Frm_Main_Load(object sender, 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, 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 删除仓库信息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.Text;

using System.Windows.Forms;

using SJZU.SWEIMS.BusinessModel; using SJZU.SWEIMS.BusinessLogic; namespace SJZU.SWEIMS.GUI.SWEIMS {

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(object sender, EventArgs e) {

if (string.IsNullOrEmpty(txtWarehouseCode.Text.Trim())) {

MessageBox.Show(\请将数据完整输入!\, \提示\, MessageBoxButtons.OK); } else {

WarehouseManage warehouseManage = new WarehouseManage();

WarehouseTable warehouseTable = new WarehouseTable(); 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(\));

warehouseTable.Summary = (string)txtSummary.Text; int i =

warehouseManage.AddWarehouseTable(warehouseTable); if (i > 0) {

MessageBox.Show(\已插入\ + i + \条记录!\, \提示\, MessageBoxButtons.OK); } else {

MessageBox.Show(\插入失败!\, \提示\, MessageBoxButtons.OK); }

} }

//取消按钮事件

private void btnCanel_Click(object sender, EventArgs e) {

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;

}

//退出按钮事件

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.BusinessLogic; namespace SJZU.SWEIMS.GUI.SWEIMS {

public partial class Frm_Warehouse_Delete : Form {

public Frm_Warehouse_Delete() {

InitializeComponent(); }

//点开删除界面时,向下拉菜单中加载可选的仓库编号 private void Frm_Warehouse_Delete_Load(object sender, EventArgs e)

{

AddWarehouseCode(); }

private void AddWarehouseCode() {

cboWarehouseCode.DataSource = new

WarehouseManage().GetWarehouseCode();

cboWarehouseCode.DisplayMember = \; }

//查询选择的仓库信息

private void btnQuery_Click(object sender, 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(cboWarehouseCode.Text)) {

MessageBox.Show(\请选择出库单编号!\); } else {

int i = new

WarehouseManage().DeleteWarehouse(cboWarehouseCode.Text); MessageBox.Show(\已经删除\+i+\条记录!\);

dgvWarehouseDetails.DataSource = null; 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; using SJZU.SWEIMS.BusinessLogic; using System.Data.SqlClient; using SJZU.SWEIMS.DBUtility;

namespace SJZU.SWEIMS.GUI.SWEIMS {

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)

{

cboWarehouseCode.DataSource = warehouseManage.GetWarehouseCode();

cboWarehouseCode.DisplayMember = \; }

//查询仓库信息

private void btnQuery_Click(object sender, EventArgs e) {

if (string.IsNullOrEmpty(cboWarehouseCode.Text)) {

MessageBox.Show(\请选择要查询的仓库编号!\); } else {

string warehouseCode = cboWarehouseCode.Text; string strsql = \WAREHOUSECODE = \ + warehouseCode;

string connectionString = SQLHelper._connectionString; SqlConnection conn = new

SqlConnection(connectionString);

adapter = new SqlDataAdapter(strsql, conn); SqlCommandBuilder builder = new 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(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.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; namespace SJZU.SWEIMS.GUI.SWEIMS {

public partial class Frm_Warehouse_Query : Form {

public Frm_Warehouse_Query() {

InitializeComponent(); }

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(\));

int endTime = int.Parse(dtpEnd.Value.ToString(\)); if (startTime > endTime) {

MessageBox.Show(\开始时间不能晚于结束时间!\); } else {

//按时间查询,仓库编号和负责人都不是查询条件 if (cbWarehouseCode.Checked == false && cbDirector.Checked == false) {

dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime); }

//按时间和仓库编号查询

else if (cbWarehouseCode.Checked == true && cbDirector.Checked == false) {

string warehouseCode = txtWarehouseCode.Text; if (string.IsNullOrEmpty(warehouseCode.Trim())) {

MessageBox.Show(\请输入仓库编号!\); } else

{

dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode);

} }

//按时间和负责人查询

else 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,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(\所选条件不能为空!\); } 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 SJZU.SWEIMS.DBUtility;

using SJZU.SWEIMS.BusinessModel; using System.Data;

namespace SJZU.SWEIMS.BusinessLogic {

public class WarehouseManage {

//向数据库WAREHOUSE表中添加仓库数据

public int AddWarehouseTable(WarehouseTable warehouseTable) {

string strsql = \ + \ + \ + \ + \ + \

+ \ + \ + \ + \

+ \ + \ + \ + \ + \ + \

+ \ + \ + \ + \;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, warehouseTable.WarehouseCode),

new SqlParameter(\, warehouseTable.WarehouseName),

new SqlParameter(\, warehouseTable.Property) ,

new SqlParameter(\, warehouseTable.Department),

new

SqlParameter(\,warehouseTable.Address), new

SqlParameter(\,warehouseTable.Tel),

new SqlParameter(\, warehouseTable.Director),

new SqlParameter(\, warehouseTable.CreateBy),

new

SqlParameter(\,warehouseTable.CreateTime), new

SqlParameter(\,warehouseTable.Summary)};

int i = SQLHelper.ExecuteSql(strsql,commandParms); return i; }

//取得仓库编号

public DataTable GetWarehouseCode() {

string strSql = \; return SQLHelper.Query(strSql).Tables[0]; }

//根据仓库编号查询仓库详细信息

public DataTable GetWarehouseTable(string warehouseCode) {

string strSql = \* from WAREHOUSE where WAREHOUSECODE = @WAREHOUSECODE\;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, warehouseCode) };

return SQLHelper.Query(strSql, commandParms).Tables[0]; }

//根据仓库编号删除仓库信息

public int DeleteWarehouse(string warehouseCode) {

string strSql = \= @WAREHOUSECODE\;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, warehouseCode) };

return SQLHelper.ExecuteSql(strSql, commandParms); }

//根据时间阶段查询仓库信息

public DataTable GetWarehouseTable(int startTime, int endTime) {

string strSql = \* from WAREHOUSE where CREATETIME >= @startTime and CREATETIME <= @endTime\;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, startTime), new SqlParameter(\, endTime) };

return SQLHelper.Query(strSql, commandParms).Tables[0]; }

//根据时间阶段和仓库编号查询

public DataTable GetWarehouseTable(int startTime, int endTime, string warehouseCode) {

string strSql = \* from WAREHOUSE where CREATETIME >= @startTime and CREATETIME <= @endTime and WAREHOUSECODE=@warehouseCode\; SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, startTime), new SqlParameter(\, endTime),new SqlParameter(\, warehouseCode)};

return SQLHelper.Query(strSql, commandParms).Tables[0]; }

//根据时间阶段和负责人查询

public DataTable GetWarehouseTable(int startTime, int endTime,string director,int i) {

string strSql = \* from WAREHOUSE where CREATETIME >= @startTime and CREATETIME <= @endTime and DIRECTOR=@director\;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, startTime), new SqlParameter(\, endTime), new SqlParameter(\, director) };

return SQLHelper.Query(strSql, commandParms).Tables[0]; }

//根据时间阶段,仓库编号和负责人查询

public DataTable GetWarehouseTable(int startTime, int endTime, string warehouseCode,string director) {

string strSql = \* from WAREHOUSE where CREATETIME >= @startTime and CREATETIME <= @endTime and WAREHOUSECODE=@warehouseCode and DIRECTOR =@director\;

SqlParameter[] commandParms = new SqlParameter[] { new SqlParameter(\, startTime), new SqlParameter(\,

endTime), new SqlParameter(\, warehouseCode), new SqlParameter(\, director)};

return SQLHelper.Query(strSql, commandParms).Tables[0]; } } }

模型层代码

using System;

using System.Collections.Generic; using System.Text;

namespace SJZU.SWEIMS.BusinessModel {

public class WarehouseTable {

private string warehouseCode;

public string WarehouseCode {

get { return warehouseCode; } set { warehouseCode = value; } }

private string warehouseName;

public string WarehouseName {

get { return warehouseName; } set { warehouseName = value; } }

private string property;

public string Property {

get { return property; } set { property = value; } }

private string department;

public string Department {

get { return department; } set { department = value; } }

private string address;

public string Address {

get { return address; } set { address = value; } }

private string tel;

public string Tel {

get { return tel; } set { tel = value; } }

private string director;

public string Director {

get { return director; } set { director = value; } }

private string createBy;

public string CreateBy {

get { return createBy; } set { createBy = value; } }

private int createTime;

public int CreateTime {

get { return createTime; } set { createTime = value; } }

private string summary;

public string Summary {

get { return summary; } set { summary = value; } }

} }


管理信息系统ERP系统库存子系统设计课设代码.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:成都中考B卷冲刺训练完成对话(05-15年真题+模拟)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: