public string rlmdwfrl(string repType, string qsrq, string jsrq, int unit, string bz) { string val = ""; if (repType == "值报") { string sql = "select 低位发热量 from 入炉煤质分析表 where 日期='" + qsrq + "' and 班值=" + bz; object obj = DBsql.RunSingle(sql, out errMsg); if (obj != null && obj.ToString() != "") { val = obj.ToString(); } else { val = "0"; } } return(val); }
/// <summary> /// 入炉煤低位热值 /// </summary> /// <param name="repType"></param> /// <param name="qsrq"></param> /// <param name="jsrq"></param> /// <param name="unit"></param> /// <returns></returns> public string rlmdwfrl(string repType, string qsrq, string jsrq, int unit) { object objML1; object objML2; string val1 = ""; string val2 = ""; double res = 0; string mon = ""; string re = ""; string dwfrl1 = "0"; string dwfrl2 = "0"; string dwfrl3 = "0"; string mz1ml1 = "0"; //煤量1 string mz1ml2 = "0"; string mz1ml3 = "0"; string mz2ml1 = "0"; //煤量2 string mz2ml2 = "0"; string mz2ml3 = "0"; string val = ""; if (repType == "值报") { string sql = "select * from 入炉煤质分析表 where 日期='" + qsrq + "'"; DataTable dtmt = dl.RunDataTable(sql, out errMsg); if (dtmt.Rows.Count > 0) { if (dtmt.Rows.Count == 1) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 2) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 3) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz1ml3 = dtmt.Rows[2]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); mz2ml3 = dtmt.Rows[2]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); dwfrl3 = dtmt.Rows[2]["低位发热量"].ToString(); } } } else if (repType == "日报") { string sqlCmd = "SELECT 低位热值 FROM 入炉煤质日数据表 where 日期='" + Convert.ToDateTime(qsrq).ToShortDateString() + "'"; object objrlm = DBsql.RunSingle(sqlCmd, out errMsg); if (objrlm == null) { string sql = "select * from 入炉煤质分析表 where 日期='" + qsrq + "'"; DataTable dtmt = DBsql.RunDataTable(sql, out errMsg); #region if (dtmt.Rows.Count > 0) { if (dtmt.Rows.Count == 1) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 2) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 3) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz1ml3 = dtmt.Rows[2]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); mz2ml3 = dtmt.Rows[2]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); dwfrl3 = dtmt.Rows[2]["低位发热量"].ToString(); } } #endregion try { mon = "((" + dwfrl1 + "*((" + mz1ml1 + ")+(" + mz2ml1 + ")))+(" + dwfrl2 + "*((" + mz1ml2 + ")+(" + mz2ml2 + ")))+(" + dwfrl3 + "*((" + mz1ml3 + ")+(" + mz2ml3 + "))))/((" + mz1ml1 + ") + (" + mz1ml2 + ") + (" + mz1ml3 + ")+(" + mz2ml1 + ") + (" + mz2ml2 + ") + (" + mz2ml3 + "))"; re = StrHelper.Cale(mon); re = StrHelper.checkCatch(re); res = double.Parse(re.ToString()); } catch { res = 0; } } else { res = double.Parse(objrlm.ToString()); } } else if (repType == "月报" || repType == "年报") { string[] date = sh.DateDiff(DateTime.Parse(qsrq), DateTime.Parse(jsrq)); for (int i = 0; i < date.Length - 1; i++) { string sql = "SELECT SUM(低位热值) FROM 入炉煤质日数据表 where 日期>='" + DateTime.Parse(date[i]).ToString("yyyy-MM-dd 0:00:00") + "' and 日期<'" + DateTime.Parse(date[i]).ToString("yyyy-MM-dd 23:59:59") + "'"; object objrlm = dl.RunSingle(sql, out errMsg); if (objrlm == null || objrlm.ToString() == "") { sql = "select * from 入炉煤质分析表 where 日期='" + DateTime.Parse(date[i]).ToString("yyyy-MM-dd 0:00:00") + "'"; DataTable dtmt = dl.RunDataTable(sql, out errMsg); #region if (dtmt.Rows.Count > 0) { if (dtmt.Rows.Count == 1) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 2) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); } else if (dtmt.Rows.Count == 3) { mz1ml1 = dtmt.Rows[0]["煤量1"].ToString(); mz1ml2 = dtmt.Rows[1]["煤量1"].ToString(); mz1ml3 = dtmt.Rows[2]["煤量1"].ToString(); mz2ml1 = dtmt.Rows[0]["煤量2"].ToString(); mz2ml2 = dtmt.Rows[1]["煤量2"].ToString(); mz2ml3 = dtmt.Rows[2]["煤量2"].ToString(); dwfrl1 = dtmt.Rows[0]["低位发热量"].ToString(); dwfrl2 = dtmt.Rows[1]["低位发热量"].ToString(); dwfrl3 = dtmt.Rows[2]["低位发热量"].ToString(); } } #endregion try { mon = "((" + dwfrl1 + "*((" + mz1ml1 + ")+(" + mz2ml1 + ")))+(" + dwfrl2 + "*((" + mz1ml2 + ")+(" + mz2ml2 + ")))+(" + dwfrl3 + "*((" + mz1ml3 + ")+(" + mz2ml3 + "))))/((" + mz1ml1 + ") + (" + mz1ml2 + ") + (" + mz1ml3 + ")+(" + mz2ml1 + ") + (" + mz2ml2 + ") + (" + mz2ml3 + "))"; re = StrHelper.Cale(mon); re = StrHelper.checkCatch(re); } catch { re = "0"; } string re1 = ""; try { mon = "((" + mz1ml1 + ") + (" + mz1ml2 + ") + (" + mz1ml3 + ")+(" + mz2ml1 + ") + (" + mz2ml2 + ") + (" + mz2ml3 + "))"; re1 = StrHelper.Cale(mon); re1 = StrHelper.checkCatch(re1); } catch { re1 = "0"; } val1 += "(" + re + "*" + re1 + ")+"; val2 += "(" + re1 + ")+"; } else { sql = "select sum(煤量1)+sum(煤量2) from 入炉煤质分析表 where 日期='" + DateTime.Parse(date[i]).ToShortDateString() + "'"; objML1 = dl.RunSingle(sql, out errMsg); val1 += "(" + objrlm.ToString() + "*" + objML1.ToString() + ")+"; val2 += "(" + objML1.ToString() + ")+"; } } val = "(" + val1.TrimEnd('+') + ")/(" + val2.TrimEnd('+') + ")"; try { re = StrHelper.Cale(val); re = StrHelper.checkCatch(re); } catch { re = "0"; } res = double.Parse(re); } return(res.ToString()); }