Exemplo n.º 1
0
 public void Replace(object sender, EventArgs e)
 {
     try
     {
         DialogResult dr;
         dr = MessageBox.Show("确定要替换当前表的全部内容吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dr == DialogResult.No)
         {
             return;
         }
         if (tabControl1.SelectedTabIndex == 0)
         {
             if (DgdDealHelper.Replace_dgd(ref dataGridViewX1))
             {
                 UIHelper.ToastNotify(true, "正式生产表数据替换成功!", tabControl1);
             }
             else
             {
                 UIHelper.ToastNotify(false, "正式生产表数据替换失败!", tabControl1);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("替换时发生异常:" + ex.Message);
     }
 }
Exemplo n.º 2
0
 public bool ClosesubForm()
 {
     try
     {
         if (!DgdDealHelper.JudgeIsnotMofidy(NotModify_dt1, dataGridViewX1))
         {
             DialogResult dr;
             dr = MessageBox.Show("当前要关闭窗体的正式生产信息有改动,但未保存,确定要关闭吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (dr == DialogResult.No)
             {
                 return(false);
             }
         }
         if (!DgdDealHelper.JudgeIsnotMofidy(NotModify_dt2, dataGridViewX2))
         {
             DialogResult dr;
             dr = MessageBox.Show("当前要关闭窗体的样机生产信息有改动,但未保存,确定要关闭吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (dr == DialogResult.No)
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("关闭当前界面是发生异常:" + ex.Message);
         return(false);
     }
 }
Exemplo n.º 3
0
 public void Paste(object sender, EventArgs e)
 {
     try
     {
         DialogResult dr;
         dr = MessageBox.Show("确定要粘贴到当前表中吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dr == DialogResult.No)
         {
             return;
         }
         if (tabControl1.SelectedTabIndex == 0)
         {
             if (DgdDealHelper.SetClipboardToDataGridVIew(ref dataGridViewX1))
             {
                 dataGridViewX1.EndEdit();
                 UIHelper.ToastNotify(true, "正式生产表数据粘贴成功!", tabControl1);
             }
             else
             {
                 UIHelper.ToastNotify(false, "正式生产表数据粘贴失败!", tabControl1);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("粘贴时发生异常:" + ex.Message);
     }
 }
Exemplo n.º 4
0
        public static void AddNode_Func(TreeNode Addnode, string change_str)
        {
            try
            {
                string formname = Addnode.Text;
                if (change_str == "添加传感器BOM")
                {
                    string lcbom_meaid_value = Guid.NewGuid().ToString();
                    string Mainbom           = AddBOM_Module(Addnode, change_str, lcbom_meaid_value);
                    if (Mainbom == "")
                    {
                        return;
                    }
                    string lcbominfo_str = DgdDealHelper.GetCombineInfo(Constant.Maingage_dt).ToString();

                    //插入数据库
                    sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (lcbom_meaid,lcbom,lcassembly,lcproductclass,lcproductmodel,lcbominfo,lcbominfo_test,modifiedby,modifieddate)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", Constant.MainBom_sqlname, lcbom_meaid_value, Constant.Add_Bom, Addnode.Text, Addnode.Parent.Parent.Text, Addnode.Parent.Text, lcbominfo_str, lcbominfo_str, Constant.CurUserName(), DateTime.Now), null);
                    SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}')", Constant.RecordLog_sqlname, formname, "", Constant.Add_Bom, Constant.CurUserName(), DateTime.Now, change_str), null);
                }
                else
                {
                    string Add_str = AddBOM_Module(Addnode, change_str);
                    if (Add_str == "")
                    {
                        return;
                    }
                    if (change_str == "添加产品容量")
                    {
                        sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (lcbom_meaid,lcbom,lcassembly,lcproductclass,lcproductmodel,lcbominfo,lcbominfo_test,modifiedby,modifieddate)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", Constant.MainBom_sqlname, Guid.NewGuid(), "0", Constant.Add_Bom, Addnode.Parent.Text, Addnode.Text, "", "", Constant.CurUserName(), DateTime.Now), null);
                        SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}')", Constant.RecordLog_sqlname, formname, "", Constant.Add_Bom, Constant.CurUserName(), DateTime.Now, change_str), null);
                    }
                    else if (change_str == "添加弹性体BOM")
                    {
                        StringBuilder Strconn = DgdDealHelper.GetCombineInfo(Constant.Elastic_dt);
                        sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0}(generic_assembly,sgelasticbom,sgelasticinfo,sgelasticinfo_test)values('{1}','{2}','{3}','{4}')", Constant.Elastic_sqlname, Addnode.Parent.Text, Constant.Add_Bom, Strconn, Strconn), null);
                        SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}')", Constant.RecordLog_sqlname, formname, "", Constant.Add_Bom, Constant.CurUserName(), DateTime.Now, change_str), null);
                    }
                    else if (change_str == "添加应变片BOM")
                    {
                        StringBuilder Strconn = DgdDealHelper.GetCombineInfo(Constant.Sgseries_dt);
                        sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sgseriesbom,sgseriesinfo,sgseriesinfo_test) values ('{1}','{2}','{3}')", Constant.SGseries_sqlname, Constant.Add_Bom, Strconn, Strconn), null);
                        SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}')", Constant.RecordLog_sqlname, formname, "", Constant.Add_Bom, Constant.CurUserName(), DateTime.Now, change_str), null);
                    }
                    else if (change_str == "添加应变胶BOM")
                    {
                        StringBuilder Strconn = DgdDealHelper.GetCombineInfo(Constant.Sgglue_dt);
                        sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sggluebom,sgglueinfo,sgglueinfo_test) values ('{1}','{2}','{3}')", Constant.Sgglue_sqlname, Constant.Add_Bom, Strconn, Strconn), null);
                        SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}')", Constant.RecordLog_sqlname, formname, "", Constant.Add_Bom, Constant.CurUserName(), DateTime.Now, change_str), null);
                    }
                }
                Log4netHelper.Info(new TreeNodeHelper().GetType(), string.Format("{0}:{1}", change_str, Constant.Add_Bom));
                UIHelper.DesktopNotify(true, string.Format("{0}:{1}", change_str, Constant.Add_Bom));
            }
            catch (Exception ex)
            {
                MessageBox.Show("添加节点时发生异常:" + ex.Message);
            }
        }
Exemplo n.º 5
0
 public void Save(object sender, EventArgs e)
 {
     try
     {
         SendKeys.SendWait("{ENTER}");
         for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
         {
             if (!string.IsNullOrEmpty(dataGridViewX1.Rows[i].Cells[1].ErrorText))
             {
                 UIHelper.ToastNotify(false, "保存失败,正式生产表中存在不合理数据,请重新检查!", tabControl1);
                 Log4netHelper.Error(this.GetType(), string.Format("正式生产表中存在不合理数据,请重新检查!第{0}行,第{1}列,原因是:{2}", i, 1, dataGridViewX1.Rows[i].Cells[1].ErrorText));
                 return;
             }
         }
         //获取盒子名称;
         Boxtype_str = GetBoxtypeName();
         if (Boxtype_str == "NULL")
         {
             BoxType_TextBox.Focus();
             return;
         }
         //先判断是否已存在
         DataTable sql_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select sgboxtype from {0} where sgboxtype='{1}'", Constant.Boxtype_sqlname, Boxtype_str), null);
         if (sql_dt.Rows.Count > 0 && !submit_flag)
         {
             UIHelper.ToastNotify(false, "该型号已存在,请不要重复创建!--" + Boxtype_str, tabControl1);
             return;
         }
         DataTable     formal_dt      = ((DataTable)dataGridViewX1.DataSource).Copy();
         StringBuilder Formal_strconn = DgdDealHelper.GetCombineInfo(formal_dt);
         if (submit_flag)
         {
             sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set sgboxinfo='{1}',sgboxinfo_test='{2}' where sgboxtype='{3}'", Constant.Boxtype_sqlname, Formal_strconn, Formal_strconn, Boxtype_str), null);
             DgdDealHelper.Deal_DifDgdValue(this.Text, NotModify_dt1, dataGridViewX1, "正式表");
             UIHelper.ToastNotify(true, "表数据修改保存成功!", tabControl1);
         }
         else
         {
             sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sgboxtype,sgboxinfo,sgboxinfo_test)values('{1}','{2}','{3}')", Constant.Boxtype_sqlname, Boxtype_str, Formal_strconn, Formal_strconn), null);
             SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}')", Constant.RecordLog_sqlname, Boxtype_str, Constant.CurUserName(), DateTime.Now, "创建Boxtype"), null);
             //创建节点
             CreateTypeNode(parent_str, Boxtype_str);
             UIHelper.ToastNotify(true, "表数据创建成功!", tabControl1);
             Log4netHelper.Info(this.GetType(), Boxtype_str + "表数据创建成功!");
         }
         NotModify_dt1 = formal_dt;
         submit_flag   = true;
         CloseCreatForm(this.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show("保存时发生异常:" + ex.Message);
     }
 }
Exemplo n.º 6
0
        public void Save(object sender, EventArgs e)
        {
            try
            {
                SendKeys.SendWait("{ENTER}");
                if (tabControl1.SelectedTabIndex == 0)
                {
                    for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(dataGridViewX1.Rows[i].Cells[1].ErrorText))
                        {
                            UIHelper.ToastNotify(false, "保存失败,正式生产表中存在不合理数据,请重新检查!", tabControl1);
                            //MessageBox.Show("保存失败,正式生产表中存在不合理数据,请重新检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Log4netHelper.Error(this.GetType(), string.Format("正式生产表中存在不合理数据,请重新检查!第{0}行,第{1}列,原因是:{2}", i, 1, dataGridViewX1.Rows[i].Cells[1].ErrorText));
                            return;
                        }
                    }
                    DataTable     formal_dt      = ((DataTable)dataGridViewX1.DataSource).Copy();
                    StringBuilder Formal_strconn = DgdDealHelper.GetCombineInfo(formal_dt);
                    sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set lcbominfo='{1}' where lcbom_meaid='{2}'", Constant.MainBom_sqlname, Formal_strconn, UniqueID), null);
                    DgdDealHelper.Deal_DifDgdValue(this.Text, NotModify_dt1, dataGridViewX1, "正式表");
                    NotModify_dt1 = formal_dt;
                    UIHelper.ToastNotify(true, "已提交,正式表数据保存成功!", tabControl1);
                }
                else
                {
                    for (int j = 0; j < dataGridViewX2.Rows.Count; j++)
                    {
                        if (!string.IsNullOrEmpty(dataGridViewX2.Rows[j].Cells[1].ErrorText))
                        {
                            UIHelper.ToastNotify(false, "保存失败,样机生产表中存在不合理数据,请重新检查!", tabControl1);
                            //MessageBox.Show("保存失败,样机生产表中存在不合理数据,请重新检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Log4netHelper.Error(this.GetType(), string.Format("样机生产表中存在不合理数据,请重新检查!第{0}行,第{1}列,原因是:{2}", j, 1, dataGridViewX1.Rows[j].Cells[1].ErrorText));
                            return;
                        }
                    }

                    DataTable     test_dt      = ((DataTable)dataGridViewX2.DataSource).Copy();
                    StringBuilder Test_strconn = DgdDealHelper.GetCombineInfo(test_dt);
                    sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set lcbominfo_test='{1}' where lcbom_meaid='{2}'", Constant.MainBom_sqlname, Test_strconn, UniqueID), null);
                    DgdDealHelper.Deal_DifDgdValue(this.Text, NotModify_dt2, dataGridViewX2, "样机表");
                    NotModify_dt2 = test_dt;
                    UIHelper.ToastNotify(true, "已提交,样机表数据保存成功!", tabControl1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存时发生异常:" + ex.Message);
            }
        }
Exemplo n.º 7
0
        public void Copy(object sender, EventArgs e)
        {
            try
            {
                dataGridViewX1.EndEdit();

                if (tabControl1.SelectedTabIndex == 0)
                {
                    DgdDealHelper.SetDataGridVIewToClipboard(dataGridViewX1);
                    //UIHelper.ToastNotify(true, "正式生产表数据已复制到粘贴板!", tabControl1);
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.Fatal(this.GetType(), "复制时发生异常:", ex);
            }
        }
Exemplo n.º 8
0
        private void ManulImport_MainBom()
        {
            try
            {
                XMLGetModel.XMLRead();
                string category_Str = "";
                string category_chn = "";

                StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Maingage_dt.Copy());
                for (int m = 0; m < 2; m++)
                {
                    if (m == 0)
                    {
                        category_Str = "AnalogLC";
                        category_chn = "模拟传感器";
                    }
                    else
                    {
                        category_Str = "DigitalLC";
                        category_chn = "数字传感器";
                    }

                    DataTable model_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_MODEL from MT_CZ_ASSORTMENTTYPE where CATEGORY='{0}' and ME is not null", category_Str), null);
                    for (int k = 0; k < model_dt.Rows.Count; k++)
                    {
                        DataTable Assmely_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_ASSEMBLY from MT_CZ_ASSORTMENTTYPE where GENERIC_MODEL='{0}' and GENERIC_ASSEMBLY is not null and ME is not null", model_dt.Rows[k][0]), null);
                        for (int i = 0; i < Assmely_dt.Rows.Count; i++)
                        {
                            DataTable bom_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct ME from MT_CZ_ASSORTMENTTYPE where GENERIC_ASSEMBLY='{0}' and ME is not null", Assmely_dt.Rows[i][0]), null);
                            for (int j = 0; j < bom_dt.Rows.Count; j++)
                            {
                                sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (lcbom_meaid,lcbom,lcassembly,lcproductclass,lcproductmodel,lcbominfo,lcbominfo_test,modifieddate)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", Constant.MainBom_sqlname, Guid.NewGuid(), bom_dt.Rows[j][0], Assmely_dt.Rows[i][0], category_chn, model_dt.Rows[k][0], strconn, strconn, DateTime.Now), null);
                            }
                        }
                    }
                }
                MessageBox.Show("done");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 9
0
 private void ManulImport_sgseries()
 {
     try
     {
         XMLGetModel.XMLRead();
         StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Sgseries_dt.Copy());
         DataTable     gage_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct gagebom from {0} where isactive='1'", "MT_CZ_PRODUCTION_GAGE"), null);
         for (int i = 0; i < gage_dt.Rows.Count; i++)
         {
             sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sgseriesbom,sgseriesinfo,sgseriesinfo_test,modifiedby,modifieddate)values('{1}','{2}','{3}','{4}','{5}')", Constant.SGseries_sqlname, gage_dt.Rows[i][0], strconn, strconn, "HT", DateTime.Now), null);
         }
         MessageBox.Show("done1");
         //this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 10
0
        private void MaintainMainBomForm_Load(object sender, EventArgs e)
        {
            try
            {
                this.Save_Btn.Click    += new System.EventHandler(this.Save);
                this.Copy_Btn.Click    += new System.EventHandler(this.Copy);
                this.Pasete_Btn.Click  += new System.EventHandler(this.Paste);
                this.Replace_Btn.Click += new System.EventHandler(this.Replace);
                this.Format_Btn.Click  += new System.EventHandler(this.Format);
                this.Cancel_Btn.Click  += new System.EventHandler(this.Cancel);
                this.AddLine_Btn.Click += new System.EventHandler(this.AddLine);

                InitialCombox();

                tabControl1.SelectedTabIndex  = 0;//默认初始打开的都是正式维护界面
                this.Formal_tabitem.TextColor = Color.LightGray;
                this.test_tabitem.TextColor   = Color.LightGray;

                Title_label.Text = string.Format("{0}-传感器物料号维护模块:{1}", Assembly_str, LCBOM_str);
                DataTable Sql_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select lcbominfo,lcbominfo_test from {0} where lcbom_meaid='{1}'", Constant.MainBom_sqlname, UniqueID), null);

                if (Sql_dt.Rows.Count == 1)
                {
                    dataGridViewX1.DataSource = DgdDealHelper.InitiaDgd(Sql_dt, 0).Copy();
                    dataGridViewX2.DataSource = DgdDealHelper.InitiaDgd(Sql_dt, 1).Copy();
                }
                else if (Sql_dt.Rows.Count <= 0)// load and insert sql
                {
                    MessageBox.Show("未找到该物料号的数据,请重新创建该产品:" + UniqueID);
                    return;
                }

                NotModify_dt1 = ((DataTable)dataGridViewX1.DataSource).Copy();
                NotModify_dt2 = ((DataTable)dataGridViewX2.DataSource).Copy();
                UserRightHelper.Table_UserRight(this.Text, dataGridViewX1, dataGridViewX2, contextMenuStrip1);
                this.dataGridViewX1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(DefineDTlineNO.datagridviewLineNO);
                this.dataGridViewX2.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(DefineDTlineNO.datagridviewLineNO);

                this.dataGridViewX1.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.Dgd_EditingControlShowing);
                this.dataGridViewX2.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.Dgd_EditingControlShowing);
                this.dataGridViewX1.CellErrorTextNeeded   += new System.Windows.Forms.DataGridViewCellErrorTextNeededEventHandler(this.Dgd_CellErrorTextNeeded);
                this.dataGridViewX2.CellErrorTextNeeded   += new System.Windows.Forms.DataGridViewCellErrorTextNeededEventHandler(this.Dgd_CellErrorTextNeeded);
                this.dataGridViewX1.CellValueChanged      += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellValueChanged);
                this.dataGridViewX2.CellValueChanged      += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellValueChanged);
                this.dataGridViewX1.CellBeginEdit         += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.Dgd_CellBeginEdit);
                this.dataGridViewX2.CellBeginEdit         += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.Dgd_CellBeginEdit);
                this.dataGridViewX1.CellClick             += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellClick);
                this.dataGridViewX2.CellClick             += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellClick);
                this.dataGridViewX1.CellValidating        += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.Dgd_CellValidating);
                this.dataGridViewX2.CellValidating        += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.Dgd_CellValidating);

                //载入图片信息
                Gage_pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                if (File.Exists("MAINBOM.jpg"))
                {
                    Gage_pictureBox.Load("MAINBOM.jpg");
                }
                else
                {
                    Gage_pictureBox.Image = Properties.Resources.MT;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("界面载入时发生异常:" + ex.Message);
            }
        }
Exemplo n.º 11
0
        private void MaintainSgglueForm_Load(object sender, EventArgs e)
        {
            try
            {
                this.dataGridViewX1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(DefineDTlineNO.datagridviewLineNO);
                this.dataGridViewX2.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(DefineDTlineNO.datagridviewLineNO);
                this.Save_Btn.Click    += new System.EventHandler(this.Save);
                this.Copy_Btn.Click    += new System.EventHandler(this.Copy);
                this.Pasete_Btn.Click  += new System.EventHandler(this.Paste);
                this.Replace_Btn.Click += new System.EventHandler(this.Replace);
                this.Format_Btn.Click  += new System.EventHandler(this.Format);
                this.Cancel_Btn.Click  += new System.EventHandler(this.Cancel);
                this.AddLine_Btn.Click += new System.EventHandler(this.AddLine);

                Title_label.Text              = string.Format("应变胶BOM:{0}------应变胶信息数据维护", SGglue_Bom);
                tabControl1.SelectedTabIndex  = 0;//默认初始打开的都是正式维护界面
                this.Formal_tabitem.TextColor = Color.LightGray;
                this.test_tabitem.TextColor   = Color.LightGray;

                DataTable Sql_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select sgglueinfo,sgglueinfo_test from {0} where sggluebom='{1}'", Constant.Sgglue_sqlname, SGglue_Bom), null);
                if (Sql_dt.Rows.Count == 1)
                {
                    dataGridViewX1.DataSource = DgdDealHelper.InitiaDgd(Sql_dt, 0).Copy();
                    dataGridViewX2.DataSource = DgdDealHelper.InitiaDgd(Sql_dt, 1).Copy();
                }
                else if (Sql_dt.Rows.Count <= 0)// load and insert sql
                {
                    MessageBox.Show("当前数据信息第一次创建,请维护!");
                    dataGridViewX1.DataSource = Constant.Sgglue_dt.Copy();
                    dataGridViewX2.DataSource = Constant.Sgglue_dt.Copy();
                    StringBuilder Strconn = DgdDealHelper.GetCombineInfo(Constant.Sgglue_dt);
                    //insert
                    sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sggluebom,sgglueinfo,sgglueinfo_test) values ('{1}','{2}','{3}')", Constant.Sgglue_sqlname, SGglue_Bom, Strconn, Strconn), null);
                }
                NotModify_dt1 = ((DataTable)dataGridViewX1.DataSource).Copy();
                NotModify_dt2 = ((DataTable)dataGridViewX2.DataSource).Copy();
                UserRightHelper.Table_UserRight(this.Text, dataGridViewX1, dataGridViewX2, contextMenuStrip1);

                this.dataGridViewX1.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.Dgd_EditingControlShowing);
                this.dataGridViewX2.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.Dgd_EditingControlShowing);
                this.dataGridViewX1.CellErrorTextNeeded   += new System.Windows.Forms.DataGridViewCellErrorTextNeededEventHandler(this.Dgd_CellErrorTextNeeded);
                this.dataGridViewX2.CellErrorTextNeeded   += new System.Windows.Forms.DataGridViewCellErrorTextNeededEventHandler(this.Dgd_CellErrorTextNeeded);
                this.dataGridViewX1.CellValueChanged      += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellValueChanged);
                this.dataGridViewX2.CellValueChanged      += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellValueChanged);
                this.dataGridViewX1.CellBeginEdit         += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.Dgd_CellBeginEdit);
                this.dataGridViewX2.CellBeginEdit         += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.Dgd_CellBeginEdit);
                this.dataGridViewX1.CellClick             += new System.Windows.Forms.DataGridViewCellEventHandler(this.Dgd_CellClick);
                this.dataGridViewX1.CellValidating        += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.Dgd_CellValidating);
                this.dataGridViewX2.CellValidating        += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.Dgd_CellValidating);

                //载入图片信息
                Gage_pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                if (File.Exists("SGGLUE.jpg"))
                {
                    Gage_pictureBox.Load("SGGLUE.jpg");
                }
                else
                {
                    Gage_pictureBox.Image = Properties.Resources.MT;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("界面载入时发生异常:" + ex.Message);
            }
        }