diff --git a/UserClass/AsyncTcpClient.cs b/UserClass/AsyncTcpClient.cs index fd85b4d..38b3933 100644 --- a/UserClass/AsyncTcpClient.cs +++ b/UserClass/AsyncTcpClient.cs @@ -1,33 +1,34 @@ -using System; +using DyeingComputer.UserClass; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ScottPlot; +using ScottPlot.Colormaps; +using SkiaSharp; +using SunlightCentralizedControlManagement_SCCM_.View; +using SunlightCentralizedControlManagement_SCCM_.ViewModel; +using System; +using System.Collections; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Reflection.Emit; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; +using System.Windows; +using System.Xml.Linq; using TouchSocket.Core; using TouchSocket.Sockets; -using SunlightCentralizedControlManagement_SCCM_.ViewModel; -using System.Runtime.InteropServices; -using ScottPlot.Colormaps; +using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static System.Windows.Forms.AxHost; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; using static System.Windows.Forms.VisualStyles.VisualStyleElement; -using Newtonsoft.Json; -using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; -using SunlightCentralizedControlManagement_SCCM_.View; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; using TcpClient = TouchSocket.Sockets.TcpClient; -using Newtonsoft.Json.Linq; -using System.Xml.Linq; -using ScottPlot; -using System.Collections; -using DyeingComputer.UserClass; -using System.Windows; namespace SunlightCentralizedControlManagement_SCCM_.UserClass {/// @@ -240,7 +241,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass { try { - MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1); + DAT = DAT.Substring(DAT.IndexOf("]") + 1); + MonitorView.Product_DAT = JsonConvert.DeserializeObject(DAT).Copy();//反序列化 + MonitorView.Product_bool=true; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } }//当前领料单信息 diff --git a/View/DyelotView.xaml b/View/DyelotView.xaml index 8135164..1b2a9de 100644 --- a/View/DyelotView.xaml +++ b/View/DyelotView.xaml @@ -63,7 +63,7 @@ - + diff --git a/View/DyelotView.xaml.cs b/View/DyelotView.xaml.cs index ae2b8ec..4125aa3 100644 --- a/View/DyelotView.xaml.cs +++ b/View/DyelotView.xaml.cs @@ -48,7 +48,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View Grid_data.ItemsSource = dat_c.DefaultView; } + public void DyelotDatatable(DataTable dat) + { + Grid_data.ItemsSource = dat.DefaultView; + } - } } diff --git a/View/MonitorView.xaml.cs b/View/MonitorView.xaml.cs index d5f4461..6aad1c2 100644 --- a/View/MonitorView.xaml.cs +++ b/View/MonitorView.xaml.cs @@ -67,7 +67,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View dyelot= MainWindowViewModel.dyelot; machin_LOG.Text = MainWindowViewModel.machin_LOG; IsInteractive = false; - DATA_view(); + DATA_view(); } private string machine; @@ -75,6 +75,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View private string dyelot; private int machines_info=0; public static string Sys_log; + public static DataTable Product_DAT = new DataTable(); + public static bool Product_bool = false; private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表 { @@ -122,7 +124,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View } } - private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e) + private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e)//步骤定位 { TechnologicalProcess_bool = false; int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量 @@ -145,7 +147,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View rdp.Visibility = Visibility.Collapsed; Picture.Visibility = Visibility.Collapsed; }//信息 - private async Task PingTest(string ip) { bool result = false; @@ -210,12 +211,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View return; } + int index = Convert.ToInt16(drEmployee.Field("ID")); + MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString + { + ID = index, + DAT = "SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + }); + machines_info = 2; - log.Visibility = Visibility.Visible; + log.Visibility = Visibility.Collapsed; rdp.Visibility = Visibility.Collapsed; - Picture.Visibility = Visibility.Collapsed; + Picture.Visibility = Visibility.Visible; DyelotView dyelotView = new DyelotView(); - dyelotView.Dyelot(workOrder); + dyelotView.DyelotDatatable(Product_DAT); Picture.Content = dyelotView; }//单据 private void ListViewItem_LOCK_XML(object sender, MouseButtonEventArgs e) @@ -249,7 +257,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information); } }//锁定 - private void ListViewItem_Curve(object sender, MouseButtonEventArgs e) { log.Visibility = Visibility.Collapsed; @@ -258,6 +265,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View Picture.Content = new View.CurveDiagram(true, "", "", "", workOrder); machines_info = 3; }//曲线 + private void ListViewItem_Resume(object sender, MouseButtonEventArgs e) { IsInteractive = false; @@ -356,7 +364,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View TechnologicalProcess_bool = true; } - private void ListViewItem_Jump(object sender, MouseButtonEventArgs e) { Dictionary dat_821 = new Dictionary(); @@ -541,13 +548,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View { }//输送状态 - else if (machines_info == 2) + else if (machines_info == 2 && Product_bool) { - MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString - { - ID = index, - DAT = "SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") - }); + Product_bool = false; + DyelotView dyelotView = new DyelotView(); + dyelotView.DyelotDatatable(Product_DAT); + Picture.Content = dyelotView; }//单据 MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString @@ -626,8 +632,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View technologicalProcess_View = value; RaisePropertyChanged("TechnologicalProcess_View"); } - } - + } public ObservableCollection TechnologicalMachine_View { get { return technologicalMachine_View; }