sc 11 months ago
parent
commit
0aa48142e9
  1. 17
      UserClass/AsyncTcpServer.cs

17
UserClass/AsyncTcpServer.cs

@ -194,13 +194,13 @@ namespace DyeingComputer.UserClass
} }
else if (dat_821.GetValue("INSTRUCTION").ToString() == "INSERT") else if (dat_821.GetValue("INSTRUCTION").ToString() == "INSERT")
{ {
int d = Convert.ToInt16( dat_821.GetValue("ID")); int d = Convert.ToInt16(dat_821.GetValue("ID"));
TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径 TechnologicalProcessView.SQLiteHelpers = new SQLiteHelper(TechnologicalProcessView.DBAddress); //数据库连接路径
TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库 TechnologicalProcessView.SQLiteHelpers.Open(); //打开数据库
/**插入行**/ /**插入行**/
string ProgramID = TechnologicalProcessView.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString(); 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(); 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();//添加表数据 DataRow dr = TechnologicalProcessView.sql.Tables[0].NewRow();//添加表数据
dr["ProgramID"] = ProgramID; dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME; dr["Program"] = ProgramNAME;
@ -230,8 +230,8 @@ namespace DyeingComputer.UserClass
drtt["DYELOT"] = MainWindowViewModel.WorkNumder; drtt["DYELOT"] = MainWindowViewModel.WorkNumder;
drtt.EndEdit(); drtt.EndEdit();
// var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面 // var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView; // _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
//_TechnologicalProcessView.Grid.SelectedIndex = -1; //_TechnologicalProcessView.Grid.SelectedIndex = -1;
/**存入信息**/ /**存入信息**/
TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null); TechnologicalProcessView.SQLiteHelpers.Delete("RUN", null, null);
@ -251,8 +251,8 @@ namespace DyeingComputer.UserClass
TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入 TechnologicalProcessView.SQLiteHelpers.InsertData("RUN", TechnologicalProcessView.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接 TechnologicalProcessView.SQLiteHelpers.Close(); //关闭连接
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" +MainWindowViewModel.dt_TP.ToJsonString()); client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
}//插入 }//插入
else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT") else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT")
{ {
@ -321,7 +321,10 @@ namespace DyeingComputer.UserClass
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
} }
client.SendAsync("SC821" + SYSKEY + SYSDAT); else
{
client.SendAsync("SC821" + SYSKEY + SYSDAT);
}
} }
catch { client.SendAsync("SC921"); } catch { client.SendAsync("SC921"); }
} }

Loading…
Cancel
Save