Browse Source

设备连线逻辑修改

master
sc 3 weeks ago
parent
commit
61dbaa3c33
  1. 4
      UserClass/AsyncTcpClient.cs
  2. 1
      View/MachinesSet.xaml
  3. 99
      View/MachinesSet.xaml.cs
  4. 9
      View/MonitorView.xaml
  5. 11
      View/MonitorView.xaml.cs
  6. 7
      ViewModel/CurveDiagramViewModel.cs

4
UserClass/AsyncTcpClient.cs

@ -251,8 +251,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder")); Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
Chart_new.Add("Machine", _new.GetValue("Machine")); Chart_new.Add("Machine", drEmployee["Name"]);
Chart_new.Add("Time", _new.GetValue("Time")); Chart_new.Add("Time", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
Chart_new.Add("MST", _new.GetValue("MST")); Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT")); Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL")); Chart_new.Add("MTL", _new.GetValue("MTL"));

1
View/MachinesSet.xaml

@ -65,6 +65,7 @@
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Model}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>

99
View/MachinesSet.xaml.cs

@ -36,14 +36,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
// 获取所有可用串口端口,并添加到comboBoxCOM // 获取所有可用串口端口,并添加到comboBoxCOM
// string[] ports = System.IO.Ports.SerialPort.GetPortNames(); // string[] ports = System.IO.Ports.SerialPort.GetPortNames();
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
comboBoxCOM0.ItemsSource = ports; comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台 comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
string[] type_ = { "828", "838" };
comboBoxtype.ItemsSource = type_; comboBoxtype.ItemsSource = type_;
} }
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
string[] type_ = { "828", "838" };
string link_model = "838" ;
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
//private string SYS_machines = null; //private string SYS_machines = null;
int ID_; int ID_;
@ -70,6 +71,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void Save_Click(object sender, RoutedEventArgs e) private void Save_Click(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(Station.Text)) Station.Text = "255";
if (!string.IsNullOrEmpty(comboBoxMachine.Text)) if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{ {
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
@ -83,6 +85,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_["PORT"] = PORT.Text; dat_["PORT"] = PORT.Text;
dat_["Serial"] = comboBoxCOM0.Text; dat_["Serial"] = comboBoxCOM0.Text;
dat_["Type"] = comboBoxtype.Text; dat_["Type"] = comboBoxtype.Text;
dat_["Model"] = comboBoxtype.Text;
dat_["Station"] = Station.Text; dat_["Station"] = Station.Text;
dat_["ID"] = 999; dat_["ID"] = 999;
dat_["ERR"] = false; dat_["ERR"] = false;
@ -94,9 +97,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_["WaterLevel"] = 0; dat_["WaterLevel"] = 0;
dat_["WORK_RUN"] = -1; dat_["WORK_RUN"] = -1;
dat_["UserInfoStart"] = 900; dat_["UserInfoStart"] = 900;
if (comboBoxtype.Text == "838") if (comboBoxtype.Text.Contains( link_model))
{ dat_["Desktop"] = true; } {
else { dat_["Desktop"] = false; } dat_["Desktop"] = true;
dat_["Type"] = true;
}
else
{
dat_["Desktop"] = false;
dat_["Type"] = false;
}
dat_.EndEdit(); dat_.EndEdit();
MainWindowViewModel.Machines.Rows.Add(dat_); MainWindowViewModel.Machines.Rows.Add(dat_);
DatSteps(MainWindowViewModel.Machines); DatSteps(MainWindowViewModel.Machines);
@ -113,6 +123,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]); Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]); Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]); Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear(); Machines_DAT.Clear();
} }
@ -126,18 +137,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr["IP"] = IP.Text; dr["IP"] = IP.Text;
dr["PORT"] = PORT.Text; dr["PORT"] = PORT.Text;
dr["Serial"] = comboBoxCOM0.Text; dr["Serial"] = comboBoxCOM0.Text;
dr["Type"] = comboBoxtype.Text; dr["Model"] = comboBoxtype.Text;
dr["Station"] = Station.Text; dr["Station"] = Station.Text;
dr["ID"] = 999; if (comboBoxtype.Text.Contains(link_model))
dr["ERR"] = false; { dr["Desktop"] = true;
dr["AUTO"] = false; dr["Type"] = true; }
dr["CALL"] = false; else
dr["LOCK"] = false; {
dr["State"] = 800; dr["Desktop"] = false;
dr["Temperature"] = 0; dr["Type"] = false;
dr["WaterLevel"] = 0; }
dr["WORK_RUN"] = -1;
dr["UserInfoStart"] = 900;
dr.EndEdit(); dr.EndEdit();
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);// MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++) for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
@ -152,6 +161,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]); Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]); Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]); Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
Machines_DAT.Add("LOCK", "FALSE"); Machines_DAT.Add("LOCK", "FALSE");
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear(); Machines_DAT.Clear();
@ -224,21 +234,29 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮 private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
{ {
if (comboBoxtype.Text == "828")
{ if (comboBoxtype.Text.Contains(link_model))
if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text)) {//网络
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
{ {
textlog.Text = "TEST"; textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------ //------------使用ping类------
string host = IP.Text; string host = IP.Text;
try
{
Ping p1 = new Ping(); Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址 PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder; //StringBuilder sbuilder;
if (reply.Status == IPStatus.Success) if (reply.Status == IPStatus.Success)
{ {
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//连接服务器,绑定IP 与 端口
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
try try
{ {
socket.Connect(iPEndPoint);
socket.Close();//离线
textlog.Text = "Link succeed"; textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
} }
@ -248,11 +266,26 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
} }
} }
else if (reply.Status == IPStatus.TimedOut)
{
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else else
{ {
textlog.Text = "No links"; textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
}
catch (Exception)
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else if (!string.IsNullOrEmpty(comboBoxCOM0.Text))
{
} }
else else
{ {
@ -261,28 +294,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
} }
else if (comboBoxtype.Text == "838") else
{ {//串口
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text)) if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
{ {
textlog.Text = "TEST"; textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------ //------------使用ping类------
string host = IP.Text; string host = IP.Text;
try
{
Ping p1 = new Ping(); Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址 PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder; //StringBuilder sbuilder;
if (reply.Status == IPStatus.Success) if (reply.Status == IPStatus.Success)
{ {
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//连接服务器,绑定IP 与 端口
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
try try
{ {
socket.Connect(iPEndPoint);
socket.Close();//离线
textlog.Text = "Link succeed"; textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
} }
@ -292,26 +318,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
} }
} }
else if (reply.Status == IPStatus.TimedOut)
{
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else else
{ {
textlog.Text = "No links"; textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
}
catch (Exception)
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else if (!string.IsNullOrEmpty(comboBoxCOM0.Text))
{
} }
else else
{ {

9
View/MonitorView.xaml

@ -35,11 +35,12 @@
<RowDefinition Height="60"/> <RowDefinition Height="60"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" <DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
SelectionChanged="Griddata_SelectionChanged" SelectionChanged="Griddata_SelectionChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" > CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
@ -171,6 +172,8 @@
<ColumnDefinition MinWidth="1200"/> <ColumnDefinition MinWidth="1200"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged" <DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
@ -309,10 +312,10 @@
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/> <TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
<Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" > <Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
<rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" /> <rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
<ContentControl x:Name="Picture" Background="White"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly"> <ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/> <TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
</ScrollViewer> </ScrollViewer>
<ContentControl x:Name="Picture" Background="White"/>
</Grid> </Grid>
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/> <GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
</Grid> </Grid>

11
View/MonitorView.xaml.cs

@ -80,6 +80,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表 private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
{ {
if (rdp.IsConnected) rdp.Disconnect();
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
string mac_s = "800"; string mac_s = "800";
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
@ -141,6 +142,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e) private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e)
{ {
if (rdp.IsConnected)rdp.Disconnect();
machines_info = 0; machines_info = 0;
log.Visibility = Visibility.Visible; log.Visibility = Visibility.Visible;
rdp.Visibility = Visibility.Collapsed; rdp.Visibility = Visibility.Collapsed;
@ -166,7 +168,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
return result; return result;
} }
private async void ListViewItem_Screen(object sender, MouseButtonEventArgs e) private void ListViewItem_Screen(object sender, MouseButtonEventArgs e)
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
string host = drEmployee.Field<string>("IP"); string host = drEmployee.Field<string>("IP");
@ -184,8 +186,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
rdp.Visibility = Visibility.Visible; rdp.Visibility = Visibility.Visible;
// RemoteDesktopWpf remoteDesktopWpf = new RemoteDesktopWpf(); // RemoteDesktopWpf remoteDesktopWpf = new RemoteDesktopWpf();
// Picture.Content = remoteDesktopWpf; // Picture.Content = remoteDesktopWpf;
if (await PingTest(host))
{
if (!rdp.IsConnected) if (!rdp.IsConnected)
{ {
try try
@ -199,10 +199,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
LogGing.ERRDATA(ex); LogGing.ERRDATA(ex);
} }
} }
}
}//远程 }//远程
private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e) private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e)
{ {
if (rdp.IsConnected) rdp.Disconnect();
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
if (!drEmployee.Field<bool>("Dispense")) if (!drEmployee.Field<bool>("Dispense"))
{ {
@ -289,10 +289,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}//手自动 }//手自动
private void ListViewItem_Curve(object sender, MouseButtonEventArgs e) private void ListViewItem_Curve(object sender, MouseButtonEventArgs e)
{ {
if (rdp.IsConnected) rdp.Disconnect();
log.Visibility = Visibility.Collapsed; log.Visibility = Visibility.Collapsed;
rdp.Visibility = Visibility.Collapsed; rdp.Visibility = Visibility.Collapsed;
Picture.Visibility = Visibility.Visible; Picture.Visibility = Visibility.Visible;
Picture.Content = new View.CurveDiagram(true, "", "", "", workOrder); Picture.Content = new View.CurveDiagram(false, machine, DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss"), DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), workOrder);
machines_info = 3; machines_info = 3;
}//曲线 }//曲线

7
ViewModel/CurveDiagramViewModel.cs

@ -160,7 +160,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
var STLB_items = new List<DateTimePoint>(); var STLB_items = new List<DateTimePoint>();
var STTC_items = new List<DateTimePoint>(); var STTC_items = new List<DateTimePoint>();
var STLC_items = new List<DateTimePoint>(); var STLC_items = new List<DateTimePoint>();
for (var i = 0; i < CDB_Count; i=i+10) for (var i = 0; i < CDB_Count; i=i+4)
{
try
{ {
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time")); DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT"))); MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
@ -174,7 +176,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB"))); STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB")));
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC"))); STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC")));
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC"))); STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC")));
}
catch (Exception) { }
} }
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items); MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);

Loading…
Cancel
Save