|
|
@@ -1666,22 +1666,25 @@ void CResistAlarmMng::JudgeAlarm(CResistAlarmMng* pService, RETENSION_FORCE_DROP
|
|
|
|
|
|
|
|
|
CString sql;
|
|
|
- sql.Format("INSERT INTO [rm_alarm]([ID],[mo],[mp],[no],[type],[occur_time],[level],[desc],[suggest],[val],[event_id],[rel_id],posi,loworhigh,referval,[sunroof]) "\
|
|
|
- "VALUES(%d, '%s', '%s', %d, %d, '%s', %d, '%s', '%s', %d, '%s', '%s',%d,%d,%d,%d);",
|
|
|
- pAlarmInfo->id, pAlarmInfo->mo.c_str(), pAlarmInfo->mp.c_str(), pAlarmInfo->no, pAlarmInfo->type,
|
|
|
- ctShowTime.Format("%Y-%m-%d %H:%M:%S"), pAlarmInfo->level, pAlarmInfo->desc.c_str(), pAlarmInfo->suggest.c_str(), pAlarmInfo->val,
|
|
|
- pAlarmInfo->event_id.c_str(), pAlarmInfo->rel_id.c_str(), uint8_t(pAlarmInfo->posi), uint8_t(pAlarmInfo->loworhigh), pAlarmInfo->refer_val,
|
|
|
- pAlarmInfo->sunroof);
|
|
|
+ if (bNew) {
|
|
|
+ sql.Format("INSERT INTO [rm_alarm]([ID],[mo],[mp],[no],[type],[occur_time],[level],[desc],[suggest],[val],[event_id],[rel_id],posi,loworhigh,referval,[sunroof]) "\
|
|
|
+ "VALUES(%d, '%s', '%s', %d, %d, '%s', %d, '%s', '%s', %d, '%s', '%s',%d,%d,%d,%d);",
|
|
|
+ pAlarmInfo->id, pAlarmInfo->mo.c_str(), pAlarmInfo->mp.c_str(), pAlarmInfo->no, pAlarmInfo->type,
|
|
|
+ ctShowTime.Format("%Y-%m-%d %H:%M:%S"), pAlarmInfo->level, pAlarmInfo->desc.c_str(), pAlarmInfo->suggest.c_str(), pAlarmInfo->val,
|
|
|
+ pAlarmInfo->event_id.c_str(), pAlarmInfo->rel_id.c_str(), uint8_t(pAlarmInfo->posi), uint8_t(pAlarmInfo->loworhigh), pAlarmInfo->refer_val,
|
|
|
+ pAlarmInfo->sunroof);
|
|
|
|
|
|
- if (false == CDBConnectPool::Instance()->DBExecuteSQL(sql))
|
|
|
- SPDLOG_INFO("[保持力报警执行语句失败,sql]:{}", sql);
|
|
|
- else {
|
|
|
- uint8_t* pack = nullptr; int len = 0;
|
|
|
- auto packno = CResistAlarmMng::GeneralNewAlarmData(pAlarmInfo, &pack, &len);
|
|
|
- if (packno) CSuperManager::Instance()->SendPack(pack, len, packno, E_ZL_PROTOCAL::ZL_ALARM_DATA, true);
|
|
|
- delete[] pack;
|
|
|
- pack = nullptr;
|
|
|
- }
|
|
|
+ if (false == CDBConnectPool::Instance()->DBExecuteSQL(sql))
|
|
|
+ SPDLOG_INFO("[保持力报警执行语句失败,sql]:{}", sql);
|
|
|
+ else {
|
|
|
+ uint8_t* pack = nullptr; int len = 0;
|
|
|
+ auto packno = CResistAlarmMng::GeneralNewAlarmData(pAlarmInfo, &pack, &len);
|
|
|
+ if (packno) CSuperManager::Instance()->SendPack(pack, len, packno, E_ZL_PROTOCAL::ZL_ALARM_DATA, true);
|
|
|
+ delete[] pack;
|
|
|
+ pack = nullptr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
else{//恢复
|
|
|
@@ -4550,7 +4553,7 @@ BOOL CResistAlarmMng::LoadUnAck()
|
|
|
CString sql = " SELECT [ID],a.[mo],a.[mp],[no],[type],[occur_time],[level],[desc],[suggest],[val],[event_id],[rel_id],[posi],[loworhigh],[referval],[recovery_time],[sunroof],zzjno,[ack_result] FROM [rm_alarm] as A \
|
|
|
LEFT JOIN(SELECT mo, mp, zzjno FROM rm_map) AS B ON a.mo = b.mo and a.mp = b.mp \
|
|
|
WHERE DATEADD(dd, -31, getdate()) < occur_time and sunroof = 0 and (ack_result = 0 OR [recovery_time] < '2000') \
|
|
|
- ORDER BY ID; ";
|
|
|
+ ORDER BY occur_time ASC; ";
|
|
|
COdbcStatement stmt;
|
|
|
if (!CDBConnectPool::Instance()->DBQuery(stmt, sql))
|
|
|
{
|
|
|
@@ -4617,7 +4620,7 @@ BOOL CResistAlarmMng::LoadUnAck()
|
|
|
|
|
|
m_lstUnConfirmAlarm.push_back(pAlarm);
|
|
|
|
|
|
- } while (true);
|
|
|
+ } while (true);
|
|
|
stmt.Close();
|
|
|
|
|
|
CSimpleLog::Info(("一共加载(" + to_string(m_lstUnConfirmAlarm.size()) + ")条未受理和未恢复的报警").c_str());
|