页面显示设备状态逻辑修改
This commit is contained in:
commit
6eae137bd1
15 files changed
+456
-218
No files matched your search
+19
-6
@@ -13,6 +13,7 @@
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1800">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
@@ -21,7 +22,7 @@
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,0,0,60" HorizontalAlignment="Right" Width="300" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
Margin="0,0,0,60" HorizontalAlignment="Right" Width="330" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
@@ -52,11 +53,23 @@
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<Border>
|
||||
<Grid>
|
||||
<StackPanel Width="100" Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
@@ -68,7 +81,7 @@
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
VerticalAlignment="Top" Height="500" Margin="0,0,300,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" >
|
||||
VerticalAlignment="Top" Height="500" Margin="0,0,330,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
@@ -165,7 +178,7 @@
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Background="White" Margin="0,500,300,60">
|
||||
<Grid Background="White" Margin="0,500,330,60">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
+21
-8
@@ -9,11 +9,12 @@
|
||||
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}"
|
||||
d:DataContext="{d:DesignInstance Type=local:MachinesView}"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1200">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
<ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/>
|
||||
<ConvertMoels:IORBConvert x:Key="IORBConvert"/>
|
||||
@@ -23,13 +24,13 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
<DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
|
||||
AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
HorizontalAlignment="Left" Width="280" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
HorizontalAlignment="Left" Width="310" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
@@ -68,18 +69,30 @@
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<Border>
|
||||
<Grid>
|
||||
<StackPanel Width="100" Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Grid Grid.Row="0" Margin="280,0,0,0">
|
||||
<Grid Grid.Row="0" Margin="310,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="5"/>
|
||||
|
||||
+253
-12
@@ -4,11 +4,14 @@ using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -23,16 +26,34 @@ using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using TouchSocket.Core;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// MachinesSet.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MachinesView : UserControl
|
||||
public partial class MachinesView : UserControl, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public void RaisePropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
if (propertyName != null)
|
||||
{
|
||||
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
public MachinesView()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
CountDown();
|
||||
}
|
||||
@@ -42,7 +63,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
//private string SYS_machines = null;
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
string machine;
|
||||
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
@@ -115,12 +137,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
SQLiteHelpers.Close();//关闭数据库
|
||||
}
|
||||
IO_data();//重新获得io表
|
||||
MainWindowViewModel.D_view = true;
|
||||
D_view = true;
|
||||
}
|
||||
|
||||
private void Grid_D_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
MainWindowViewModel.D_view = false;
|
||||
D_view = false;
|
||||
}
|
||||
|
||||
private void Grid_A_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
@@ -140,12 +162,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
||||
SQLiteHelpers.Close();//关闭数据库
|
||||
}
|
||||
MainWindowViewModel.A_view = true;
|
||||
A_view = true;
|
||||
}
|
||||
|
||||
private void Grid_A_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
MainWindowViewModel.A_view = false;
|
||||
A_view = false;
|
||||
}
|
||||
|
||||
private void SYS_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
@@ -168,7 +190,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
|
||||
});//发送862指令修改系统设置
|
||||
}
|
||||
MainWindowViewModel.SysSet_view = true;
|
||||
SysSet_view = true;
|
||||
}
|
||||
|
||||
private void SET_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
@@ -191,17 +213,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") +datagrid_v.ToJsonString()
|
||||
});//发送861指令修改程序设置
|
||||
}
|
||||
MainWindowViewModel.ParameterSet_view = true;
|
||||
ParameterSet_view = true;
|
||||
}
|
||||
|
||||
private void SYS_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
MainWindowViewModel.SysSet_view = false;
|
||||
SysSet_view = false;
|
||||
}
|
||||
|
||||
private void SET_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
MainWindowViewModel.ParameterSet_view = false;
|
||||
ParameterSet_view = false;
|
||||
}
|
||||
|
||||
private int view = 0;
|
||||
@@ -261,8 +283,227 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
timer1s.Start();
|
||||
}//时间周期初始化
|
||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{ IO_data(); }
|
||||
{
|
||||
IO_data();
|
||||
DATA_view();
|
||||
}
|
||||
private async void DATA_view()//IO显示
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dt_m.Rows.Count >= 0)
|
||||
{
|
||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
if (dt_a.Rows.Count >= 0)
|
||||
{
|
||||
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
if (dt_d.Rows.Count >= 0)
|
||||
{
|
||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
TechnologicalMachine_View = ToObservableCollection<TechnologicalM>(Machines);
|
||||
}
|
||||
catch (Exception) { }
|
||||
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) { }
|
||||
});
|
||||
}
|
||||
|
||||
bool A_view =true;
|
||||
bool D_view =true;
|
||||
bool ParameterSet_view = true;
|
||||
bool SysSet_view = true;
|
||||
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
||||
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
||||
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
||||
ObservableCollection<ParameterSet> paramete_Set = new ObservableCollection<ParameterSet>();
|
||||
ObservableCollection<SysSet> sys_Set = new ObservableCollection<SysSet>();
|
||||
ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
|
||||
public ObservableCollection<DATA_A> SYSData_A
|
||||
{
|
||||
|
||||
|
||||
get { return sysData_A; }
|
||||
set
|
||||
{
|
||||
sysData_A = value;
|
||||
RaisePropertyChanged("SYSData_A");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<DATA_D> SYSData_D
|
||||
{
|
||||
|
||||
get { return sysData_D; }
|
||||
set
|
||||
{
|
||||
sysData_D = value;
|
||||
RaisePropertyChanged("SYSData_D");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<DATA_M> SYSData_M
|
||||
{
|
||||
get { return sysData_M; }
|
||||
set
|
||||
{
|
||||
sysData_M = value;
|
||||
RaisePropertyChanged("SYSData_M");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<TechnologicalM> TechnologicalMachine_View
|
||||
{
|
||||
get { return technologicalMachine_View; }
|
||||
set
|
||||
{
|
||||
technologicalMachine_View = value;
|
||||
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 string IOName { get; set; }
|
||||
public int AIO { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string PLC { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
public class DATA_D
|
||||
{
|
||||
public string IOName { get; set; }
|
||||
public bool DIO { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string PLC { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
public class DATA_M
|
||||
{
|
||||
public string IOName { get; set; }
|
||||
public double Value { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string PLC { 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 string LOCK { get; set; }
|
||||
|
||||
}
|
||||
public class ParameterSet
|
||||
{
|
||||
public string Category { get; set; }
|
||||
public string ParameterID { get; set; }
|
||||
public string ParameterName { get; set; }
|
||||
public string Value { 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()
|
||||
{
|
||||
Type t = typeof(T);
|
||||
PropertyInfo[] propertys = t.GetProperties();
|
||||
ObservableCollection<T> lst = new ObservableCollection<T>();
|
||||
string typeName = string.Empty;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
{
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
{
|
||||
if (!pi.CanWrite) continue;
|
||||
object value = dr[typeName];
|
||||
if (value == DBNull.Value) continue;
|
||||
if (pi.PropertyType == typeof(string))
|
||||
{
|
||||
pi.SetValue(entity, value.ToString(), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(int) || pi.PropertyType == typeof(int?))
|
||||
{
|
||||
pi.SetValue(entity, int.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(DateTime?) || pi.PropertyType == typeof(DateTime))
|
||||
{
|
||||
pi.SetValue(entity, DateTime.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(float))
|
||||
{
|
||||
pi.SetValue(entity, float.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(double))
|
||||
{
|
||||
pi.SetValue(entity, double.Parse(value.ToString()), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
pi.SetValue(entity, value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
lst.Add(entity);
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
-6
@@ -13,6 +13,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="1000" d:DesignWidth="1900">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
|
||||
</UserControl.Resources>
|
||||
@@ -23,7 +24,8 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" SelectionChanged="Griddata_SelectionChanged"
|
||||
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
|
||||
SelectionChanged="Griddata_SelectionChanged"
|
||||
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||
@@ -33,6 +35,7 @@
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="FontSize" Value="25" />
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||
@@ -42,7 +45,7 @@
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False"/>
|
||||
<DataTrigger Binding="{Binding State}" Value="309">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
<Setter Property="Background" Value="Yellow"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -51,6 +54,7 @@
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="20"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||
@@ -70,11 +74,24 @@
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTextColumn Binding="{Binding State}" Width="0" MaxWidth="0" IsReadOnly="True"/>
|
||||
<DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<DataTemplate>
|
||||
<UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<Border>
|
||||
<Grid>
|
||||
<StackPanel Width="100" Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
+46
-29
@@ -1,4 +1,6 @@
|
||||
using SkiaSharp;
|
||||
using LiveChartsCore.Geo;
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
@@ -8,6 +10,7 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -21,15 +24,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using VncSharpWpf;
|
||||
using System.Xml.Linq;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using VncSharpWpf;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
@@ -74,36 +75,51 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
private string dyelot;
|
||||
private int machines_info=0;
|
||||
public static string Sys_log;
|
||||
|
||||
|
||||
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
|
||||
{
|
||||
Stop.IsEnabled = true;
|
||||
Paused.IsEnabled = true;
|
||||
Insert.IsEnabled = false;
|
||||
edit.IsEnabled = false;
|
||||
Resume.IsEnabled = false;
|
||||
Delete.IsEnabled = false;
|
||||
Jump.IsEnabled = false;
|
||||
DyeingMachine.IsEnabled = true;
|
||||
Curve.IsEnabled = true;
|
||||
Screen.IsEnabled = true;
|
||||
Receipt.IsEnabled = true;
|
||||
LOCK_XML.IsEnabled = true;
|
||||
TechnologicalProcess_bool = true;
|
||||
IsInteractive = false;
|
||||
|
||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
string mac_s = "800";
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
machine = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
workOrder = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
dyelot = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
mac_s = (Griddata.Columns[0].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
}
|
||||
else { return; }
|
||||
|
||||
if ((mac_s != "800") && (mac_s != "801") && (mac_s != "802"))
|
||||
{
|
||||
Stop.IsEnabled = true;
|
||||
Paused.IsEnabled = true;
|
||||
Insert.IsEnabled = false;
|
||||
edit.IsEnabled = false;
|
||||
Resume.IsEnabled = false;
|
||||
Delete.IsEnabled = false;
|
||||
Jump.IsEnabled = false;
|
||||
DyeingMachine.IsEnabled = true;
|
||||
Curve.IsEnabled = true;
|
||||
Screen.IsEnabled = true;
|
||||
Receipt.IsEnabled = true;
|
||||
LOCK_XML.IsEnabled = true;
|
||||
TechnologicalProcess_bool = true;
|
||||
IsInteractive = false;
|
||||
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
machine = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
workOrder = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
dyelot = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
|
||||
MainWindowViewModel.machine = machine;
|
||||
MainWindowViewModel.workOrder = workOrder;
|
||||
MainWindowViewModel.dyelot = dyelot;
|
||||
MainWindowViewModel.machin_LOG = Properties.Resources.Machine + ":" + machine + " " + Properties.Resources.WorkOrder + ":" + workOrder;
|
||||
machin_LOG.Text = MainWindowViewModel.machin_LOG;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.TMNR, "800", MessageBoxButton.OK, MessageBoxImage.Information); //
|
||||
|
||||
MainWindowViewModel.machine = machine;
|
||||
MainWindowViewModel.workOrder= workOrder;
|
||||
MainWindowViewModel.dyelot= dyelot;
|
||||
MainWindowViewModel.machin_LOG = Properties.Resources.Machine + ":" + machine + " " + Properties.Resources.WorkOrder + ":" + workOrder;
|
||||
machin_LOG.Text = MainWindowViewModel.machin_LOG;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +642,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
public string Process { get; set; }
|
||||
public string Step { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string State { get; set; }
|
||||
public string State { get; set; }
|
||||
public string LOCK { get; set; }
|
||||
|
||||
}
|
||||
public class TechnologicalP
|
||||
|
||||
Reference in new issue
Block a user