diff --git a/UserClass/AsyncTcpServer.cs b/UserClass/AsyncTcpServer.cs index f89aea0..3c6204a 100644 --- a/UserClass/AsyncTcpServer.cs +++ b/UserClass/AsyncTcpServer.cs @@ -339,6 +339,8 @@ namespace DyeingComputer.UserClass Chart_new.Add("Machine", MainWindowViewModel.S01); Chart_new.Add("WorkNumder", MainWindowViewModel.WorkNumder); Chart_new.Add("Time", MainWindowViewModel.SYSTime); + Chart_new.Add("Process", MainWindowViewModel.ProgramName); + Chart_new.Add("Step", MainWindowViewModel.Process_step); Chart_new.Add("MST", MainWindowViewModel.TEMP_co); Chart_new.Add("MTT", MainWindowViewModel.Selet_dtm("1010")); Chart_new.Add("MTL", MainWindowViewModel.Selet_dtm("1015")); diff --git a/UserClass/SQLDATA.cs b/UserClass/SQLDATA.cs index 06edd9f..100d78c 100644 --- a/UserClass/SQLDATA.cs +++ b/UserClass/SQLDATA.cs @@ -81,7 +81,7 @@ namespace DyeingComputer.UserClass string sql_script = "select * from WorkorderSteps where ProgramID = '" + workName + "'"; if (TechnologicalProcessView.sql != null) TechnologicalProcessView.sql.Clear(); //清空缓存 TechnologicalProcessView.sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存 - TechnologicalProcessView.Program_Name = SQLiteHelpers.ExecuteScalar("select ProgramName from Workorder where ProgramID = '" + workName + "'", null).ToString(); + MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select ProgramName from Workorder where ProgramID = '" + workName + "'", null).ToString(); SQLiteHelpers.Delete("RUN", null, null); //删除run信息 DataTable data_t = new DataTable(); diff --git a/View/TechnologicalProcessView.xaml b/View/TechnologicalProcessView.xaml index b9471aa..4e8d83c 100644 --- a/View/TechnologicalProcessView.xaml +++ b/View/TechnologicalProcessView.xaml @@ -69,7 +69,7 @@ - + diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs index f898e47..426459e 100644 --- a/View/TechnologicalProcessView.xaml.cs +++ b/View/TechnologicalProcessView.xaml.cs @@ -49,7 +49,6 @@ namespace DyeingComputer.View } public static object workName; - public static string Program_Name; public static SQLiteHelper SQLiteHelpers = null; //定义数据库 public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径 public static DataSet sql; //内存数据缓存 @@ -61,7 +60,7 @@ namespace DyeingComputer.View string sql_script = "select * from WorkorderSteps where ProgramID = '" + workName + "'"; if (sql != null) sql.Clear(); //清空缓存 sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存 - Program_Name = SQLiteHelpers.ExecuteScalar("select ProgramName from WorkOrder where ProgramID = '" + workName + "'", null).ToString(); + MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select ProgramName from WorkOrder where ProgramID = '" + workName + "'", null).ToString(); if (sql != null) dt_TP = sql.Tables[0]; //转换显示计划表 SQLiteHelpers.Delete("RUN", null, null); //删除run信息 @@ -92,7 +91,7 @@ namespace DyeingComputer.View string sql_script = "select * from RUN"; if (sql != null) sql.Clear(); //清空缓存 sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存 - Program_Name = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString(); + MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString(); MainWindowViewModel.WorkNumder = SQLiteHelpers.ExecuteScalar("select DYELOT from RUN where Step = '1'", null).ToString(); SQLiteHelpers.Close(); //关闭连接 @@ -319,7 +318,7 @@ namespace DyeingComputer.View // MainWindowViewModel.TechnologicalProcess_View = MainWindowViewModel.ToObservableCollection(sql.Tables[0]); // Grid.ItemsSource = dt_m.DE sql.Tables[0].DefaultView; //转换显示计划表 - name.Text = Program_Name; + // name.Text = Program_Name; } } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 44cc060..b91a2a3 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -211,13 +211,20 @@ namespace DyeingComputer.ViewModel get { return sys_log; } set { sys_log = value; OnPropertyChanged("Sys_log"); } } + public string program_Name; + public string Program_Name //通知UI控件参数改变 + { + get { return program_Name; } + set { program_Name = value; OnPropertyChanged("Program_Name"); } + } public static int ViewID = 0;//页面id public static object Name_err = ""; public static object SYSTime; public static object WorkNumder; public static object StatusStr; - public static object Process_step; + public static object Process_step = "-----"; + public static string ProgramName = "-----";//工艺名 public static Int32 DIDETime; //空闲计时器 bool ERR_JOG;//故障状态 public void CountDown() @@ -251,6 +258,8 @@ namespace DyeingComputer.ViewModel Work_Temp = Selet_dtm("1010") + " ℃"; Work_Numder = WorkNumder.ToString(); StatusStr = Status_Str; + Program_Name = ProgramName; + if(dt_TP==null) Process_step = dt_TP.Select("Step=" + RUN_STEPID).First().Field("ParameterName"); if (!SETP_runtime) DIDETime++;