浏览代码

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@87 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b

chenyu 1 年之前
父节点
当前提交
de7a59144d
共有 3 个文件被更改,包括 27 次插入12 次删除
  1. 1 1
      2.Web/src/components/Layout.vue
  2. 5 2
      4.Data/MGDataHandler.cpp
  3. 21 9
      4.Data/ResistAlarm.cpp

+ 1 - 1
2.Web/src/components/Layout.vue

@@ -506,7 +506,7 @@ export default {
      //  if (re_msg.code != 200) return this.$message.warning('受理失败...')
      //  this.$message.success('受理成功...')
      try {
-      this.new_alarm_list.find(item => item.alarm_id == re_msg.alarm_id).ack_result = 1
+      this.new_alarm_list = this.new_alarm_list.filter(item => item.alarm_id != re_msg.alarm_id);
      } catch (error) {}
      if (this.path_list.includes(this.$route.path)) {
       this.$refs.children_box.parent_call(re_msg)

+ 5 - 2
4.Data/MGDataHandler.cpp

@@ -1120,8 +1120,11 @@ int CMGDataHandler::HandleAlarmAck(uint32_t alarm_id, string ack_name, yyjson_mu
 	//¸üÐÂÊý¾Ý¿â
 	{
 		CString sql;
-		sql.Format("UPDATE [rm_alarm] SET ack_result = 1, ack_name='%s', ack_time='%s' WHERE ID = %d;",
-			ack_name.c_str(), ack_time.c_str(), alarm_id);
+
+		sql.Format("UPDATE  t1 SET t1.ack_result = 1, t1.ack_name = '%s',t1.ack_time = '%s' \
+			from rm_alarm  t1 where t1.ack_result = 0 and EXISTS(SELECT  1 from  rm_alarm t2 \
+           WHERE t2.ID = % d and t1.mo = t2.mo and t1.mp = t2.mp and t1.no = t2.no and t1.type \
+           = t2.type);",ack_name.c_str(), ack_time.c_str(), alarm_id);
 
 		ret |= CDBConnectPool::Instance()->DBExecuteSQL(sql);
 	}

+ 21 - 9
4.Data/ResistAlarm.cpp

@@ -172,21 +172,33 @@ bool CResistAlarmMng::AckAlarm(int alarm_id, string& name, CTime& time)
 {
 	lock_guard<mutex> lock(m_mtxAlarm);
 	auto it = m_lstUnConfirmAlarm.begin();
+	auto pInfo = *it;
+	bool result = false;
 	for (it; it != m_lstUnConfirmAlarm.end(); ++it)
 	{
-		auto& pInfo = *it;
+		pInfo = *it;
 		if (alarm_id == pInfo->id)
 		{
-			pInfo->ack_result = 1;
-			pInfo->ack_name = name;
-			pInfo->ack_time = time;
-
-			//g_p315ClientManager->GetTcpClient()->SendAlarmData(pInfo->no, 2, CTime(pInfo->time).GetTime(), time.GetTime(), (WORD)pInfo->type, pInfo->val, 0, 0);
-
-			return true;
+			result = true;
+			break;
+			//g_p315ClientManager->GetTcpClient()->SendAlarmData(pInfo->no, 2, CTime(pInfo->time).GetTime(), time.GetTime(), (WORD)pInfo->type, pInfo->val, 0, 0);			
 		}
 	}
-	return false;
+	if (!result) return false;
+	auto itNew = m_lstUnConfirmAlarm.begin();
+	for (itNew;itNew != m_lstUnConfirmAlarm.end();++itNew) {
+		auto& pInfoNew = *itNew;
+		if (pInfo->mo == pInfoNew->mo
+			&& pInfo->mp == pInfoNew->mp
+			&& pInfo->no == pInfoNew->no
+			&& pInfo->type == pInfoNew->type) {
+
+			pInfoNew->ack_result = 1;
+			pInfoNew->ack_name = name;
+			pInfoNew->ack_time = time;
+		}
+	}
+	return true;
 }
 
 bool CResistAlarmMng::HandleAlarm(int alarm_id)