private void butQuery_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; butQuery.Enabled = false; DateTime DT_S, DT_E; if (dTP_S.Value > dTP_E.Value) { DT_E = dTP_S.Value; DT_S = dTP_E.Value; } else { DT_E = dTP_E.Value; DT_S = dTP_S.Value; } string sSQL = "SELECT (@i:=@i+1) as 序号, AL_SOELog.Date_Time as 时间,"; sSQL += "AL_SOELog.StationName as 子站名称,AL_SOELog.AlarmType as 类型 ,"; sSQL += "AL_SOELog.Recorder as 报警内容,AL_SOELog.ConfirmTime as 确认时间,"; sSQL += "AL_SOELog.ConfirmName as 确认人 FROM (select @i:=0)it,AL_SOELog "; sSQL += "where AL_SOELog.Date_Time between '" + DT_S.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + DT_E.ToString("yyyy-MM-dd HH:mm:ss") + "' "; string sSQL1 = sSQL + " and (AL_SOELog.Priority=1 or AL_SOELog.Priority=2) and AL_SOELog.AlarmType!= '人工操作' order by AL_SOELog.Date_Time;"; DataTable DTValue = LSDatabase.GetSOEData(sSQL1); HisdGV1.DataSource = DTValue; HisdGV1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; string sSQL2 = sSQL + " and AL_SOELog.Priority=3 and AL_SOELog.AlarmType!= '人工操作' order by AL_SOELog.Date_Time;"; DataTable DTValue2 = LSDatabase.GetSOEData(sSQL2); HisdGV2.DataSource = DTValue2; HisdGV2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; string sSQL3 = sSQL + " and AL_SOELog.AlarmType= '人工操作' order by AL_SOELog.Date_Time;"; DataTable DTValue3 = LSDatabase.GetSOEData(sSQL3); HisdGV3.DataSource = DTValue3; HisdGV3.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; } catch (Exception ex) { MessageBox.Show(ex.Message, "butQuery_Click"); } finally { this.Cursor = Cursors.Default; butQuery.Enabled = true; } }
private void DrawChart() { Cursor.Current = Cursors.WaitCursor; switch (ChartMode) { case 0: //实时曲线 ZedG1.XAxisFormat = "HH:mm:ss"; ZedG1.TitleText = "实时曲线:" + ZedG1.SelTream.Name + "(" + (iRealSec / 60).ToString() + "分钟)"; ZedG1.SelTream.UpdateReal(DateTime.Now, DateTime.Now, iRealSec); iOldSecond = DateTime.Now.Second; break; case 1: //配方曲线 ZedG1.XAxisFormat = "yy-MM-dd\r\nHH:mm:ss"; ZedG1.TitleText = nSelRecipe.Name + ":" + ZedG1.SelTream.Name + "\r\n(" + nSelRecipe.DT_S.ToString("yyyy-MM-dd HH:mm:ss") + "—" + nSelRecipe.DT_E.ToString("yyyy-MM-dd HH:mm:ss") + ")"; ZedG1.SelTream.UpdateReal(nSelRecipe.DT_S.AddSeconds(-1 * iRecipeSec), nSelRecipe.DT_E.AddSeconds(iRecipeSec), iRealSec); break; case 2: //历史曲线 ZedG1.XAxisFormat = "yy-MM-dd\r\nHH:mm:ss"; ZedG1.TitleText = "历史曲线:" + ZedG1.SelTream.Name + "\r\n(" + DT_S.ToString("yyyy-MM-dd HH:mm:ss") + "—" + DT_E.ToString("yyyy-MM-dd HH:mm:ss") + ")"; ZedG1.SelTream.UpdateReal(DT_S, DT_E, iRealSec); break; default: return; } ZedG1.DrawChart(); /*double dNow = new XDate(DateTime.Now); * double dS = new XDate(DateTime.Now.AddSeconds(-1 * iRealSec)); * ZedG1.zedG.GraphPane.XAxis.Scale.MinAuto = false; * ZedG1.zedG.GraphPane.XAxis.Scale.Min = dS; * ZedG1.zedG.GraphPane.XAxis.Scale.MaxAuto = false; * ZedG1.zedG.GraphPane.XAxis.Scale.Max = dNow;*/ HisdGV1.DataSource = GetChartDT(); HisdGV1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; Cursor.Current = Cursors.Default; }