Пример #1
0
        private void bulidperformance(string idataid)
        {
            DataTable dt = DataOperation.ExecQuery("select id,DATA_ID,CAPA1,CAPA2,CAPA3,MIN_SIGN,MIN_VALUE,MIN_EXPONENTIAL,MAX_SIGN,MAX_VALUE,MAX_EXPONENTIAL,TEST_METHOD,TEST_CONDITION,MTEXT,status,CAPA1code,CAPA2code,CAPA3code       from NEW_ID_CAPABILITY where data_id='" + idataid + "'");

            dgvperformance.DataSource = null;
            if (dt != null)
            {
                DataGridViewTextBoxColumn column0 = new DataGridViewTextBoxColumn();
                column0.DataPropertyName = "id";//对应数据源的字段
                this.dgvperformance.Columns.Add(column0);
                this.dgvperformance.Columns[0].Visible = false;

                DataGridViewTextBoxColumn column1 = new DataGridViewTextBoxColumn();
                column1.DataPropertyName = "DATA_ID";//对应数据源的字段
                this.dgvperformance.Columns.Add(column1);
                this.dgvperformance.Columns[1].Visible = false;


                DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn();
                column2.HeaderText       = "一级性能";
                column2.DataPropertyName = "CAPA1";//对应数据源的字段
                column2.ReadOnly         = true;
                this.dgvperformance.Columns.Add(column2);

                DataGridViewTextBoxColumn column21 = new DataGridViewTextBoxColumn();
                column21.HeaderText       = "二级性能";
                column21.ReadOnly         = true;
                column21.DataPropertyName = "CAPA2";//对应数据源的字段
                this.dgvperformance.Columns.Add(column21);

                DataGridViewTextBoxColumn column22 = new DataGridViewTextBoxColumn();
                column22.HeaderText       = "三级性能";
                column22.ReadOnly         = true;
                column22.DataPropertyName = "CAPA3";//对应数据源的字段
                this.dgvperformance.Columns.Add(column22);

                List <string> ListData = new List <string> {
                    ">=", ">", "="
                };
                DataGridViewComboBoxColumn column3 = new DataGridViewComboBoxColumn();
                column3.Name             = "Name";
                column3.DataPropertyName = "MIN_SIGN";//对应数据源的字段
                column3.HeaderText       = " ";
                column3.Width            = 40;
                this.dgvperformance.Columns.Add(column3);
                column3.DataSource = ListData;

                DataGridViewTextBoxColumn column4 = new DataGridViewTextBoxColumn();
                column4.Name             = "MIN_VALUE";
                column4.DataPropertyName = "MIN_VALUE";//对应数据源的字段
                column4.HeaderText       = "下界数据";
                column4.Width            = 80;
                this.dgvperformance.Columns.Add(column4);

                DataGridViewTextBoxColumn column5 = new DataGridViewTextBoxColumn();
                column5.Name             = "MIN_EXPONENTIAL";
                column5.DataPropertyName = "MIN_EXPONENTIAL";//对应数据源的字段
                column5.HeaderText       = "幂次";

                column5.Width = 80;
                this.dgvperformance.Columns.Add(column5);

                List <string> ListData1 = new List <string> {
                    "<=", "<", "="
                };
                DataGridViewComboBoxColumn column6 = new DataGridViewComboBoxColumn();
                column6.Name             = "MAX_SIGN";
                column6.DataPropertyName = "MAX_SIGN";//对应数据源的字段
                column6.HeaderText       = " ";
                column6.Width            = 40;
                this.dgvperformance.Columns.Add(column6);
                column6.DataSource = ListData1;

                DataGridViewTextBoxColumn column7 = new DataGridViewTextBoxColumn();
                column7.Name             = "MAX_VALUE";
                column7.DataPropertyName = "MAX_VALUE";//对应数据源的字段
                column7.HeaderText       = "上界数据";
                column7.Width            = 80;
                this.dgvperformance.Columns.Add(column7);

                DataGridViewTextBoxColumn column8 = new DataGridViewTextBoxColumn();
                column8.Name             = "MAX_EXPONENTIAL";
                column8.DataPropertyName = "MAX_EXPONENTIAL";//对应数据源的字段
                column8.HeaderText       = "幂次";
                column8.Width            = 80;
                this.dgvperformance.Columns.Add(column8);

                DataGridViewTextBoxColumn column9 = new DataGridViewTextBoxColumn();
                column9.Name             = "TEST_METHOD";
                column9.DataPropertyName = "TEST_METHOD";//对应数据源的字段
                column9.HeaderText       = "测试方法";
                column9.Width            = 300;
                this.dgvperformance.Columns.Add(column9);

                DataGridViewTextBoxColumn column10 = new DataGridViewTextBoxColumn();
                column10.Name             = "测试条件";
                column10.DataPropertyName = "TEST_CONDITION";//对应数据源的字段
                column10.HeaderText       = "测试条件";
                column10.Width            = 300;
                this.dgvperformance.Columns.Add(column10);


                DataGridViewTextBoxColumn column11 = new DataGridViewTextBoxColumn();
                column11.Name             = "MTEXT";
                column11.DataPropertyName = "MTEXT";//对应数据源的字段
                column11.HeaderText       = "备注";
                column11.Visible          = true;
                this.dgvperformance.Columns.Add(column11);

                DataGridViewTextBoxColumn column12 = new DataGridViewTextBoxColumn();
                column12.DataPropertyName = "status";//对应数据源的字段
                column12.Name             = "状态";
                column12.HeaderText       = "状态";
                column12.Visible          = false;
                this.dgvperformance.Columns.Add(column12);

                DataGridViewTextBoxColumn column13 = new DataGridViewTextBoxColumn();
                column13.DataPropertyName = "CAPA1code";//对应数据源的字段
                column13.Name             = "状态";
                column13.HeaderText       = "状态";
                column13.Visible          = false;
                this.dgvperformance.Columns.Add(column13);

                DataGridViewTextBoxColumn column14 = new DataGridViewTextBoxColumn();
                column14.DataPropertyName = "CAPA2code";//对应数据源的字段
                column14.Name             = "状态";
                column14.HeaderText       = "状态";
                column14.Visible          = false;

                this.dgvperformance.Columns.Add(column14);

                DataGridViewTextBoxColumn column15 = new DataGridViewTextBoxColumn();
                column15.DataPropertyName = "CAPA3code";//对应数据源的字段
                column15.Name             = "状态";
                column15.HeaderText       = "状态";
                column15.Visible          = false;
                this.dgvperformance.Columns.Add(column15);

                dgvperformance.DataSource = dt;
            }
        }
Пример #2
0
        private void bulidcheckmaterial()
        {
            dt = DataOperation.ExecQuery("select  DATA_ID,DATA_SORT1NAME,DATA_SORT2NAME, DATA_SERIESNAME,AUDITING_NAME, AUDITING_YEAR&'-'&AUDITING_MONTH&'-'&Auditing_day as  AUDITINGtime from [materialbase]   where checked=0  and  DATA_ID  Like  '%" + datano.Text + "%'");
            this.dataGridView1.Columns.Clear();
            DataGridViewTextBoxColumn column0 = new DataGridViewTextBoxColumn();

            column0.DataPropertyName = "DATA_ID";//对应数据源的字段
            column0.Name             = "DATA_ID";
            column0.HeaderText       = "材料牌号";
            column0.Width            = 200;
            this.dataGridView1.Columns.Add(column0);


            DataGridViewTextBoxColumn column1 = new DataGridViewTextBoxColumn();

            column1.DataPropertyName = "DATA_SORT1NAME";//对应数据源的字段
            column1.HeaderText       = "材料类别";
            column1.Width            = 150;
            this.dataGridView1.Columns.Add(column1);

            DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn();

            column2.DataPropertyName = "DATA_SORT2NAME";//对应数据源的字段
            column2.HeaderText       = "材料种类";
            column2.Width            = 200;
            this.dataGridView1.Columns.Add(column2);

            DataGridViewTextBoxColumn column3 = new DataGridViewTextBoxColumn();

            column3.DataPropertyName = "DATA_SERIESNAME";//对应数据源的字段
            column3.HeaderText       = "材料种类";
            column3.Width            = 200;
            this.dataGridView1.Columns.Add(column3);

            DataGridViewTextBoxColumn column4 = new DataGridViewTextBoxColumn();

            column4.DataPropertyName = "AUDITING_NAME";//对应数据源的字段
            column4.HeaderText       = "审核人";
            column4.Width            = 200;
            this.dataGridView1.Columns.Add(column4);

            DataGridViewTextBoxColumn column5 = new DataGridViewTextBoxColumn();

            column5.DataPropertyName = "AUDITINGtime";//对应数据源的字段
            column5.HeaderText       = "审核日期";
            column5.Width            = 200;
            this.dataGridView1.Columns.Add(column5);



            DataGridViewCheckBoxColumn column6 = new DataGridViewCheckBoxColumn();

            column6.HeaderText       = "审核?";
            column6.Name             = "Select";
            column6.DataPropertyName = "Select";
            column6.ReadOnly         = false;
            column6.TrueValue        = true;
            column6.FalseValue       = false;

            this.dataGridView1.Columns.Add(column6);
            this.dataGridView1.DataSource = dt;
        }
Пример #3
0
        private void save_Click(object sender, EventArgs e)
        {
            string sql = null;

            if (tabControl1.SelectedIndex == 0)
            {
                for (int i = 0; i < dgvdcapabilityhead.Rows.Count; i++)
                {
                    if (dgvdcapabilityhead.Rows[i].Cells[0].Value.ToString().Length > 0)
                    {
                        sql = "update  NEW_ID_CAPABILITY_HEAD   set [CHARACTER]='" + dgvdcapabilityhead.Rows[i].Cells[2].Value + "',MINI_SIGN='" + dgvdcapabilityhead.Rows[i].Cells[3].Value + "',MINI_VALUE=" + dgvdcapabilityhead.Rows[i].Cells[4].Value
                              + ",MINI_EXPONENTIAL=" + dgvdcapabilityhead.Rows[i].Cells[5].Value + ",MAX_SIGN='" + dgvdcapabilityhead.Rows[i].Cells[6].Value + "',MAX_VALUE=" +
                              dgvdcapabilityhead.Rows[i].Cells[7].Value + ",MAX_EXPONENTIAL=" + dgvdcapabilityhead.Rows[i].Cells[8].Value + ",MTEXT='" + dgvdcapabilityhead.Rows[i].Cells[9].Value + "'" + ",COMMENTS1='" + dgvdcapabilityhead.Rows[i].Cells[10].Value + "'" +
                              ",pcode='" + dgvdcapabilityhead.Rows[i].Cells[11].Value + "'" + "  where Id=" + dgvdcapabilityhead.Rows[i].Cells[0].Value;
                    }
                    else
                    {
                        sql = "insert  into NEW_ID_CAPABILITY_HEAD(DATA_ID,[CHARACTER],MINI_SIGN,MINI_VALUE,MINI_EXPONENTIAL,MAX_SIGN,MAX_VALUE,MAX_EXPONENTIAL,MTEXT,COMMENTS1,pcode,status)  values('" +
                              dataid + "','" + dgvdcapabilityhead.Rows[i].Cells[2].Value + "','" + dgvdcapabilityhead.Rows[i].Cells[3].Value + "'," +
                              dgvdcapabilityhead.Rows[i].Cells[4].Value + "," + dgvdcapabilityhead.Rows[i].Cells[5].Value + ",'" +
                              dgvdcapabilityhead.Rows[i].Cells[6].Value + "'," + dgvdcapabilityhead.Rows[i].Cells[7].Value + "," +
                              dgvdcapabilityhead.Rows[i].Cells[8].Value + ",'" + dgvdcapabilityhead.Rows[i].Cells[9].Value + "','" + dgvdcapabilityhead.Rows[i].Cells[10].Value + "','" + dgvdcapabilityhead.Rows[i].Cells[11].Value + "',1)";
                    }
                    DataOperation.Execsql(sql);
                }
                bulidcapabilityhead(dataid);
            }
            if (tabControl1.SelectedIndex == 1)
            {
                for (int i = 0; i < dgvperformance.Rows.Count; i++)
                {
                    if (dgvperformance.Rows[i].Cells[0].Value.ToString().Length > 0)
                    {
                        sql = "update  NEW_ID_CAPABILITY   set  CAPA1='" + dgvperformance.Rows[i].Cells[2].Value + "',CAPA2='" + dgvperformance.Rows[i].Cells[3].Value + "',CAPA3='" + dgvperformance.Rows[i].Cells[4].Value +
                              "',MIN_SIGN = '" + dgvperformance.Rows[i].Cells[5].Value + "',MIN_VALUE=" + dgvperformance.Rows[i].Cells[6].Value + ",MIN_EXPONENTIAL=" + dgvperformance.Rows[i].Cells[7].Value +
                              ",MAX_SIGN = '" + dgvperformance.Rows[i].Cells[8].Value + "',MAX_VALUE=" + dgvperformance.Rows[i].Cells[9].Value + ",MAX_EXPONENTIAL=" + dgvperformance.Rows[i].Cells[10].Value +
                              ",TEST_METHOD='" + dgvperformance.Rows[i].Cells[11].Value + "',TEST_CONDITION='" + dgvperformance.Rows[i].Cells[12].Value + "',MTEXT='" + dgvperformance.Rows[i].Cells[13].Value
                              + "'  where Id=" + dgvperformance.Rows[i].Cells[0].Value;
                    }
                    else
                    {
                        sql = "insert  into NEW_ID_CAPABILITY(DATA_ID,CAPA1,CAPA2,CAPA3,MIN_SIGN,MIN_VALUE,MIN_EXPONENTIAL,MAX_SIGN,MAX_VALUE,MAX_EXPONENTIAL,TEST_METHOD,TEST_CONDITION,MTEXT,[status],CAPA1code,CAPA2code,CAPA3code)  " +
                              "values('" + dataid + "','" + dgvperformance.Rows[i].Cells[2].Value + "','" + dgvperformance.Rows[i].Cells[3].Value + "','" + dgvperformance.Rows[i].Cells[4].Value + "','" + dgvperformance.Rows[i].Cells[5].Value + "'," +
                              dgvperformance.Rows[i].Cells[6].Value + "," + dgvperformance.Rows[i].Cells[7].Value + ",'" + dgvperformance.Rows[i].Cells[8].Value + "'," + dgvperformance.Rows[i].Cells[9].Value + "," +
                              dgvperformance.Rows[i].Cells[10].Value + ",'" + dgvperformance.Rows[i].Cells[11].Value + "','" + dgvperformance.Rows[i].Cells[12].Value + "','" + dgvperformance.Rows[i].Cells[13].Value

                              + "',1,'" + dgvperformance.Rows[i].Cells[15].Value + "','" + dgvperformance.Rows[i].Cells[16].Value + "','" + dgvperformance.Rows[i].Cells[17].Value + "')";
                    }
                    DataOperation.Execsql(sql);
                }
                bulidperformance(dataid);
            }

            if (tabControl1.SelectedIndex == 2)
            {
                if (DataOperation.ExecQuery("select * from  NEW_ID_EXAMINE_NEW  where DATA_ID='" + dataid + "'").Rows.Count > 0)
                {
                    sql = "update  NEW_ID_EXAMINE_NEW   set  TESTTYPE='" + TESTTYPE.Text + "',TESTNAME='" + TESTNAME.Text + "',METHOD='" + METHOD.Text +
                          "',CONDITION = '" + CONDITION.Text + "',RESULT='" + PRESULT.Text + "'"
                          + "  where DATA_ID='" + dataid + "'";;
                }
                else
                {
                    sql = "insert  into NEW_ID_EXAMINE_NEW(DATA_ID,TESTTYPE,TESTNAME,METHOD,CONDITION,RESULT)  " +
                          "values('" + dataid + "','" + TESTTYPE.Text + "','" + TESTNAME.Text + "','" + METHOD.Text + "','" + CONDITION.Text + "','" +
                          PRESULT.Text + "')";
                }
                DataOperation.Execsql(sql);

                bulidpexam(dataid);
            }
        }
Пример #4
0
        private void bulidcapabilityhead(string idataid)
        {
            DataTable dt = DataOperation.ExecQuery("select *   from NEW_ID_CAPABILITY_HEAD where data_id='" + idataid + "'");

            dgvdcapabilityhead.DataSource = null;
            if (dt != null)
            {
                DataGridViewTextBoxColumn column0 = new DataGridViewTextBoxColumn();
                column0.DataPropertyName = "id";//对应数据源的字段
                this.dgvdcapabilityhead.Columns.Add(column0);
                this.dgvdcapabilityhead.Columns[0].Visible = false;

                DataGridViewTextBoxColumn column1 = new DataGridViewTextBoxColumn();
                column1.DataPropertyName = "DATA_ID";//对应数据源的字段
                this.dgvdcapabilityhead.Columns.Add(column1);
                this.dgvdcapabilityhead.Columns[1].Visible = false;

                DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn();
                column2.HeaderText       = "性能项目";
                column2.DataPropertyName = "CHARACTER";//对应数据源的字段
                column2.ReadOnly         = true;
                this.dgvdcapabilityhead.Columns.Add(column2);

                List <string> ListData = new List <string> {
                    ">=", ">", "="
                };
                DataGridViewComboBoxColumn column3 = new DataGridViewComboBoxColumn();
                column3.Name             = "Name";
                column3.DataPropertyName = "MINI_SIGN";//对应数据源的字段
                column3.HeaderText       = " ";
                column3.Width            = 40;
                this.dgvdcapabilityhead.Columns.Add(column3);
                column3.DataSource = ListData;

                DataGridViewTextBoxColumn column4 = new DataGridViewTextBoxColumn();
                column4.Name             = "MINI_VALUE";
                column4.DataPropertyName = "MINI_VALUE";//对应数据源的字段
                column4.HeaderText       = "下界数据";
                column4.Width            = 80;
                this.dgvdcapabilityhead.Columns.Add(column4);

                DataGridViewTextBoxColumn column5 = new DataGridViewTextBoxColumn();
                column5.Name             = "MINI_EXPONENTIAL";
                column5.DataPropertyName = "MINI_EXPONENTIAL";//对应数据源的字段
                column5.HeaderText       = "幂次";

                column5.Width = 80;
                this.dgvdcapabilityhead.Columns.Add(column5);

                List <string> ListData1 = new List <string> {
                    "<=", "<", "="
                };
                DataGridViewComboBoxColumn column6 = new DataGridViewComboBoxColumn();
                column6.Name             = "MAX_SIGN";
                column6.DataPropertyName = "MAX_SIGN";//对应数据源的字段
                column6.HeaderText       = " ";
                column6.Width            = 40;
                this.dgvdcapabilityhead.Columns.Add(column6);
                column6.DataSource = ListData1;

                DataGridViewTextBoxColumn column7 = new DataGridViewTextBoxColumn();
                column7.Name             = "MAX_VALUE";
                column7.DataPropertyName = "MAX_VALUE";//对应数据源的字段
                column7.HeaderText       = "上界数据";
                column7.Width            = 80;
                this.dgvdcapabilityhead.Columns.Add(column7);

                DataGridViewTextBoxColumn column8 = new DataGridViewTextBoxColumn();
                column8.Name             = "MAX_EXPONENTIAL";
                column8.DataPropertyName = "MAX_EXPONENTIAL";//对应数据源的字段
                column8.HeaderText       = "幂次";
                column8.Width            = 80;
                this.dgvdcapabilityhead.Columns.Add(column8);

                DataGridViewTextBoxColumn column9 = new DataGridViewTextBoxColumn();
                column9.Name             = "MTEXT";
                column9.DataPropertyName = "MTEXT";//对应数据源的字段
                column9.HeaderText       = "定性指标";
                column9.Width            = 300;
                this.dgvdcapabilityhead.Columns.Add(column9);

                DataGridViewTextBoxColumn column10 = new DataGridViewTextBoxColumn();
                column10.Name             = "备注";
                column10.DataPropertyName = "comments1";//对应数据源的字段
                column10.HeaderText       = "备注";
                column10.Width            = 300;
                this.dgvdcapabilityhead.Columns.Add(column10);


                DataGridViewTextBoxColumn column11 = new DataGridViewTextBoxColumn();
                column11.Name             = "特征代码";
                column11.DataPropertyName = "pcode";//对应数据源的字段
                column11.HeaderText       = "特征代码";
                column11.Visible          = true;
                this.dgvdcapabilityhead.Columns.Add(column11);

                DataGridViewTextBoxColumn column12 = new DataGridViewTextBoxColumn();
                column12.DataPropertyName = "status";//对应数据源的字段
                column12.Name             = "特征代码";
                column12.HeaderText       = "状态码";
                column12.Visible          = true;
                this.dgvdcapabilityhead.Columns.Add(column12);

                dgvdcapabilityhead.DataSource = dt;
            }
        }
Пример #5
0
 private void del_Click(object sender, EventArgs e)
 {
     DataOperation.Execsql("delete  from standard where id=" + dt.Rows[rows][0].ToString());
     bulidstand();
 }
Пример #6
0
        private void datano_TextChanged(object sender, EventArgs e)
        {
            DataTable dt = DataOperation.ExecQuery("select  DATA_ID,DATA_SORT1NAME,DATA_SORT2NAME, DATA_SERIESNAME from [materialbase]   where DATA_ID  Like  '%" + datano.Text + "%'");

            this.dataGridView1.DataSource = dt;
        }
Пример #7
0
        private void Inputbaseinfo()
        {
            System.IO.Stream myStream;
            int    allResult  = 0;
            int    allResult1 = 0;
            string sql;

            if (!(MessageBox.Show("确认导入数据,将会清空以前的数据?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK))
            {
                return;
            }
            DataOperation.Execsql("delete   from [commpany]");
            DataOperation.Execsql("delete   from [applicationArea]");
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = openFileDialog.OpenFile()) != null)
                    {
                        StreamReader st  = new StreamReader(openFileDialog.FileName, Encoding.GetEncoding("utf-8"));
                        string       str = st.ReadLine();
                        while (str != null)
                        {
                            string[] sArray1 = str.Split(new string[] { "#$&" }, StringSplitOptions.RemoveEmptyEntries);
                            int      xx      = sArray1.Length;
                            //导入单位数据
                            if ((sArray1.Length == 4) && sArray1[3].Equals("######"))
                            {
                                sql = "insert  into [commpany]([Code],[pname],[memo])  values ('" + sArray1[0] + "','" + sArray1[1] + "','" + sArray1[2] + "')";
                                try
                                {
                                    int inResult = DataOperation.Execsql(sql);
                                    if (inResult > 0)
                                    {
                                        allResult = allResult + 1;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("添加异常:" + ex.Message, "提示");
                                }
                            }
                            //导入应用领域数据
                            //导入单位数据
                            if ((sArray1.Length == 5) && sArray1[4].Equals("######"))
                            {
                                sql = "insert  into [applicationArea]([firstLevelCode],[secondLevelCode],[firstLevelName],[secondLevelName])  values ('" + sArray1[0] + "','" + sArray1[1] + "','" + sArray1[2] + "','" + sArray1[3] + "')";
                                try
                                {
                                    int inResult = DataOperation.Execsql(sql);
                                    if (inResult > 0)
                                    {
                                        allResult1 = allResult1 + 1;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("添加异常:" + ex.Message, "提示");
                                }
                            }
                            str = st.ReadLine();
                        }

                        MessageBox.Show("导入单位数据" + allResult + "条/13" + "导入应用领域数据" + allResult1 + "条", "数据添加成功");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("打开文件出错:" + ex.Message);
                }
            }
            //  datainput fm = new datainput();
            //fm.ShowDialog();
        }
Пример #8
0
        private void 数据上报ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string    separator = "#$&";    //分隔符标签
            string    datetag   = "@@@";    //日期标签
            string    headtag   = "&&&&&&"; //p牌号标签
            string    tabletag  = "******"; //表标签
            string    datatag   = "######"; //数据标签
            DataTable dt        = null;

            try
            {
                FileStream   fs = new FileStream("output.txt", FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ms") + datetag);
                dt = DataOperation.ExecQuery("Select *  from materialbase where checked=1");
                sw.WriteLine(dt.Rows.Count.ToString());
                //输出牌号列表
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + headtag);
                }
                //输出各各个数据表
                sw.WriteLine("new_head" + tabletag);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["DATA_NAME"].ToString() + separator + dt.Rows[i]["DATA_FOREIGN"].ToString() +
                                 dt.Rows[i]["DATA_SORT1"].ToString() + separator + dt.Rows[i]["DATA_SORT2"].ToString() + separator + dt.Rows[i]["DATA_SERIES"].ToString() + separator + dt.Rows[i]["GATHER_NAME"].ToString() +
                                 dt.Rows[i]["GATHER_COMPANY"].ToString() + separator + dt.Rows[i]["GATHER_YEAR"].ToString() + separator + dt.Rows[i]["GATHER_MONTH"].ToString() + separator + dt.Rows[i]["GATHER_DAY"].ToString() +
                                 dt.Rows[i]["INPUT_NAME"].ToString() + separator +
                                 dt.Rows[i]["INPUT_COMPANY"].ToString() + separator + dt.Rows[i]["INPUT_YEAR"].ToString() + separator + dt.Rows[i]["INPUT_MONTH"].ToString() + separator + dt.Rows[i]["INPUT_DAY"].ToString() +
                                 dt.Rows[i]["AUDITING_NAME"].ToString() + separator + dt.Rows[i]["AUDITING_COMPANY"].ToString() + separator + dt.Rows[i]["AUDITING_YEAR"].ToString() + separator + dt.Rows[i]["AUDITING_MONTH"].ToString() +
                                 dt.Rows[i]["Auditing_day"].ToString() + separator + dt.Rows[i]["checked"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_APPLY" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_APPLY  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["FIELD"].ToString() + separator + dt.Rows[i]["WEAPON"].ToString() + separator + dt.Rows[i]["BACKGROUMD"].ToString() +
                                 dt.Rows[i]["PART"].ToString() + separator + dt.Rows[i]["RESULT"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_BREED" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_BREED  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["STATUS"].ToString() + separator + dt.Rows[i]["SPEC"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_CAPABILITY" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_CAPABILITY  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if ((int.Parse(dt.Rows[i]["MIN_VALUE"].ToString()) == 0) && (int.Parse(dt.Rows[i]["MAX_VALUE"].ToString()) == 0))
                    {
                        continue;                                                                                                                  //如果上下限为0  表示数据没填
                    }
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["CAPA1"].ToString() + separator + dt.Rows[i]["CAPA2"].ToString() + separator + dt.Rows[i]["CAPA3"].ToString() +
                                 dt.Rows[i]["TEST_METHOD"].ToString() + separator + dt.Rows[i]["TEST_CONDITION"].ToString() + separator + dt.Rows[i]["MIN_SIGN"].ToString() +
                                 dt.Rows[i]["MIN_VALUE"].ToString() + separator + dt.Rows[i]["MIN_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MAX_SIGN"].ToString() + separator + dt.Rows[i]["MAX_VALUE"].ToString() +
                                 dt.Rows[i]["MAX_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MTEXT"].ToString() + separator + datatag);
                }
                sw.WriteLine("NEW_ID_CAPABILITY_HEAD" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_CAPABILITY_HEAD  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if ((int.Parse(dt.Rows[i]["MINI_VALUE"].ToString()) == 0) && (int.Parse(dt.Rows[i]["MAX_VALUE"].ToString()) == 0))
                    {
                        continue;                                                                                                                 //如果上下限为0  表示数据没填
                    }
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["CHARACTER"].ToString() + separator + dt.Rows[i]["MINI_SIGN"].ToString() + separator + dt.Rows[i]["MINI_VALUE"].ToString() +
                                 dt.Rows[i]["MINI_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MAX_SIGN"].ToString() + separator + dt.Rows[i]["MAX_VALUE"].ToString() +
                                 dt.Rows[i]["MAX_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MTEXT"].ToString() + separator + dt.Rows[i]["COMMENTS1"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_COMPONET" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_COMPONET  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["COMPONET"].ToString() + separator + dt.Rows[i]["MINI_SIGN"].ToString() + separator + dt.Rows[i]["MINI_VALUE"].ToString() +
                                 dt.Rows[i]["MINI_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MAX_SIGN"].ToString() + separator + dt.Rows[i]["MAX_VALUE"].ToString() +
                                 dt.Rows[i]["MAX_EXPONENTIAL"].ToString() + separator + dt.Rows[i]["MTEXT"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_EXAMINE_NEW" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_EXAMINE_NEW  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["TESTTYPE"].ToString() + separator + dt.Rows[i]["TESTNAME"].ToString() + separator + dt.Rows[i]["METHOD"].ToString() +
                                 dt.Rows[i]["CONDITION"].ToString() + separator + dt.Rows[i]["RESULT"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_PATENT" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_PATENT  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["PATENT_NUM"].ToString() + separator + dt.Rows[i]["PATENT_NAME"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_PREPARATION" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_PREPARATION  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["METHOD"].ToString() + separator + dt.Rows[i]["ART"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_PREPARATION" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_PREPARATION  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["METHOD"].ToString() + separator + dt.Rows[i]["ART"].ToString() + separator + datatag);
                }
                sw.WriteLine("NEW_ID_PROCESS" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_PROCESS  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["METHOD"].ToString() + separator + dt.Rows[i]["ART"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_SUPPLY" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_SUPPLY  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["COMP_NUM"].ToString() + separator + dt.Rows[i]["COMP_NAME"].ToString() + dt.Rows[i]["COMP_SIGN"].ToString() + separator + datatag);
                }

                sw.WriteLine("NEW_ID_TECHNIQUE" + tabletag);
                dt = DataOperation.ExecQuery("select *   from  NEW_ID_TECHNIQUE  where DATA_ID in  (Select DATA_ID  from materialbase where checked=1) order  by  DATA_ID");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sw.WriteLine(dt.Rows[i]["DATA_ID"].ToString() + separator + dt.Rows[i]["STANDARD_NUM"].ToString() + separator + dt.Rows[i]["STANDARD_NAME"].ToString() + separator + datatag);
                }


                sw.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        //导入材料体系数据
        private void Inputsystem()
        {
            System.IO.Stream myStream;
            int    allResult  = 0;
            int    allResult1 = 0;
            string sql        = "";

            if (!(MessageBox.Show("确认导入数据,将会清空以前的数据?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK))
            {
                return;
            }
            //清空原始表
            DataOperation.Execsql("delete   from  [materialsystem]");
            DataOperation.Execsql("ALTER TABLE [materialsystem] ALTER COLUMN [sid] COUNTER (1, 1)");
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = openFileDialog.OpenFile()) != null)
                    {
                        StreamReader st  = new StreamReader(openFileDialog.FileName, Encoding.GetEncoding("utf-8"));
                        string       str = st.ReadLine();
                        while (str != null)
                        {
                            string[] sArray1 = str.Split(new string[] { "#$&" }, StringSplitOptions.None);
                            int      xx      = sArray1.Length;
                            //导入单位数据
                            if ((sArray1.Length == 9) && sArray1[8].Equals("######"))
                            {
                                sql = "insert  into [materialSystem]([firstLevelCode],[secondLevelCode],[thirdLevelCode],[firstLevelName],[secondLevelName],[thirdLevelName],[memo])  values ('";
                                sql = sql + sArray1[0] + "','" + sArray1[1] + "','" + sArray1[2] + "','" + sArray1[3] + "','" + sArray1[4] + "','" + sArray1[5] + "','" + sArray1[6] + "')";
                                try
                                {
                                    int inResult = DataOperation.Execsql(sql);
                                    if (inResult > 0)
                                    {
                                        allResult   = allResult + 1;
                                        status.Text = "成功导入材料体系数据:" + allResult + "条";
                                    }
                                    else
                                    {
                                        status.Text = "失败导入材料体系数据:" + allResult1 + "条";
                                        allResult1  = allResult1 + 1;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("添加异常:" + ex.Message, "提示");
                                }
                            }

                            str = st.ReadLine();
                        }
                    }
                    MessageBox.Show("导入材料体系数据" + allResult + "条", "数据添加成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("打开文件出错:" + ex.Message);
                }
            }
        }