diff --git a/UserClass/APILog.cs b/UserClass/APILog.cs index 37bbd6e..1f85515 100644 --- a/UserClass/APILog.cs +++ b/UserClass/APILog.cs @@ -70,6 +70,16 @@ namespace DyeingComputer.UserClass LOGDB("IOLog", API_LOG);//行插入 API_LOG.Clear(); } + public static void ERRlog(string WorkOrder, string ERRID, string MESSAGE, string Time) + { + Dictionary API_LOG = new Dictionary();//缓存函数 + API_LOG.Add("NAME", WorkOrder); + API_LOG.Add("ERRID", ERRID); + API_LOG.Add("MESSAGE", MESSAGE); + API_LOG.Add("TIME", Time); + LOGDB("ERRLog", API_LOG);//行插入 + API_LOG.Clear(); + } public static void LOGDB(string NAME, Dictionary dat)//添加信息到队列 { diff --git a/UserClass/ERRinf.cs b/UserClass/ERRinf.cs index 953d7dd..e70af9b 100644 --- a/UserClass/ERRinf.cs +++ b/UserClass/ERRinf.cs @@ -23,6 +23,7 @@ namespace DyeingComputer.UserClass if (i == 0) { dataTable.Rows.Add(ID,dat, DateTime.Now.ToString("yyMMddHHmmss")); + APILog.ERRlog(MainWindowViewModel.WorkNumder.ToString(),ID,dat, DateTime.Now.ToString("yy_MM_dd_HH:mm:ss")); } } public static void ERRinf_d(DataTable dataTable, string dat)//删除 @@ -33,9 +34,12 @@ namespace DyeingComputer.UserClass dataTable.Rows.Remove(dataTable.Select("ID='" + dat + "'").First()); } } + + public static int i=0; public static string ERRinf_r(DataTable dataTable)//读取 { - string index = dataTable.Rows[0].Field("INF"); + if (i >= dataTable.Rows.Count) { i = 0; } else { i++; } + string index = dataTable.Rows[i].Field("INF"); return index; } } diff --git a/View/TechnologicalProcessView.xaml b/View/TechnologicalProcessView.xaml index a711d5c..2964918 100644 --- a/View/TechnologicalProcessView.xaml +++ b/View/TechnologicalProcessView.xaml @@ -90,7 +90,7 @@ - =10) { timer5s_ = 0; Tick_Event_5S(); } if (LINK_OK) IO_data(); - } void Chart() @@ -841,7 +838,7 @@ namespace DyeingComputer.ViewModel } else if (THL_mode == 1)//升温 { - if (STEP_P1 > TEMP_co) TEMP_co = TEMP_co + (STEP_P2 / 600); + if (STEP_P1 > TEMP_co) TEMP_co = TEMP_co + (STEP_P2 / 60); TO = pid.PID_iterate(TEMP_co, T, ts); if (TO < 0) TO = 0; if ((TEMP_co < T) || (T - TEMP_co > 3)) TO = 0; @@ -852,24 +849,25 @@ namespace DyeingComputer.ViewModel } else { - TIME_M = Convert.ToInt16((STEP_P1 - T) / (STEP_P2 / 10)); + TIME_M = Convert.ToInt16((STEP_P1 - T) / STEP_P2 ); } if (errTabler.Rows.Count == 0) { Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; if ((TEMP_co - T) > 5) { - Status_Str = Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]"; + ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]", "201-1");//写入 } else { + ERRinf.ERRinf_d(errTabler, "201-1");// Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; } } } else if (THL_mode == 2)//降温 { - if (STEP_P1 < TEMP_co) TEMP_co = TEMP_co - (STEP_P2 / 600); + if (STEP_P1 < TEMP_co) TEMP_co = TEMP_co - (STEP_P2 / 60); TO = pid.PID_iterate(TEMP_co, T, ts); if (TO > 0) TO = 0; TO = Math.Abs(TO); @@ -880,17 +878,18 @@ namespace DyeingComputer.ViewModel } else { - TIME_M = Convert.ToInt16((T - STEP_P1) / (STEP_P2 / 10)); + TIME_M = Convert.ToInt16((T - STEP_P1) / STEP_P2 ); } if (errTabler.Rows.Count == 0) { Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; if ((T - TEMP_co) > 5) { - Status_Str = Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]"; + ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]", "201-2");//写入 } else { + ERRinf.ERRinf_d(errTabler, "201-2");// Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min; } } @@ -1571,8 +1570,6 @@ namespace DyeingComputer.ViewModel } else if (WORK_RUN == 1) { - SETP_runtime = false; - STEP_finish = false; Status_Str = Resources.Paused; Updata_dtm("1004", 0); Updata_dtd("3009", false);