Sfoglia il codice sorgente

1、修改直流和单相电源监控24h无记录的bug

liyuezong 2 anni fa
parent
commit
0818bee639
3 ha cambiato i file con 24 aggiunte e 4 eliminazioni
  1. 2 2
      pro/src/app.c
  2. 21 2
      pro/src/appweb_handle.c
  3. 1 0
      pro/src/json_handle.c

+ 2 - 2
pro/src/app.c

@@ -1065,7 +1065,7 @@ void AlarmCtrlChn(int nChID, int nCtrl)
                                                 nCtrl, false);
             }
 
-            sprintf(buff, "Over limit protection $关闭$|$通道$|%d", _globalPowerMangerTemp->product_ch_id);
+            sprintf(buff, "Over limit protection |$关闭$|$通道$|%d", _globalPowerMangerTemp->product_ch_id);
             dev_insert_alarm_ctrl(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, ALARM_TYPE_SENSOR, buff);
             break;
         }
@@ -1088,7 +1088,7 @@ void AlarmCtrlAll(int nCtrl)
             int rec=g_switch_set_all_ctrl(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_ch_type,_globalPowerMangerTemp->product_saddr,nCtrl);
             if(rec<0)log_i("Close All address:%d rec:%d:%s",nSendAddr,rec,modbus_strerror(errno));
         }      
-        sprintf(buff,"Over limit protection $关闭$|$所有$|$通道$");
+        sprintf(buff,"Over limit protection |$关闭$|$所有$|$通道$");
         dev_insert_alarm_ctrl(__globalDeviceManage.db,_globalPowerMangerTemp->product_id,ALARM_TYPE_SENSOR,buff);
 }
 /**

+ 21 - 2
pro/src/appweb_handle.c

@@ -852,7 +852,25 @@ static void overallStatusMonitoring(void* conn)
         {
             ack_str = over_all_data_t_ac_to_json(pall, &_over_all_sts_monitor, TOTAL_POWER_CONS_TYPE);
         }
-        else if (_over_all_sts_monitor.lType && (strcmp(_over_all_sts_monitor.lType,"L1")==0 || strcmp(_over_all_sts_monitor.lType,"L2")==0 || strcmp(_over_all_sts_monitor.lType,"L3")==0))
+        else if (_over_all_sts_monitor.product_pwr_type >= 0)
+        {
+            // 查询数据库总电源信息 传给所申请的参数结构体
+            if (dev_search_time_power_info(__globalDeviceManage.db, __globalDeviceManage._globalDevInfo.product_id, 0, TOTAL_POWER_CONS_TYPE, &__globalPowerInfo, _over_all_sts_monitor.start_time, _over_all_sts_monitor.end_time) != 0)
+            {
+                log_e("serach total power consumption err.");
+            }
+            // 传值给总管理结构体
+            for (int i = 0; i < TOTAL_COUNT; i++)
+            {
+                strcpy(pall->_total_consumption.xAxis[i], __globalPowerInfo._total_consumption.xAxis[i]);
+                pall->_total_consumption.ydata[i] = __globalPowerInfo._total_consumption.ydata[i];
+            }
+
+            // 返回耗电量统计
+            ack_str = over_all_total_info_to_json(pall, TOTAL_POWER_CONS_TYPE);
+        }
+        else if (_over_all_sts_monitor.lType && (strcmp(_over_all_sts_monitor.lType,"L1")==0 || strcmp(_over_all_sts_monitor.lType,"L2")==0 || strcmp(_over_all_sts_monitor.lType,"L3")==0)
+        &&(__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B) )
         {
             int ph_id=-1;
             if (strcmp(_over_all_sts_monitor.lType,"L1")==0)
@@ -960,7 +978,8 @@ static void overallStatusMonitoring(void* conn)
         //清0
         memset(&__PowerTrendInfo,0,sizeof(GlobalPowerInfo));
         #if 1
-         if (_over_all_sts_monitor.lType && (strcmp(_over_all_sts_monitor.lType,"L1")==0 || strcmp(_over_all_sts_monitor.lType,"L2")==0 || strcmp(_over_all_sts_monitor.lType,"L3")==0))
+         if (_over_all_sts_monitor.lType && (strcmp(_over_all_sts_monitor.lType,"L1")==0 || strcmp(_over_all_sts_monitor.lType,"L2")==0 || strcmp(_over_all_sts_monitor.lType,"L3")==0)
+           &&(__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B) )
         {
             int ph_id=-1;
             if (strcmp(_over_all_sts_monitor.lType,"L1")==0)

+ 1 - 0
pro/src/json_handle.c

@@ -1018,6 +1018,7 @@ cJSON* json_to_overall_status_monitor(const char* str,_Over_All_Sts_Monitor* _ov
     cJSON *cjson_product_type = cJSON_GetObjectItem(cjson, "productType");
     if (cjson_product_type != NULL)
         _over_all_sts_monitor->product_pwr_type = atoi(cjson_product_type->valuestring);
+    else _over_all_sts_monitor->product_pwr_type = -1;
 
     cJSON *cjson_PhOrder = cJSON_GetObjectItem(cjson, "productPhOrder");
     if (cjson_PhOrder != NULL)