(3)信息展示
信息展示模块的功能是展示实时告警信息和查询历史告警信息。
1)实时告警展示
实时告警展示模块的功能是展示当前接收到的告警信息。
核心代码如下:
public frmRealAlarm(StationAlarm.frmContainer parent)
{
// Windows 窗体设计器支持所必需的
InitializeComponent();
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
this.MdiParent = parent;
frmContainer mainWindow = (frmContainer)this.MdiParent;
if (mainWindow.realAlarmLog != null)
dgRealAlarm.SetDataBinding(mainWindow.realAlarmLog.Tables[0].DefaultView, "");
}
2)历史告警查询
历史告警查询模块的功能是按时间段、基站号或告警编号查询历史告警信息。
核心代码如下:
public frmHisAlarm(StationAlarm.frmContainer parent)
{
InitializeComponent();
this.MdiParent = parent;
AlarmQuery();//告警记录查询
}
private void AlarmQuery()
{
//告警记录查询
string sql, queryCondition;
string connString = @"Data Source=StationAlarm.mdb;Provider=Microsoft.Jet.OLEDB.4.0;";
queryCondition = " and AlarmDate between '" + startTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + endTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'";
if (SiteID.Text != "")
queryCondition += " and AlarmLog.SiteID=" + SiteID.Text;
if (AlarmID.Text != "")
queryCondition += " and AlarmLog.AlarmID=" + AlarmID.Text;
OleDbConnection conn = new OleDbConnection(connString);
try
{
conn.Open();
//取基站信息表记录
sql = "SELECT AlarmLog.SerialNo as 流水号, AlarmLog.BSC,AlarmLog.[ModuleID] as 模块号, AlarmLog.SiteID as 站号,SiteInfo.SiteName as 基站名称, SiteInfo.SiteEnName as 基站英文名称, AlarmLog.AlarmID as 告警编号, AlarmInfo.AlarmName as 告警名称," +
" AlarmInfo.AlarmType as 告警类型, AlarmInfo.AlarmLevel as 告警级别, AlarmLog.AlarmDate as 告警时间, AlarmLog.LogDate as 记录时间, AlarmLog.LogMemo as 备注, AlarmLog.Flag " +
" FROM SiteInfo INNER JOIN (AlarmInfo INNER JOIN AlarmLog ON AlarmInfo.AlarmID = AlarmLog.AlarmID) ON (AlarmLog.[ModuleID] = SiteInfo.[ModuleID]) AND (AlarmLog.BSC = SiteInfo.BSC) AND (SiteInfo.SiteID = AlarmLog.SiteID) WHERE 1=1";
sql += queryCondition;
da2 = new OleDbDataAdapter(sql, conn);
hisAlarmLog.Clear();
da2.Fill(hisAlarmLog);
conn.Close();
dgHisAlarm.SetDataBinding(hisAlarmLog.Tables[0].DefaultView, "");
}
catch
{
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
}
四、结语
基站综合告警系统克服了原有告警系统没有声音的缺点,使值班人员能更加及时准确地处理基站告警,降低了劳动强度,为提高网络质量提供了强有力的技术支撑。使用网络监听采集数据的方法优点是实时性高,解决了不同硬件和操作系统的数据采集问题,对原有的告警系统没有任何影响。本文程序代码在VS2005环境下测试通过,目前已平稳运行了一年多,取得了良好的效果。
参考文献
[1]黄承安,谢东文,许聪。C#网络应用案例导航.中国铁道出版社,2003年.
[2]Simon Robinson,K.Scott Allen等著,杨浩,杨铁男等译。C#高级编程.清华大学出版社,2002年.
|