MRPHistory.cs
资源名称:VCSDB.rar [点击查看]
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:18k
源码类别:
企业管理
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 生产管理系统
- {
- /// <summary>
- /// MRPHistory 的摘要说明。
- /// </summary>
- public class MRPHistory : System.Windows.Forms.Form
- {
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.DataGrid dataGrid1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Button btnSearch;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox txt1;
- private System.Windows.Forms.TextBox txt3;
- private System.Windows.Forms.TextBox txt2;
- private System.Data.SqlClient.SqlDataAdapter da1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- private System.Data.SqlClient.SqlConnection sqlConnection1;
- private 生产管理系统.DataSet3 dataSet31;
- private System.Data.DataView dataView1;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.TextBox textBox2;
- private System.Windows.Forms.TextBox txt5;
- private System.Windows.Forms.TextBox txt4;
- private System.Windows.Forms.TextBox textBox3;
- private System.Windows.Forms.TextBox txt6;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.TextBox textBox4;
- private System.Windows.Forms.TextBox textBox5;
- private System.Windows.Forms.TextBox textBox6;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Label label12;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public MRPHistory()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MRPHistory));
- this.da1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.dataView1 = new System.Data.DataView();
- this.dataSet31 = new 生产管理系统.DataSet3();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.txt5 = new System.Windows.Forms.TextBox();
- this.txt4 = new System.Windows.Forms.TextBox();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.txt6 = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.textBox5 = new System.Windows.Forms.TextBox();
- this.textBox6 = new System.Windows.Forms.TextBox();
- this.label10 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.dataGrid1 = new System.Windows.Forms.DataGrid();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.txt3 = new System.Windows.Forms.TextBox();
- this.label6 = new System.Windows.Forms.Label();
- this.btnSearch = new System.Windows.Forms.Button();
- this.txt2 = new System.Windows.Forms.TextBox();
- this.label7 = new System.Windows.Forms.Label();
- this.txt1 = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // da1
- //
- this.da1.SelectCommand = this.sqlSelectCommand1;
- this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
- new System.Data.Common.DataTableMapping("Table", "mrp物料需求历史", new System.Data.Common.DataColumnMapping[] {
- new System.Data.Common.DataColumnMapping("物料名称", "物料名称"),
- new System.Data.Common.DataColumnMapping("发布编号", "发布编号"),
- new System.Data.Common.DataColumnMapping("发布时间", "发布时间"),
- new System.Data.Common.DataColumnMapping("物料编号", "物料编号"),
- new System.Data.Common.DataColumnMapping("年份", "年份"),
- new System.Data.Common.DataColumnMapping("计划期", "计划期"),
- new System.Data.Common.DataColumnMapping("期初库存", "期初库存"),
- new System.Data.Common.DataColumnMapping("毛需求", "毛需求"),
- new System.Data.Common.DataColumnMapping("预计入库", "预计入库"),
- new System.Data.Common.DataColumnMapping("预计出库", "预计出库"),
- new System.Data.Common.DataColumnMapping("预计库存", "预计库存"),
- new System.Data.Common.DataColumnMapping("净需求", "净需求"),
- new System.Data.Common.DataColumnMapping("计划产出", "计划产出"),
- new System.Data.Common.DataColumnMapping("计划投入", "计划投入")})});
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "SELECT b.物料名称, a.发布编号, a.发布时间, a.物料编号, a.年份, a.计划期, a.期初库存, a.毛需求, a.预计入库, a.预计出库" +
- ", a.预计库存, a.净需求, a.计划产出, a.计划投入 FROM mrp物料需求历史 a INNER JOIN 物料主文件 b ON a.物料编号 = " +
- "b.物料编号";
- this.sqlSelectCommand1.Connection = this.sqlConnection1;
- //
- // sqlConnection1
- //
- this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=mrpbook;";
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.textBox1);
- this.groupBox2.Controls.Add(this.textBox2);
- this.groupBox2.Controls.Add(this.txt5);
- this.groupBox2.Controls.Add(this.txt4);
- this.groupBox2.Controls.Add(this.textBox3);
- this.groupBox2.Controls.Add(this.txt6);
- this.groupBox2.Controls.Add(this.label2);
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Controls.Add(this.label5);
- this.groupBox2.Controls.Add(this.label8);
- this.groupBox2.Controls.Add(this.label9);
- this.groupBox2.Controls.Add(this.textBox4);
- this.groupBox2.Controls.Add(this.textBox5);
- this.groupBox2.Controls.Add(this.textBox6);
- this.groupBox2.Controls.Add(this.label10);
- this.groupBox2.Controls.Add(this.label11);
- this.groupBox2.Controls.Add(this.label12);
- this.groupBox2.Location = new System.Drawing.Point(0, 64);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(544, 120);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- //
- // textBox1
- //
- this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "年份"));
- this.textBox1.Enabled = false;
- this.textBox1.Location = new System.Drawing.Point(72, 56);
- this.textBox1.Name = "textBox1";
- this.textBox1.ReadOnly = true;
- this.textBox1.TabIndex = 72;
- this.textBox1.Text = "";
- //
- // dataView1
- //
- this.dataView1.Table = this.dataSet31.mrp物料需求历史;
- //
- // dataSet31
- //
- this.dataSet31.DataSetName = "DataSet3";
- this.dataSet31.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // textBox2
- //
- this.textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "物料编号"));
- this.textBox2.Enabled = false;
- this.textBox2.Location = new System.Drawing.Point(72, 26);
- this.textBox2.Name = "textBox2";
- this.textBox2.ReadOnly = true;
- this.textBox2.TabIndex = 71;
- this.textBox2.Text = "";
- //
- // txt5
- //
- this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "计划期"));
- this.txt5.Enabled = false;
- this.txt5.Location = new System.Drawing.Point(256, 56);
- this.txt5.Name = "txt5";
- this.txt5.ReadOnly = true;
- this.txt5.TabIndex = 74;
- this.txt5.Text = "";
- //
- // txt4
- //
- this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "物料名称"));
- this.txt4.Enabled = false;
- this.txt4.Location = new System.Drawing.Point(256, 26);
- this.txt4.Name = "txt4";
- this.txt4.ReadOnly = true;
- this.txt4.TabIndex = 70;
- this.txt4.Text = "";
- //
- // textBox3
- //
- this.textBox3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "期初库存"));
- this.textBox3.Enabled = false;
- this.textBox3.Location = new System.Drawing.Point(72, 88);
- this.textBox3.Name = "textBox3";
- this.textBox3.ReadOnly = true;
- this.textBox3.TabIndex = 69;
- this.textBox3.Text = "";
- //
- // txt6
- //
- this.txt6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "毛需求"));
- this.txt6.Enabled = false;
- this.txt6.Location = new System.Drawing.Point(256, 88);
- this.txt6.Name = "txt6";
- this.txt6.ReadOnly = true;
- this.txt6.TabIndex = 73;
- this.txt6.Text = "";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(33, 61);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(32, 16);
- this.label2.TabIndex = 66;
- this.label2.Text = "年份";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(18, 31);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(56, 16);
- this.label3.TabIndex = 63;
- this.label3.Text = "物料编号";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(216, 62);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(48, 16);
- this.label4.TabIndex = 67;
- this.label4.Text = "计划期";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(203, 30);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(56, 16);
- this.label5.TabIndex = 65;
- this.label5.Text = "物料名称";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(16, 92);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(56, 16);
- this.label8.TabIndex = 64;
- this.label8.Text = "期初库存";
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(216, 93);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(48, 16);
- this.label9.TabIndex = 68;
- this.label9.Text = "毛需求";
- //
- // textBox4
- //
- this.textBox4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "预计库存"));
- this.textBox4.Enabled = false;
- this.textBox4.Location = new System.Drawing.Point(424, 56);
- this.textBox4.Name = "textBox4";
- this.textBox4.ReadOnly = true;
- this.textBox4.TabIndex = 74;
- this.textBox4.Text = "";
- //
- // textBox5
- //
- this.textBox5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "预计出库"));
- this.textBox5.Enabled = false;
- this.textBox5.Location = new System.Drawing.Point(424, 26);
- this.textBox5.Name = "textBox5";
- this.textBox5.ReadOnly = true;
- this.textBox5.TabIndex = 70;
- this.textBox5.Text = "";
- //
- // textBox6
- //
- this.textBox6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "净需求"));
- this.textBox6.Enabled = false;
- this.textBox6.Location = new System.Drawing.Point(424, 88);
- this.textBox6.Name = "textBox6";
- this.textBox6.ReadOnly = true;
- this.textBox6.TabIndex = 73;
- this.textBox6.Text = "";
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(371, 62);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(56, 16);
- this.label10.TabIndex = 67;
- this.label10.Text = "预计库存";
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(373, 32);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(56, 16);
- this.label11.TabIndex = 65;
- this.label11.Text = "预计出库";
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(384, 96);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(56, 16);
- this.label12.TabIndex = 68;
- this.label12.Text = "净需求";
- //
- // dataGrid1
- //
- this.dataGrid1.CaptionVisible = false;
- this.dataGrid1.DataMember = "";
- this.dataGrid1.DataSource = this.dataView1;
- this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid1.Location = new System.Drawing.Point(0, 192);
- this.dataGrid1.Name = "dataGrid1";
- this.dataGrid1.ReadOnly = true;
- this.dataGrid1.Size = new System.Drawing.Size(544, 224);
- this.dataGrid1.TabIndex = 2;
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.txt3);
- this.groupBox1.Controls.Add(this.label6);
- this.groupBox1.Controls.Add(this.btnSearch);
- this.groupBox1.Controls.Add(this.txt2);
- this.groupBox1.Controls.Add(this.label7);
- this.groupBox1.Controls.Add(this.txt1);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Location = new System.Drawing.Point(0, 8);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(544, 56);
- this.groupBox1.TabIndex = 31;
- this.groupBox1.TabStop = false;
- //
- // txt3
- //
- this.txt3.Location = new System.Drawing.Point(440, 24);
- this.txt3.Name = "txt3";
- this.txt3.TabIndex = 7;
- this.txt3.Text = "";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(392, 27);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(48, 16);
- this.label6.TabIndex = 5;
- this.label6.Text = "计划期";
- //
- // btnSearch
- //
- this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
- this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.btnSearch.Location = new System.Drawing.Point(16, 20);
- this.btnSearch.Name = "btnSearch";
- this.btnSearch.Size = new System.Drawing.Size(72, 24);
- this.btnSearch.TabIndex = 3;
- this.btnSearch.Text = " 搜索";
- this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
- //
- // txt2
- //
- this.txt2.Location = new System.Drawing.Point(280, 24);
- this.txt2.Name = "txt2";
- this.txt2.TabIndex = 6;
- this.txt2.Text = "";
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(248, 28);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(32, 16);
- this.label7.TabIndex = 4;
- this.label7.Text = "年份";
- //
- // txt1
- //
- this.txt1.Location = new System.Drawing.Point(160, 24);
- this.txt1.Name = "txt1";
- this.txt1.Size = new System.Drawing.Size(80, 21);
- this.txt1.TabIndex = 6;
- this.txt1.Text = "";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(109, 27);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(56, 16);
- this.label1.TabIndex = 4;
- this.label1.Text = "物料编号";
- //
- // MRPHistory
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(552, 421);
- this.Controls.Add(this.dataGrid1);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "MRPHistory";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "【MRP历史查询】";
- this.Load += new System.EventHandler(this.MRPHistory_Load);
- this.groupBox2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
- this.groupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- //-------------根据输入数据查询MRP计算记录-------------
- private void btnSearch_Click(object sender, System.EventArgs e)
- {
- string strFilter="";
- if(txt1.Text.Trim() != "")//设置表的过滤条件
- strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";
- if(txt2.Text.Trim() != "")
- strFilter += "年份= '" + txt2.Text.Trim() + "' and ";
- if(txt3.Text.Trim() != "")
- strFilter += "计划期='" + txt3.Text.Trim() + "' and ";
- if(strFilter != "") // 存在查询条件
- strFilter = strFilter.Substring(0,strFilter.Length-5);
- dataView1.RowFilter=strFilter;
- }
- //--------------窗体创建时,读入全部数据---------------
- private void MRPHistory_Load(object sender, System.EventArgs e)
- {
- da1.Fill(dataSet31);
- }
- }
- }