diff --git a/View/TechnologicalProcessView.xaml.cs b/View/TechnologicalProcessView.xaml.cs index 48cb828..457e7d8 100644 --- a/View/TechnologicalProcessView.xaml.cs +++ b/View/TechnologicalProcessView.xaml.cs @@ -138,6 +138,7 @@ namespace DyeingComputer.View SQLiteHelpers.Open(); //打开数据库 SQLiteHelpers.Delete("RUN", null, null); DataTable data_t = new DataTable(); + data_t.Columns.Add("DYELOT", typeof(string)); //添加列 data_t = sql.Tables[0].Clone(); int a = sql.Tables[0].Rows.Count; for (int i = 0; i < a; i++) @@ -148,8 +149,11 @@ namespace DyeingComputer.View DataRow drT = data_t.NewRow(); drT.ItemArray = dt.ItemArray; data_t.Rows.InsertAt(drT, 0); + dr.BeginEdit(); //添加订单号 + dr["DYELOT"] = MainWindowViewModel.WorkNumder; + dr.EndEdit(); - SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入 + SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入 } SQLiteHelpers.Close(); //关闭连接 @@ -183,11 +187,19 @@ namespace DyeingComputer.View private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e) { int d = 0; + SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 + SQLiteHelpers.Open(); //打开数据库 + + string ProgramID = SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString(); + string ProgramNAME = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString(); + + SQLiteHelpers.Close(); if (ID != null) { d = StrToInt.To16Convert10(ID); } else { return; } - DataRow dr = sql.Tables[0].NewRow();//添加表数据 - // dr["ProgramID"] = ProgramID; - // dr["Program"] = ProgramNAME; + DataRow dr = sql.Tables[0].NewRow();//添加表数据 + dr["ProgramID"] = ProgramID; + dr["Program"] = ProgramNAME; + sql.Tables[0].Rows.InsertAt(dr, d - 1); ID = null;