Bläddra i källkod

revise database bug

chenzk 1 vecka sedan
förälder
incheckning
d657128b27

+ 1 - 2
CyberX8_RT/Devices/Reservoir/StandardHotReservoirDevice.cs

@@ -511,7 +511,6 @@ namespace CyberX8_RT.Devices.Reservoir
             ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);
             _isSystemAutoMode = reservoirEntity.IsAuto;
             //触发水位过高或者过低将reservoir切成error
-
             if (!_reservoirData.LowLevel)
             {
                 if (!errorLogSet.Contains($"{Module}.WaterLevel"))
@@ -583,7 +582,7 @@ namespace CyberX8_RT.Devices.Reservoir
                 if (_isSystemAutoMode && !AlarmListManager.Instance.IsContainDataError(Module, "Level"))
                 {
                     AlarmListManager.Instance.AddDataError(Module,
-                        $"Level", $"Current level:{ReservoirData.Level} is larger than recipe's CA ErrorHigh paramater:{_resRecipe.CALevelErrorHigh}");
+                        $"Level", $"Current level:{ReservoirData.Level} is larger than recipe CA ErrorHigh paramater:{_resRecipe.CALevelErrorHigh}");
                 }
 
             }

+ 8 - 8
Framework/Common/DBCore/AlarmListRecorder.cs

@@ -40,10 +40,10 @@ namespace MECF.Framework.Common.DBCore
                 AlarmList data = new AlarmList();
                 data.ModuleName = ds.Tables[0].Rows[i]["module_name"].ToString();
                 data.ModuleState = ds.Tables[0].Rows[i]["module_state"].ToString();
-                data.ModuleStep=int.Parse(ds.Tables[0].Rows[i]["module_step"].ToString());
+                data.ModuleStep = int.Parse(ds.Tables[0].Rows[i]["module_step"].ToString());
                 data.ModuleCmd = int.Parse(ds.Tables[0].Rows[i]["module_cmd"].ToString());
                 data.AlarmMsg = ds.Tables[0].Rows[i]["alarm_msg"].ToString();
-                data.AlarmType= int.Parse(ds.Tables[0].Rows[i]["alarm_type"].ToString());
+                data.AlarmType = int.Parse(ds.Tables[0].Rows[i]["alarm_type"].ToString());
                 data.DataItem = ds.Tables[0].Rows[i]["data_item"].ToString();
                 data.CreateTime = (DateTime)ds.Tables[0].Rows[i]["create_time"];
                 data.UpdateTime = (DateTime)ds.Tables[0].Rows[i]["update_time"];
@@ -63,14 +63,14 @@ namespace MECF.Framework.Common.DBCore
             string sql = string.Format(@"Insert into alarm_list(module_name,module_state,module_step,module_cmd,alarm_msg,
                     create_time,update_time,alarm_type,data_item)
                 Values('{0}','{1}',{2},{3},'{4}','{5}','{6}',{7},'{8}');",
-            data.ModuleName,data.ModuleState,data.ModuleStep,data.ModuleCmd,data.AlarmMsg, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), 
-            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),data.AlarmType,data.DataItem);
+            data.ModuleName, data.ModuleState, data.ModuleStep, data.ModuleCmd, data.AlarmMsg, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
+            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), data.AlarmType, data.DataItem);
             DB.Insert(sql);
-            string sqlHistory= string.Format(@"Insert into alarm_list_history(module_name,module_state,module_step,module_cmd,alarm_msg,
+            string sqlHistory = string.Format(@"Insert into alarm_list_history(module_name,module_state,module_step,module_cmd,alarm_msg,
                     create_time,update_time,alarm_type,data_item,alarm_operation)
                 Values('{0}','{1}',{2},{3},'{4}','{5}','{6}',{7},'{8}','{9}');",
             data.ModuleName, data.ModuleState, data.ModuleStep, data.ModuleCmd, data.AlarmMsg, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
-            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), data.AlarmType,data.DataItem,ADD_OPERATION);
+            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), data.AlarmType, data.DataItem, ADD_OPERATION);
             DB.Insert(sqlHistory);
         }
 
@@ -99,7 +99,7 @@ namespace MECF.Framework.Common.DBCore
         /// <param name="data"></param>
         public static void RemoveAlarmList(AlarmList data)
         {
-            string sql = string.Format(@"delete from alarm_list where module_name='{0}'", data.ModuleName);
+            string sql = string.Format(@"delete from alarm_list where module_name='{0}' and data_item='{1}'", data.ModuleName, data.DataItem);
             DB.Update(sql);
 
             string sqlHistory = string.Format(@"Insert into alarm_list_history(module_name,module_state,module_step,module_cmd,alarm_msg,
@@ -118,5 +118,5 @@ namespace MECF.Framework.Common.DBCore
             string sql = "delete from alarm_list";
             DB.Update(sql);
         }
-    } 
+    }
 }