ProducePlan.cs
资源名称:VCSDB.rar [点击查看]
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:59k
源码类别:
企业管理
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace 生产管理系统
- {
- /// <summary>
- /// ProducePlan 的摘要说明。
- /// </summary>
- public class ProducePlan : System.Windows.Forms.Form
- {
- CurrencyManager cmOrders;
- public static string mID,mName;//保存物料编号和名称
- public static string sYear,sOrder,sBegin,sEnd;//保存双击选择得到的计划期等信息
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.TextBox txt10;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Button btnSearch;
- private System.Windows.Forms.TextBox txt9;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.TextBox txt8;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.ToolBar toolBar1;
- private System.Windows.Forms.ToolBarButton tBtnFirst;
- private System.Windows.Forms.ToolBarButton tBtnPre;
- private System.Windows.Forms.ToolBarButton tBtnNext;
- private System.Windows.Forms.ToolBarButton tBtnLast;
- private System.Windows.Forms.ToolBarButton tBtnNew;
- private System.Windows.Forms.ToolBarButton tBtnEdit;
- private System.Windows.Forms.ToolBarButton tBtnDelete;
- private System.Windows.Forms.ToolBarButton tBtnSubmit;
- private System.Windows.Forms.ToolBarButton tBtnQuit;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.DataGrid dataGrid1;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.DataGrid dataGrid2;
- private System.Windows.Forms.Button selBtn1;
- 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.Label label10;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.Label label14;
- private System.Windows.Forms.Button importBtn;
- private System.Windows.Forms.Label label15;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
- private System.Data.SqlClient.SqlConnection sqlConnection1;
- private 生产管理系统.DataSet1 dataSet11;
- private System.Windows.Forms.RichTextBox txtMemo;
- private System.Windows.Forms.TextBox txt2;
- private System.Windows.Forms.TextBox txt1;
- private System.Windows.Forms.TextBox txt5;
- private System.Windows.Forms.TextBox txt4;
- private System.Windows.Forms.TextBox txt3;
- private System.Windows.Forms.TextBox txt6;
- private System.Windows.Forms.TextBox txt11;
- private System.Windows.Forms.TextBox txt7;
- private System.Windows.Forms.TextBox txt12;
- private System.Windows.Forms.TextBox txt13;
- private System.Windows.Forms.TextBox txt14;
- private System.Data.SqlClient.SqlDataAdapter da1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand3;
- private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
- private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
- private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
- private System.Windows.Forms.Button selBtn2;
- private System.Data.SqlClient.SqlDataAdapter da2;
- private 生产管理系统.DataSet2 dataSet21;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand4;
- private System.Windows.Forms.ToolBarButton tBtnCancel;
- private System.Windows.Forms.Label label16;
- private System.Windows.Forms.TextBox txt15;
- private System.ComponentModel.IContainer components;
- public ProducePlan()
- {
- //
- // 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()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ProducePlan));
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.txt10 = new System.Windows.Forms.TextBox();
- this.label6 = new System.Windows.Forms.Label();
- this.btnSearch = new System.Windows.Forms.Button();
- this.txt9 = new System.Windows.Forms.TextBox();
- this.label7 = new System.Windows.Forms.Label();
- this.txt8 = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.toolBar1 = new System.Windows.Forms.ToolBar();
- this.tBtnFirst = new System.Windows.Forms.ToolBarButton();
- this.tBtnPre = new System.Windows.Forms.ToolBarButton();
- this.tBtnNext = new System.Windows.Forms.ToolBarButton();
- this.tBtnLast = new System.Windows.Forms.ToolBarButton();
- this.tBtnNew = new System.Windows.Forms.ToolBarButton();
- this.tBtnEdit = new System.Windows.Forms.ToolBarButton();
- this.tBtnDelete = new System.Windows.Forms.ToolBarButton();
- this.tBtnSubmit = new System.Windows.Forms.ToolBarButton();
- this.tBtnCancel = new System.Windows.Forms.ToolBarButton();
- this.tBtnQuit = new System.Windows.Forms.ToolBarButton();
- this.dataGrid1 = new System.Windows.Forms.DataGrid();
- this.dataSet11 = new 生产管理系统.DataSet1();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.selBtn2 = new System.Windows.Forms.Button();
- this.txtMemo = new System.Windows.Forms.RichTextBox();
- this.txt2 = new System.Windows.Forms.TextBox();
- this.txt1 = new System.Windows.Forms.TextBox();
- this.txt5 = new System.Windows.Forms.TextBox();
- this.txt4 = new System.Windows.Forms.TextBox();
- this.txt3 = new System.Windows.Forms.TextBox();
- this.txt6 = new System.Windows.Forms.TextBox();
- this.txt11 = new System.Windows.Forms.TextBox();
- this.txt7 = new System.Windows.Forms.TextBox();
- this.txt12 = new System.Windows.Forms.TextBox();
- this.txt13 = new System.Windows.Forms.TextBox();
- this.txt14 = new System.Windows.Forms.TextBox();
- this.label15 = new System.Windows.Forms.Label();
- this.selBtn1 = new System.Windows.Forms.Button();
- 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.label10 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.label14 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.txt15 = new System.Windows.Forms.TextBox();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.importBtn = new System.Windows.Forms.Button();
- this.dataGrid2 = new System.Windows.Forms.DataGrid();
- this.dataSet21 = new 生产管理系统.DataSet2();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
- this.da1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand3 = new System.Data.SqlClient.SqlCommand();
- this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
- this.da2 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlSelectCommand4 = new System.Data.SqlClient.SqlCommand();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet21)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.txt10);
- this.groupBox1.Controls.Add(this.label6);
- this.groupBox1.Controls.Add(this.btnSearch);
- this.groupBox1.Controls.Add(this.txt9);
- this.groupBox1.Controls.Add(this.label7);
- this.groupBox1.Controls.Add(this.txt8);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.groupBox2);
- this.groupBox1.Location = new System.Drawing.Point(0, 40);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(704, 56);
- this.groupBox1.TabIndex = 32;
- this.groupBox1.TabStop = false;
- //
- // txt10
- //
- this.txt10.Location = new System.Drawing.Point(440, 24);
- this.txt10.Name = "txt10";
- this.txt10.TabIndex = 7;
- this.txt10.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);
- //
- // txt9
- //
- this.txt9.Location = new System.Drawing.Point(280, 24);
- this.txt9.Name = "txt9";
- this.txt9.TabIndex = 6;
- this.txt9.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 = "年份";
- //
- // txt8
- //
- this.txt8.Location = new System.Drawing.Point(160, 24);
- this.txt8.Name = "txt8";
- this.txt8.Size = new System.Drawing.Size(80, 21);
- this.txt8.TabIndex = 6;
- this.txt8.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 = "物料编号";
- //
- // groupBox2
- //
- this.groupBox2.Location = new System.Drawing.Point(100, 100);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(120, 120);
- this.groupBox2.TabIndex = 33;
- this.groupBox2.TabStop = false;
- //
- // imageList1
- //
- this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
- this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
- this.imageList1.TransparentColor = System.Drawing.SystemColors.ControlLightLight;
- //
- // toolBar1
- //
- this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
- this.tBtnFirst,
- this.tBtnPre,
- this.tBtnNext,
- this.tBtnLast,
- this.tBtnNew,
- this.tBtnEdit,
- this.tBtnDelete,
- this.tBtnSubmit,
- this.tBtnCancel,
- this.tBtnQuit});
- this.toolBar1.DropDownArrows = true;
- this.toolBar1.ImageList = this.imageList1;
- this.toolBar1.Location = new System.Drawing.Point(0, 0);
- this.toolBar1.Name = "toolBar1";
- this.toolBar1.ShowToolTips = true;
- this.toolBar1.Size = new System.Drawing.Size(712, 41);
- this.toolBar1.TabIndex = 31;
- this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
- //
- // tBtnFirst
- //
- this.tBtnFirst.ImageIndex = 0;
- this.tBtnFirst.Text = "首记录";
- this.tBtnFirst.ToolTipText = "首记录";
- //
- // tBtnPre
- //
- this.tBtnPre.ImageIndex = 1;
- this.tBtnPre.Text = "上一记录";
- this.tBtnPre.ToolTipText = "上一记录";
- //
- // tBtnNext
- //
- this.tBtnNext.ImageIndex = 2;
- this.tBtnNext.Text = "下一记录";
- this.tBtnNext.ToolTipText = "下一记录";
- //
- // tBtnLast
- //
- this.tBtnLast.ImageIndex = 3;
- this.tBtnLast.Text = "尾记录";
- this.tBtnLast.ToolTipText = "尾记录";
- //
- // tBtnNew
- //
- this.tBtnNew.ImageIndex = 4;
- this.tBtnNew.Text = "新增";
- this.tBtnNew.ToolTipText = "新增";
- //
- // tBtnEdit
- //
- this.tBtnEdit.ImageIndex = 5;
- this.tBtnEdit.Text = "修改";
- this.tBtnEdit.ToolTipText = "修改";
- //
- // tBtnDelete
- //
- this.tBtnDelete.ImageIndex = 6;
- this.tBtnDelete.Text = "删除";
- this.tBtnDelete.ToolTipText = "删除";
- //
- // tBtnSubmit
- //
- this.tBtnSubmit.ImageIndex = 7;
- this.tBtnSubmit.Text = "提交";
- this.tBtnSubmit.ToolTipText = "提交";
- //
- // tBtnCancel
- //
- this.tBtnCancel.ImageIndex = 8;
- this.tBtnCancel.Text = "取消";
- this.tBtnCancel.ToolTipText = "取消";
- //
- // tBtnQuit
- //
- this.tBtnQuit.ImageIndex = 9;
- this.tBtnQuit.Text = "退出";
- this.tBtnQuit.ToolTipText = "退出";
- //
- // dataGrid1
- //
- this.dataGrid1.CaptionVisible = false;
- this.dataGrid1.DataMember = "主生产计划";
- this.dataGrid1.DataSource = this.dataSet11;
- this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid1.Location = new System.Drawing.Point(0, 96);
- this.dataGrid1.Name = "dataGrid1";
- this.dataGrid1.ReadOnly = true;
- this.dataGrid1.Size = new System.Drawing.Size(336, 384);
- this.dataGrid1.TabIndex = 34;
- //
- // dataSet11
- //
- this.dataSet11.DataSetName = "DataSet1";
- this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.selBtn2);
- this.groupBox3.Controls.Add(this.txtMemo);
- this.groupBox3.Controls.Add(this.txt2);
- this.groupBox3.Controls.Add(this.txt1);
- this.groupBox3.Controls.Add(this.txt5);
- this.groupBox3.Controls.Add(this.txt4);
- this.groupBox3.Controls.Add(this.txt3);
- this.groupBox3.Controls.Add(this.txt6);
- this.groupBox3.Controls.Add(this.txt11);
- this.groupBox3.Controls.Add(this.txt7);
- this.groupBox3.Controls.Add(this.txt12);
- this.groupBox3.Controls.Add(this.txt13);
- this.groupBox3.Controls.Add(this.txt14);
- this.groupBox3.Controls.Add(this.label15);
- this.groupBox3.Controls.Add(this.selBtn1);
- this.groupBox3.Controls.Add(this.label2);
- this.groupBox3.Controls.Add(this.label3);
- this.groupBox3.Controls.Add(this.label4);
- this.groupBox3.Controls.Add(this.label5);
- this.groupBox3.Controls.Add(this.label8);
- this.groupBox3.Controls.Add(this.label9);
- this.groupBox3.Controls.Add(this.label10);
- this.groupBox3.Controls.Add(this.label11);
- this.groupBox3.Controls.Add(this.label12);
- this.groupBox3.Controls.Add(this.label13);
- this.groupBox3.Controls.Add(this.label14);
- this.groupBox3.Controls.Add(this.label16);
- this.groupBox3.Controls.Add(this.txt15);
- this.groupBox3.Location = new System.Drawing.Point(336, 96);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(368, 224);
- this.groupBox3.TabIndex = 35;
- this.groupBox3.TabStop = false;
- //
- // selBtn2
- //
- this.selBtn2.Enabled = false;
- this.selBtn2.Image = ((System.Drawing.Image)(resources.GetObject("selBtn2.Image")));
- this.selBtn2.Location = new System.Drawing.Point(176, 48);
- this.selBtn2.Name = "selBtn2";
- this.selBtn2.Size = new System.Drawing.Size(24, 23);
- this.selBtn2.TabIndex = 65;
- this.selBtn2.Click += new System.EventHandler(this.selBtn2_Click);
- this.selBtn2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.selBtn2_MouseUp);
- //
- // txtMemo
- //
- this.txtMemo.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.备注"));
- this.txtMemo.Location = new System.Drawing.Point(14, 192);
- this.txtMemo.Name = "txtMemo";
- this.txtMemo.ReadOnly = true;
- this.txtMemo.Size = new System.Drawing.Size(336, 24);
- this.txtMemo.TabIndex = 64;
- this.txtMemo.Text = "";
- //
- // txt2
- //
- this.txt2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.年份"));
- this.txt2.Enabled = false;
- this.txt2.Location = new System.Drawing.Point(70, 48);
- this.txt2.Name = "txt2";
- this.txt2.ReadOnly = true;
- this.txt2.TabIndex = 58;
- this.txt2.Text = "";
- //
- // txt1
- //
- this.txt1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.物料编号"));
- this.txt1.Enabled = false;
- this.txt1.Location = new System.Drawing.Point(70, 24);
- this.txt1.Name = "txt1";
- this.txt1.ReadOnly = true;
- this.txt1.TabIndex = 57;
- this.txt1.Text = "";
- this.txt1.TextChanged += new System.EventHandler(this.txt1_TextChanged);
- //
- // txt5
- //
- this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.计划期"));
- this.txt5.Enabled = false;
- this.txt5.Location = new System.Drawing.Point(254, 48);
- this.txt5.Name = "txt5";
- this.txt5.ReadOnly = true;
- this.txt5.TabIndex = 62;
- this.txt5.Text = "";
- //
- // txt4
- //
- this.txt4.Enabled = false;
- this.txt4.Location = new System.Drawing.Point(254, 24);
- this.txt4.Name = "txt4";
- this.txt4.ReadOnly = true;
- this.txt4.TabIndex = 54;
- this.txt4.Text = "";
- //
- // txt3
- //
- this.txt3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.开始日期"));
- this.txt3.Enabled = false;
- this.txt3.Location = new System.Drawing.Point(70, 72);
- this.txt3.Name = "txt3";
- this.txt3.ReadOnly = true;
- this.txt3.TabIndex = 53;
- this.txt3.Text = "";
- //
- // txt6
- //
- this.txt6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.结束日期"));
- this.txt6.Enabled = false;
- this.txt6.Location = new System.Drawing.Point(254, 72);
- this.txt6.Name = "txt6";
- this.txt6.ReadOnly = true;
- this.txt6.TabIndex = 61;
- this.txt6.Text = "";
- //
- // txt11
- //
- this.txt11.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.需求数量"));
- this.txt11.Location = new System.Drawing.Point(120, 112);
- this.txt11.Name = "txt11";
- this.txt11.ReadOnly = true;
- this.txt11.Size = new System.Drawing.Size(104, 21);
- this.txt11.TabIndex = 63;
- this.txt11.Text = "";
- //
- // txt7
- //
- this.txt7.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.期初库存"));
- this.txt7.Location = new System.Drawing.Point(14, 112);
- this.txt7.Name = "txt7";
- this.txt7.ReadOnly = true;
- this.txt7.Size = new System.Drawing.Size(98, 21);
- this.txt7.TabIndex = 56;
- this.txt7.Text = "";
- //
- // txt12
- //
- this.txt12.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.MPS数量"));
- this.txt12.Location = new System.Drawing.Point(232, 112);
- this.txt12.Name = "txt12";
- this.txt12.ReadOnly = true;
- this.txt12.Size = new System.Drawing.Size(120, 21);
- this.txt12.TabIndex = 55;
- this.txt12.Text = "";
- //
- // txt13
- //
- this.txt13.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.生产单数量"));
- this.txt13.Location = new System.Drawing.Point(16, 152);
- this.txt13.Name = "txt13";
- this.txt13.ReadOnly = true;
- this.txt13.Size = new System.Drawing.Size(96, 21);
- this.txt13.TabIndex = 59;
- this.txt13.Text = "";
- //
- // txt14
- //
- this.txt14.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.预计库存"));
- this.txt14.Location = new System.Drawing.Point(120, 152);
- this.txt14.Name = "txt14";
- this.txt14.ReadOnly = true;
- this.txt14.Size = new System.Drawing.Size(104, 21);
- this.txt14.TabIndex = 60;
- this.txt14.Text = "";
- //
- // label15
- //
- this.label15.Location = new System.Drawing.Point(16, 176);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(32, 16);
- this.label15.TabIndex = 52;
- this.label15.Text = "备注";
- //
- // selBtn1
- //
- this.selBtn1.Enabled = false;
- this.selBtn1.Image = ((System.Drawing.Image)(resources.GetObject("selBtn1.Image")));
- this.selBtn1.Location = new System.Drawing.Point(176, 24);
- this.selBtn1.Name = "selBtn1";
- this.selBtn1.Size = new System.Drawing.Size(24, 23);
- this.selBtn1.TabIndex = 50;
- this.selBtn1.Click += new System.EventHandler(this.selBtn1_Click);
- this.selBtn1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.selBtn1_MouseUp);
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(40, 48);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(32, 16);
- this.label2.TabIndex = 49;
- this.label2.Text = "年份";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(16, 24);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(56, 16);
- this.label3.TabIndex = 48;
- this.label3.Text = "物料编号";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(208, 48);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(48, 16);
- this.label4.TabIndex = 49;
- this.label4.Text = "计划期";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(216, 24);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(32, 16);
- this.label5.TabIndex = 48;
- this.label5.Text = "名称";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(16, 72);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(56, 16);
- this.label8.TabIndex = 48;
- this.label8.Text = "开始日期";
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(200, 72);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(56, 16);
- this.label9.TabIndex = 49;
- this.label9.Text = "结束日期";
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(120, 96);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(56, 16);
- this.label10.TabIndex = 49;
- this.label10.Text = "需求数量";
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(16, 96);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(56, 16);
- this.label11.TabIndex = 48;
- this.label11.Text = "期初库存";
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(232, 96);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(56, 16);
- this.label12.TabIndex = 48;
- this.label12.Text = "MPS数量";
- //
- // label13
- //
- this.label13.Location = new System.Drawing.Point(16, 136);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(71, 16);
- this.label13.TabIndex = 49;
- this.label13.Text = "生产单数量";
- //
- // label14
- //
- this.label14.Location = new System.Drawing.Point(120, 136);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(56, 16);
- this.label14.TabIndex = 49;
- this.label14.Text = "预计库存";
- //
- // label16
- //
- this.label16.Location = new System.Drawing.Point(232, 136);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(56, 16);
- this.label16.TabIndex = 49;
- this.label16.Text = "状态";
- //
- // txt15
- //
- this.txt15.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "主生产计划.状态"));
- this.txt15.Enabled = false;
- this.txt15.Location = new System.Drawing.Point(232, 152);
- this.txt15.Name = "txt15";
- this.txt15.ReadOnly = true;
- this.txt15.Size = new System.Drawing.Size(120, 21);
- this.txt15.TabIndex = 60;
- this.txt15.Text = "";
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.importBtn);
- this.groupBox4.Controls.Add(this.dataGrid2);
- this.groupBox4.Location = new System.Drawing.Point(336, 320);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(368, 160);
- this.groupBox4.TabIndex = 36;
- this.groupBox4.TabStop = false;
- //
- // importBtn
- //
- this.importBtn.Location = new System.Drawing.Point(16, 16);
- this.importBtn.Name = "importBtn";
- this.importBtn.Size = new System.Drawing.Size(120, 23);
- this.importBtn.TabIndex = 1;
- this.importBtn.Text = "由需求计划导入";
- this.importBtn.Click += new System.EventHandler(this.importBtn_Click);
- //
- // dataGrid2
- //
- this.dataGrid2.CaptionVisible = false;
- this.dataGrid2.DataMember = "主需求计划";
- this.dataGrid2.DataSource = this.dataSet21;
- this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid2.Location = new System.Drawing.Point(8, 48);
- this.dataGrid2.Name = "dataGrid2";
- this.dataGrid2.ReadOnly = true;
- this.dataGrid2.Size = new System.Drawing.Size(352, 104);
- this.dataGrid2.TabIndex = 0;
- //
- // dataSet21
- //
- this.dataSet21.DataSetName = "DataSet2";
- this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // da1
- //
- this.da1.DeleteCommand = this.sqlDeleteCommand1;
- this.da1.InsertCommand = this.sqlInsertCommand1;
- this.da1.SelectCommand = this.sqlSelectCommand3;
- this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
- new System.Data.Common.DataTableMapping("Table", "主生产计划", 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("MPS数量", "MPS数量"),
- 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("备注", "备注")})});
- this.da1.UpdateCommand = this.sqlUpdateCommand1;
- //
- // sqlDeleteCommand1
- //
- this.sqlDeleteCommand1.CommandText = @"DELETE FROM 主生产计划 WHERE (年份 = @Original_年份) AND (物料编号 = @Original_物料编号) AND (计划期 = @Original_计划期) AND (MPS数量 = @Original_MPS数量) AND (修改日期 = @Original_修改日期 OR @Original_修改日期 IS NULL AND 修改日期 IS NULL) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (审核人 = @Original_审核人 OR @Original_审核人 IS NULL AND 审核人 IS NULL) AND (审核日期 = @Original_审核日期 OR @Original_审核日期 IS NULL AND 审核日期 IS NULL) AND (开始日期 = @Original_开始日期 OR @Original_开始日期 IS NULL AND 开始日期 IS NULL) AND (期初库存 = @Original_期初库存 OR @Original_期初库存 IS NULL AND 期初库存 IS NULL) AND (状态 = @Original_状态) AND (生产单数量 = @Original_生产单数量 OR @Original_生产单数量 IS NULL AND 生产单数量 IS NULL) AND (结束日期 = @Original_结束日期 OR @Original_结束日期 IS NULL AND 结束日期 IS NULL) AND (编号 = @Original_编号 OR @Original_编号 IS NULL AND 编号 IS NULL) AND (记帐人 = @Original_记帐人 OR @Original_记帐人 IS NULL AND 记帐人 IS NULL) AND (需求数量 = @Original_需求数量 OR @Original_需求数量 IS NULL AND 需求数量 IS NULL) AND (预计库存 = @Original_预计库存 OR @Original_预计库存 IS NULL AND 预计库存 IS NULL)";
- this.sqlDeleteCommand1.Connection = this.sqlConnection1;
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_年份", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "年份", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物料编号", System.Data.SqlDbType.VarChar, 14, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物料编号", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_计划期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "计划期", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_MPS数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "MPS数量", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_修改日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "修改日期", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_审核人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "审核人", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_审核日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "审核日期", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开始日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开始日期", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_期初库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "期初库存", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_生产单数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "生产单数量", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_结束日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "结束日期", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.VarChar, 14, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记帐人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记帐人", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_需求数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "需求数量", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_预计库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "预计库存", System.Data.DataRowVersion.Original, null));
- //
- // sqlConnection1
- //
- this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=mrpbook;";
- //
- // sqlInsertCommand1
- //
- this.sqlInsertCommand1.CommandText = @"INSERT INTO 主生产计划(物料编号, 编号, 年份, 计划期, 开始日期, 结束日期, 期初库存, 需求数量, MPS数量, 生产单数量, 预计库存, 记帐人, 修改日期, 审核人, 审核日期, 状态, 备注) VALUES (@物料编号, @编号, @年份, @计划期, @开始日期, @结束日期, @期初库存, @需求数量, @MPS数量, @生产单数量, @预计库存, @记帐人, @修改日期, @审核人, @审核日期, @状态, @备注); SELECT 物料编号, 编号, 年份, 计划期, 开始日期, 结束日期, 期初库存, 需求数量, MPS数量, 生产单数量, 预计库存, 记帐人, 修改日期, 审核人, 审核日期, 状态, 备注 FROM 主生产计划 WHERE (年份 = @年份) AND (物料编号 = @物料编号) AND (计划期 = @计划期)";
- this.sqlInsertCommand1.Connection = this.sqlConnection1;
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@物料编号", System.Data.SqlDbType.VarChar, 14, "物料编号"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.VarChar, 14, "编号"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年份", System.Data.SqlDbType.Int, 4, "年份"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@计划期", System.Data.SqlDbType.Int, 4, "计划期"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开始日期", System.Data.SqlDbType.Int, 4, "开始日期"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@结束日期", System.Data.SqlDbType.Int, 4, "结束日期"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@期初库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "期初库存", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@需求数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "需求数量", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MPS数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "MPS数量", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@生产单数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "生产单数量", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@预计库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "预计库存", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@记帐人", System.Data.SqlDbType.VarChar, 10, "记帐人"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@修改日期", System.Data.SqlDbType.Int, 4, "修改日期"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@审核人", System.Data.SqlDbType.VarChar, 10, "审核人"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@审核日期", System.Data.SqlDbType.Int, 4, "审核日期"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 10, "状态"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 40, "备注"));
- //
- // sqlSelectCommand3
- //
- this.sqlSelectCommand3.CommandText = "SELECT 物料编号, 编号, 年份, 计划期, 开始日期, 结束日期, 期初库存, 需求数量, MPS数量, 生产单数量, 预计库存, 记帐人, 修改日期, " +
- "审核人, 审核日期, 状态, 备注 FROM 主生产计划 WHERE (物料编号 LIKE @Param4) AND (年份 LIKE @Param5) AND" +
- " (计划期 LIKE @Param6)";
- this.sqlSelectCommand3.Connection = this.sqlConnection1;
- this.sqlSelectCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 20, "物料编号"));
- this.sqlSelectCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 20, "年份"));
- this.sqlSelectCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 20, "计划期"));
- //
- // sqlUpdateCommand1
- //
- this.sqlUpdateCommand1.CommandText = @"UPDATE 主生产计划 SET 物料编号 = @物料编号, 编号 = @编号, 年份 = @年份, 计划期 = @计划期, 开始日期 = @开始日期, 结束日期 = @结束日期, 期初库存 = @期初库存, 需求数量 = @需求数量, MPS数量 = @MPS数量, 生产单数量 = @生产单数量, 预计库存 = @预计库存, 记帐人 = @记帐人, 修改日期 = @修改日期, 审核人 = @审核人, 审核日期 = @审核日期, 状态 = @状态, 备注 = @备注 WHERE (年份 = @Original_年份) AND (物料编号 = @Original_物料编号) AND (计划期 = @Original_计划期) AND (MPS数量 = @Original_MPS数量) AND (修改日期 = @Original_修改日期 OR @Original_修改日期 IS NULL AND 修改日期 IS NULL) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (审核人 = @Original_审核人 OR @Original_审核人 IS NULL AND 审核人 IS NULL) AND (审核日期 = @Original_审核日期 OR @Original_审核日期 IS NULL AND 审核日期 IS NULL) AND (开始日期 = @Original_开始日期 OR @Original_开始日期 IS NULL AND 开始日期 IS NULL) AND (期初库存 = @Original_期初库存 OR @Original_期初库存 IS NULL AND 期初库存 IS NULL) AND (状态 = @Original_状态) AND (生产单数量 = @Original_生产单数量 OR @Original_生产单数量 IS NULL AND 生产单数量 IS NULL) AND (结束日期 = @Original_结束日期 OR @Original_结束日期 IS NULL AND 结束日期 IS NULL) AND (编号 = @Original_编号 OR @Original_编号 IS NULL AND 编号 IS NULL) AND (记帐人 = @Original_记帐人 OR @Original_记帐人 IS NULL AND 记帐人 IS NULL) AND (需求数量 = @Original_需求数量 OR @Original_需求数量 IS NULL AND 需求数量 IS NULL) AND (预计库存 = @Original_预计库存 OR @Original_预计库存 IS NULL AND 预计库存 IS NULL); SELECT 物料编号, 编号, 年份, 计划期, 开始日期, 结束日期, 期初库存, 需求数量, MPS数量, 生产单数量, 预计库存, 记帐人, 修改日期, 审核人, 审核日期, 状态, 备注 FROM 主生产计划 WHERE (年份 = @年份) AND (物料编号 = @物料编号) AND (计划期 = @计划期)";
- this.sqlUpdateCommand1.Connection = this.sqlConnection1;
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@物料编号", System.Data.SqlDbType.VarChar, 14, "物料编号"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.VarChar, 14, "编号"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年份", System.Data.SqlDbType.Int, 4, "年份"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@计划期", System.Data.SqlDbType.Int, 4, "计划期"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开始日期", System.Data.SqlDbType.Int, 4, "开始日期"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@结束日期", System.Data.SqlDbType.Int, 4, "结束日期"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@期初库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "期初库存", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@需求数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "需求数量", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MPS数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "MPS数量", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@生产单数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "生产单数量", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@预计库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "预计库存", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@记帐人", System.Data.SqlDbType.VarChar, 10, "记帐人"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@修改日期", System.Data.SqlDbType.Int, 4, "修改日期"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@审核人", System.Data.SqlDbType.VarChar, 10, "审核人"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@审核日期", System.Data.SqlDbType.Int, 4, "审核日期"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 10, "状态"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 40, "备注"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_年份", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "年份", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物料编号", System.Data.SqlDbType.VarChar, 14, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物料编号", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_计划期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "计划期", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_MPS数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "MPS数量", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_修改日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "修改日期", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_审核人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "审核人", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_审核日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "审核日期", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开始日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开始日期", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_期初库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "期初库存", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_生产单数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "生产单数量", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_结束日期", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "结束日期", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.VarChar, 14, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记帐人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记帐人", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_需求数量", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "需求数量", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_预计库存", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(15)), ((System.Byte)(2)), "预计库存", System.Data.DataRowVersion.Original, null));
- //
- // da2
- //
- this.da2.SelectCommand = this.sqlSelectCommand4;
- this.da2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
- new System.Data.Common.DataTableMapping("Table", "主需求计划", 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("备注", "备注")})});
- //
- // sqlSelectCommand4
- //
- this.sqlSelectCommand4.CommandText = "SELECT 物料编号, 年份, 计划期, 开始日期, 结束日期, 需求数量, 记帐人, 修改日期, 状态, 备注 FROM 主需求计划";
- this.sqlSelectCommand4.Connection = this.sqlConnection1;
- //
- // ProducePlan
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(712, 485);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.dataGrid1);
- this.Controls.Add(this.toolBar1);
- this.Controls.Add(this.groupBox1);
- this.Name = "ProducePlan";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "【主生产计划】";
- this.Load += new System.EventHandler(this.ProducePlan_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
- this.groupBox3.ResumeLayout(false);
- this.groupBox4.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- //--------------创建窗体时显示全部数据--------------
- private void ProducePlan_Load(object sender, System.EventArgs e)
- {
- da1.SelectCommand.Parameters[0].Value="%%";
- da1.SelectCommand.Parameters[1].Value="%%";
- da1.SelectCommand.Parameters[2].Value="%%";
- da1.Fill(dataSet11);
- da2.Fill(dataSet21);
- //绑定数据导航控件
- cmOrders=(CurrencyManager) BindingContext[dataSet11,"主生产计划"];
- }
- //----------------根据输入查询信息---------------
- private void btnSearch_Click(object sender, System.EventArgs e)
- {
- da1.SelectCommand.Parameters[0].Value="%%";
- da1.SelectCommand.Parameters[1].Value="%%";
- da1.SelectCommand.Parameters[2].Value="%%";
- //根据用户在文本框中的输入来设置SQL查询的参数
- if(txt8.Text.Trim()!="")
- {
- da1.SelectCommand.Parameters[0].Value="%"+txt8.Text.Trim()+"%";
- }
- if(txt9.Text.Trim()!="")
- {
- da1.SelectCommand.Parameters[1].Value="%"+txt9.Text.Trim()+"%";
- }
- if(txt10.Text.Trim()!="")
- {
- da1.SelectCommand.Parameters[2].Value="%"+txt10.Text.Trim()+"%";
- }
- //清空数据表,并根据新设置的查询参数重新填充
- dataSet11.主生产计划.Clear();
- da1.Fill(dataSet11);
- }
- //------------根据物料编号查询并显示物料名称----------------
- private void txt1_TextChanged(object sender, System.EventArgs e)
- {
- if(txt1.Text!="")
- {
- string strConn = "server=localhost;Integrated Security=SSPI;database=mrpbook";
- SqlConnection cn=new SqlConnection(strConn);
- cn.Open();
- SqlCommand cmd=cn.CreateCommand();
- cmd.CommandText="select 物料名称 from 物料主文件 where 物料编号='"+txt1.Text.Trim()+"'";
- txt4.Text=Convert.ToString(cmd.ExecuteScalar());
- }
- else
- txt4.Text="";
- }
- //------------调出窗体,选择物料--------------
- private void selBtn1_Click(object sender, System.EventArgs e)
- {
- SelectMaterial.callForm=2;
- SelectMaterial selFrm=new SelectMaterial();
- selFrm.ShowDialog();
- SendKeys.Send("{Tab}");//向活动应用程序发送Tab键,跳到下一控件
- }
- //---------将选择得到的物料编号和名称填入文本框----------
- private void selBtn1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- txt1.Text=mID;
- txt4.Text=mName;
- SendKeys.Send("{Tab}");
- }
- //------------调出窗体,选择工厂日历--------------
- private void selBtn2_Click(object sender, System.EventArgs e)
- {
- FactorySchedule.callForm=2;//表示由主需求窗体调用
- FactorySchedule newFrm=new FactorySchedule();
- newFrm.closeToolbar();//该窗体仅供选择,不能编辑
- newFrm.Text+=",双击表格首列选择";
- newFrm.ShowDialog();
- SendKeys.Send("{Tab}");//向活动应用程序发送Tab键,跳到下一控件
- }
- //---------将选择得到的工厂日历信息填入文本框----------
- private void selBtn2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- txt2.Text=sYear;
- txt5.Text=sOrder;
- txt3.Text=sBegin;
- txt6.Text=sEnd;
- }
- //---------------设置工具栏操作--------------
- private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
- {
- if (e.Button.ToolTipText == "首记录")
- {
- this.dataGrid1.UnSelect(cmOrders.Position); //取消原选中的行
- cmOrders.Position = 0;
- this.dataGrid1.Select(cmOrders.Position); //选中当前行
- this.dataGrid1.CurrentRowIndex = cmOrders.Position; //移动表头指示图标
- return;
- }
- if (e.Button.ToolTipText == "上一记录")
- {
- if (cmOrders.Position >= 0)
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position--;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- }
- return;
- }
- if (e.Button.ToolTipText == "下一记录")
- {
- if (cmOrders.Position <= cmOrders.Count-1)
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position++;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- }
- return;
- }
- if (e.Button.ToolTipText == "尾记录")
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position = cmOrders.Count-1;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- return;
- }
- if(e.Button.ToolTipText=="新增")
- {
- cmOrders.AddNew();
- txt15.Text="正常";//新增加的生产计划默认状态为正常,且不允许修改
- //设置按钮
- SetModifyMode(true);
- }
- if(e.Button.ToolTipText=="修改")
- {
- SetModifyMode(true);
- }
- if(e.Button.ToolTipText=="删除")
- {
- DialogResult result=MessageBox.Show("确认删除?","删除数据",MessageBoxButtons.OKCancel);
- if(result==DialogResult.OK)
- if(cmOrders.Count>0)
- cmOrders.RemoveAt(cmOrders.Position);
- else
- MessageBox.Show("表中为空,已无可删除数据","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- }
- if(e.Button.ToolTipText=="提交")
- {
- if (this.txt1.Text.Trim() == "")//检查不能为空的字段
- {
- MessageBox.Show("请先选择物料!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- return;
- }
- if (this.txt2.Text.Trim() == "")//检查不能为空的字段
- {
- MessageBox.Show("请先选择计划期!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- return;
- }
- if (this.txt12.Text.Trim() == "")//检查不能为空的字段
- {
- MessageBox.Show("MPS数量不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- return;
- }
- cmOrders.EndCurrentEdit();//结束当前编辑操作并提交修改
- if (dataSet11.GetChanges()!=null)
- {
- try
- {
- this.da1.Update(dataSet11);
- }
- catch(Exception express)
- {
- MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- dataSet11.RejectChanges();
- }
- }
- return;
- }
- if (e.Button.ToolTipText == "取消")
- {
- try
- {
- cmOrders.CancelCurrentEdit();//取消编辑
- SetModifyMode(false);
- }
- catch(Exception express)
- {
- MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- }
- return;
- }
- if(e.Button.ToolTipText=="退出")
- {
- if(dataSet11.HasChanges())
- {
- DialogResult result=MessageBox.Show("数据集有被修改但尚未提交的数据,是否提交?","确认",MessageBoxButtons.OKCancel);
- if(result==DialogResult.OK)
- da1.Update(dataSet11);
- }
- this.Close();
- }
- }
- //--------------对控件的Enable属性做设置---------------
- private void SetModifyMode(bool blnModify)
- {
- //设置文本框
- txt7.ReadOnly=!blnModify;
- txt12.ReadOnly=!blnModify;
- txt13.ReadOnly=!blnModify;
- txt14.ReadOnly=!blnModify;
- txt11.ReadOnly=!blnModify;
- txtMemo.ReadOnly=!blnModify;
- //设置表格的只读模式
- dataGrid1.ReadOnly=!blnModify;
- //编辑时不允许搜索数据
- btnSearch.Enabled=!blnModify;
- //允许使用选择按钮
- selBtn1.Enabled=blnModify;
- selBtn2.Enabled=blnModify;
- }
- //--------------从主需求计划向主生长计划导入数据--------------
- private void importBtn_Click(object sender, System.EventArgs e)
- {
- string inOrder,inSec;//取得当前指向的主需求计划的物料编号和计划期数据
- inOrder=dataSet21.主需求计划.Rows[dataGrid2.CurrentRowIndex]["物料编号"].ToString().Trim();
- inSec=dataSet21.主需求计划.Rows[dataGrid2.CurrentRowIndex]["计划期"].ToString().Trim();
- //向主生产计划中导入
- string strConn = "server=localhost;Integrated Security=SSPI;database=mrpbook";
- SqlConnection cn=new SqlConnection(strConn);
- cn.Open();
- SqlCommand cmd=cn.CreateCommand();
- cmd.CommandText="insert into 主生产计划([物料编号], [年份], [计划期], [开始日期], [结束日期], [需求数量], [MPS数量], [状态], [备注]) select 物料编号,年份,计划期, 开始日期,结束日期,需求数量,需求数量,状态,备注 from 主需求计划"+" where (物料编号='"+inOrder+"')and(计划期='"+inSec+"')";
- int inResult=cmd.ExecuteNonQuery();
- if(inResult!=-1)//删除已经导入后的主需求计划中的数据
- {
- MessageBox.Show("从主需求计划向主生产计划导入数据成功!");
- cmd.CommandText="delete from 主需求计划"+" where (物料编号='"+inOrder+"')and(计划期='"+inSec+"')";
- cmd.ExecuteNonQuery();
- //刷新数据
- dataSet11.Clear();
- dataSet21.Clear();
- da1.Fill(dataSet11);
- da2.Fill(dataSet21);
- }
- }
- }
- }