Explorar el Código

1、增加单双三相切换控制(通道关闭状态下才可以);2、修改日志排序;

liyuezong hace 1 año
padre
commit
231ec021c1
Se han modificado 3 ficheros con 24 adiciones y 15 borrados
  1. 1 1
      pro/src/app.c
  2. 22 13
      pro/src/appweb_handle.c
  3. 1 1
      pro/src/sqlite_handle.c

+ 1 - 1
pro/src/app.c

@@ -1060,7 +1060,7 @@ static void* power_thread(void* arg)
                         dev_update_power_ds(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, _globalPowerMangerTemp->product_ch_id, _powerDsManageTemp);
                        
                         char strLog[200];
-                         sprintf(strLog, "CH%d ", _globalPowerMangerTemp->product_ch_id);
+                         sprintf(strLog, "CH%d", _globalPowerMangerTemp->product_ch_id);
                         dev_Alarm_Run_message(_globalDeviceManager,strLog,"scheduled task triggered!");
                     }
                 }                

+ 22 - 13
pro/src/appweb_handle.c

@@ -91,17 +91,12 @@ static char* g_product_type_str[] = {
     "SmartPDU(DC)",
     "SmartPDU(AC)",
     "SmartPDU",
-    "SmartPDU(Three_AC_Tree)",
-    "SmartPDU(Three_AC_One)",
-    "SmartPDU(Three_AC_One_B)",
-};
-static char* g_product_pwr_type_str[] = {
-    "xxx",
-    "直流",
-    "交流单相",
-    "交流三相三出",
-    "交流三相单出",
+    "SmartPDU(AC_3P-IN & 3P-OUT)",
+    "SmartPDU(AC_3P-IN & 1P-OUT)",
+    "SmartPDU(AC_3P-IN & 1P-OUT)",
+    "SmartPDU(AC_3P-IN & 2P-OUT)",
 };
+
 static web_handle_t webHandle;
 static int webSetCallback(void);
 
@@ -2029,6 +2024,19 @@ static void channelStatusMonitoring(void* conn)
                 break;
             }
         }
+
+        if (_globalPowerMangerTemp != NULL)
+        {
+            //1三项2单项3二相
+            if (_globalPowerMangerTemp->_PowerInfo.status== 1)
+            {
+                ack_str=ctrl_breaker_err_ack_to_json("To change channel phase, turn it off first!");
+                http_reply(conn, 201, ack_str);
+                cJSON_free((void *)ack_str);
+                return;
+            }
+        }
+
         if (__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One
             ||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One_B
             ||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Two
@@ -2037,6 +2045,7 @@ static void channelStatusMonitoring(void* conn)
             //1三项2单项3二相
             if (_over_chn_pwr_request.outputType == 1)
             {
+                ack_str=ctrl_breaker_err_ack_to_json("Can't change channel phase!");
                 http_reply(conn, 201, ack_str);
                 cJSON_free((void *)ack_str);
                 return;
@@ -2149,7 +2158,7 @@ static void channelStatusMonitoring(void* conn)
                         GlobalTreeACManager *_globalTACManager = NULL;
                         list_for_each_entry(_globalTACManager, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
                         {
-                            if (__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Tree||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Two)
+                            if (__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Tree ||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Two )
                             {
                                 if (g_switch_set_t_ac_phchn_reset(&__globalDeviceManage._globalRelaySampManger, _globalTACManager->product_saddr, _globalTACManager->product_ch_addr - 1) < 0)
                                 {
@@ -5353,7 +5362,7 @@ static void equipmentMintenance(void *conn)
         _over_back_sts_info.product_Code = __globalDeviceManage._globalDevInfo.product.pnumber;
        // _over_back_sts_info.product_type = malloc(32);
         //strcpy(_over_back_sts_info.product_type, "GC Series");
-        _over_back_sts_info.product_type=g_product_type_str[__globalDeviceManage._globalDevInfo.product.type];
+        _over_back_sts_info.product_type=g_product_type_str[__globalDeviceManage._globalDevInfo.product.pwr_type];
         _over_back_sts_info.productVersion = __globalDeviceManage._globalDevInfo.product.version;
  
         _over_back_sts_info.product_sysTime = malloc(32);
@@ -5412,7 +5421,7 @@ static void equipmentMintenance(void *conn)
         breaker_info.product_id = __globalDeviceManage._globalDevInfo.product.id;
         breaker_info.product_name = __globalDeviceManage._globalDevInfo.product.name;
         breaker_info.product_number = __globalDeviceManage._globalDevInfo.product.number;
-        breaker_info.product_type = __globalDeviceManage._globalDevInfo.product.type;
+        breaker_info.product_type = __globalDeviceManage._globalDevInfo.product.pwr_type;
         ack_str = over_breaker_product_list_info_to_json(&__globalDeviceManage,&breaker_info,false);
     }else if(strcmp(_Over_equipment_mintenance.type,"listKgTdQuery")==0)
     {

+ 1 - 1
pro/src/sqlite_handle.c

@@ -3079,7 +3079,7 @@ int dev_search_alarm_info(sqlite3* db,
     }
     else
     {
-        sprintf(select_sql, "SELECT* FROM Table_AlarmManage WHERE (alarmType=%d) AND (alarmDate BETWEEN '%s' AND '%s')  LIMIT %d OFFSET %d ;",
+        sprintf(select_sql, "SELECT* FROM Table_AlarmManage WHERE (alarmType=%d) AND (alarmDate BETWEEN '%s' AND '%s')  order by alarmDate desc LIMIT %d OFFSET %d ;",
                 alarm_type,
                 start_time,
                 end_time,