📄 ptcmdf.cpp
字号:
// {
// pPort->dValue = 0.000 ;
// theApp.m_pAdoDB->WriteCheckData(pItem->pEQ->nID,pPort->strPortSort,pPort->nSVDID,pPort->strSpotSort,0.000) ;
// }
// if( pPort->nState == PORT_WARNING)//设备原处于告警状态
// {
// if( pPort->nACount <= 0 )
// {
// pPort->nState = PORT_NORMAL ;
// pItem->pEQ->unEQState = 0 ; //设备处于正常状态
// //f( theApp.m_pComm->m_bIsDebug )
// //((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.SetEQState(pItem->pEQ->nNo,5,pItem->pEQ->unEQState) ;
// strTip.Format("系统:设备 %s 告警端口:%s 恢复正常,告警信息表置消警",pItem->pEQ->strName, pPort->strPortSort) ;
// theApp.DebugShow(strTip) ;
// cAdo.WriteLog(strTip) ;
// strTime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S") ;
// //写消警记录
// cAdo.WriteAlarm(pItem->pEQ->nID,PORT_SWITCH,pPort->strPortSort,pItem->pEQ->strIDAddr,pItem->pEQ->strName,pPort->nSVDID,pPort->strSpotSort,1,"",strTime,"",3,0.00,"") ;
// }
// else
// {
// pPort->nACount-- ;
// //strTip.Format("端口 %s 恢复正常累加%d",pPort->strPortSort,pPort->nACount) ;
// //theApp.OutPut(strTip) ;
// }
// }
// else
// {
// strTip.Format("端口:%s 告警恢复\r\n",pPort->strPortSort) ;
// theApp.DebugShow(strTip) ;
// //theApp.OutPut(strTip) ;
// pPort->nACount = 0 ;
// }
// }//告警判别
// }
// ucCover <<= 1 ; //告警位移动
// }//位告警循环
// }
////********* 工频量告警处理 ***********
// strStep.Format( "*********************\r\n来源:%s\r\n\r\n",pItem->pEQ->strName) ;
// for( i = 0 ; i < 16 ; i++ ) //16路工频列告警
// {
// nPort = i + 24 + 1 ;
// pPort = theApp.m_pComm->m_pEQPool->FindEQPort(pItem->pEQ,nPort) ;
// //-测试观察用-端口告警
// if(pItem->InPack.INFO[i+3])
// theApp.AddDebugAlarm(pItem->pEQ,nPort-1) ;
// if( pPort == NULL && pItem->InPack.INFO[i+3])
// {
// //strPort.Format("%d",nPort) ;
// //theApp.m_pAdoDB->WriteCheckData(pItem->pEQ->nID,strPort,-1,"",1.0) ;
//
// strAlarm.Format("异常:设备 %s 未知端口:%d 发生告警\r\n",pItem->pEQ->strName,nPort) ;
// strTip = strStep + strAlarm + strTemp;
// nSIAlarm = 1 ;
// theApp.DebugShow(strTip) ;
// cAdo.WriteLog(strAlarm) ;
// }
// else if( pPort != NULL )
// {
// if( pItem->InPack.INFO[i+3] ) //工频列告警状态
// {
// //##写端口数据暂为开关量赋值
// if( pPort->dValue != 1.000 )
// {
// pPort->dValue = 1.000 ;
// theApp.m_pAdoDB->WriteCheckData(pItem->pEQ->nID,pPort->strPortSort,pPort->nSVDID,pPort->strSpotSort,1.000) ;
// }
// strAlarm.Format("系统:告警位置:%s-%s-%s-%s 设备名:%s 类型:%s 告警列:%s 接入描述:%s", pPort->strSVDCity ,pPort->strSVDArea, pPort->strSVDAddr,pPort->strSVDPlace,pPort->strSVDName,pPort->strSVDType,pPort->strSpotSort,pPort->strSpotNote) ;
// strTip = strStep + strAlarm + strTemp;
// nSIAlarm = 1 ;
// theApp.DebugShow(strTip) ;
// if( pPort->nState == PORT_NORMAL )
// {
// if( pPort->nACount >= ALARM_LIMIT )
// {
// strTime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S") ;
// pPort->nState = PORT_WARNING ;
// pItem->pEQ->unEQState = 1 ; //设备处于告警状态。
// if( theApp.m_pComm->m_bIsDebug )
// ((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.SetEQState(pItem->pEQ->nNo,5,pItem->pEQ->unEQState) ;
//
// /* 模拟量处理被屏蔽
// if( pPort->nType == TYPE_SIMULATE )
// {
// nNo1 = pPort->strAlarmL1.Find("/") ;
// nNo2 = pPort->strAlarmL2.Find("/") ;
// nNo3 = pPort->strAlarmL3.Find("/") ;
//
// if( nNo1 > 0 )
// {
// strAlarmL = pPort->strAlarmL1.Left(nNo1) ;
// dUpper = atof(strAlarmL.GetBuffer(0)) ;
// strAlarmL = pPort->strAlarmL1.Mid(nNo1+1) ;
// dLower = atof(strAlarmL.GetBuffer(0)) ;
// //##值的比较-未编写
// }
// if( nNo2 > 0 )
// {
// strAlarmL = pPort->strAlarmL2.Left(nNo2) ;
// dUpper = atof(strAlarmL.GetBuffer(0)) ;
// strAlarmL = pPort->strAlarmL2.Mid(nNo2+1) ;
// dLower = atof(strAlarmL.GetBuffer(0)) ;
// //##值的比较-未编写
// }
// if( nNo3 > 0 )
// {
// strAlarmL = pPort->strAlarmL3.Left(nNo3) ;
// dUpper = atof(strAlarmL.GetBuffer(0)) ;
// strAlarmL = pPort->strAlarmL3.Mid(nNo3+1) ;
// dLower = atof(strAlarmL.GetBuffer(0)) ;
// //##值的比较-未编写
// }
// //##写告警记录
// }
// */
// cAdo.WriteLog(strAlarm) ;
// //写端口告警记录表
// cAdo.WriteAlarm( pItem->pEQ->nID,PORT_SWITCH,pPort->strPortSort,pItem->pEQ->strIDAddr,pItem->pEQ->strName,pPort->nSVDID,pPort->strSpotSort,1,strTime,"","",1,1.0,"") ;
//
// //短信告警
// if( theApp.m_pComm->m_bIsMsgOpen )
// theApp.m_pComm->AddGsmMsg(strAlarm) ;//增加一条短信报警
// //电话语音
// if( theApp.m_pComm->m_bIsVoiceOpen )
// {
// if( theApp.m_pComm->m_bIsDebug )
// theApp.m_pComm->AddGsmVoice(pItem->pEQ->strName,pItem->pEQ->strIDAddr,nPort,((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.m_hWnd) ;
// else
// theApp.m_pComm->AddGsmVoice(pItem->pEQ->strName,pItem->pEQ->strIDAddr,nPort,theApp.m_pMainWnd->m_hWnd) ;
// }
// }
// else
// {
// pPort->nACount++ ;
// //strTip.Format("端口 %s 发生告警累加%d",pPort->strPortSort,pPort->nACount) ;
// //theApp.OutPut(strTip) ;
// }
// }
// else
// {
// strTip.Format("系统:告警信息表已存在设备告警,但尚未处理\r\n") ;
// theApp.DebugShow(strTip) ;
// //theApp.OutPut(strTip) ;
// pPort->nACount = ALARM_LIMIT ;
// }
// }
// else //设备处于正常状态
// {
// //##写端口数据暂为开关量赋值
// if( pPort->dValue != 0.000 )
// {
// pPort->dValue = 0.000 ;
// theApp.m_pAdoDB->WriteCheckData(pItem->pEQ->nID,pPort->strPortSort,pPort->nSVDID,pPort->strSpotSort,0.000) ;
// }
// if( pPort->nState == PORT_WARNING )
// {
// if( pPort->nACount <= 0 )
// {
// if( pPort->nType == TYPE_SIMULATE )
// {
// //模拟量转换
// //pItem->pEQ->sPort[nPort].dValue = pItem->pPack->INFO[i+5] ;
// }
// pPort->nState = PORT_NORMAL ;
// strTime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S") ;
// pItem->pEQ->unEQState = 0 ; //设备处于正常状态
// if( theApp.m_pComm->m_bIsDebug )
// ((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.SetEQState(pItem->pEQ->nNo,5,pItem->pEQ->unEQState) ;
//
// strTip.Format("系统:设备 %s 告警端口:%s 恢复正常,告警信息表置消警",pItem->pEQ->strName, pPort->strPortSort) ;
// theApp.DebugShow(strTip) ;
// cAdo.WriteLog(strTip) ;
//
// //消除报警记录
// theApp.m_pAdoDB->WriteAlarm(pItem->pEQ->nID,PORT_SWITCH,pPort->strPortSort,pItem->pEQ->strIDAddr,pItem->pEQ->strName,pPort->nSVDID,pPort->strSpotSort,1,"",strTime,"",3,0.0,"") ;
// }
// else
// pPort->nACount-- ;
// }
// else
// {
// pPort->nACount = 0 ;
// }
// }
// }
// }
// if( !(nSWAlarm || nSIAlarm) )
// {
// theApp.DebugShow("系统:设备正常无告警") ;
// }
//}
//catch(_com_error e)
//{
// strTip.Format( "异常:执行MDF响应命令ACmd44H发生异常:%s ",(LPCSTR)e.Description() ) ;
// cAdo.WriteLog(strTip) ;
// return -1 ;
//}
return 0 ;
}
//*** 获取监测模块时间 ***
//##ModelId=44B6F88400FB
int CPtcMDF::ACmd4DH(sCommItem *pItem)
{
CString strTip ;
UCHAR* ucpTemp ;
int nYear;
CAdoDB cAdo ;
//try
//{
// //cAdo.InitDB() ;
// nLen = pItem->strBuf.GetLength() ;
// if( nLen < 30 )
// {
// strTip.Format("异常:设备 %s 获取监测模块时间 响应命令 格式出错",pItem->pEQ->strName) ;
// theApp.DebugShow(strTip) ;
// cAdo.WriteLog(strTip) ;
// return -1 ;
// }
// ucpTemp = pItem->InPack.INFO ;
// nYear = 0 ;
// nYear = ( *ucpTemp << 8 ) | *(ucpTemp + 1) ;//取得年份
// strTip.Format("设备 %s 地址 %s 的时间是 %d年 %d月 %d日 %d时 %d分 %d秒\r\n",pItem->pEQ->strName,pItem->pEQ->strIDAddr,nYear,*(ucpTemp+2),*(ucpTemp+3),*(ucpTemp+4),*(ucpTemp+5),*(ucpTemp+6)) ;
// if( theApp.m_pComm->m_bIsDebug )
// ((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.ShowMsg(strTip) ;
// return 0 ;
//}
//catch(_com_error e)
//{
// strTip.Format( "异常:执行MDF响应命令ACmd4DH发生异常:%s ",(LPCSTR)e.Description() ) ;
// cAdo.WriteLog(strTip) ;
// return -1 ;
//}
return -1;
}
//##ModelId=44B6F88400EF
int CPtcMDF::ACmd4EH(sCommItem *pItem)
{
int nLen ;
CString strTip ;
CAdoDB cAdo ;
try
{
//cAdo.InitDB() ;
nLen = pItem->strBuf.GetLength() ;
if( nLen < 16 )
{
strTip.Format("异常:设备 %s 设置监测模块时间 响应命令 格式出错",pItem->pEQ->strName) ;
theApp.DebugShow(strTip) ;
cAdo.WriteLog(strTip) ;
return -1 ;
}
strTip = "设备时间设置成功\r\n" ;
theApp.DebugShow(strTip) ;
return 0 ;
}
catch(_com_error e)
{
strTip.Format( "异常:执行MDF响应命令ACmd4EH发生异常:%s ",(LPCSTR)e.Description() ) ;
cAdo.WriteLog(strTip) ;
return -1 ;
}
}
//##ModelId=44B6F88400ED
int CPtcMDF::ACmd4FH(sCommItem *pItem)
{
int nLen ;
UCHAR ucCover ;
CString strTip ;
CAdoDB cAdo ;
//try
//{
// //cAdo.InitDB() ;
// nLen = pItem->strBuf.GetLength() ;
// if( nLen != 18 )
// {
// strTip.Format("异常:设备 %s 获取监测模块 通讯协议 响应命令 格式出错 ",pItem->pEQ->strName) ;
// theApp.DebugShow(strTip) ;
// theApp.OutPut(strTip) ;
// return -1 ;
// }
// ucCover = pItem->InPack.VER & 0x0F ;
// if(ucCover > 0x09)
// strTip.Format("协议版本号:%d.1%d \r\n", pItem->InPack.VER >> 4 , ucCover-0x0A) ;
// else
// strTip.Format("协议版本号:%d.0%d \r\n", pItem->InPack.VER >> 4 , ucCover ) ;
// if( theApp.m_pComm->m_bIsDebug )
// ((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.ShowMsg(strTip) ;
//
// return 0 ;
//}
//catch(_com_error e)
//{
// strTip.Format( "异常:执行MDF响应命令ACmd4FH发生异常:%s ",(LPCSTR)e.Description() ) ;
// cAdo.WriteLog(strTip) ;
// return -1 ;
//}
return -1;
}
//##ModelId=44B6F88400EB
int CPtcMDF::ACmd50H(sCommItem *pItem)
{
int nLen ;
CString strTip ;
CAdoDB cAdo ;
//try
//{
// //cAdo.InitDB() ;
// nLen = pItem->strBuf.GetLength() ;
// if( nLen < 16 )
// {
// strTip.Format("异常:设备 %s 获取监测模块 地址 响应命令 格式出错 ",pItem->pEQ->strName) ;
// theApp.DebugShow(strTip) ;
// cAdo.WriteLog(strTip) ;
// return -1 ;
// }
// strTip.Format("设备地址为:%x%x\r\n", pItem->InPack.ADR >> 4 , pItem->InPack.ADR & 0x0F) ;
// if( theApp.m_pComm->m_bIsDebug )
// ((CMDFDlg*)theApp.m_pMainWnd)->m_UI.m_DebugDlg.ShowMsg( strTip ) ;
// return 0 ;
//}
//catch(_com_error e)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -