public static void BOFKeyEvents_Ini(ref BOFKeyEvents lst)
 {
     lst.datetime = " "; lst.Duration = 0; lst.Decription = " "; lst.Weight = " "; lst.Temp = " ";
     lst.O2ppm = " "; 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_Cr = " ";
     lst.Ele_Ni = " "; lst.Ele_Mo = " "; lst.Ele_Ti = " "; lst.Ele_Nb = " "; lst.Ele_Pb = " ";
     lst.Mat_Name = " ";
 }
        public static List<BOFKeyEvents> GetBOFKeyEvents(string HeatID)
        {
            List<BOFKeyEvents> LST = new List<BOFKeyEvents>();
            BOFKeyEvents lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);

            string str = "";

            DateTime StartDateTime = DateTime.Now;
            //工序起始时间
            string strSQL = "SELECT ready_time FROM BOF_HEAT WHERE heat_id='" + HeatID + "'";
            DataTable dt = GetDataFromOledb(strSQL, lyqstr);
            if (dt.Rows.Count > 0) str = dt.Rows[0]["ready_time"].ToString(); if (str.Length > 0) StartDateTime = Convert.ToDateTime(str);

            //物料添加表
            strSQL = "SELECT * FROM BOF_HEAT WHERE heat_id='" + HeatID + "'";
            dt = GetDataFromOledb(strSQL, lyqstr);
            if (dt.Rows.Count > 0)
            {
                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);
                lst.Decription = "铁水";
                str = dt.Rows[0]["hm_time"].ToString(); if (str.Length > 0) { lst.datetime = str; } else { lst.datetime = StartDateTime.ToString(); }
                str = dt.Rows[0]["hm_weight"].ToString(); if (str.Length > 0) lst.Weight = str;
                str = dt.Rows[0]["hm_trpmture"].ToString(); if (str.Length > 0) lst.Temp = str;
                LST.Add(lst);

                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);
                lst.Decription = "废钢";
                lst.datetime = StartDateTime.ToString();
                str = dt.Rows[0]["scrap_weight"].ToString(); if (str.Length > 0) lst.Weight = str;
                LST.Add(lst);

                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);
                lst.Decription = "TSC";
                str = dt.Rows[0]["tsc_starttime"].ToString(); if (str.Length > 0) lst.datetime = str;
                str = dt.Rows[0]["tsc_tem"].ToString(); if (str.Length > 0) lst.Temp = str;
                str = dt.Rows[0]["tsc_c"].ToString(); if (str.Length > 0) lst.Ele_C = Convert.ToDouble(str).ToString("#0.0000");
                LST.Add(lst);

                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);
                lst.Decription = "TSO";
                str = dt.Rows[0]["tso_starttime"].ToString(); if (str.Length > 0) lst.datetime = str;
                str = dt.Rows[0]["tso_tem"].ToString(); if (str.Length > 0) lst.Temp = str;
                str = dt.Rows[0]["tso_c"].ToString(); if (str.Length > 0) lst.Ele_C = Convert.ToDouble(str).ToString("#0.0000");
                str = dt.Rows[0]["tso_o2ppm"].ToString(); if (str.Length > 0) lst.O2ppm = str.Split(new char[] { '.' })[0];
                LST.Add(lst);
            }

            //化验值
            strSQL = "SELECT * FROM  addition WHERE heat_id='" + HeatID + "' AND device_no='LY210_BOF'";
            dt = GetDataFromOledb(strSQL, lyqstr);

            for (int RowIndex = 0; RowIndex < dt.Rows.Count; RowIndex++)
            {
                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);
                lst.Decription = "加料";
                lst.datetime = dt.Rows[RowIndex]["add_time"].ToString();
                lst.Mat_Name = dt.Rows[RowIndex]["mat_Name"].ToString();
                lst.Weight = dt.Rows[RowIndex]["weight"].ToString();

                LST.Add(lst);
            }

            //化验值
            strSQL = "SELECT * FROM  elem_ana WHERE heat_id='" + HeatID + "' AND device_no='LY210_BOF'";
            dt = GetDataFromOledb(strSQL, lyqstr);

            for (int RowIndex = 0; RowIndex < dt.Rows.Count; RowIndex++)
            {
                lst = new BOFKeyEvents(); BOFKeyEvents_Ini(ref lst);

                lst.Decription = "化验值";
                lst.datetime = dt.Rows[RowIndex]["sampletime"].ToString();

                lst.Ele_C = dt.Rows[RowIndex]["ele_c"].ToString();
                lst.Ele_Si = dt.Rows[RowIndex]["ele_si"].ToString();
                lst.Ele_Mn = dt.Rows[RowIndex]["ele_mn"].ToString();

                lst.Ele_S = dt.Rows[RowIndex]["ele_s"].ToString();
                lst.Ele_P = dt.Rows[RowIndex]["ele_p"].ToString();
                lst.Ele_Cu = dt.Rows[RowIndex]["ele_cu"].ToString();

                lst.Ele_As = dt.Rows[RowIndex]["ele_as"].ToString();
                lst.Ele_Sn = dt.Rows[RowIndex]["ele_Sn"].ToString();
                lst.Ele_Cr = dt.Rows[RowIndex]["ele_Cr"].ToString();

                lst.Ele_Ni = dt.Rows[RowIndex]["ele_Ni"].ToString();
                lst.Ele_Mo = dt.Rows[RowIndex]["ele_Mo"].ToString();
                lst.Ele_Ti = dt.Rows[RowIndex]["ele_Ti"].ToString();
                lst.Ele_Nb = dt.Rows[RowIndex]["ele_Nb"].ToString();
                lst.Ele_Pb = dt.Rows[RowIndex]["ele_Pb"].ToString();

                LST.Add(lst);
            }

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

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

            return LST;
        }