diff --git a/View/WorkOrderView.xaml.cs b/View/WorkOrderView.xaml.cs index 27346c7..36c4d13 100644 --- a/View/WorkOrderView.xaml.cs +++ b/View/WorkOrderView.xaml.cs @@ -156,10 +156,10 @@ namespace DyeingComputer.View SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 string sql_script = "select * from ProgramName where ProgramID = '" + Process_id + "'"; - int i = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0].Rows.Count; //读取计划表写入缓存 + int i = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0].Rows.Count; //读取工艺表返回0工艺不存在 SQLiteHelpers.Close(); //关闭连接 - if(i == 0) + if(i == 0) //工艺不存在提示 { WorkOrder_Numder = null; Process_id = null; @@ -172,11 +172,14 @@ namespace DyeingComputer.View { if (e.Key == Key.K) { - MainWindowViewModel.WorkNumder = WorkOrder_Numder; - TechnologicalProcessView.workName = Process_id; + if (Process_id != null) + { + MainWindowViewModel.WorkNumder = WorkOrder_Numder; + TechnologicalProcessView.workName = Process_id; - var _mainWindow = Application.Current.Windows .Cast() .FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面 - _mainWindow.container.Content = new TechnologicalProcessView();//获取控件 + var _mainWindow = Application.Current.Windows.Cast().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面 + _mainWindow.container.Content = new TechnologicalProcessView();//获取控件 + } } } }