diff --git a/View/TechnologicalProcessView.xaml b/View/TechnologicalProcessView.xaml index 26c185b..bfa7923 100644 --- a/View/TechnologicalProcessView.xaml +++ b/View/TechnologicalProcessView.xaml @@ -62,6 +62,7 @@ + diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs index 4706f2c..d38cc7a 100644 --- a/View/TechnologicalProcessView.xaml.cs +++ b/View/TechnologicalProcessView.xaml.cs @@ -30,6 +30,15 @@ namespace DyeingComputer.View public TechnologicalProcessView() { InitializeComponent(); + FocusManager.SetFocusedElement(Grid, Grid); + if (workName != null) + { + TechnologicalProcess_Import(); + } + else + { + TechnologicalProcess_sql(); + } } public static object workName; @@ -77,6 +86,7 @@ namespace DyeingComputer.View if (sql != null) sql.Clear(); //清空缓存 sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取表写入缓存 name.Text = 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(); //关闭连接 if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 @@ -84,20 +94,15 @@ namespace DyeingComputer.View private void UserControl_Loaded(object sender, RoutedEventArgs e) { - FocusManager.SetFocusedElement(Grid, Grid); + // FocusManager.SetFocusedElement(Grid, Grid); if (workName != null) { - TechnologicalProcess_Import(); - //Grid.SelectedIndex = 0; - //MainWindowViewModel.Process_step = 0; + Grid.SelectedIndex = 0; } else { - TechnologicalProcess_sql(); - // Grid.SelectedIndex = Convert.ToInt16(MainWindowViewModel.Process_step); + if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 } - - if(MainWindowViewModel.WORK_RUN !=0)Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID-1;//设定图表显示 } private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控 @@ -222,6 +227,7 @@ namespace DyeingComputer.View string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0"; private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e) { + if (MainWindowViewModel.WORK_RUN ==2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示 int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 if (rownum != -1)//判断鼠标定位是否有效 {