public static void KRKeyEvents_Ini(ref KRKeyEvents lst)
 {
     lst.DateAndTime = " "; lst.Duration = 0; lst.Descripion = " "; lst.Tempture = " ";
     lst.Weight = " "; lst.Ele_C = " "; lst.Ele_Si = " "; lst.Ele_Mn = " ";
     lst.Ele_S = " "; lst.Ele_P = " "; lst.Ele_Cu = " "; lst.Ele_As = " ";
     lst.Ele_Sn = " "; lst.Ele_Cu5As8Sn = " "; lst.Ele_Cr = " "; lst.Ele_Ni = " ";
     lst.Ele_Mo = " "; lst.Ele_Ti = " "; lst.Ele_Nb = " "; lst.Ele_Pb = " ";
 }
        //获取脱硫站KR 化学分析、测温、加料等关键事件
        public static List<KRKeyEvents> GetKRKeyEvents(string HeatID)
        {
            List<KRKeyEvents> LST = new List<KRKeyEvents>();
            KRKeyEvents lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
            string str = "";

            //为了计算Duration而设置
            DateTime StartDateTime = new DateTime();

            //获取化验成分事件
            string strSQL = "select * FROM elem_ana where Heat_ID='" + HeatID + "' and DEVICE_NO like 'LY210_KR%'";
            DataTable dt = GetDataFromOledb(strSQL, lyqstr);

            if (dt.Rows.Count > 0)
            {
                int RowIndex = 0;

                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                lst.Descripion = "化验值" + RowIndex.ToString();

                //str = dt.Rows[RowIndex][""].ToString();if (str.Length>0) lst=str;
                str = dt.Rows[RowIndex]["sampletime"].ToString(); if (str.Length > 0) lst.DateAndTime = str;
                str = dt.Rows[RowIndex]["Ele_C"].ToString(); if (str.Length > 0) lst.Ele_C = str;
                str = dt.Rows[RowIndex]["Ele_Si"].ToString(); if (str.Length > 0) lst.Ele_Si = str;
                str = dt.Rows[RowIndex]["Ele_Mn"].ToString(); if (str.Length > 0) lst.Ele_Mn = str;

                str = dt.Rows[RowIndex]["Ele_S"].ToString(); if (str.Length > 0) lst.Ele_S = str;
                str = dt.Rows[RowIndex]["Ele_P"].ToString(); if (str.Length > 0) lst.Ele_P = str;
                str = dt.Rows[RowIndex]["Ele_Cu"].ToString(); if (str.Length > 0) lst.Ele_Cu = str;
                str = dt.Rows[RowIndex]["Ele_As"].ToString(); if (str.Length > 0) lst.Ele_As = str;
                str = dt.Rows[RowIndex]["Ele_Sn"].ToString(); if (str.Length > 0) lst.Ele_Sn = str;

                lst.Ele_Cu5As8Sn = (Convert.ToSingle(lst.Ele_Cu) + 5 * Convert.ToSingle(lst.Ele_As) + 8 * Convert.ToSingle(lst.Ele_Sn)).ToString();
                str = dt.Rows[RowIndex]["Ele_Cr"].ToString(); if (str.Length > 0) lst.Ele_Cr = str;
                str = dt.Rows[RowIndex]["Ele_Ni"].ToString(); if (str.Length > 0) lst.Ele_Ni = str;
                str = dt.Rows[RowIndex]["Ele_Mo"].ToString(); if (str.Length > 0) lst.Ele_Mo = str;

                str = dt.Rows[RowIndex]["Ele_Ti"].ToString(); if (str.Length > 0) lst.Ele_Ti = str;
                str = dt.Rows[RowIndex]["Ele_Nb"].ToString(); if (str.Length > 0) lst.Ele_Nb = str;
                str = dt.Rows[RowIndex]["Ele_Pb"].ToString(); if (str.Length > 0) lst.Ele_Pb = str;

                LST.Add(lst);
            }
            dt.Dispose();

            //物料添加表---主要是石灰
            strSQL = "select * FROM addition where Heat_ID='" + HeatID + "' and DEVICE_NO like 'LY210_KR'";
            dt = GetDataFromOledb(strSQL, lyqstr);
            for (int RowIndex = 0; RowIndex < dt.Rows.Count; RowIndex++)
            {
                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                lst.Descripion = "脱硫剂" + RowIndex.ToString();
                str = dt.Rows[RowIndex]["ad_time"].ToString(); if (str.Length > 0) lst.DateAndTime = str;
                str = dt.Rows[RowIndex]["weight"].ToString(); if (str.Length > 0) lst.Weight = str;

                LST.Add(lst);
            }
            dt.Dispose();

            /////// 各种事件/////////////////
            strSQL = "SELECT * FROM KR_HEAT WHERE heat_ID= '" + HeatID + "'";
            dt = GetDataFromOledb(strSQL, lyqstr);
            //获取化验成分表,是一个常规纵表
            for (int RowIndex = 0; RowIndex < dt.Rows.Count; RowIndex++)
            {
                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);

                lst.Descripion = "初始铁水";
                str = dt.Rows[RowIndex]["LADLE_ARRIVE"].ToString(); if (str.Length > 0) { lst.DateAndTime = str; StartDateTime = Convert.ToDateTime(str); }

                str = dt.Rows[RowIndex]["INI_TEMP"].ToString(); if (str.Length > 0) lst.Tempture = str;
                str = dt.Rows[RowIndex]["INI_WGT"].ToString(); if (str.Length > 0) lst.Weight = str;
                str = dt.Rows[RowIndex]["INI_C"].ToString(); if (str.Length > 0) lst.Ele_C = str;
                str = dt.Rows[RowIndex]["INI_SI"].ToString(); if (str.Length > 0) lst.Ele_Si = str;
                str = dt.Rows[RowIndex]["INI_MN"].ToString(); if (str.Length > 0) lst.Ele_Mn = str;
                str = dt.Rows[RowIndex]["INI_P"].ToString(); if (str.Length > 0) lst.Ele_P = str;
                str = dt.Rows[RowIndex]["INI_S"].ToString(); if (str.Length > 0) lst.Ele_S = str;
                str = dt.Rows[RowIndex]["INI_TI"].ToString(); if (str.Length > 0) lst.Ele_Ti = str;

                LST.Add(lst);

                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                lst.Descripion = "终点铁水";
                str = dt.Rows[RowIndex]["LADLE_LEAVE"].ToString(); if (str.Length > 0) lst.DateAndTime = str;
                str = dt.Rows[RowIndex]["FIN_TEMP"].ToString(); if (str.Length > 0) lst.Tempture = str;
                str = dt.Rows[RowIndex]["FIN_WGT"].ToString(); if (str.Length > 0) lst.Weight = str;
                LST.Add(lst);

                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                lst.Descripion = "脱硫开始";
                str = dt.Rows[RowIndex]["DES_START"].ToString();
                if (str.Length > 0)
                {
                    lst.DateAndTime = str;
                }
                LST.Add(lst);

                lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                lst.Descripion = "脱硫结束";
                str = dt.Rows[RowIndex]["DES_END"].ToString();
                if (str.Length > 0)
                {
                    lst.DateAndTime = str;
                }
                LST.Add(lst);

                str = dt.Rows[RowIndex]["RESIDUE_FIRST_S"].ToString();
                if (str.Length > 0)
                {
                    lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                    lst.Descripion = "去前渣开始";
                    lst.DateAndTime = str;
                    LST.Add(lst);
                }

                str = dt.Rows[RowIndex]["RESIDUE_FIRST_E"].ToString();
                if (str.Length > 0)
                {
                    lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                    lst.Descripion = "去前渣结束";
                    lst.DateAndTime = str;
                    LST.Add(lst);
                }

                str = dt.Rows[RowIndex]["RESIDUE_LAST_S"].ToString();
                if (str.Length > 0)
                {
                    lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                    lst.Descripion = "去后渣开始";
                    lst.DateAndTime = str;
                    LST.Add(lst);
                }
                str = dt.Rows[RowIndex]["RESIDUE_LAST_E"].ToString();
                if (str.Length > 0)
                {
                    lst = new KRKeyEvents(); KRKeyEvents_Ini(ref lst);
                    lst.Descripion = "去后渣结束";
                    lst.DateAndTime = str;
                    LST.Add(lst);
                }
            }

            dt.Dispose();

            DateTime cDateTime = new DateTime();
            TimeSpan ts = new TimeSpan();
            for (int I = 0; I < LST.Count; I++)
            {
                if (DateTime.TryParse(LST[I].DateAndTime, out cDateTime))
                {
                    ts = cDateTime - StartDateTime;
                    LST[I].Duration = float.Parse((ts.TotalSeconds / 60.0).ToString("#0.00"));
                }
            }

            //按照时长排序
            LST.Sort(delegate(KRKeyEvents a, KRKeyEvents b) { return a.Duration.CompareTo(b.Duration); });

            return LST;
        }