Пример #1
0
        private void comboBox2_MouseLeave(object sender, EventArgs e)
        {
            string    str = comboBox2.Text.ToString();
            Key_Value kv1 = new Key_Value();

            str = kv1.MyDictionary[str];
            SqlConnection sqlCnt1 = new SqlConnection(strConn);
            SqlConnection sqlCnt2 = new SqlConnection(strConn);

            sqlCnt1.Open();
            sqlCnt2.Open();
            string sql   = string.Format(@"select max({0}) from Project_Iron", str);
            string sql_1 = string.Format(@"select min({0}) from Project_Iron", str);

            SqlCommand sqlCmd1 = new SqlCommand(sql_1, sqlCnt1);
            SqlCommand sqlCmd2 = new SqlCommand(sql, sqlCnt2);

            SqlDataReader reader  = sqlCmd1.ExecuteReader();
            SqlDataReader reader2 = sqlCmd2.ExecuteReader();

            while (reader.Read() && reader2.Read())
            {
                linkLabel1.Text = reader[0].ToString();
                linkLabel2.Text = reader2[0].ToString();
                break;
            }
            sqlCnt1.Close();
            sqlCnt2.Close();
        }
Пример #2
0
        /// <summary>
        /// Convert KeyValue Pairs into a Dictionary
        /// </summary>
        /// <param name="allKeyValue"></param>
        /// <returns></returns>
        public static Dictionary <string, string> ConvertToDictionary(string[] allKeyValue)
        {
            var results = new Dictionary <string, string>();

            foreach (var Key_Value in allKeyValue)
            {
                var keyValue = Key_Value.Split('=');
                var key      = keyValue[0];
                var value    = keyValue[1];
                results[key] = value;
            }
            return(results);
        }
Пример #3
0
 public static Dictionary <string, string> ReadInfoIniFile(string path, string section)
 {
     warnmsg.Clear();
     string[] allKeys = ReadIniAllKeys(section, path);
     foreach (string Key_Value in allKeys)
     {
         string[] _Key_Value = Key_Value.Split('=');
         string   key        = _Key_Value[0];
         string   value      = _Key_Value[1];
         warnmsg[key] = value;
     }
     return(warnmsg);
 }
Пример #4
0
        /// <summary>
        /// Removes a key-value pair.
        /// </summary>
        /// <param name="kv">The key-value pair to remove.</param>
        /// <returns><c>true</c> if successfully removed; <c>false</c> if the pair could not be found.</returns>
        public static async Task <bool> DeleteKeyValueAsync(Key_Value kv)
        {
            using (var dbContext = new DataBaseContext())
            {
                dbContext.KeyVaules.Remove(kv);

                try
                {
                    await dbContext.SaveChangesAsync();

                    return(true);
                }
                catch (DbUpdateException)
                {
                    return(false);
                }
            }
        }
        /// <summary>
        /// Reattaches to a previously sent Announcement message.
        /// Handles if the message is different from current playtest.
        /// If message was manually removed.
        /// </summary>
        private async void GetPreviousAnnounceAsync(Key_Value id, Key_Value name)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Announcement Message Information Found!\n{id.value}\n{name.value}");

            var announceId = Convert.ToUInt64(id.value);

            if (name.value == CurrentEventInfo[2]) //If saved title == current title
            {
                Console.WriteLine("Titles match! Attempting to reattach!");
                try
                {
                    AnnounceMessage = await _dataService.AnnouncementChannel.GetMessageAsync(announceId) as IUserMessage;

                    Console.WriteLine("SUCCESS!");
                }
                catch (Exception)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Unable to load previous announcement message");
                }
                await GetAlbum();
            }
            else
            {
                Console.WriteLine("Titles do not match. Attempting to delete old message!");
                try
                {
                    AnnounceMessage = await _dataService.AnnouncementChannel.GetMessageAsync(announceId) as IUserMessage;

                    await AnnounceMessage.DeleteAsync();

                    AnnounceMessage = null;
                    Console.WriteLine("Old message Deleted!\nForcing refresh to post new message.");
                }
                catch
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Could not delete old message. Was it already deleted?");
                }
            }

            Console.ResetColor();
        }
Пример #6
0
 /// <summary>
 /// Read PLC Address
 /// </summary>
 /// <param name="path"></param>
 public static void ReadAddrIniFile(string path)
 {
     try
     {
         string[] sections = INIGetAllSectionNames(path);
         foreach (string section in sections)
         {
             string[] allKeys = ReadIniAllKeys(section, path);
             foreach (string Key_Value in allKeys)
             {
                 string[] _Key_Value = Key_Value.Split('=');
                 string   key        = _Key_Value[0];
                 string   value      = _Key_Value[1];
                 addr[key] = value;
             }
         }
     }
     catch
     { Trace.Write("配置文件读取失败!"); }
 }
Пример #7
0
 public void ReadInfoIniFile(string path)
 {
     try
     {
         var sections = IniGetAllSectionNames(path);
         foreach (var section in sections)
         {
             var allKeys = IniGetAllItems(path, section);
             foreach (var Key_Value in allKeys)
             {
                 var keyValue = Key_Value.Split('=');
                 var key      = keyValue[0];
                 var value    = keyValue[1];
                 warnmsg[key] = value;
             }
         }
     }
     catch
     {
         Trace.Write("配置文件读取失败!");
     }
 }
Пример #8
0
 public void ReadAddrIniFile(string path)
 {
     try
     {
         var sections = IniGetAllSectionNames(path);
         foreach (var section in sections)
         {
             var allKeys = IniGetAllItems(path, section);
             foreach (var Key_Value in allKeys)
             {
                 var _Key_Value = Key_Value.Split('=');
                 var key        = _Key_Value[0];
                 var value      = _Key_Value[1];
                 addr[key] = Convert.ToInt32(value);
             }
         }
     }
     catch
     {
         Trace.Write("配置文件读取失败!");
     }
 }
Пример #9
0
        public DataTable GetClassCount(string str_choiced)
        {
            DataTable dt = new DataTable();
            Key_Value kv = new Key_Value();

            if (str_choiced == "理论产量")
            {
                float buchang_llcl = 15F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox1.Text.Trim());
            }
            if (str_choiced == "第一罐产量")
            {
                //默认的步长
                float buchang_llcl = 15F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox2.Text.Trim());
            }
            if (str_choiced == "第二罐产量")
            {
                float buchang_llcl = 15F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox3.Text.Trim());
            }
            if (str_choiced == "Si_1")
            {
                float buchang_llcl = 0.3F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox4.Text.Trim());
            }
            if (str_choiced == "S_1")
            {
                float buchang_llcl = 0.008F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox5.Text.Trim());
            }
            if (str_choiced == "Mn_1")
            {
                float buchang_llcl = 0.15F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox6.Text.Trim());
            }
            if (str_choiced == "P_1")
            {
                float buchang_llcl = 0.05F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox7.Text.Trim());
            }
            if (str_choiced == "Ti_1")
            {
                float buchang_llcl = 0.003F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox8.Text.Trim());
            }
            if (str_choiced == "Si_2")
            {
                float buchang_llcl = 0.07F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox9.Text.Trim());
            }
            if (str_choiced == "S_2")
            {
                float buchang_llcl = 3F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox10.Text.Trim());
            }
            if (str_choiced == "Ti_2")
            {
                float buchang_llcl = 3F;
                fenzhuang_GetClassC(ref dt, kv, strConn, str_choiced, buchang_llcl, textBox11.Text.Trim());
            }
            return(dt);
        }
Пример #10
0
        private void fenzhuang_GetClassC(ref DataTable dt, Key_Value kv,
                                         string strConn, string str_choiced, float buchang_llcl, string text_box)
        {
            SqlConnection sqlCnt1 = new SqlConnection(strConn);
            SqlConnection sqlCnt2 = new SqlConnection(strConn);

            sqlCnt1.Open();
            sqlCnt2.Open();
            dt.Columns.Add("llcl", typeof(string));  //产量
            dt.Columns.Add("count", typeof(double)); //产量范围的个数
            string sql   = string.Format(@"select max({0}) from Project_Iron", kv.MyDictionary[str_choiced]);
            string sql_1 = string.Format(@"select min({0}) from Project_Iron", kv.MyDictionary[str_choiced]);

            SqlCommand sqlCmd1 = new SqlCommand(sql_1, sqlCnt1);
            SqlCommand sqlCmd2 = new SqlCommand(sql, sqlCnt2);

            SqlDataReader reader  = sqlCmd1.ExecuteReader();
            SqlDataReader reader2 = sqlCmd2.ExecuteReader();
            //
            float min   = 0F;
            float max   = 0F;
            int   count = 0; //统计出来的个数

            while (reader.Read() && reader2.Read())
            {
                float.TryParse(reader[0].ToString(), out min);
                float.TryParse(reader2[0].ToString(), out max);
                break;
            }
            sqlCnt1.Close();
            sqlCnt2.Close();
            //默认的步长
            //float buchang_llcl = 15F;
            if (text_box == string.Empty)    //默认为固定的步长
            {
                for (float j = min; j <= max; j += buchang_llcl)
                {
                    //计算个数的sql语句
                    SqlConnection sqlCnt3 = new SqlConnection(strConn);
                    sqlCnt3.Open();
                    string sql_ = string.Format(@"select count({0}) from Project_Iron where 
{1} >={2} and {3} <{4}", kv.MyDictionary[str_choiced], kv.MyDictionary[str_choiced], j, kv.MyDictionary[str_choiced],
                                                j + buchang_llcl);
                    SqlCommand    sqlCmd3 = new SqlCommand(sql_, sqlCnt3);
                    SqlDataReader reader3 = sqlCmd3.ExecuteReader();
                    if (reader3.Read())
                    {
                        int.TryParse(reader3[0].ToString(), out count);
                        dt.Rows.Add(j.ToString() + "-" + (j + buchang_llcl).ToString(), count);
                    }
                    sqlCnt3.Close();
                }
            }
            else
            {
                float temp = 0;
                float.TryParse(text_box, out temp);   //temp为输入的步长
                for (float j = min; j <= max; j += temp)
                {
                    //计算个数的sql语句
                    SqlConnection sqlCnt3 = new SqlConnection(strConn);
                    sqlCnt3.Open();
                    string sql_ = string.Format(@"select count({0}) from Project_Iron where 
{1} >={2} and {3} <{4}", kv.MyDictionary[str_choiced], kv.MyDictionary[str_choiced], j, kv.MyDictionary[str_choiced],
                                                j + temp);
                    SqlCommand    sqlCmd3 = new SqlCommand(sql_, sqlCnt3);
                    SqlDataReader reader3 = sqlCmd3.ExecuteReader();
                    if (reader3.Read())
                    {
                        int.TryParse(reader3[0].ToString(), out count);
                        dt.Rows.Add(j.ToString() + "-" + (j + temp).ToString(), count);
                    }
                    sqlCnt3.Close();
                }
            }
        }
Пример #11
0
        private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            int       i    = 0;
            string    sttt = checkedListBox1.SelectedItem.ToString();
            Key_Value kv   = new Key_Value();

            switch (sttt)
            {
            case "理论产量":
                i = 0;
                break;

            case "第一罐产量":
                i = 1;
                break;

            case "第二罐产量":
                i = 2;
                break;

            case "Si_1":
                i = 3;
                break;

            case "S_1":
                i = 4;
                break;

            case "Mn_1":
                i = 5;
                break;

            case "P_1":
                i = 6;
                break;

            case "Ti_1":
                i = 7;
                break;

            case "Si_2":
                i = 8;
                break;

            case "S_2":
                i = 9;
                break;

            case "Ti_2":
                i = 10;
                break;

            default:
                break;
            }
            string str = null;

            // str = checkedListBox1.GetItemText(checkedListBox1.Items[i]);
            kv.MyDictionary.TryGetValue(sttt, out str);       //1 style
                                                              //str = kv.MyDictionary[str];   2 style
            switch (i)
            {
            case 0:
                Fengzhuang(str, linkLabel1, linkLabel2);
                break;

            case 1:
                Fengzhuang(str, linkLabel3, linkLabel4);
                break;

            case 2:
                Fengzhuang(str, linkLabel5, linkLabel6);
                break;

            case 3:
                Fengzhuang(str, linkLabel7, linkLabel8);
                break;

            case 4:
                Fengzhuang(str, linkLabel9, linkLabel10);
                break;

            case 5:
                Fengzhuang(str, linkLabel11, linkLabel12);
                break;

            case 6:
                Fengzhuang(str, linkLabel13, linkLabel14);
                break;

            case 7:
                Fengzhuang(str, linkLabel15, linkLabel16);
                break;

            case 8:
                Fengzhuang(str, linkLabel17, linkLabel18);
                break;

            case 9:
                Fengzhuang(str, linkLabel19, linkLabel20);
                break;

            case 10:
                Fengzhuang(str, linkLabel21, linkLabel22);
                break;

            default:
                break;
            }
        }
Пример #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            listView1.Clear();
            string str = comboBox1.Text;
            string str_item;
            // Mysql_excute conn = new Mysql_excute();

            DateTime input_1_to;
            DateTime input_1_from;

            //获取输入的时间
            DateTime.TryParse(watermarkTextBox1.Text, out input_1_from);
            DateTime.TryParse(watermarkTextBox2.Text, out input_1_to);

            SqlConnection sqlCnt1 = new SqlConnection(strConn);

            sqlCnt1.Open();

            //获取原料表 表头的记录
            string [] str_yuanliao_header = { "炉号", "入炉原料化学分析时间", "品种",     "TFe", "FeO", "S",      "SiO2", "CaO",  "MgO",   "Al2O3", "P2O5",  "MnO", "TiO2", "R2", "H2O",
                                              "A",  "V",          "fuel_S", "C固",  "P",   "机烧粒度时间", "<5",   "5-10", "10-15", "15-25", "25-40", ">40" };

            //创建高炉操作的查询表头,动态创建
            if (str == "")
            {
                List <string> list  = new List <string>();
                Key_Value     kv    = new Key_Value();
                int           count = 0;
                foreach (var item in kv.MyDictionary)
                {
                    count++;
                    list.Add(item.Key);
                }
                string[] str123 = new string[count];
                str123 = list.ToArray();
                //设置列标题
                for (int i = 0; i < count; ++i)
                {
                    ColumnHeader ch = new ColumnHeader();
                    ch.Text = str123[i];
                    this.listView1.Columns.Add(ch);
                }
                //总表以出铁时间为基准
                //chutie ,
                string sql = string.Format(@"select HeatNum,outIronTime,meterialBatch,theoryYield,yield_1 ,yield_2,difference,type_1,type_1_Si,
type_1_S, type_1_Mn, type_1_P, type_1_Ti, type_2, type_2_Si, type_2_S, type_2_Ti, ironDeep, zhaYang ,
GaoLuOperationTime,waistEastTemp,waistSouthTemp,waistWestTemp,waistNorthTemp ,HearthEastTemp,HearthSouthTemp,
HearthWestTemp,HearthNorthTemp,batchNum ,airtightTemp ,fuelRatio,windVolume ,hotWindpress ,coldWindpress,
windTemp ,toptempSoutheast,toptempSouthwest,toptempNorthwest,toptempNortheast,topPress,breathIndex,OVolume,
requiresCoal,actualCoal,load,Vj ,Vk,coalRatio,COutilization,blastIndex,blastCokeRatio,blastCoalRatio,
blastMineRatio,combustionRatio,JiaoDing,banZu,zhibanren,jiluren,beizhu, 
YuanLiaoTime, pingZhong, TFe, FeO, S, SiO2, CaO, MgO, Al2O3, P2O5, MnO, TiO2, R2, fuel_H2O,
fuel_A, fuel_V, fuel_S, fuel_C, fuel_P, granularityTime, JSLD_Lessthan5, JSLD_5to10, JSLD_10to15,
JSLD_15to25, JSLD_25to40, JSLD_Morethan40 ,VirtualHeatNum, LuZhaTime, slag_SiO2, slag_CaO, slag_MgO, 
slag_Al2O3, slag_R2, slag_R3 from Project_Iron where outIronTime >= '{0}' 
and outIronTime <= '{1}'", input_1_from, input_1_to);

                SqlCommand    sqlCmd1 = new SqlCommand(sql, sqlCnt1);
                SqlDataReader reader  = sqlCmd1.ExecuteReader();

                while (reader.Read())
                {
                    ListViewItem lt = new ListViewItem();
                    lt.Text = reader[0].ToString();
                    for (int i = 1; i < count; ++i)
                    {
                        lt.SubItems.Add(reader[i].ToString());
                    }
                    listView1.Items.Add(lt);
                }
                sqlCnt1.Close();
            }
            else if (str == "原料记录")
            {
                //str_item = "yuanliao";
                string sql = string.Format(@"select HeatNum,YuanLiaoTime, pingZhong,TFe,FeO,S,SiO2,CaO,MgO,Al2O3,P2O5,
MnO,TiO2,R2,fuel_H2O,fuel_A,fuel_V,fuel_S,fuel_C,fuel_P,granularityTime,JSLD_Lessthan5,JSLD_5to10,JSLD_10to15,JSLD_15to25,
JSLD_25to40,JSLD_Morethan40 from Project_Iron where YuanLiaoTime >= '{0}' 
and YuanLiaoTime <= '{1}'", input_1_from, input_1_to);

                SqlCommand    sqlCmd1 = new SqlCommand(sql, sqlCnt1);
                SqlDataReader reader  = sqlCmd1.ExecuteReader();

                for (int i = 0; i < str_yuanliao_header.Length; ++i)
                {
                    ColumnHeader ch = new ColumnHeader();
                    ch.Text = str_yuanliao_header[i];   //设置列标题
                    this.listView1.Columns.Add(ch);
                }
                while (reader.Read())
                {
                    ListViewItem lt = new ListViewItem();
                    lt.Text = reader[0].ToString();
                    for (int i = 1; i < str_yuanliao_header.Length; ++i)
                    {
                        lt.SubItems.Add(reader[i].ToString());
                    }
                    listView1.Items.Add(lt);
                }
                sqlCnt1.Close();
            }
            else if (str == "高炉操作记录")
            {
                str_item = "gaolu_caozuo_qingkuang";
                string       sql      = string.Format(@"select HeatNum,GaoLuOperationTime,waistEastTemp,waistSouthTemp,waistWestTemp,waistNorthTemp ,HearthEastTemp,HearthSouthTemp,
HearthWestTemp,HearthNorthTemp,batchNum ,airtightTemp ,fuelRatio,windVolume ,hotWindpress ,coldWindpress,
windTemp ,toptempSoutheast,toptempSouthwest,toptempNorthwest,toptempNortheast,topPress,breathIndex,OVolume,
requiresCoal,actualCoal,load,Vj ,Vk,coalRatio,COutilization,blastIndex,blastCokeRatio,blastCoalRatio,
blastMineRatio,combustionRatio,JiaoDing,banZu,zhibanren,jiluren,beizhu from Project_Iron where GaoLuOperationTime >= '{0}' 
and GaoLuOperationTime <= '{1}'", input_1_from, input_1_to);
                DataGridView lg_gaolu = new GaoLu().retu_();
                search_fengzhuang(lg_gaolu, sql, ref sqlCnt1, comboBox1.Text);
                sqlCnt1.Close();
            }
            else if (str == "出铁记录")
            {
                str_item = "chutie_qingkuang";
                string sql = string.Format(@"select HeatNum,outIronTime,meterialBatch,theoryYield,yield_1 ,yield_2,difference,type_1,type_1_Si,
type_1_S,type_1_Mn,type_1_P,type_1_Ti,type_2,type_2_Si,type_2_S,type_2_Ti,ironDeep,zhaYang from Project_Iron where outIronTime >= '{0}' 
and outIronTime <= '{1}'", input_1_from, input_1_to);
                //MySqlDataReader DataSet = conn.getmysqlread(sql);
                // SqlCommand sqlCmd1 = new SqlCommand(sql, sqlCnt1);
                //SqlDataReader reader = sqlCmd1.ExecuteReader();

                DataGridView chutie_dgw = new chutie().chutie_retu();
                search_fengzhuang(chutie_dgw, sql, ref sqlCnt1, comboBox1.Text);
                sqlCnt1.Close();
            }
            else if (str == "炉渣记录")
            {
                str_item = "luzha_huaxue_fenxi";
                //创建炉渣查询的表头t
                DataGridView str_lz = new LuZhaFenXi().luzhan_retu();       //改变的

                string sql = string.Format(@"select HeatNum,VirtualHeatNum,LuZhaTime,slag_SiO2,slag_CaO,slag_MgO,slag_Al2O3 ,slag_R2, slag_R3 from Project_Iron where outIronTime >= '{0}' 
and outIronTime <= '{1}'", input_1_from, input_1_to);
                //search_fengzhuang(str_lz, sql, ref sqlCnt1, comboBox1.Text);

                SqlCommand    sqlCmd3 = new SqlCommand(sql, sqlCnt1);
                SqlDataReader DataSet = sqlCmd3.ExecuteReader();
                int           col_len = str_lz.ColumnCount; //改变
                                                            //零时de
                                                            //查出出铁查询的表头
                string[] str_ = new string[col_len + 1];
                str_[0] = "炉号";
                for (int i = 1; i < col_len + 1; ++i)
                {
                    str_[i] = str_lz.Columns[i - 1].HeaderText;           //改变的
                }

                //设置列标题
                for (int i = 0; i < col_len + 1; ++i)
                {
                    ColumnHeader ch = new ColumnHeader();
                    ch.Text = str_[i];
                    this.listView1.Columns.Add(ch);
                }
                while (DataSet.Read())
                {
                    ListViewItem lt = new ListViewItem();
                    // string stt = DataSet[0].ToString() ;
                    // string stt1 = DataSet[1].ToString();
                    lt.Text = DataSet[0].ToString();
                    lt.UseItemStyleForSubItems = false;
                    for (int i = 1; i < col_len; ++i)
                    {
                        lt.SubItems.Add(DataSet[i].ToString());
                    }
                    listView1.Items.Add(lt);
                }
                //sqlCnt1.Close();

                sqlCnt1.Close();
            }
            sqlCnt1.Close();
        }
Пример #13
0
        private void temp_fun()
        {
            string str = comboBox1.Text;

            comboBox2.Items.Clear();
            int col_len = 0;

            //原料
            string[] str_yuanliao_header = { "炉号",    "入炉原料化学分析时间", "TFe", "FeO", "SiO2", "CaO",        "MgO",    "P2O5", "MnO",  "TiO2",  "R2",    "A",
                                             "Al2O3", "S",          "C固",  "P",   "V",    "入炉原料化学分析时间", "机烧粒度时间", "<5",   "5-10", "10-15", "15-25",
                                             "25-40", ">40" };
            if (str == "")
            {
                List <string> list  = new List <string>();
                Key_Value     kv1   = new Key_Value();
                int           count = 0;
                foreach (var item in kv1.MyDictionary)
                {
                    count++;
                    list.Add(item.Key);
                }
                string[] str123 = new string[count];
                str123 = list.ToArray();

                for (int i = 0; i < count; ++i)
                {
                    comboBox2.Items.Add(str123[i]);
                }
            }
            else if (str == "原料记录")
            {
                for (int i = 0; i < str_yuanliao_header.Length; ++i)
                {
                    comboBox2.Items.Add(str_yuanliao_header[i]);
                }
            }
            else if (str == "高炉操作记录")
            {
                DataGridView dgw = new GaoLu().retu_();
                col_len = dgw.ColumnCount;       //改变

                //查出出铁查询的表头
                string[] str_gl = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_gl[i] = dgw.Columns[i].HeaderText;           //改变的
                    comboBox2.Items.Add(str_gl[i]);
                }
            }
            else if (str == "出铁记录")
            {
                DataGridView dgw = new chutie().chutie_retu();
                col_len = dgw.ColumnCount;       //改变

                //查出出铁查询的表头
                string[] str_gl = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_gl[i] = dgw.Columns[i].HeaderText;           //改变的
                    comboBox2.Items.Add(str_gl[i]);
                }
            }
            else if (str == "炉渣记录")
            {
                DataGridView dgw = new LuZhaFenXi().luzhan_retu();
                col_len = dgw.ColumnCount;       //改变

                //查出出铁查询的表头
                string[] str_gl = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_gl[i] = dgw.Columns[i].HeaderText;           //改变的
                    comboBox2.Items.Add(str_gl[i]);
                }
            }
            //comboBox2.Text = comboBox2.SelectedItem.ToString();
        }
Пример #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            double input_2_to;
            double input_2_from;
            string input_2_element;

            listView1.Clear();
            string str = comboBox1.Text;

            // Mysql_excute conn = new Mysql_excute();

            double.TryParse(watermarkTextBox3.Text, out input_2_from);
            double.TryParse(watermarkTextBox4.Text, out input_2_to);
            input_2_element = comboBox2.Text.ToString();
            // MySqlDataReader DataSet;
            //获取原料表 表头的记录
            string[] str_yuanliao_header = { "炉号",    "入炉原料化学分析时间", "TFe", "FeO", "SiO2", "CaO",        "MgO",    "P2O5", "MnO",  "TiO2",  "R2",    "A",
                                             "Al2O3", "S",          "C固",  "P",   "V",    "入炉原料化学分析时间", "机烧粒度时间", "<5",   "5-10", "10-15", "15-25",
                                             "25-40", ">40" };
            //SqlConnection sqlCnt2 = new SqlConnection(strConn);
            SqlConnection sqlCnt1 = new SqlConnection(strConn);
            SqlConnection sqlCnt2 = new SqlConnection(strConn);

            sqlCnt1.Open();
            sqlCnt2.Open();
            Key_Value kv     = new Key_Value();
            string    str_tt = comboBox2.Text.ToString();

            //kv.MyDictionary.ContainsKey();
            str_tt = kv.MyDictionary[str_tt];

            //创建高炉操作的查询表头,动态创建
            if (str == "")
            {
                List <string> list  = new List <string>();
                Key_Value     kv1   = new Key_Value();
                int           count = 0;
                foreach (var item in kv1.MyDictionary)
                {
                    count++;
                    list.Add(item.Key);
                }
                string[] str123 = new string[count];
                str123 = list.ToArray();
                //设置列标题
                for (int i = 0; i < count; ++i)
                {
                    ColumnHeader ch = new ColumnHeader();
                    ch.Text = str123[i];
                    this.listView1.Columns.Add(ch);
                }
                //总表以出铁时间为基准
                //chutie ,
                string sql = string.Format(@"select HeatNum,outIronTime,meterialBatch,theoryYield,yield_1 ,yield_2,difference,type_1,type_1_Si,
type_1_S, type_1_Mn, type_1_P, type_1_Ti, type_2, type_2_Si, type_2_S, type_2_Ti, ironDeep, zhaYang ,
GaoLuOperationTime,waistEastTemp,waistSouthTemp,waistWestTemp,waistNorthTemp ,HearthEastTemp,HearthSouthTemp,
HearthWestTemp,HearthNorthTemp,batchNum ,airtightTemp ,fuelRatio,windVolume ,hotWindpress ,coldWindpress,
windTemp ,toptempSoutheast,toptempSouthwest,toptempNorthwest,toptempNortheast,topPress,breathIndex,OVolume,
requiresCoal,actualCoal,load,Vj ,Vk,coalRatio,COutilization,blastIndex,blastCokeRatio,blastCoalRatio,
blastMineRatio,combustionRatio,JiaoDing,banZu,zhibanren,jiluren,beizhu, 
YuanLiaoTime, pingZhong, TFe, FeO, S, SiO2, CaO, MgO, Al2O3, P2O5, MnO, TiO2, R2, fuel_H2O,
fuel_A, fuel_V, fuel_S, fuel_C, fuel_P, granularityTime, JSLD_Lessthan5, JSLD_5to10, JSLD_10to15,
JSLD_15to25, JSLD_25to40, JSLD_Morethan40 ,VirtualHeatNum, LuZhaTime, slag_SiO2, slag_CaO, slag_MgO, 
slag_Al2O3, slag_R2, slag_R3 from Project_Iron where {0} >= {1} 
and {2} <= {3}", kv.MyDictionary[input_2_element], input_2_from, kv.MyDictionary[input_2_element], input_2_to);

                SqlCommand    sqlCmd1 = new SqlCommand(sql, sqlCnt1);
                SqlDataReader reader  = sqlCmd1.ExecuteReader();

                while (reader.Read())
                {
                    ListViewItem lt = new ListViewItem();
                    lt.Text = reader[0].ToString();
                    for (int i = 1; i < count; ++i)
                    {
                        lt.SubItems.Add(reader[i].ToString());
                    }
                    listView1.Items.Add(lt);
                }
                sqlCnt1.Close();
            }
            else if (str == "原料记录")
            {
                index_of = Array.IndexOf(str_yuanliao_header, input_2_element);

                /*string sql1 = string.Format(@"SELECT column_name FROM
                 * INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= Project_Iron LIMIT {1},1", index_of);
                 * // DataSet = conn.getmysqlread(sql1);
                 *
                 * while (DataSet.Read())
                 *  Text = DataSet[0].ToString();*/
                // SqlCommand sqlCmd1 = new SqlCommand(sql1, sqlCnt1);
                //SqlDataReader DataSet = sqlCmd1.ExecuteReader();

                string        sql     = string.Format(@"select HeatNum,YuanLiaoTime,pingZhong,TFe,FeO,S,SiO2,CaO,MgO,Al2O3,P2O5,MnO,TiO2,R2,fuel_H2O,
fuel_A,fuel_V,fuel_S,fuel_C,fuel_P,granularityTime,JSLD_Lessthan5,JSLD_5to10,JSLD_10to15,
JSLD_15to25,JSLD_25to40,JSLD_Morethan40 from Project_Iron where {0} >= {1} 
and {2} <={3}", str_tt, input_2_from, str_tt, input_2_to);
                SqlCommand    sqlCmd2 = new SqlCommand(sql, sqlCnt1);
                SqlDataReader DataSet = sqlCmd2.ExecuteReader();
                for (int i = 0; i < str_yuanliao_header.Length; ++i)
                {
                    ColumnHeader ch = new ColumnHeader();
                    ch.Text = str_yuanliao_header[i];   //设置列标题
                    this.listView1.Columns.Add(ch);
                }
                while (DataSet.Read())
                {
                    ListViewItem lt = new ListViewItem();
                    // string stt = DataSet[0].ToString() ;
                    // string stt1 = DataSet[1].ToString();
                    lt.Text = DataSet[0].ToString();
                    lt.UseItemStyleForSubItems = false;
                    for (int i = 1; i < str_yuanliao_header.Length; ++i)
                    {
                        lt.SubItems.Add(DataSet[i].ToString());
                    }
                    // lt.SubItems[str_yuanliao_header.ToList().IndexOf(input_2_element)].BackColor = Color.Red;
                    // lt.SubItems[str_yuanliao_header.ToList().IndexOf(input_2_element)].ForeColor = Color.Blue;

                    //listView1.Items[j++].SubItems[2].BackColor = Color.Red;
                    listView1.Items.Add(lt);
                }
            }
            else if (str == "高炉操作记录")
            {
                DataGridView dgw     = new GaoLu().retu_();
                int          col_len = dgw.ColumnCount; //改变
                //查出出铁查询的表头
                string[] str_ = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_[i] = dgw.Columns[i].HeaderText;           //改变的
                }
                index_of = Array.IndexOf(str_, input_2_element);

                /* string sql1 = string.Format(@"SELECT column_name FROM
                 * INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= '{0}' LIMIT {1},1", str_item,index_of);
                 *
                 * //DataSet = conn.getmysqlread(sql1);
                 * SqlCommand sqlCmd1 = new SqlCommand(sql1, sqlCnt1);
                 * SqlDataReader DataSet = sqlCmd1.ExecuteReader();
                 * while (DataSet.Read())
                 *   Text = DataSet[0].ToString();*/
                string sql = string.Format(@"select GaoLuOperationTime,waistEastTemp,waistSouthTemp,waistWestTemp,waistNorthTemp ,HearthEastTemp,HearthSouthTemp,
HearthWestTemp,HearthNorthTemp,batchNum ,airtightTemp ,fuelRatio,windVolume ,hotWindpress ,coldWindpress,
windTemp ,toptempSoutheast,toptempSouthwest,toptempNorthwest,toptempNortheast,topPress,breathIndex,OVolume,
requiresCoal,actualCoal,load,Vj ,Vk,coalRatio,COutilization,blastIndex,blastCokeRatio,blastCoalRatio,
blastMineRatio,combustionRatio,JiaoDing,banZu,zhibanren,jiluren,beizhu from Project_Iron where {0} >= {1} 
and {2} <= {3}", str_tt, input_2_from, str_tt, input_2_to);

                DataGridView lg_gaolu = new GaoLu().retu_();
                search_fengzhuang(lg_gaolu, sql, ref sqlCnt2, comboBox2.Text);
                sqlCnt2.Close();
            }
            else if (str == "出铁记录")
            {
                // str_item = "chutie_qingkuang";
                DataGridView dgw     = new chutie().chutie_retu();
                int          col_len = dgw.ColumnCount; //改变

                //查出出铁查询的表头
                string[] str_ = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_[i] = dgw.Columns[i].HeaderText;           //改变的
                }

                /* index_of = Array.IndexOf(str_, input_2_element);
                 * string sql1 = string.Format(@"SELECT column_name FROM
                 * INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= '{0}' LIMIT {1},1",str_item,index_of);
                 * SqlCommand sqlCmd1 = new SqlCommand(sql1, sqlCnt1);
                 * SqlDataReader DataSet = sqlCmd1.ExecuteReader();
                 * while (DataSet.Read())
                 *   Text = DataSet[0].ToString();*/

                string sql = string.Format(@"select HeatNum,outIronTime,meterialBatch,theoryYield,yield_1 ,yield_2,difference,type_1,type_1_Si,
type_1_S,type_1_Mn,type_1_P,type_1_Ti,type_2,type_2_Si,type_2_S,type_2_Ti,ironDeep,zhaYang from Project_Iron where {0} >= {1}
and {2} <= {3}", str_tt, input_2_from, str_tt, input_2_to);
                //SqlCommand sqlCmd2 = new SqlCommand(sql, sqlCnt2);
                // SqlDataReader DataSet = sqlCmd2.ExecuteReader();
                //DataSet = conn.getmysqlread(sql);
                DataGridView chutie_dgw = new chutie().chutie_retu();
                search_fengzhuang(chutie_dgw, sql, ref sqlCnt2, input_2_element);
                sqlCnt2.Close();
            }
            else if (str == "炉渣记录")
            {
                //str_item = "luzha_huaxue_fenxi";
                DataGridView dgw     = new LuZhaFenXi().luzhan_retu();
                int          col_len = dgw.ColumnCount; //改变

                //查出出铁查询的表头
                string[] str_ = new string[col_len];
                for (int i = 0; i < col_len; ++i)
                {
                    str_[i] = dgw.Columns[i].HeaderText;           //改变的
                }

                /* index_of = Array.IndexOf(str_, input_2_element);
                 * string sql1 = string.Format(@"SELECT column_name FROM
                 * INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= '{0}' LIMIT {1},1",str_item,index_of);
                 * SqlCommand sqlCmd1 = new SqlCommand(sql1, sqlCnt1);
                 * SqlDataReader DataSet = sqlCmd1.ExecuteReader();
                 * // DataSet = conn.getmysqlread(sql1);
                 * while (DataSet.Read())
                 *   Text = DataSet[0].ToString();*/
                //创建炉渣查询的表头
                DataGridView str_lz = new LuZhaFenXi().luzhan_retu();       //改变的

                string sql = string.Format(@"select VirtualHeatNum,LuZhaTime,slag_SiO2,slag_CaO,slag_MgO,slag_Al2O3 ,slag_R2, slag_R3 from Project_Iron where {0} >= {1} 
and {2} <= {3}", str_tt, input_2_from, str_tt, input_2_to);
                search_fengzhuang(str_lz, sql, ref sqlCnt2, input_2_element);
            }
            sqlCnt1.Close();
            sqlCnt2.Close();
        }