浏览代码

测试:BUG下面的【188、204、211、215、219、221、222、223、224、225、226、237、239、245、249】处理

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@111 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b
heqiang 1 年之前
父节点
当前提交
cc1a7b8aed

+ 35 - 12
2.Web/src/views/AlarmManagement.vue

@@ -234,7 +234,7 @@
        <el-table-column
         prop="desc"
         align="center"
-        min-width="300"
+        min-width="250"
         show-overflow-tooltip
         label="报警内容"
        >
@@ -286,19 +286,19 @@
      </template>
     </el-table-column>
     <!-- 嵌入表格结束 -->
-    <el-table-column prop="up_name" show-overflow-tooltip width="200px" label="站" align="center">
+    <el-table-column prop="up_name" show-overflow-tooltip width="120px" label="站" align="center">
     </el-table-column>
     <el-table-column prop="mo_name" sortable align="center" label="道岔号" width="90">
     </el-table-column>
     <el-table-column prop="mp" sortable align="center" label="牵引点" width="90"> </el-table-column>
-    <el-table-column sortable prop="level" align="center" label="报警等级" min-width="110">
+    <el-table-column sortable prop="level" align="center" label="报警等级" min-width="100">
      <template slot-scope="scope">
       <span :style="{ color: scope.row.level == 1 ? 'red' : 'orange' }">{{
        scope.row.level == 1 ? '告警' : '预警'
       }}</span>
      </template>
     </el-table-column>
-    <el-table-column prop="sunroof" align="center" label="天窗" min-width="90">
+    <el-table-column prop="sunroof" align="center" label="天窗" min-width="60">
      <template slot-scope="scope">
       <span>{{ scope.row.sunroof == 1 ? '是' : '否' }}</span>
      </template>
@@ -319,20 +319,20 @@
      prop="desc"
      align="center"
      show-overflow-tooltip
-     min-width="300"
+     min-width="240"
      label="报警内容"
     >
     </el-table-column>
-    <el-table-column sortable prop="occur_time" align="center" min-width="190" label="报警时间">
+    <el-table-column sortable prop="occur_time" align="center" min-width="170" label="报警时间">
     </el-table-column>
-    <el-table-column sortable prop="recovery_time" align="center" min-width="190" label="恢复时间">
+    <el-table-column sortable prop="recovery_time" align="center" min-width="170" label="恢复时间">
     </el-table-column>
     <el-table-column prop="handle_info" show-overflow-tooltip align="center" label="处理信息">
      <template slot-scope="scope">
       <span>{{ scope.row.handle_info || '-' }}</span>
      </template>
     </el-table-column>
-    <el-table-column sortable prop="ack_time" align="center" label="受理状态" min-width="240">
+    <el-table-column sortable prop="ack_time" align="center" label="受理状态" min-width="200">
      <template slot-scope="scope">
       <span v-if="scope.row.ack_time">{{ scope.row.ack_name }}:{{ scope.row.ack_time }}</span>
       <span v-else>
@@ -340,7 +340,7 @@
       </span>
      </template>
     </el-table-column>
-    <el-table-column sortable prop="handle_time" min-width="240" align="center" label="处理状态">
+    <el-table-column sortable prop="handle_time" min-width="200" align="center" label="处理状态">
      <template slot-scope="scope">
       <span v-if="scope.row.handle_time"
        >{{ scope.row.handle_name }}:{{ scope.row.handle_time }}</span
@@ -352,7 +352,7 @@
       </span>
      </template>
     </el-table-column>
-    <el-table-column width="100" align="center" label="前往">
+    <el-table-column width="100" align="center" fixed="right" label="前往">
      <template slot-scope="scope">
       <span v-if="scope.row.type >= 32" type="primary">-</span>
       <el-link v-else type="primary" @click="localtion_history(scope.row)">历史数据</el-link>
@@ -610,6 +610,23 @@ export default {
    this.params.offset = 0 // 将 offset 重置为 0
    return this.inquire_table()
   },
+  // 解析query
+  format_query(query) {
+   this.station_id = query.station_id;
+   this.params.mo = query.mo;
+   this.params.mp = query.mp;
+   this.params.type = query.type;
+  },
+  // 判断URL中是否有参数
+  url_is_query() {
+   if (this.$route.query.station_id) {
+    let query = this.$route.query
+    this.format_query(query)
+   }else{
+    this.get_time()
+   }
+   return this.inquire_table();
+  },
   // 前往历史数据
   localtion_history(row) {
    this.$router.push({
@@ -779,9 +796,15 @@ export default {
   },
  },
  mounted() {
-  this.get_time()
-  this.get_station_list()
+   this.get_station_list();
+   this.url_is_query();
  },
+ watch:{
+  $route(){
+    this.get_station_list();
+    this.url_is_query();
+  }
+ }
 }
 </script>
 

+ 24 - 1
2.Web/src/views/CurveRetentivity.vue

@@ -74,6 +74,7 @@
      v-debounce="export_img"
      >导出图片</el-button
     >
+    <el-button style="margin-left: 5px;" type="primary" size="mini" @click="localtion_history">历史数据</el-button>
    </div>
    <div
     v-loading="loading"
@@ -90,7 +91,7 @@
    <div class="dw_alarm_low_drop">
    <el-dialog
     width="400px"
-    title="保持力报警配置"
+    title="保持力报警配置"
     :lock-scroll="true"
     :show-close="true"
     @close="val => cancel_setting(val, 'dw_alarm_low_drop')"
@@ -247,6 +248,28 @@ export default {
     message: '导出成功!',
    })
   },
+  // 前往历史数据
+  localtion_history() {
+   if (!this.send_data.mo || !this.send_data.mp)
+    return this.$message({
+     type: 'warning',
+     showClose: true,
+     duration: 1500,
+     message: '请选择重要信息',
+    })
+   let route_data = {
+    name: 'force',
+    query: {
+     tag: this.click_id,
+     time: this.times[0] / 1000,
+     endtime: this.times[1] / 1000 + 24 * 60 * 60 - 1,
+     title: this.send_data.name,
+    },
+   }
+   this.$router.push(route_data)
+   this.$store.state.defaultActive = '/layout/force'
+   this.$store.commit('handle_save_defaultActive', '/layout/force')
+  },
   // 点击树结构
   handle_node_click(data, node) {
    if (data.type != 'mo.mp') return

+ 8 - 2
2.Web/src/views/Equipment.vue

@@ -26,7 +26,7 @@
     v-model="search"
     clearable
     style="width:300px;"
-    placeholder="输入站、道岔名称牵引点名称搜索"
+    placeholder="输入站、道岔名称牵引点名称搜索"
     prefix-icon="el-icon-search"
    />
    <el-radio-group
@@ -821,7 +821,13 @@ export default {
     return this.tableData.filter(data => {
      return Object.keys(data).some(key => {
       if (['up_name', 'mo_name', 'mp'].includes(key)) {
-       return data[key].toLowerCase().indexOf(search.toLowerCase()) > -1
+        if((typeof Number(search)=== 'number') && !isNaN(Number(search))){
+          return data[key]==Number(search);
+        }
+        else{
+          return data[key].toLowerCase().indexOf(search.toLowerCase()) > -1
+        }
+       
       }
      })
     })

+ 9 - 16
2.Web/src/views/Force.vue

@@ -1281,19 +1281,14 @@ export default {
   // 获取更多数据
   get_more_data(data, source, count, points_num) {
    let date_num = +new Date()
-   if (!this.is_get_more) return
    if (source.mo != this.get_tem.mo || source.mp != this.get_tem.mp) return
-   if (!this.is_get_more) return
    let data_list = data.map(item => {
     if (item.points && item.points.length) {
      return item.points[item.points.length - 1][0]
     }
    })
-   if (!this.is_get_more) return
    let last_time = Math.max(...data_list)
-   if (!this.is_get_more) return
    let starttime = this.$dayjs(last_time).format('YYYY-MM-DD HH:mm:ss')
-   if (!this.is_get_more) return
    let send_data = {
     mo: source.mo,
     mp: source.mp,
@@ -1302,28 +1297,18 @@ export default {
     tt: +new Date(),
     threshold: source.threshold,
    }
-   if (!this.is_get_more) return
    resist_data(send_data)
     .then(res => {
-     if (!this.is_get_more) return
      if (source.mo != this.get_tem.mo || source.mp != this.get_tem.mp) return
-     if (!this.is_get_more) return
      let option = this.myCharts.getOption()
-     if (!this.is_get_more) return
      option.series.forEach(item => {
-      if (!this.is_get_more) return
       res.data.forEach(ele => {
-       if (!this.is_get_more) return
        if (item.name == ele.name) {
-        if (!this.is_get_more) return
         item.data.push(...ele.points)
-        if (!this.is_get_more) return
        }
       })
      })
-     if (!this.is_get_more) return
      this.myCharts.setOption(option, false)
-     if (!this.is_get_more) return
      let num_list = res.data.map(item => item.points.length || 0)
      let sum = num_list.reduce((total, current) => total + current, 0)
      console.log(
@@ -1331,11 +1316,12 @@ export default {
        date_num} ms, 本次点个数:${sum}`
      )
      if (res.has_more) {
-      if (!this.is_get_more) return
+      this.is_get_more = true;
       return this.get_more_data(res.data, send_data, count + 1, points_num + sum)
      }
      console.log(`Tip:获取更多数据结束,总计点个数:${points_num + sum}`)
      this.is_get_more = false
+     this.load_finished = true;
     })
     .catch(e => {
      console.log(e)
@@ -1447,6 +1433,13 @@ export default {
     return this.$message.warning('时间格式有误,请重新选择时间...')
    if (this.times[1] < this.times[0])
     return this.$message.warning('结束时间需大于开始时间,请重新选择')
+  
+    const timeDifference = Math.abs(this.times[1]  - this.times[0] );
+    // 将时间差转换为天数
+    const daysDifference = timeDifference / (1000 * 3600 * 24);
+    if(daysDifference > 7)
+    return this.$message.warning('时间范围是7天内,请重新选择')
+
    if (type == 'threshold') {
     if (!this.isValidNumber(this.threshold_val))
      return this.$message.warning('滤波阈值范围:30≤X≤500,且为整数')

+ 2 - 0
2.Web/src/views/ReportStatistical.vue

@@ -53,6 +53,7 @@
     style="width: 100%"
     :span-method="objectSpanMethod"
     :cell-style="cellStyle"
+    :max-height="table_max_height"
    >
     <el-table-column prop="mo_name" label="道岔" align="center" show-overflow-tooltip>
     </el-table-column>
@@ -162,6 +163,7 @@ export default {
  data() {
   return {
    station_data: [],
+   table_max_height:window.innerHeight-200,
    table_data: [],
    send_data: {
     type: 1,

+ 20 - 7
4.Data/HttpPrcess.cpp

@@ -1475,7 +1475,7 @@ string convertWhere(string mo, string mp, string starttime, string endtime, stri
 	}
 
 	if (!type.empty()) {
-		wh += fmt::format(" AND a.type = {}", type);
+		wh += fmt::format(" AND type = {}", type);
 	}
 
 	if (!no.empty()) {
@@ -1927,6 +1927,14 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 		for (auto it = dtStartDate; it < odtEnd;)
 		{
 			sprintf_s(tablename, 50, "rm_resistance_%04d%02d%02d", it.GetYear(), it.GetMonth(), it.GetDay());
+			
+			CString sqlTable = fmt::format("SELECT top 1 imei FROM {}", tablename).c_str();
+			BOOL ret = CDBConnectPool::Instance()->DBExecuteSQL(sqlTable);
+			if (TRUE != ret) {
+				it += COleDateTimeSpan(1, 0, 0, 0);
+				continue;
+			} 
+
 			if (num == 0)
 			{
 				sql += fmt::format("SELECT [acquisitiontime],[data0],[data1],[data2] "\
@@ -2015,7 +2023,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 			}
 			time_t tm = ctTime.GetTime() * 1000 + ts.fraction / 1000000;
 
-#ifdef SHOW_DATA
+//#ifdef SHOW_DATA
 			{
 				auto item = yyjson_mut_arr(doc);
 				yyjson_mut_arr_add_val(points1, item);
@@ -2034,7 +2042,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 				yyjson_mut_arr_add_uint(doc, item, tm);
 				yyjson_mut_arr_add_int(doc, item, sdata2);
 			}
-#endif
+//#endif
 
 			nCount++;
 
@@ -2082,7 +2090,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 			}
 			tm = ctTime.GetTime() * 1000 + ts.fraction / 1000000;
 
-#ifdef SHOW_DATA
+//#ifdef SHOW_DATA
 			if (abs(lastdata0 - sdata0) > nThreshold)
 			{
 				auto item = yyjson_mut_arr(doc);
@@ -2107,7 +2115,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 				yyjson_mut_arr_add_int(doc, item, sdata2);
 				lastdata2 = sdata2;
 			}
-#endif
+//#endif
 
 			nCount++;
 
@@ -2153,14 +2161,14 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 				sprintf_s(tablename, 50, "rm_move_%04d%02d", it.GetYear(), it.GetMonth());
 				if (num == 0)
 				{
-					sql = fmt::format("SELECT show_time, curr_val, show_val, posi,type,sunroof FROM {} \
+					sql = fmt::format("SELECT show_time, curr_val, show_val, posi,type,sunroof,mark FROM {} \
 					WHERE mo = '{}' AND mp = '{}' AND show_time >= '{}' AND show_time <= '{}' ",
 						tablename, mo, mp, starttime, endtime).c_str();
 				}
 				else
 				{
 					sql += fmt::format(" UNION ALL "\
-						"SELECT show_time, curr_val, show_val, posi, type,sunroof FROM {} \
+						"SELECT show_time, curr_val, show_val, posi, type,sunroof,mark FROM {} \
 					WHERE mo = '{}' AND mp = '{}' AND show_time >= '{}' AND show_time <= '{}' ",
 						tablename, mo, mp, starttime, endtime).c_str();
 				}
@@ -2180,6 +2188,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 		eDaoChaPosi posi;
 		ePowerName pn;
 		uint8_t sunroof;
+		char mark[255];
 
 		int nCol = 1;
 		stmt.BindTimeStampCol(nCol++, &ts);
@@ -2188,6 +2197,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 		stmt.BindTinyIntCol(nCol++, (BYTE*)&posi);
 		stmt.BindTinyIntCol(nCol++, (BYTE*)&pn);
 		stmt.BindTinyIntCol(nCol++, &sunroof);
+		stmt.BindCharCol(nCol++, mark, sizeof(mark));
 
 		do
 		{
@@ -2196,6 +2206,9 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 
 			auto obj = yyjson_mut_obj(doc);
 
+			if ( strcmp(mark, "Ëø±ÕÁ¦:0")==0)
+				continue;
+
 			switch (posi)
 			{
 			case eDaoChaPosi::DCP_FIX:

+ 13 - 2
4.Data/MGDataHandler.cpp

@@ -1192,11 +1192,22 @@ int CMGDataHandler::HandleAlarmHandle(uint32_t alarm_id, string handle_name, str
 int CMGDataHandler::SendUnAckAlarm(mg_connection* c)
 {
 	lock_guard<mutex> lock(CResistAlarmMng::Instance()->m_mtxAlarm);
-	auto it = CResistAlarmMng::Instance()->m_lstUnConfirmAlarm.crbegin();
-	for (int i = 0; i < 10 && it != CResistAlarmMng::Instance()->m_lstUnConfirmAlarm.crend(); it++)
+	auto it = CResistAlarmMng::Instance()->m_lstUnConfirmAlarm.cbegin();
+	//set<string> alarmDataSet;
+	for (int i = 0; it != CResistAlarmMng::Instance()->m_lstUnConfirmAlarm.cend(); it++)
 	{
 		auto& pAlarmInfo = *it;
 		if (pAlarmInfo->ack_result != 0) continue;//未受理列表
+
+		/*if (alarmDataSet.size() == 10)
+			break;
+		
+			string tag = (pAlarmInfo->mo + '.' + pAlarmInfo->mp + '.' + to_string(pAlarmInfo->no + 1) + "#").c_str();
+			string up, momp_name, up_name;
+			string momp = pAlarmInfo->mo + "." + pAlarmInfo->mp;
+			CMonitorObjectMng::Instance()->GetStationNameByMomP(momp, up, momp_name);
+			alarmDataSet.insert((up + tag + to_string((int)pAlarmInfo->type)).c_str());*/
+				
 		//TODO 根据用户过滤
 		rapidjson::StringBuffer buffer;
 		auto ret = CResistAlarmMng::AlarmInfo2Pack(pAlarmInfo, buffer);

+ 20 - 17
4.Data/ResistAlarm.cpp

@@ -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());

二进制
4.Data/TimeSyncServer.rc


+ 2 - 0
4.Data/TimeSyncServerDlg.cpp

@@ -347,6 +347,7 @@ void CTimeSyncServerDlg::OnTimer(UINT_PTR nIDEvent)
 	if (IsWindowVisible())
 	{
 		((CButton*)GetDlgItem(IDC_CHK_DATA_COMPRESSION))->SetCheck(g_bDataCompression);
+		((CButton*)GetDlgItem(IDC_CHK_DATA_EXTERNALDATA))->SetCheck(g_bExternalData);
 		auto pSuper = CSuperManager::Instance();
 		if (pSuper->GetSuperNum() == 0)
 			((CButton*)GetDlgItem(IDC_CHK_SWITCH))->SetCheck(FALSE);
@@ -392,3 +393,4 @@ void CTimeSyncServerDlg::OnBnClickedChkDataCompression()
 	CString m_strIniPath = CSimpleLog::GetAppDir() + "DataServices.ini";
 	::WritePrivateProfileString("SET", "DataCompression", to_string(g_bDataCompression).c_str(), m_strIniPath);
 }
+

二进制
4.Data/resource.h


+ 1 - 1
4.Data/stdafx.h

@@ -43,7 +43,7 @@
 
 using namespace std;
 
-//#define DEBUG_202 1
+#define DEBUG_202 1
 #define SEND_LOG 1
 
 #ifndef _DEBUG