|
|
@ -197,15 +197,15 @@ namespace DyeingComputer.UserClass |
|
|
|
int d = Convert.ToInt16( dat_821.GetValue("ID")); |
|
|
|
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
|
|
|
|
|
|
|
|
/**插入行**/ |
|
|
|
string ProgramID = TechnologicalProcessView.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString(); |
|
|
|
string ProgramNAME = TechnologicalProcessView.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString(); |
|
|
|
TechnologicalProcessView.SQLiteHelpers.Close(); |
|
|
|
// TechnologicalProcessView.SQLiteHelpers.Close();
|
|
|
|
DataRow dr = TechnologicalProcessView.sql.Tables[0].NewRow();//添加表数据
|
|
|
|
dr["ProgramID"] = ProgramID; |
|
|
|
dr["Program"] = ProgramNAME; |
|
|
|
TechnologicalProcessView.sql.Tables[0].Rows.InsertAt(dr, d - 1); |
|
|
|
|
|
|
|
/**编辑行号**/ |
|
|
|
int a = TechnologicalProcessView.sql.Tables[0].Rows.Count; |
|
|
|
for (int i = 0; i < a; i++) |
|
|
|
{ |
|
|
@ -214,7 +214,7 @@ namespace DyeingComputer.UserClass |
|
|
|
drt["Step"] = i + 1; |
|
|
|
drt.EndEdit(); |
|
|
|
} |
|
|
|
|
|
|
|
/**编辑行信息**/ |
|
|
|
DataRow drtt = TechnologicalProcessView.sql.Tables[0].Rows[d - 1]; |
|
|
|
drtt.BeginEdit(); |
|
|
|
drtt["StepID"] = dat_821.GetValue("STEPID").ToString(); |
|
|
@ -230,14 +230,12 @@ namespace DyeingComputer.UserClass |
|
|
|
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
|
|
|
_TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView; |
|
|
|
_TechnologicalProcessView.Grid.SelectedIndex = -1; |
|
|
|
|
|
|
|
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
|
|
|
|
/**存入信息**/ |
|
|
|
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null); |
|
|
|
DataTable data_t = new DataTable(); |
|
|
|
data_t.Columns.Add("DYELOT", typeof(string)); //添加列
|
|
|
|
data_t = TechnologicalProcessView.sql.Tables[0].Clone(); |
|
|
|
int a = TechnologicalProcessView.sql.Tables[0].Rows.Count; |
|
|
|
a = TechnologicalProcessView.sql.Tables[0].Rows.Count; |
|
|
|
for (int i = 0; i < a; i++) |
|
|
|
{ |
|
|
|
data_t.Clear();//清空
|
|
|
@ -246,19 +244,18 @@ namespace DyeingComputer.UserClass |
|
|
|
DataRow drT = data_t.NewRow(); |
|
|
|
drT.ItemArray = dt.ItemArray; |
|
|
|
data_t.Rows.InsertAt(drT, 0); |
|
|
|
dr.BeginEdit(); //添加订单号
|
|
|
|
dr["DYELOT"] = MainWindowViewModel.WorkNumder; |
|
|
|
dr.EndEdit(); |
|
|
|
drT.BeginEdit(); //添加订单号
|
|
|
|
drT["DYELOT"] = MainWindowViewModel.WorkNumder; |
|
|
|
drT.EndEdit(); |
|
|
|
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
|
|
|
} |
|
|
|
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接
|
|
|
|
}//插入
|
|
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT") |
|
|
|
{ |
|
|
|
int n = Convert.ToInt16(dat_821.GetValue("ID").ToString()); |
|
|
|
|
|
|
|
/**编辑行信息**/ |
|
|
|
DataRow dr = TechnologicalProcessView.sql.Tables[0].Rows[n - 1]; |
|
|
|
dr.BeginEdit(); |
|
|
|
dr["StepID"] = dat_821.GetValue("STEPID").ToString(); |
|
|
@ -274,7 +271,7 @@ namespace DyeingComputer.UserClass |
|
|
|
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
|
|
|
_TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView; |
|
|
|
_TechnologicalProcessView.Grid.SelectedIndex = -1; |
|
|
|
|
|
|
|
/**存入信息**/ |
|
|
|
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null); |
|
|
@ -290,13 +287,12 @@ namespace DyeingComputer.UserClass |
|
|
|
DataRow drT = data_t.NewRow(); |
|
|
|
drT.ItemArray = dt.ItemArray; |
|
|
|
data_t.Rows.InsertAt(drT, 0); |
|
|
|
dr.BeginEdit(); //添加订单号
|
|
|
|
dr["DYELOT"] = MainWindowViewModel.WorkNumder; |
|
|
|
dr.EndEdit(); |
|
|
|
drT.BeginEdit(); //添加订单号
|
|
|
|
drT["DYELOT"] = MainWindowViewModel.WorkNumder; |
|
|
|
drT.EndEdit(); |
|
|
|
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
|
|
|
} |
|
|
|
|
|
|
|
TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接
|
|
|
|
}//编辑
|
|
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "DELETE") |
|
|
|