diff --git a/UserClass/AsyncTcpServer.cs b/UserClass/AsyncTcpServer.cs index 2be67a3..dbc2ea5 100644 --- a/UserClass/AsyncTcpServer.cs +++ b/UserClass/AsyncTcpServer.cs @@ -250,7 +250,9 @@ namespace DyeingComputer.UserClass TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入 } - TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接 + TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接 + + client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" +MainWindowViewModel.dt_TP.ToJsonString()); }//插入 else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT") { @@ -293,7 +295,9 @@ namespace DyeingComputer.UserClass TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入 } - TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接 + TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接 + + client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); }//编辑 else if (dat_821.GetValue("INSTRUCTION").ToString() == "DELETE") { @@ -314,6 +318,8 @@ namespace DyeingComputer.UserClass var _TechnologicalProcessView = Application.Current.Windows.Cast().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面 _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView; //转换显示计划表 } + + client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); } client.SendAsync("SC821" + SYSKEY + SYSDAT); } @@ -348,7 +354,6 @@ namespace DyeingComputer.UserClass { if (SYSKEY == MainWindowViewModel.SYSKEY) { - client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" +MainWindowViewModel.dt_TP.ToJsonString()); } else { client.SendAsync("SC999"); } diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs index d0959d5..f898e47 100644 --- a/View/TechnologicalProcessView.xaml.cs +++ b/View/TechnologicalProcessView.xaml.cs @@ -62,7 +62,7 @@ namespace DyeingComputer.View if (sql != null) sql.Clear(); //清空缓存 sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存 Program_Name = SQLiteHelpers.ExecuteScalar("select ProgramName from WorkOrder where ProgramID = '" + workName + "'", null).ToString(); - if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 + if (sql != null) dt_TP = sql.Tables[0]; //转换显示计划表 SQLiteHelpers.Delete("RUN", null, null); //删除run信息 DataTable data_t = new DataTable(); @@ -96,7 +96,7 @@ namespace DyeingComputer.View MainWindowViewModel.WorkNumder = SQLiteHelpers.ExecuteScalar("select DYELOT from RUN where Step = '1'", null).ToString(); SQLiteHelpers.Close(); //关闭连接 - if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 + if (sql != null) dt_TP = sql.Tables[0]; //转换显示计划表 } private void UserControl_Loaded(object sender, RoutedEventArgs e) @@ -162,7 +162,7 @@ namespace DyeingComputer.View dr["Parameter5"] = e.P5; dr.EndEdit(); - Grid.ItemsSource = sql.Tables[0].DefaultView; + dt_TP = sql.Tables[0]; Grid.SelectedIndex = -1; SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 @@ -236,7 +236,7 @@ namespace DyeingComputer.View } SQLiteHelpers.Close(); //关闭连接 - Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 + dt_TP = sql.Tables[0]; //转换显示计划表 } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 7c9e08a..44cc060 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -1896,6 +1896,7 @@ namespace DyeingComputer.ViewModel } public class TechnologicalProcess { + public string ProgramID { get; set; } public string Program { get; set; } public double Step { get; set; } public string StepID { get; set; }