Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
c6513fb20c
4 files changed
+285
-33
No files matched your search
@@ -183,7 +183,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
}//缓存表
|
}//缓存表
|
||||||
|
else if (SYSAPI == "SC854")
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_ParameterSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}//程序设置表
|
||||||
|
else if (SYSAPI == "SC855")
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_SysSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}//系统设置表
|
||||||
|
|
||||||
|
|
||||||
return EasyTask.CompletedTask;
|
return EasyTask.CompletedTask;
|
||||||
|
|||||||
+110
-12
@@ -7,6 +7,9 @@
|
|||||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||||
|
xmlns:localUserClass="clr-namespace:DyeingComputer.UserClass"
|
||||||
|
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||||
|
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Loaded="UserControl_Loaded"
|
Loaded="UserControl_Loaded"
|
||||||
d:DesignHeight="900" d:DesignWidth="1200">
|
d:DesignHeight="900" d:DesignWidth="1200">
|
||||||
@@ -21,10 +24,11 @@
|
|||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
<DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||||
Background="White"
|
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
|
||||||
|
AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
HorizontalAlignment="Left" Width="280" MouseDoubleClick="Griddata_MouseDoubleClick">
|
HorizontalAlignment="Left" Width="280" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
@@ -73,11 +77,6 @@
|
|||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding Groups}" Width="0" IsReadOnly="True"/>
|
|
||||||
<DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/>
|
|
||||||
<DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/>
|
|
||||||
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
|
|
||||||
<DataGridTextColumn Binding="{Binding Baud}" Width="0" IsReadOnly="True"/>
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Grid Grid.Row="0" Margin="280,0,0,0">
|
<Grid Grid.Row="0" Margin="280,0,0,0">
|
||||||
@@ -87,7 +86,97 @@
|
|||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
|
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed">
|
||||||
|
<DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
|
||||||
|
ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
||||||
|
CellEditEnding="SET_Grid_CellEditEnding" BeginningEdit="SET_Grid_BeginningEdit" Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Type}" Width="200" Binding="{Binding Category}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="200" Binding="{Binding ParameterID}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/>
|
||||||
|
<localUserClass:NumericTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="200" Binding="{Binding Value}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="2" x:Name="SYS_GRID" Visibility="Collapsed">
|
||||||
|
<DataGrid x:Name="SYS_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
|
||||||
|
ItemsSource="{Binding Path=Sys_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
||||||
|
CellEditEnding="SYS_Grid_CellEditEnding" BeginningEdit="SYS_Grid_BeginningEdit" Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Type}" Width="200" Binding="{Binding Category}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="200" Binding="{Binding ParameterID}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="400" Binding="{Binding Value}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="2" x:Name="IO_GRID" Visibility="Visible">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
@@ -259,7 +348,6 @@
|
|||||||
<DataGridTextColumn Header="info" Width="100" Binding="{Binding Value}" IsReadOnly="True"/>
|
<DataGridTextColumn Header="info" Width="100" Binding="{Binding Value}" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Grid.Row="2" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" >
|
<StackPanel Grid.Row="2" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" >
|
||||||
@@ -288,7 +376,17 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
|
||||||
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
|
<ListViewItem>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="ChatProcessing" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
|
<TextBlock Text="{x:Static lang:Resources.Machine}" FontSize="20" VerticalAlignment="Center" Margin="20 10" Foreground="White" />
|
||||||
|
<TextBlock x:Name="MAC_name" FontSize="20" VerticalAlignment="Center" Margin="20 10" Foreground="White" FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
</ListViewItem>
|
||||||
|
</ListView>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
using TouchSocket.Core;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||||
@@ -42,7 +43,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
private string SYS_machines = null;
|
private string SYS_machines = null;
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
|
||||||
}
|
}
|
||||||
string machine;
|
string machine;
|
||||||
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
@@ -51,20 +51,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
machine = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
machine = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||||
|
MAC_name.Text= machine;
|
||||||
|
|
||||||
|
MainWindowViewModel.dt_d.Clear();
|
||||||
|
MainWindowViewModel.dt_a.Clear();
|
||||||
|
MainWindowViewModel.dt_m.Clear();
|
||||||
|
MainWindowViewModel.dt_ParameterSet.Clear();
|
||||||
|
MainWindowViewModel.dt_SysSet.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
IO_GRID.Visibility = Visibility.Visible;
|
||||||
|
SYS_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SET_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
view = 0;
|
||||||
}
|
}
|
||||||
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
IO_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SYS_GRID.Visibility = Visibility.Visible;
|
||||||
|
SET_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
view = 2;
|
||||||
}
|
}
|
||||||
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
IO_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SYS_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SET_GRID.Visibility = Visibility.Visible;
|
||||||
|
view = 1;
|
||||||
}
|
}
|
||||||
private void Grid_D_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Grid_D_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -81,7 +97,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Grid_D_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
private void Grid_D_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
string ID;
|
string ID;
|
||||||
@@ -125,7 +140,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
SQLiteHelpers.Close();//关闭数据库
|
||||||
}
|
}
|
||||||
IO_data();//重新获得io表
|
|
||||||
MainWindowViewModel.A_view = true;
|
MainWindowViewModel.A_view = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +148,63 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
MainWindowViewModel.A_view = false;
|
MainWindowViewModel.A_view = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SYS_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
int rownum = SYS_Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
string ID = (SYS_Grid.Columns[1].GetCellContent(SYS_Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||||
|
|
||||||
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
|
datagrid_v.Add("Value", newValue);
|
||||||
|
datagrid_v.Add("ID", ID);
|
||||||
|
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + datagrid_v.ToJsonString()
|
||||||
|
});//发送862指令修改系统设置
|
||||||
|
}
|
||||||
|
MainWindowViewModel.SysSet_view = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SET_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
int rownum = SET_Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
string ID = (SET_Grid.Columns[1].GetCellContent(SET_Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||||
|
|
||||||
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
|
datagrid_v.Add("Value", newValue);
|
||||||
|
datagrid_v.Add("ID", ID);
|
||||||
|
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)+datagrid_v.ToJsonString()
|
||||||
|
});//发送861指令修改程序设置
|
||||||
|
}
|
||||||
|
MainWindowViewModel.ParameterSet_view = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SYS_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.SysSet_view = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SET_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.ParameterSet_view = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int view = 0;
|
||||||
private void IO_data()
|
private void IO_data()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(machine))
|
if (!string.IsNullOrEmpty(machine))
|
||||||
@@ -142,6 +213,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||||
|
{
|
||||||
|
if (view == 0)
|
||||||
{
|
{
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
@@ -158,6 +231,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)
|
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)
|
||||||
});
|
});
|
||||||
|
} else if (view==1)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC854" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (view == 2)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC855" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,5 +262,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}//时间周期初始化
|
}//时间周期初始化
|
||||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{ IO_data(); }
|
{ IO_data(); }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,17 +275,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public static DataTable dt_m = new DataTable("M");
|
public static DataTable dt_m = new DataTable("M");
|
||||||
public static DataTable dt_TM = new DataTable();
|
public static DataTable dt_TM = new DataTable();
|
||||||
public static DataTable dt_TP = new DataTable();
|
public static DataTable dt_TP = new DataTable();
|
||||||
|
public static DataTable dt_ParameterSet = new DataTable();
|
||||||
|
public static DataTable dt_SysSet = new DataTable();
|
||||||
public static bool TechnologicalProcess_bool =true;
|
public static bool TechnologicalProcess_bool =true;
|
||||||
public static bool A_view =true;
|
public static bool A_view =true;
|
||||||
public static bool D_view =true;
|
public static bool D_view =true;
|
||||||
public static bool IO_view;
|
public static bool IO_view;
|
||||||
|
public static bool ParameterSet_view=true;
|
||||||
|
public static bool SysSet_view=true;
|
||||||
private async void DATA_view()//IO显示
|
private async void DATA_view()//IO显示
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (dt_m.Rows.Count > 0)
|
if (dt_m.Rows.Count >= 0)
|
||||||
{
|
{
|
||||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||||
}
|
}
|
||||||
@@ -293,7 +297,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
catch (Exception ) { }
|
catch (Exception ) { }
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (dt_a.Rows.Count > 0)
|
if (dt_a.Rows.Count >= 0)
|
||||||
{
|
{
|
||||||
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||||
}
|
}
|
||||||
@@ -301,7 +305,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
catch (Exception ) { }
|
catch (Exception ) { }
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (dt_d.Rows.Count > 0)
|
if (dt_d.Rows.Count >= 0)
|
||||||
{
|
{
|
||||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||||
}
|
}
|
||||||
@@ -313,6 +317,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (dt_ParameterSet.Rows.Count >= 0)
|
||||||
|
{
|
||||||
|
if(ParameterSet_view) Paramete_Set = ToObservableCollection<ParameterSet>(dt_ParameterSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dt_SysSet.Rows.Count >= 0)
|
||||||
|
{
|
||||||
|
if (SysSet_view) Sys_Set = ToObservableCollection<SysSet>(dt_SysSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (dt_TP.Rows.Count >= 0)
|
if (dt_TP.Rows.Count >= 0)
|
||||||
{
|
{
|
||||||
@@ -327,6 +347,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
||||||
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
||||||
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
||||||
|
ObservableCollection<ParameterSet> paramete_Set = new ObservableCollection<ParameterSet>();
|
||||||
|
ObservableCollection<SysSet> sys_Set = new ObservableCollection<SysSet>();
|
||||||
ObservableCollection<TechnologicalP> technologicalProcess_View = new ObservableCollection<TechnologicalP>();
|
ObservableCollection<TechnologicalP> technologicalProcess_View = new ObservableCollection<TechnologicalP>();
|
||||||
ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
|
ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
|
||||||
public ObservableCollection<DATA_A> SYSData_A
|
public ObservableCollection<DATA_A> SYSData_A
|
||||||
@@ -376,6 +398,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
RaisePropertyChanged("TechnologicalMachine_View");
|
RaisePropertyChanged("TechnologicalMachine_View");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public ObservableCollection<ParameterSet> Paramete_Set
|
||||||
|
{
|
||||||
|
get { return paramete_Set; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
paramete_Set = value;
|
||||||
|
RaisePropertyChanged("Paramete_Set");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ObservableCollection<SysSet> Sys_Set
|
||||||
|
{
|
||||||
|
get { return sys_Set; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
sys_Set = value;
|
||||||
|
RaisePropertyChanged("Sys_Set");
|
||||||
|
}
|
||||||
|
}
|
||||||
public class DATA_A
|
public class DATA_A
|
||||||
{
|
{
|
||||||
public string IOName { get; set; }
|
public string IOName { get; set; }
|
||||||
@@ -400,6 +440,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public string PLC { get; set; }
|
public string PLC { get; set; }
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
}
|
}
|
||||||
|
public class TechnologicalM
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string WorkOrder { get; set; }
|
||||||
|
public string Dyelot { get; set; }
|
||||||
|
public string Temperature { get; set; }
|
||||||
|
public string WaterLevel { get; set; }
|
||||||
|
public string Process { get; set; }
|
||||||
|
public string Step { get; set; }
|
||||||
|
public string Message { get; set; }
|
||||||
|
public string State { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
public class TechnologicalP
|
public class TechnologicalP
|
||||||
{
|
{
|
||||||
public string ProgramID { get; set; }
|
public string ProgramID { get; set; }
|
||||||
@@ -415,19 +468,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public string Parameter5 { get; set; }
|
public string Parameter5 { get; set; }
|
||||||
public string DYELOT { get; set; }
|
public string DYELOT { get; set; }
|
||||||
}
|
}
|
||||||
public class TechnologicalM
|
public class ParameterSet
|
||||||
{
|
{ public string Category { get; set; }
|
||||||
public string Name { get; set; }
|
public string ParameterID { get; set; }
|
||||||
public string WorkOrder { get; set; }
|
public string ParameterName { get; set; }
|
||||||
public string Dyelot { get; set; }
|
public string Value { get; set; }
|
||||||
public string Temperature { get; set; }
|
|
||||||
public string WaterLevel { get; set; }
|
|
||||||
public string Process { get; set; }
|
|
||||||
public string Step { get; set; }
|
|
||||||
public string Message { get; set; }
|
|
||||||
public string State { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public class SysSet
|
||||||
|
{
|
||||||
|
public string Category { get; set; }
|
||||||
|
public string ParameterID { get; set; }
|
||||||
|
public string ParameterName { get; set; }
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||||
{
|
{
|
||||||
Type t = typeof(T);
|
Type t = typeof(T);
|
||||||
|
|||||||
Reference in new issue
Block a user