瀏覽代碼

丢失版本内容提交

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@110 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b
heqiang 1 年之前
父節點
當前提交
56ace185ce
共有 8 個文件被更改,包括 849 次插入443 次删除
  1. 46 6
      4.Data/AppService.cpp
  2. 233 216
      4.Data/HttpPrcess.cpp
  3. 29 17
      4.Data/MGDataHandler.cpp
  4. 4 0
      4.Data/MonitorObject.h
  5. 524 196
      4.Data/ResistAlarm.cpp
  6. 12 7
      4.Data/ResistAlarm.h
  7. 1 1
      4.Data/SkylightMng.cpp
  8. 二進制
      4.Data/TimeSyncServer.rc

+ 46 - 6
4.Data/AppService.cpp

@@ -173,6 +173,40 @@ bool CAppService::Start()
 			ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
 		}
 
+
+		//move 记录检查type 索引
+		{
+			SYSTEMTIME lastSt;
+			GetLocalTime(&lastSt);
+			string table_today = fmt::format("rm_move_{:0>4}{:0>2}", lastSt.wYear, lastSt.wMonth);
+			sql = fmt::format("IF NOT EXISTS (\
+				SELECT * FROM(\
+					SELECT\
+					i.name AS IndexName,\
+					OBJECT_NAME(ic.OBJECT_ID) AS TableName,\
+					COL_NAME(ic.OBJECT_ID, ic.column_id) AS ColumnName\
+					FROM\
+					sys.indexes AS i\
+					INNER JOIN sys.index_columns AS ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id\
+					WHERE\
+					OBJECT_NAME(ic.OBJECT_ID) = '{0}') AS tb WHERE tb.IndexName = 'IDX_MO_MP' AND ColumnName = 'type')\
+				BEGIN\
+				if exists(select 1\
+					from  sysindexes\
+			where  id = object_id('{0}')\
+				and name = 'IDX_MO_MP'\
+				and indid > 0\
+				and indid < 255)\
+					drop index {0}.IDX_MO_MP\
+				create unique clustered index IDX_MO_MP on {0}(\
+					mo ASC,\
+					mp ASC,\
+					show_time ASC,\
+					type ASC)\
+				END", table_today).c_str();
+            ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
+		}
+
 		sql = "DELETE FROM rm_user WHERE username IN (SELECT username FROM ( SELECT username, COUNT(*) AS TotalCount FROM rm_user GROUP BY username) AS Counts WHERE TotalCount >= 2);";
 		ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
 
@@ -354,11 +388,9 @@ bool CAppService::Start()
 		sql = "UPDATE rm_alarm set ack_result=1, ack_name='system',ack_time=GETDATE() WHERE type = 0x21 and ack_result = 0";
 		ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
 
-		//清除保持力历史数据
-		//sql = "UPDATE rm_alarm set recovery_time=GETDATE() WHERE type = 6  and recovery_time < '2000'";
-		//ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
-		//sql = "UPDATE rm_alarm set ack_result=1, ack_name='system',ack_time=GETDATE() WHERE type = 6 and ack_result = 0";
-		//ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);
+		sql = "update rm_alarm_set set conf = REPLACE(conf, 'true', 'false') where type in(1, 2)";
+		ret = CDBConnectPool::Instance()->DBExecuteSQL(sql);	
+
 	}
 	//end 升级
 
@@ -393,7 +425,7 @@ bool CAppService::Start()
 		//}
 	}
 
-	if (!CResistAlarmMng::Instance()->Start())
+	if (!CResistAlarmMng::Instance()->Start(m_strIniPath))
 	{
 		CSimpleLog::Error("Alarm Start Fail.");
 	}
@@ -878,6 +910,14 @@ void CAppService::ThreadProcCreateTable(DWORD_PTR pThis)
 							CDBConnectPool::Instance()->DBExecuteSQL(qq);
 						}
 
+						qq = CString("SELECT top 1 type FROM ") + tablename;
+						if (CDBConnectPool::Instance()->DBExecuteSQL(qq) == FALSE)
+						{
+							qq.Format("ALTER TABLE %s ADD type tinyint null;", tablename);
+							CDBConnectPool::Instance()->DBExecuteSQL(qq);
+							qq.Format("UPDATE %s SET type = 0 where type is null;", tablename);
+							CDBConnectPool::Instance()->DBExecuteSQL(qq);
+						}
 
 						qq = CString("SELECT top 1 type FROM ") + tablename;
 						if (CDBConnectPool::Instance()->DBExecuteSQL(qq) == FALSE)

+ 233 - 216
4.Data/HttpPrcess.cpp

@@ -473,11 +473,11 @@ int DealGetMitieLock(const httplib::Request& req, const string token, char** jso
 			yyjson_mut_obj_add_int(doc, root, "warn_low_limit", pInfo->warn_low_limit);
 		else 
 			yyjson_mut_obj_add_null(doc, root, "warn_low_limit");
-		if (pInfo->alarm_high_limit < INT_MAX)
+		if (pInfo->alarm_high_limit > INT_MIN)
 			yyjson_mut_obj_add_int(doc, root, "alarm_high_limit", pInfo->alarm_high_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "alarm_high_limit");
-		if (pInfo->warn_high_limit < INT_MAX)
+		if (pInfo->warn_high_limit > INT_MIN)
 			yyjson_mut_obj_add_int(doc, root, "warn_high_limit", pInfo->warn_high_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "warn_high_limit");
@@ -536,24 +536,32 @@ int DealPostMitieLock(const char* body_ptr, const size_t body_len, const string
 				auto val = yyjson_obj_get(conf, "alarm_low_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->alarm_low_limit = yyjson_get_int(val);
+				else
+					pInfo->alarm_low_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "alarm_low_limit", pInfo->alarm_low_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "warn_low_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->warn_low_limit = yyjson_get_int(val);
+				else
+					pInfo->warn_low_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "warn_low_limit", pInfo->warn_low_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "alarm_high_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->alarm_high_limit = yyjson_get_int(val);
+				else
+					pInfo->alarm_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "alarm_high_limit", pInfo->alarm_high_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "warn_high_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->warn_high_limit = yyjson_get_int(val);
+				else
+					pInfo->warn_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "warn_high_limit", pInfo->warn_high_limit);
 			}
 
@@ -591,7 +599,7 @@ int DealPostMitieLock(const char* body_ptr, const size_t body_len, const string
 				if (val && yyjson_is_int(val))
 					pInfo->alarm_high_limit = yyjson_get_int(val);
 				else
-					pInfo->alarm_high_limit = INT_MAX;
+					pInfo->alarm_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "alarm_high_limit", pInfo->alarm_high_limit);
 			}
 			{
@@ -599,7 +607,7 @@ int DealPostMitieLock(const char* body_ptr, const size_t body_len, const string
 				if (val && yyjson_is_int(val))
 					pInfo->warn_high_limit = yyjson_get_int(val);
 				else
-					pInfo->warn_high_limit = INT_MAX;
+					pInfo->warn_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "warn_high_limit", pInfo->warn_high_limit);
 			}
 
@@ -647,15 +655,18 @@ int DealGetConvertResist(const httplib::Request& req, const string token, char**
 			yyjson_mut_obj_add_int(doc, root, "dw_alarm_low_limit", pInfo->dw_alarm_low_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "dw_alarm_low_limit");
+
 		if (pInfo->dw_warn_low_limit > INT_MIN)
 			yyjson_mut_obj_add_int(doc, root, "dw_warn_low_limit", pInfo->dw_warn_low_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "dw_warn_low_limit");
-		if (pInfo->up_alarm_high_limit < INT_MAX)
+
+		if (pInfo->up_alarm_high_limit > INT_MIN)
 			yyjson_mut_obj_add_int(doc, root, "up_alarm_high_limit", pInfo->up_alarm_high_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "up_alarm_high_limit");
-		if (pInfo->up_warn_high_limit < INT_MAX)
+
+		if (pInfo->up_warn_high_limit > INT_MIN)
 			yyjson_mut_obj_add_int(doc, root, "up_warn_high_limit", pInfo->up_warn_high_limit);
 		else
 			yyjson_mut_obj_add_null(doc, root, "up_warn_high_limit");
@@ -754,24 +765,32 @@ int DealPostConvertResist(const char* body_ptr, const size_t body_len, const str
 				auto val = yyjson_obj_get(conf, "dw_alarm_low_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->dw_alarm_low_limit = yyjson_get_int(val);
+				else
+					pInfo->dw_alarm_low_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "dw_alarm_low_limit", pInfo->dw_alarm_low_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "dw_warn_low_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->dw_warn_low_limit = yyjson_get_int(val);
+				else
+					pInfo->dw_warn_low_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "dw_warn_low_limit", pInfo->dw_warn_low_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "up_alarm_high_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->up_alarm_high_limit = yyjson_get_int(val);
+				else
+					pInfo->up_alarm_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "up_alarm_high_limit", pInfo->up_alarm_high_limit);
 			}
 			{
 				auto val = yyjson_obj_get(conf, "up_warn_high_limit");
 				if (val && yyjson_is_int(val))
 					pInfo->up_warn_high_limit = yyjson_get_int(val);
+				else
+					pInfo->up_warn_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "up_warn_high_limit", pInfo->up_warn_high_limit);
 			}
 
@@ -807,7 +826,7 @@ int DealPostConvertResist(const char* body_ptr, const size_t body_len, const str
 				if (val && yyjson_is_int(val))
 					pInfo->up_alarm_high_limit = yyjson_get_int(val);
 				else
-					pInfo->up_alarm_high_limit = INT_MAX;
+					pInfo->up_alarm_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "up_alarm_high_limit", pInfo->up_alarm_high_limit);
 			}
 			{
@@ -815,7 +834,7 @@ int DealPostConvertResist(const char* body_ptr, const size_t body_len, const str
 				if (val && yyjson_is_int(val))
 					pInfo->up_warn_high_limit = yyjson_get_int(val);
 				else
-					pInfo->up_warn_high_limit = INT_MAX;
+					pInfo->up_warn_high_limit = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "up_warn_high_limit", pInfo->up_warn_high_limit);
 			}
 
@@ -883,7 +902,7 @@ int DealPosttRetesionForce(const char* body_ptr, const size_t body_len, const st
 				if (val && yyjson_is_int(val))
 					pInfo->dw_alarm_low_drop = yyjson_get_int(val);
 				else
-					pInfo->dw_alarm_low_drop = 3000;
+					pInfo->dw_alarm_low_drop = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "dw_alarm_low_drop", pInfo->dw_alarm_low_drop);
 			}
 			{
@@ -903,6 +922,11 @@ int DealPosttRetesionForce(const char* body_ptr, const size_t body_len, const st
 				yyjson_mut_obj_add_int(doc, root, "alarm_low_percent", pInfo->alarm_low_percent);
 			}
 
+			if(((pInfo->alarm_low_percent <= 95 && pInfo->alarm_low_percent >= 5)
+				|| (pInfo->alarm_high_percent <= 95 && pInfo->alarm_high_percent >= 5))) {
+				pInfo->is_page_dyna = true;
+			}
+
 			str_conf = yyjson_mut_write(doc, 0, &len);
 			yyjson_mut_doc_free(doc);
 			CResistAlarmMng::Instance()->Insert(mo, mp, posi, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pInfo);
@@ -916,7 +940,7 @@ int DealPosttRetesionForce(const char* body_ptr, const size_t body_len, const st
 				if (val && yyjson_is_int(val))
 					pInfo->dw_alarm_low_drop = yyjson_get_int(val);
 				else
-					pInfo->dw_alarm_low_drop = 3000;
+					pInfo->dw_alarm_low_drop = INT_MIN;
 				yyjson_mut_obj_add_int(doc, root, "dw_alarm_low_drop", pInfo->dw_alarm_low_drop);
 			}
 			{
@@ -936,6 +960,10 @@ int DealPosttRetesionForce(const char* body_ptr, const size_t body_len, const st
 				yyjson_mut_obj_add_int(doc, root, "alarm_low_percent", pInfo->alarm_low_percent);
 			}
 
+			if (((pInfo->alarm_low_percent <= 95 && pInfo->alarm_low_percent >= 5)
+				|| (pInfo->alarm_high_percent <= 95 && pInfo->alarm_high_percent >= 5))) {
+				pInfo->is_page_dyna = true;
+			}
 			str_conf = yyjson_mut_write(doc, 0, &len);
 			yyjson_mut_doc_free(doc);
 
@@ -1473,10 +1501,6 @@ string convertWhere(string mo, string mp, string starttime, string endtime, stri
 			wh += " AND [sunroof]=1";
 	}
 
-	if (!handle_result.empty()) {
-		wh += fmt::format(" AND handle_result = {}", handle_result);
-	}
-
 	if (!recovery.empty()) {
 		if (recovery.compare("0") == 0)
 			wh += " AND [recovery_time] < '1901'";
@@ -1484,7 +1508,7 @@ string convertWhere(string mo, string mp, string starttime, string endtime, stri
 			wh += " AND [recovery_time] > '1901'";
 	}
 
-	wh += " AND rel_id = ''";
+	wh += " AND type not in (32,33)  GROUP BY mo,mp,no,type) a";
 
 	int nPos = wh.find("AND");
 	if (nPos != -1)
@@ -1531,7 +1555,7 @@ int deal_get_alarm_list(const httplib::Request& req, const string token, char**
 
 	do 
 	{
-		CString sql = ("select count(*) from rm_alarm as a " + wh).c_str();
+		CString sql = ("SELECT count(*)   from (SELECT mo,mp,no,type from rm_alarm   " + wh).c_str();
 
 		COdbcStatement stmt;
 		if (!CDBConnectPool::Instance()->DBQuery(stmt, sql))
@@ -1554,10 +1578,10 @@ int deal_get_alarm_list(const httplib::Request& req, const string token, char**
 		if (total == -1)
 			break;
 
-		CString sql = fmt::format("select a.[id],[mo],[mp],[no],a.[type] ,[occur_time],[level],[desc],[suggest],[val],[referval],"\
-			" [ack_result],ISNULL([ack_name], ''),ISNULL([ack_time], 0),[handle_result],ISNULL([handle_name],''),ISNULL([handle_time], 0),ISNULL([handle_info], '') ,b.name,c.id,c.name,"\
-			" recovery_time,sunroof,[event_id] from [rm_alarm] as a left join rm_mo as b on b.id = a.mo left join rm_mo as c on b.up = c.id {} {}",
-			wh, or ).c_str();
+		CString sql = fmt::format("SELECT  b.id,b.mo,b.mp,b.no,b.type,b.occur_time,b.level,b.[desc],b.suggest,b.val,b.referval, b.ack_result,ISNULL(b.ack_name, '') ack_name,ISNULL(b.ack_time, 0) ack_time,b.handle_result,"\
+			" ISNULL(b.handle_name,'') handle_name,ISNULL(b.handle_time, 0) handle_time,ISNULL(b.handle_info, '') handle_info,c.name,d.id,d.name, b.recovery_time,b.sunroof,b.event_id from "\
+			" rm_alarm b right JOIN (SELECT mo,mp,no,type,max(id) as id from rm_alarm as a  {} on a. mo = b.mo and a.mp = b.mp and a.no= b.no and  a.type = b.type  and a.id = b.id"\
+			"  left join  rm_mo  c on c.id = b.mo left join rm_mo  d on c.up = d.id  {}",wh, or ).c_str();
 
 		COdbcStatement stmt;
 		if (!CDBConnectPool::Instance()->DBQuery(stmt, sql))
@@ -1623,7 +1647,10 @@ int deal_get_alarm_list(const httplib::Request& req, const string token, char**
 			yyjson_mut_arr_add_val(rows, obj);
 			auto child = yyjson_mut_arr(doc);
 			yyjson_mut_obj_add_val(doc, obj, "child", child);
-			mapList[event_id] = child; //临时记录后面统一添加
+
+			string mapKey = smo;
+			mapKey.append(smp).append(to_string(no)).append(to_string(utype)).append(".").append(to_string(id));
+			mapList[mapKey] = child; //临时记录后面统一添加
 
 			if (ack_name[0])
 				yyjson_mut_obj_add_strcpy(doc, obj, "ack_name", ANSItoUTF8(ack_name).c_str());
@@ -1649,7 +1676,7 @@ int deal_get_alarm_list(const httplib::Request& req, const string token, char**
 			yyjson_mut_obj_add_int(doc, obj, "id", id);
 			yyjson_mut_obj_add_int(doc, obj, "level", level);
 			yyjson_mut_obj_add_strcpy(doc, obj, "mo", smo);
-			yyjson_mut_obj_add_strcpy(doc, obj, "mo_name", mo_name);
+			yyjson_mut_obj_add_strcpy(doc, obj, "mo_name", ANSItoUTF8(mo_name).c_str());
 			yyjson_mut_obj_add_strcpy(doc, obj, "mp", smp); 
 			yyjson_mut_obj_add_int(doc, obj, "no", no);
 
@@ -1689,152 +1716,158 @@ int deal_get_alarm_list(const httplib::Request& req, const string token, char**
 	{
 		if (mapList.size() == 0)
 			break;
-
-		stringstream ss;
-		ss << " where rel_id in (";
-		int index = 0;
-		for (const auto& it : mapList)
-		{
-			if (index == 0)
-				ss << '\'' << it.first << '\'';
-			else
-				ss << ",'" << it.first << '\'';
-			index++;
-		}
-		ss << ')';
-
-		CString sql = fmt::format("select a.[id],[mo],[mp],[no],a.[type] ,[occur_time],[level],[desc],[suggest],[val],[referval],"\
-			" [ack_result],ISNULL([ack_name], ''),ISNULL([ack_time], 0),[handle_result],ISNULL([handle_name],''),ISNULL([handle_time], 0),ISNULL([handle_info], '') ,b.name,c.id,c.name,"\
-			" recovery_time,sunroof,[event_id],[rel_id] from [rm_alarm] as a left join rm_mo as b on b.id = a.mo left join rm_mo as c on b.up = c.id {}",
-			ss.str()).c_str();
-
-		COdbcStatement stmt;
-		if (!CDBConnectPool::Instance()->DBQuery(stmt, sql))
-		{
-			msg = fmt::format("语句执行错误:{}", sql);
-			code = 500;
-			break;
-		}
-
-		int id, val, refer;
-		char smo[20];
-		char smp[10];
-		char desc[200];
-		char suggest[200];
-		char ack_name[50];
-		char handle_name[50];
-		char hanele_info[50];
-
-		char mo_name[20];
-		char station_name[50];
-		char station_id[50];
-
-		char event_id[37] = { 0 };
-		char rel_id[37] = { 0 };
-
-		uint8_t no, utype, level, ack_result, h_result, skylight;
-		TIMESTAMP_STRUCT tsOcccur, tsHandle, tsAck, tsRecovery;
-
-		int nCol = 1;
-
-		stmt.BindIntCol(nCol++, &id);
-		stmt.BindCharCol(nCol++, smo, sizeof(smo));
-		stmt.BindCharCol(nCol++, smp, sizeof(smp));
-		stmt.BindTinyIntCol(nCol++, &no);
-		stmt.BindTinyIntCol(nCol++, &utype);
-		stmt.BindTimeStampCol(nCol++, &tsOcccur);
-		stmt.BindTinyIntCol(nCol++, &level);
-		stmt.BindCharCol(nCol++, desc, sizeof(desc));
-		stmt.BindCharCol(nCol++, suggest, sizeof(suggest));
-		stmt.BindIntCol(nCol++, &val);
-		stmt.BindIntCol(nCol++, &refer);
-		stmt.BindTinyIntCol(nCol++, &ack_result);
-		stmt.BindCharCol(nCol++, ack_name, sizeof(ack_name));
-		stmt.BindTimeStampCol(nCol++, &tsAck);
-		stmt.BindTinyIntCol(nCol++, &h_result);
-		stmt.BindCharCol(nCol++, handle_name, sizeof(handle_name));
-		stmt.BindTimeStampCol(nCol++, &tsHandle);
-		stmt.BindCharCol(nCol++, hanele_info, sizeof(hanele_info));
-
-		stmt.BindCharCol(nCol++, mo_name, sizeof(mo_name));
-		stmt.BindCharCol(nCol++, station_id, sizeof(station_id));
-		stmt.BindCharCol(nCol++, station_name, sizeof(station_name));
-		stmt.BindTimeStampCol(nCol++, &tsRecovery);
-		stmt.BindTinyIntCol(nCol++, &skylight);
-		stmt.BindCharCol(nCol++, event_id, sizeof(event_id));
-		stmt.BindCharCol(nCol++, rel_id, sizeof(rel_id));
-
-		while (true)
-		{
-			if (stmt.FetchNext() != 0)
-				break;
-
-			auto arr = mapList[rel_id];
+		 
+		for ( auto it = (&mapList)->cbegin();it != (&mapList)->cend();it++) {
+			string keyMap = it->first;
+			vector <string> result;
+			istringstream resultStream(keyMap);
+			string temp;
+			string mompnotype;
+			string idStr;
+			auto arr = mapList[keyMap];
 			if (arr == nullptr)
 			{
 				ASSERT(0);
 				continue;
 			}
-			auto obj = yyjson_mut_obj(doc);
-			yyjson_mut_arr_add_val(arr, obj);//添加到原有的child里
+			while (std::getline(resultStream,temp,'.')) {
+				result.push_back(temp);
+			}
+			if (result.size() == 2) {
+				mompnotype = result[0];
+				idStr = result[1];
 
-			if (ack_name[0])
-				yyjson_mut_obj_add_strcpy(doc, obj, "ack_name", ANSItoUTF8(ack_name).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "ack_name", "");
-			if (tsAck.year != 1900)
-				yyjson_mut_obj_add_strcpy(doc, obj, "ack_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
-					tsAck.year, tsAck.month, tsAck.day, tsAck.hour, tsAck.minute, tsAck.second).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "ack_time", "");
 
-			yyjson_mut_obj_add_int(doc, obj, "ack_result", ack_result);
-			if (handle_name[0])
-				yyjson_mut_obj_add_strcpy(doc, obj, "handle_name", ANSItoUTF8(handle_name).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "handle_name", "");
-			if (tsHandle.year != 1900)
-				yyjson_mut_obj_add_strcpy(doc, obj, "handle_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
-					tsHandle.year, tsHandle.month, tsHandle.day, tsHandle.hour, tsHandle.minute, tsHandle.second).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "handle_time", "");
-			yyjson_mut_obj_add_int(doc, obj, "handle_result", h_result);
-			yyjson_mut_obj_add_int(doc, obj, "id", id);
-			yyjson_mut_obj_add_int(doc, obj, "level", level);
-			yyjson_mut_obj_add_strcpy(doc, obj, "mo", smo);
-			yyjson_mut_obj_add_strcpy(doc, obj, "mo_name", mo_name);
-			yyjson_mut_obj_add_strcpy(doc, obj, "mp", smp);
-			yyjson_mut_obj_add_int(doc, obj, "no", no);
+				CString sql = fmt::format("select a.id,a.mo,a.mp,a.no,a.type ,a.occur_time,a.level,a.[desc],a.suggest,a.val,a.referval,"\
+					"a.ack_result, ISNULL(a.ack_name, ''), ISNULL(a.ack_time, 0), a.handle_result, ISNULL(a.handle_name, ''), ISNULL(a.handle_time, 0), ISNULL(a.handle_info, ''), b.name, c.id, c.name,"\
+					"a.recovery_time, a.sunroof, a.event_id, a.rel_id from rm_alarm  a left join rm_mo as b on b.id = a.mo left join rm_mo as c on b.up = c.id where  concat(a.mo, a.mp, a.no, a.type) = '{}' and a.id < {}",
+					mompnotype,idStr).c_str();
 
-			yyjson_mut_obj_add_strcpy(doc, obj, "type_name", ANSItoUTF8(GetAlarmName((eZL_ALARMTYPE)utype)).c_str());
+				COdbcStatement stmt;
+				if (!CDBConnectPool::Instance()->DBQuery(stmt, sql))
+				{
+					msg = fmt::format("语句执行错误:{}", sql);
+					code = 500;
+					break;
+				}
 
-			yyjson_mut_obj_add_strcpy(doc, obj, "occur_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
-				tsOcccur.year, tsOcccur.month, tsOcccur.day, tsOcccur.hour, tsOcccur.minute, tsOcccur.second).c_str());
+				int id, val, refer;
+				char smo[20];
+				char smp[10];
+				char desc[200];
+				char suggest[200];
+				char ack_name[50];
+				char handle_name[50];
+				char hanele_info[50];
+
+				char mo_name[20];
+				char station_name[50];
+				char station_id[50];
+
+				char event_id[37] = { 0 };
+				char rel_id[37] = { 0 };
+
+				uint8_t no, utype, level, ack_result, h_result, skylight;
+				TIMESTAMP_STRUCT tsOcccur, tsHandle, tsAck, tsRecovery;
+
+				int nCol = 1;
+
+				stmt.BindIntCol(nCol++, &id);
+				stmt.BindCharCol(nCol++, smo, sizeof(smo));
+				stmt.BindCharCol(nCol++, smp, sizeof(smp));
+				stmt.BindTinyIntCol(nCol++, &no);
+				stmt.BindTinyIntCol(nCol++, &utype);
+				stmt.BindTimeStampCol(nCol++, &tsOcccur);
+				stmt.BindTinyIntCol(nCol++, &level);
+				stmt.BindCharCol(nCol++, desc, sizeof(desc));
+				stmt.BindCharCol(nCol++, suggest, sizeof(suggest));
+				stmt.BindIntCol(nCol++, &val);
+				stmt.BindIntCol(nCol++, &refer);
+				stmt.BindTinyIntCol(nCol++, &ack_result);
+				stmt.BindCharCol(nCol++, ack_name, sizeof(ack_name));
+				stmt.BindTimeStampCol(nCol++, &tsAck);
+				stmt.BindTinyIntCol(nCol++, &h_result);
+				stmt.BindCharCol(nCol++, handle_name, sizeof(handle_name));
+				stmt.BindTimeStampCol(nCol++, &tsHandle);
+				stmt.BindCharCol(nCol++, hanele_info, sizeof(hanele_info));
+
+				stmt.BindCharCol(nCol++, mo_name, sizeof(mo_name));
+				stmt.BindCharCol(nCol++, station_id, sizeof(station_id));
+				stmt.BindCharCol(nCol++, station_name, sizeof(station_name));
+				stmt.BindTimeStampCol(nCol++, &tsRecovery);
+				stmt.BindTinyIntCol(nCol++, &skylight);
+				stmt.BindCharCol(nCol++, event_id, sizeof(event_id));
+				stmt.BindCharCol(nCol++, rel_id, sizeof(rel_id));
+
+				while (true)
+				{
+					if (stmt.FetchNext() != 0)
+						break;
 
-			if (tsRecovery.year != 1900)
-				yyjson_mut_obj_add_strcpy(doc, obj, "recovery_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
-					tsRecovery.year, tsRecovery.month, tsRecovery.day, tsRecovery.hour, tsRecovery.minute, tsRecovery.second).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "recovery_time", "");
+					auto obj = yyjson_mut_obj(doc);
+					yyjson_mut_arr_add_val(arr, obj);//添加到原有的child里
 
-			if (suggest[0])
-				yyjson_mut_obj_add_strcpy(doc, obj, "suggest", ANSItoUTF8(suggest).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "suggest", "");
-			if (desc[0])
-				yyjson_mut_obj_add_strcpy(doc, obj, "desc", ANSItoUTF8(desc).c_str());
-			else
-				yyjson_mut_obj_add_str(doc, obj, "desc", "");
-			yyjson_mut_obj_add_int(doc, obj, "sunroof", skylight);
-			yyjson_mut_obj_add_int(doc, obj, "type", utype);
-			//yyjson_mut_obj_add_strcpy(doc, obj, "type_name", )
-			yyjson_mut_obj_add_strcpy(doc, obj, "up", ANSItoUTF8(station_id).c_str());
-			yyjson_mut_obj_add_strcpy(doc, obj, "up_name", ANSItoUTF8(station_name).c_str());
-			yyjson_mut_obj_add_int(doc, obj, "val", val);
-			yyjson_mut_obj_add_int(doc, obj, "referval", refer);
-			yyjson_mut_obj_add_strcpy(doc, obj, "event_id", event_id);
-		}
+					if (ack_name[0])
+						yyjson_mut_obj_add_strcpy(doc, obj, "ack_name", ANSItoUTF8(ack_name).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "ack_name", "");
+					if (tsAck.year != 1900)
+						yyjson_mut_obj_add_strcpy(doc, obj, "ack_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
+							tsAck.year, tsAck.month, tsAck.day, tsAck.hour, tsAck.minute, tsAck.second).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "ack_time", "");
+
+					yyjson_mut_obj_add_int(doc, obj, "ack_result", ack_result);
+					if (handle_name[0])
+						yyjson_mut_obj_add_strcpy(doc, obj, "handle_name", ANSItoUTF8(handle_name).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "handle_name", "");
+					if (tsHandle.year != 1900)
+						yyjson_mut_obj_add_strcpy(doc, obj, "handle_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
+							tsHandle.year, tsHandle.month, tsHandle.day, tsHandle.hour, tsHandle.minute, tsHandle.second).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "handle_time", "");
+					yyjson_mut_obj_add_int(doc, obj, "handle_result", h_result);
+					yyjson_mut_obj_add_int(doc, obj, "id", id);
+					yyjson_mut_obj_add_int(doc, obj, "level", level);
+					yyjson_mut_obj_add_strcpy(doc, obj, "mo", smo);
+					yyjson_mut_obj_add_strcpy(doc, obj, "mo_name", mo_name);
+					yyjson_mut_obj_add_strcpy(doc, obj, "mp", smp);
+					yyjson_mut_obj_add_int(doc, obj, "no", no);
+
+					yyjson_mut_obj_add_strcpy(doc, obj, "type_name", ANSItoUTF8(GetAlarmName((eZL_ALARMTYPE)utype)).c_str());
+
+					yyjson_mut_obj_add_strcpy(doc, obj, "occur_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
+						tsOcccur.year, tsOcccur.month, tsOcccur.day, tsOcccur.hour, tsOcccur.minute, tsOcccur.second).c_str());
+
+					if (tsRecovery.year != 1900)
+						yyjson_mut_obj_add_strcpy(doc, obj, "recovery_time", fmt::format("{}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}",
+							tsRecovery.year, tsRecovery.month, tsRecovery.day, tsRecovery.hour, tsRecovery.minute, tsRecovery.second).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "recovery_time", "");
 
+					if (suggest[0])
+						yyjson_mut_obj_add_strcpy(doc, obj, "suggest", ANSItoUTF8(suggest).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "suggest", "");
+					if (desc[0])
+						yyjson_mut_obj_add_strcpy(doc, obj, "desc", ANSItoUTF8(desc).c_str());
+					else
+						yyjson_mut_obj_add_str(doc, obj, "desc", "");
+					yyjson_mut_obj_add_int(doc, obj, "sunroof", skylight);
+					yyjson_mut_obj_add_int(doc, obj, "type", utype);
+					//yyjson_mut_obj_add_strcpy(doc, obj, "type_name", )
+					yyjson_mut_obj_add_strcpy(doc, obj, "up", ANSItoUTF8(station_id).c_str());
+					yyjson_mut_obj_add_strcpy(doc, obj, "up_name", ANSItoUTF8(station_name).c_str());
+					yyjson_mut_obj_add_int(doc, obj, "val", val);
+					yyjson_mut_obj_add_int(doc, obj, "referval", refer);
+					yyjson_mut_obj_add_strcpy(doc, obj, "event_id", event_id);
+				}
+
+			}
+			
+
+		}
 
 	} while (false);
 
@@ -2106,6 +2139,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 	auto pConvertLimit = (CONVERT_RESIST_OVER_LIMIT*)CResistAlarmMng::Instance()->Find(mo, mp, 2, eZL_ALARMTYPE::CONVERT_LIMIT);
 	auto pFixSuobi = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
 	auto pInvertSuobi = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_INVERT, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
+	auto pFriction = (FRICTION_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, 2, eZL_ALARMTYPE::FRICTION_OVER_LIMIT);
 
 	{
 		int num = 0;
@@ -2324,8 +2358,17 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 						yyjson_mut_obj_add_str(doc, obj, "position", "bottom");
 					}
 					yyjson_mut_obj_add_int(doc, obj, "val", show_val);
-					yyjson_mut_obj_add_str(doc, obj, "color", "#802A2A");
-					//TODO 颜色
+					if (pFriction && pFriction->enable)
+					{
+						if (show_val > pFriction->up_alarm_low_limit || show_val < pFriction->dw_alarm_high_limit)
+							yyjson_mut_obj_add_str(doc, obj, "color", "Red");
+						else if (show_val > pFriction->up_warn_low_limit || show_val < pFriction->dw_warn_high_limit)
+							yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
+						else 
+							yyjson_mut_obj_add_str(doc, obj, "color", "#8A2BE2");//紫罗兰
+					}
+					else
+						yyjson_mut_obj_add_str(doc, obj, "color", "#8A2BE2");//紫罗兰
 					yyjson_mut_obj_add_strcpy(doc, obj, "label", ANSItoUTF8(fmt::format("稳态值:{}", show_val)).c_str());
 				}
 				else
@@ -3408,21 +3451,23 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 	{
 		//转换阻力报警线
 		CONVERT_RESIST_OVER_LIMIT* pInfo = (CONVERT_RESIST_OVER_LIMIT*)CResistAlarmMng::Instance()->Find(mo, mp, 2, eZL_ALARMTYPE::CONVERT_LIMIT);
+		string direct1, direct2;
+		CMonitorObjectMng::Instance()->GetDirectByMoMp(mo+"."+mp, direct1, direct2);
 		if (pInfo && pInfo->enable)
 		{
 			if (pInfo->dw_warn_low_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(convert_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8(direct1+"预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->dw_warn_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
-			if (pInfo->up_warn_high_limit < INT_MAX)
+			if (pInfo->up_warn_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(convert_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8(direct2+"预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->up_warn_high_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
@@ -3430,60 +3475,21 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(convert_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8(direct1+"告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->dw_alarm_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
-			if (pInfo->up_alarm_high_limit < INT_MAX)
+			if (pInfo->up_alarm_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(convert_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8(direct2+"告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->up_alarm_high_limit);
 
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
 		}
 	}
-	{
-		//锁闭力报警线
-		SUOBI_OVER_LIMIT_INFO* pInfo = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, -1, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
-		if (pInfo && pInfo->enable)
-		{
-			if (pInfo->warn_low_limit > INT_MIN)
-			{
-				auto obj = yyjson_mut_obj(doc);
-				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("预警线").c_str());
-				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_low_limit);
-				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
-			}
-			if (pInfo->warn_high_limit < INT_MAX)
-			{
-				auto obj = yyjson_mut_obj(doc);
-				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("预警线").c_str());
-				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_high_limit);
-				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
-			}
-			if (pInfo->alarm_low_limit > INT_MIN)
-			{
-				auto obj = yyjson_mut_obj(doc);
-				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("告警线").c_str());
-				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_low_limit);
-				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
-			}
-			if (pInfo->alarm_high_limit < INT_MAX)
-			{
-				auto obj = yyjson_mut_obj(doc);
-				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("告警线").c_str());
-				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_high_limit);
-				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
-			}
-		}
-	}
 	{
 		//定位锁闭力报警线
 		SUOBI_OVER_LIMIT_INFO* pInfo = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
@@ -3493,15 +3499,15 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位最小预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
-			if (pInfo->warn_high_limit < INT_MAX)
+			if (pInfo->warn_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位最大预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_high_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
@@ -3509,15 +3515,15 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位最小告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
-			if (pInfo->alarm_high_limit < INT_MAX)
+			if (pInfo->alarm_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("定位最大告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_high_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
@@ -3532,15 +3538,15 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位最小预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
-			if (pInfo->warn_high_limit < INT_MAX)
+			if (pInfo->warn_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位预警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位最大预警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->warn_high_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
 			}
@@ -3548,15 +3554,15 @@ int DealGetResistCurve(const httplib::Request& req, const string token, char** j
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位最小告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_low_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
-			if (pInfo->alarm_high_limit < INT_MAX)
+			if (pInfo->alarm_high_limit > INT_MIN)
 			{
 				auto obj = yyjson_mut_obj(doc);
 				yyjson_mut_arr_add_val(suobi_line, obj);
-				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位告警线").c_str());
+				yyjson_mut_obj_add_strcpy(doc, obj, "name", ANSItoUTF8("反位最大告警线").c_str());
 				yyjson_mut_obj_add_int(doc, obj, "value", pInfo->alarm_high_limit);
 				yyjson_mut_obj_add_str(doc, obj, "color", "Red");
 			}
@@ -4806,6 +4812,7 @@ int DealResistMove(const httplib::Request& req, const string token, char** json,
 		auto pConvertLimit = (CONVERT_RESIST_OVER_LIMIT*)CResistAlarmMng::Instance()->Find(mo, mp, 2, eZL_ALARMTYPE::CONVERT_LIMIT);
 		auto pFixSuobi = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
 		auto pInvertSuobi = (SUOBI_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_INVERT, eZL_ALARMTYPE::SUOBI_LOCK_LIMIT);
+		auto pFriction = (FRICTION_OVER_LIMIT_INFO*)CResistAlarmMng::Instance()->Find(mo, mp, 2, eZL_ALARMTYPE::FRICTION_OVER_LIMIT);
 
 		std::map<time_t, int64_t>* pmaxlockfix = nullptr, * pmaxlockinvert = nullptr;
 		if (pInfo->name1.find("定位") != -1)
@@ -4898,10 +4905,20 @@ int DealResistMove(const httplib::Request& req, const string token, char** json,
 			yyjson_mut_arr_add_int(doc, coord, show_time);
 			yyjson_mut_arr_add_int(doc, coord, curr_val);
 			yyjson_mut_obj_add_strcpy(doc, obj, "time", fmt::format("{}.{:0>3}", CTime(show_time/1000).Format("%Y-%m-%d %H:%M:%S"), show_time % 1000).c_str());
-			yyjson_mut_obj_add_str(doc, obj, "color", "#802A2A");
 			if (show_val < 0)
 				show_val = -show_val;
 			yyjson_mut_obj_add_int(doc, obj, "val", show_val);
+			if (pFriction && pFriction->enable)
+			{
+				if (show_val > pFriction->up_alarm_low_limit || show_val < pFriction->dw_alarm_high_limit)
+					yyjson_mut_obj_add_str(doc, obj, "color", "Red");
+				else if (show_val > pFriction->up_warn_low_limit || show_val < pFriction->dw_warn_high_limit)
+					yyjson_mut_obj_add_str(doc, obj, "color", "Orange");
+				else
+					yyjson_mut_obj_add_str(doc, obj, "color", "#8A2BE2");//紫罗兰
+			}
+			else
+				yyjson_mut_obj_add_str(doc, obj, "color", "#8A2BE2");//紫罗兰
 			yyjson_mut_obj_add_strcpy(doc, obj, "label", ANSItoUTF8(fmt::format("稳态值:{}", show_val)).c_str());
 			if (it.bUpOrDown == eUpOrDownInfo::UOD_DOWN)
 				yyjson_mut_obj_add_str(doc, obj, "position", "bottom");

+ 29 - 17
4.Data/MGDataHandler.cpp

@@ -452,7 +452,7 @@ int CMGDataHandler::HandleConfRead(string tag, string type, yyjson_mut_doc* doc,
 					{
 						int nNo = atoi(no.c_str()) - 1;
 						auto pBase = CResistAlarmMng::Instance()->Find(mo, mp, nNo, eZL_ALARMTYPE::MAX_OVER_LIMIT);
-						if (pBase && pBase->enable)
+						if (pBase)
 						{
 							string name1, name2, name3;
 							CMonitorObjectMng::Instance()->GetNameByMoMp(mo + "." + mp, name1, name2, name3);
@@ -592,28 +592,40 @@ int CMGDataHandler::HandleConfRead(string tag, string type, yyjson_mut_doc* doc,
 								yyjson_mut_arr_add_val(conf, obj);
 							}
 							{
-								auto obj = yyjson_mut_obj(doc);
-								yyjson_mut_obj_add_str(doc, obj, "name", "up_alarm_low_limit");
-								yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->up_alarm_low_limit).c_str());
-								yyjson_mut_arr_add_val(conf, obj);
+								if (pInfo->up_alarm_low_limit != INT_MAX) {
+									auto obj = yyjson_mut_obj(doc);
+									yyjson_mut_obj_add_str(doc, obj, "name", "up_alarm_low_limit");
+									yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->up_alarm_low_limit).c_str());
+									yyjson_mut_arr_add_val(conf, obj);
+								}
+								
 							}
 							{
-								auto obj = yyjson_mut_obj(doc);
-								yyjson_mut_obj_add_str(doc, obj, "name", "up_warn_low_limit");
-								yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->up_warn_low_limit).c_str());
-								yyjson_mut_arr_add_val(conf, obj);
+								if (pInfo->up_warn_low_limit != INT_MAX) {
+									auto obj = yyjson_mut_obj(doc);
+									yyjson_mut_obj_add_str(doc, obj, "name", "up_warn_low_limit");
+									yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->up_warn_low_limit).c_str());
+									yyjson_mut_arr_add_val(conf, obj);
+								}
+								
 							}
 							{
-								auto obj = yyjson_mut_obj(doc);
-								yyjson_mut_obj_add_str(doc, obj, "name", "dw_alarm_high_limit");
-								yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->dw_alarm_high_limit).c_str());
-								yyjson_mut_arr_add_val(conf, obj);
+								if (pInfo->dw_alarm_high_limit != INT_MIN) {
+									auto obj = yyjson_mut_obj(doc);
+									yyjson_mut_obj_add_str(doc, obj, "name", "dw_alarm_high_limit");
+									yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->dw_alarm_high_limit).c_str());
+									yyjson_mut_arr_add_val(conf, obj);
+								}
+								
 							}
 							{
-								auto obj = yyjson_mut_obj(doc);
-								yyjson_mut_obj_add_str(doc, obj, "name", "dw_warn_high_limit");
-								yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->dw_warn_high_limit).c_str());
-								yyjson_mut_arr_add_val(conf, obj);
+								if (pInfo->dw_warn_high_limit != INT_MIN) {
+									auto obj = yyjson_mut_obj(doc);
+									yyjson_mut_obj_add_str(doc, obj, "name", "dw_warn_high_limit");
+									yyjson_mut_obj_add_strcpy(doc, obj, "val", to_string(pInfo->dw_warn_high_limit).c_str());
+									yyjson_mut_arr_add_val(conf, obj);
+								}
+								
 							}
 
 						}

+ 4 - 0
4.Data/MonitorObject.h

@@ -35,6 +35,10 @@ struct ST_MOMP_INFO
 	string mo;
 	string mp;
 	string name;  //츰냔
+	int detectToday0 = 3000;//뎠땍貫괏넣제꽝옘令
+	time_t detectTodayTime0 = 0;
+	int detectToday1 = 3000;//뎠럽貫괏넣제꽝옘令
+	time_t detectTodayTime1 = 0;
 
 public:
 	//줄珂榴檄

文件差異過大導致無法顯示
+ 524 - 196
4.Data/ResistAlarm.cpp


+ 12 - 7
4.Data/ResistAlarm.h

@@ -73,6 +73,7 @@ typedef struct tagRetension_Force_Drop : public  tagBaseInfo
 	int dw_alarm_low_drop = INT_MIN;    //最低预警值
 	int alarm_low_percent = INT_MIN;    //下降百分比报警值
 	int alarm_high_percent = INT_MIN;    //上升百分比报警值
+	bool is_page_dyna = false;    //是否页面动态设置,默认否
 
 	time_t tLastCalc = 0;				//上一次计算时间(不参与配置)   //是不是可以用 tmLastCheckTime
 
@@ -128,7 +129,7 @@ inline string GetAlarmName(eZL_ALARMTYPE id)
 	case eZL_ALARMTYPE::SUOBI_LOCK_LIMIT:
 		return "锁闭力超限";
 	case eZL_ALARMTYPE::RETENSION_FORCE:
-		return "保持力异常告警";
+		return "保持力";
 	default:
 		return "未知";
 	}
@@ -166,7 +167,7 @@ public:
 
 	static CResistAlarmMng* Instance() { return &obj; }
 
-	BOOL Start();
+	BOOL Start(CString strIniPath);
 
 	void Stop();
 
@@ -221,15 +222,17 @@ private:
 	static void JudgeAlarm3(CResistAlarmMng* pService, RETENSION_FORCE_DROP* pRetensionForceDropInfo,
 		time_t show_time, int show_val, eSuoBiPosi posi, string mo, string mp, uint32_t zzjno);
 
-	//判断报警,且保存数据
-	static void JudgeAlarm(CResistAlarmMng* pService, RETENSION_FORCE_DROP* pConstRetensionForceWaveInfo,
-		time_t show_time, int show_val, eSuoBiPosi posi, string mo, string mp, void* pMoMpInfo);
+	//保持力判断报警,且保存数据
+	static void JudgeAlarm(CResistAlarmMng* pService, RETENSION_FORCE_DROP* pAlarmSet,
+		time_t show_time, int show_val, eSuoBiPosi posi, string mo, string mp, void* pMoMpInfo, int detectToday, eDaoChaPosi posiLast, BOOL isRedAlarm, BOOL alarmStatus);
 	//摩檫力报警判断
 	static void JudgeAlarm(CResistAlarmMng* pService, FRICTION_OVER_LIMIT_INFO* pAlarmSet,
 		time_t show_time, int show_val, eDaoChaPosi posi, eUpOrDownInfo eUpOrDown, void* pMoMpInfo);
 
+	static BOOL JudgePass(string mo, string mp);
+
 	//报警规则检测线程
-	static void ThreadProcAlarmSet(DWORD_PTR);	
+	static void ThreadProcAlarmSet(DWORD_PTR,CString strIniPath);	
 	//设备报警检测线程	
 	static void ThreadProcDevice(DWORD_PTR);
 	//扳动线程检测线程
@@ -248,7 +251,9 @@ private:
 
 	static time_t SystemTimeToTimeT(const SYSTEMTIME& st);
 
-
+	static BOOL CompareValuePass(std::map<time_t, int>* pData, time_t tsStartTime, time_t tsEndTime, int& hight_num, int& low_num, int threshold, int& iMaxDif, time_t& tMaxTime, int& nMaxValue);
+	static string getTimeString();
+	
 	BOOL LoadUnAck();
 	//报警ID
 	int m_nAlarmID = 0;

+ 1 - 1
4.Data/SkylightMng.cpp

@@ -44,7 +44,7 @@ BOOL CSkylightMng::IsSkylight(CTime* ptmTime)
 {
 	if (ptmTime)
 	{
-		if (ptmTime->GetHour() < 4 || ptmTime->GetHour() >= 23)
+		if (ptmTime->GetHour() < 4)
 			return TRUE;
 	}
 	

二進制
4.Data/TimeSyncServer.rc


部分文件因文件數量過多而無法顯示