diff --git a/Login.xaml.cs b/Login.xaml.cs index a27d27f..bc34d3b 100644 --- a/Login.xaml.cs +++ b/Login.xaml.cs @@ -1,4 +1,5 @@ -using SunlightCentralizedControlManagement_SCCM_.ViewModel; +using SunlightCentralizedControlManagement_SCCM_.UserClass; +using SunlightCentralizedControlManagement_SCCM_.ViewModel; using System; using System.Data; using System.Data.SqlClient; @@ -82,9 +83,10 @@ namespace SunlightCentralizedControlManagement_SCCM_ } } } - catch (Exception) + catch (Exception ex) { - System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error); + LogGing.ERRDATA(ex); + System.Windows.MessageBox.Show("Unable to start. Check the log for details.", "SCCM", MessageBoxButton.OK, MessageBoxImage.Error); } } diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 9a03eb3..fab7b15 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -32,7 +32,9 @@ namespace SunlightCentralizedControlManagement_SCCM_ { public static string user_; public static DataTable InfData = new DataTable(); + // public static string[] Inf_string ; public UserInformation userInformation; + // public UserInf userInf; public MainWindow() { @@ -74,6 +76,22 @@ namespace SunlightCentralizedControlManagement_SCCM_ if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal; } } + /* private void UserInfTable(string dat)//触发行改变事件 + { + userInf.Inf_DAT = dat; + if (userInf == null || !userInf.IsLoaded)//窗口不存在及创建 + { + userInf = new UserInf(); + userInf.Topmost = true; + userInf.Show(); + userInf.Activate(); + } + else + {//窗口纯在及置顶 + userInf.Activate(); + if (userInf.WindowState == WindowState.Minimized) userInf.WindowState = WindowState.Normal; + } + }*/ private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e) { diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 03deb17..451a7ee 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -1284,6 +1284,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties { } } + /// + /// 查找类似 Machines 的本地化字符串。 + /// + public static string Machines { + get { + return ResourceManager.GetString("Machines", resourceCulture); + } + } + /// /// 查找类似 Malfunction 的本地化字符串。 /// @@ -2004,6 +2013,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties { } } + /// + /// 查找类似 ProgramName 的本地化字符串。 + /// + public static string ProgramName { + get { + return ResourceManager.GetString("ProgramName", resourceCulture); + } + } + /// /// 查找类似 ProportionalValves 的本地化字符串。 /// diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx index baabba5..7692e38 100644 --- a/Properties/Resources.en-US.resx +++ b/Properties/Resources.en-US.resx @@ -1086,4 +1086,10 @@ Start + + Program Name + + + Machines + \ No newline at end of file diff --git a/Properties/Resources.resx b/Properties/Resources.resx index ca9ef7d..fb7d2b5 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -1086,4 +1086,10 @@ Start + + ProgramName + + + Machines + \ No newline at end of file diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx index ce4a1ee..25d49c6 100644 --- a/Properties/Resources.zh-CN.resx +++ b/Properties/Resources.zh-CN.resx @@ -1086,4 +1086,10 @@ 开始 + + 工艺名 + + + 机台 + \ No newline at end of file diff --git a/Properties/Resources.zh-TW.resx b/Properties/Resources.zh-TW.resx index fabc61b..72c59eb 100644 --- a/Properties/Resources.zh-TW.resx +++ b/Properties/Resources.zh-TW.resx @@ -1084,6 +1084,12 @@ 擺佈 - + 開始 + + + 工藝名 + + + 機器 \ No newline at end of file diff --git a/SunlightCentralizedControlManagement_SCCM_.csproj b/SunlightCentralizedControlManagement_SCCM_.csproj index f223b4a..0f1999d 100644 --- a/SunlightCentralizedControlManagement_SCCM_.csproj +++ b/SunlightCentralizedControlManagement_SCCM_.csproj @@ -153,6 +153,9 @@ DispenseMacInfo.xaml + + UserWorkOrder.xaml + UserInf.xaml @@ -295,6 +298,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/UserClass/AsyncTcpClient.cs b/UserClass/AsyncTcpClient.cs index 7527225..395a360 100644 --- a/UserClass/AsyncTcpClient.cs +++ b/UserClass/AsyncTcpClient.cs @@ -6,6 +6,7 @@ using ScottPlot.Colormaps; using SkiaSharp; using SunlightCentralizedControlManagement_SCCM_.View; using SunlightCentralizedControlManagement_SCCM_.ViewModel; +using SunlightCentralizedControlManagement_SCCM_.WindowsView; using System; using System.Collections; using System.Collections.Generic; @@ -22,10 +23,11 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; +using System.Windows.Documents; using System.Xml.Linq; using TouchSocket.Core; -using TouchSocket.Sockets; using TouchSocket.SerialPorts; +using TouchSocket.Sockets; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView; using static System.Windows.Forms.AxHost; @@ -181,8 +183,26 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass { DAT = DAT.Substring(DAT.IndexOf("]") + 1); DataTable dataTable = JsonConvert.DeserializeObject(DAT).Copy();//反序列化 + Application.Current.Dispatcher.Invoke(() => + { + UserWorkOrder userWorkOrder = new UserWorkOrder(); + userWorkOrder.WorkOrderTable = dataTable; + userWorkOrder.Show(); + }); + } + catch (Exception) + { + Application.Current.Dispatcher.Invoke(() => + { + UserInf userInf = new UserInf(); + userInf.Inf_DAT = "没有等待中的工艺"; + userInf.Show(); + userInf.Activate(); + }); + + // LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); + MainWindowViewModel.ERR_c++; } - catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } } else if (SYSAPI == "SC827") { @@ -381,6 +401,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } }//细节错误 + else if (SYSAPI == "SC921") + { + try + { + DAT = DAT.Substring(DAT.IndexOf("]") + 1); + } + catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } + }//错误 else if (SYSAPI == "SC980") { DAT = DAT.Substring(DAT.IndexOf("]") + 1); diff --git a/View/MachinesSet.xaml.cs b/View/MachinesSet.xaml.cs index 7000630..91ea1e5 100644 --- a/View/MachinesSet.xaml.cs +++ b/View/MachinesSet.xaml.cs @@ -84,7 +84,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View dat_["IP"] = IP.Text; dat_["PORT"] = PORT.Text; dat_["Serial"] = comboBoxCOM0.Text; - dat_["Type"] = comboBoxtype.Text; dat_["Model"] = comboBoxtype.Text; dat_["Station"] = Station.Text; dat_["ID"] = 999; diff --git a/View/MonitorView.xaml.cs b/View/MonitorView.xaml.cs index 5a5a675..cb745f0 100644 --- a/View/MonitorView.xaml.cs +++ b/View/MonitorView.xaml.cs @@ -232,7 +232,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View { if (!string.IsNullOrEmpty(machine)) { - + DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); + int index = Convert.ToInt16(drEmployee.Field("ID")); + MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString + { + ID = index, + DAT = "SC822" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + }); } }//开始 private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e) diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index a8262af..9e46afb 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -94,7 +94,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel public static int ERR_c = 0;//错误计数器 public bool UPort1, UPort2, UPort3; public static bool[] USER_Capacity { set; get; } = new bool[99]; - + public MainWindowViewModel() { try @@ -108,19 +108,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel SN_KEY = Configini.IniReadvalue("SN", "SN1"); DyelotsDispenser = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser")); - SQLiteChartAdress = new SQLiteHelper(ChartAdress); //数据库连接路径 - SQLiteChartAdress.Open(); //打开数据库 - SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 - SQLiteHelpers.Open(); //打开数据库 - Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 - USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0]; - Dyelot_CALL = SQLiteHelpers.ExecuteDataSet("select * from Dyelot", null).Tables[0].Clone(); + SQLiteChartAdress = new SQLiteHelper(ChartAdress); //数据库连接路径 + SQLiteChartAdress.Open(); //打开数据库 + SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 + SQLiteHelpers.Open(); //打开数据库 + Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 + USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0]; + Dyelot_CALL = SQLiteHelpers.ExecuteDataSet("select * from Dyelot", null).Tables[0].Clone(); Whole_dat.Columns.Add("Machine", Type.GetType("System.String")); - Whole_dat.Columns.Add("DateTime", Type.GetType("System.DateTime")); - Whole_dat.Columns.Add("DAT", Type.GetType("System.Double")); - } - catch (Exception ex) { LogGing.ERRDATA(ex); + Whole_dat.Columns.Add("DateTime", Type.GetType("System.DateTime")); + Whole_dat.Columns.Add("DAT", Type.GetType("System.Double")); + } + catch (Exception ex) + { + LogGing.ERRDATA(ex); } USERCapacity(App.USER_Purview);//App.USER_Purview); diff --git a/WindowsView/UserWorkOrder.xaml b/WindowsView/UserWorkOrder.xaml new file mode 100644 index 0000000..c05f8ba --- /dev/null +++ b/WindowsView/UserWorkOrder.xaml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +