@@ -1,4 +1,6 @@ | |||
using System; | |||
| |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
@@ -7,24 +9,24 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
public class RemoteRecipeData | |||
public class RemoteRecipeData : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; } } | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
/// 配方ID | |||
/// </summary> | |||
public long RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; } } | |||
public long RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } | |||
private long _mRecipeCode; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; } } | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
/// <summary> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -6,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
public class RemoteRecipeRawMaterial | |||
public class RemoteRecipeRawMaterial :ObservableObject | |||
{ | |||
private int _mIp; | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; }} | |||
@@ -14,19 +15,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; } } | |||
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value;OnPropertyChanged(); } } | |||
private int _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } } | |||
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private double _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; } } | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
} | |||
} |
@@ -7,8 +7,8 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
Title="RecipeInfosView" | |||
Width="550" | |||
Height="450" | |||
Width="800" | |||
Height="550" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
@@ -52,7 +52,7 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" BorderThickness="1" > | |||
<!--<Border Name="br" BorderThickness="1" > | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
@@ -134,5 +134,243 @@ | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border>--> | |||
<!--<Border Name="br"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"></RowDefinition> | |||
<RowDefinition Height="88"></RowDefinition> | |||
<RowDefinition Height="40"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="大料站配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="22" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2" Margin="0,0,0,8"> | |||
<StackPanel Orientation="Vertical" Margin="0,0,-13,0"> | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="16" Margin="5,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding RecipeName}" Width="150" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入托盘编号:" Foreground="#FF2AB2E7" FontSize="16" Margin="5,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding TrayCode}" InputMethod.IsInputMethodEnabled="False" Width="150" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid Width="260" HorizontalAlignment="Right"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,5,0"> | |||
<Button Content="添加原料" Width="120" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="120" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Margin="0,3,5,0"> | |||
<Button Content="另存为" Height="30" Width="120" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="120" Cursor="Hand"></Button> | |||
</StackPanel> | |||
</Grid> | |||
</UniformGrid> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="130"/> | |||
<ColumnDefinition Width="145"/> | |||
<ColumnDefinition Width="145"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="14"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="14"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="14"></TextBlock> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="14"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel></StackPanel> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton> | |||
<RadioButton.Template> | |||
<ControlTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="130"/> | |||
<ColumnDefinition Width="145"></ColumnDefinition> | |||
<ColumnDefinition Width="145"></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding RawMaterialBarrelNum}" Margin="5,0,0,5" Width="120" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" > | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="#e69519"/> | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" > | |||
<TextBox Text="{Binding RawMaterialLocation}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="135" Margin="5,0,0,5" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Column="2"> | |||
<TextBox Text="{Binding RawMaterialWeight}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="125" Margin="5,0,0,5" ></TextBox> | |||
<TextBlock VerticalAlignment="Center" Margin="4,0,0,5" Text="g" Foreground="#e69519" ></TextBlock> | |||
</StackPanel> | |||
<Button Grid.Column="3" | |||
Content="删除" | |||
Width="94" | |||
FontSize="14" | |||
Margin="10,0,20,5" | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding MaterialCode}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border>--> | |||
<Border Name="br" BorderThickness="2" BorderBrush="#0CADF5"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"></RowDefinition> | |||
<RowDefinition Height="85"></RowDefinition> | |||
<RowDefinition Height="40"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="大配料站配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2" Margin="0,0,0,5"> | |||
<StackPanel Orientation="Vertical" > | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入托盘编号:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding TrayCode}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,4,0,0"> | |||
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,4,0,0" HorizontalAlignment="Center"> | |||
<Button Content="另存为" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="180" Cursor="Hand"></Button> | |||
</StackPanel> | |||
</Grid> | |||
</UniformGrid> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="210"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="托盘桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel></StackPanel> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton> | |||
<RadioButton.Template> | |||
<ControlTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="210"/> | |||
<ColumnDefinition Width="210"></ColumnDefinition> | |||
<ColumnDefinition Width="225"></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding RawMaterialLocation}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus"> | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="#e69519"/> | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" > | |||
<TextBox Text="{Binding RawMaterialBarrelNum}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Column="2"> | |||
<TextBox Text="{Binding RawMaterialWeight}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox> | |||
<TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock> | |||
</StackPanel> | |||
<Button Grid.Column="3" | |||
Content="删除" | |||
Width="94" | |||
FontSize="14" | |||
Margin="0,0,20,10" | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RawMaterialLocation}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -23,9 +23,24 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
public RecipeInfosView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView"); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void ComboBox_KeyUp(object sender, KeyEventArgs e) | |||
{ | |||
} | |||
private void ComboBox_LostFocus(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -13,6 +13,9 @@ | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
@@ -37,6 +40,112 @@ | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
<!--#region 下拉列表样式--> | |||
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<!--<Setter Property="Height" Value="10" />--> | |||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | |||
<Setter Property="VerticalContentAlignment" Value="Top" /> | |||
<Setter Property="Padding" Value="10,10" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<Grid> | |||
<Border | |||
x:Name="border2" | |||
Width="auto" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Background="{TemplateBinding Background}"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<!--<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Background" Value="#FFd2e7f4" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="false"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger>--> | |||
<!--<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger>--> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="False"> | |||
<Setter TargetName="border2" Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | |||
<Setter Property="VerticalContentAlignment" Value="Stretch" /> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Expander}"> | |||
<DockPanel> | |||
<ToggleButton | |||
x:Name="HeaderSite" | |||
Height="20" | |||
Width="auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="1" | |||
Padding="{TemplateBinding Padding}" | |||
Background="Transparent" | |||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding Header}" | |||
ContentTemplate="{TemplateBinding HeaderTemplate}" | |||
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" | |||
DockPanel.Dock="Top" | |||
FontFamily="{TemplateBinding FontFamily}" | |||
FontSize="{TemplateBinding FontSize}" | |||
FontStretch="{TemplateBinding FontStretch}" | |||
FontStyle="{TemplateBinding FontStyle}" | |||
FontWeight="{TemplateBinding FontWeight}" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ToggleButtonStyle}" /> | |||
<ContentPresenter | |||
x:Name="ExpandSite" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
DockPanel.Dock="Left" | |||
Focusable="false" | |||
Visibility="Visible" /> | |||
</DockPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsExpanded" Value="True"> | |||
<Setter TargetName="ExpandSite" Property="Visibility" Value="Collapsed" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
@@ -49,6 +158,16 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding NewRecipe}" | |||
Content="新建配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
@@ -74,70 +193,194 @@ | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="1"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ListBox | |||
Grid.Row="2" | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
</ListBox.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="2,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeName}" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Grid.Column="0" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="详情" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterial}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Expander Style="{StaticResource ExpanderStyle}" Margin="40,0,0,0"> | |||
<Expander.Header> | |||
<StackPanel Orientation="Horizontal"> | |||
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="0,0,5,0"> | |||
<Border.Background> | |||
<RadialGradientBrush> | |||
<GradientStop Color="#FF2AB2E7" Offset="0.5" /> | |||
<GradientStop Color="White"/> | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Expander.Header> | |||
<Expander.Content> | |||
<StackPanel Margin="36,0,0,0"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="原料重量:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
</StackPanel> | |||
</Expander.Content> | |||
</Expander> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<!--<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Grid> | |||
</UserControl> |
@@ -9,6 +9,8 @@ using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||
using System.Windows.Forms; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
@@ -33,10 +35,89 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
} | |||
}), "RecipeInfo"); | |||
ReturnPage = new RelayCommand(() => | |||
AddRecipe = new RelayCommand(() => { | |||
RawMaterialsInfo.Add(new RemoteRecipeRawMaterial()); | |||
}); | |||
Comfirm = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
var bom= Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); | |||
if (bom == null)//新配方 | |||
{ | |||
var name= Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); | |||
if (name == null) | |||
{ | |||
go: | |||
long recipeCode = new Random().Next(10000, 99999); | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode}); | |||
Json<RemoteRecipeDataColl>.Save(); | |||
} | |||
else | |||
{ | |||
goto go; | |||
} | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
else | |||
{ | |||
MessageBox.Show("配方名称重复,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
} | |||
else//编辑已有配方 | |||
{ | |||
bom.RawMaterial.Clear(); | |||
foreach (var item in RawMaterialsInfo) | |||
{ | |||
bom.RawMaterial.Add(item); | |||
} | |||
bom.RecipeName = RecipeName; | |||
Json<RemoteRecipeDataColl>.Save(); | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
}); | |||
SaveAs = new RelayCommand(() => { | |||
var bom = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); | |||
var rec = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); | |||
if (bom == null && rec != null)//配方名称更改 | |||
{ | |||
prop: long recipeCode = new Random().Next(10000, 99999);//配方唯一ID,后期根据实际要求更改 | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加 | |||
Json<RemoteRecipeDataColl>.Save(); | |||
} | |||
else | |||
{ | |||
goto prop; | |||
} | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
else | |||
{ | |||
MessageBox.Show("另存配方失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
RemoveRecipe = new RelayCommand<int>((materilaName) => { | |||
var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialLocation==materilaName); | |||
if (res != null) | |||
RawMaterialsInfo.Remove(res); | |||
}); | |||
//ReturnPage = new RelayCommand(() => | |||
//{ | |||
// ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
//}); | |||
} | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
@@ -50,6 +131,14 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public RelayCommand ReturnPage { get; set; } | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RelayCommand AddRecipe { get; set; } | |||
public RelayCommand Comfirm { get; set; } | |||
public RelayCommand SaveAs { get; set; } | |||
public RelayCommand<int> RemoveRecipe { get; set; } | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>() ; | |||
} | |||
} |
@@ -23,10 +23,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
public class RecipeReceiveViewModel : ObservableObject | |||
{ | |||
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RecipeReceiveViewModel() | |||
{ | |||
//Json<LocaPar>.Read(); | |||
Json<RemoteRecipeDataColl>.Read(); | |||
Recipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
@@ -40,6 +40,12 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}"); | |||
} | |||
}); | |||
NewRecipe = new RelayCommand(() => { | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
nrv.ShowDialog(); | |||
}); | |||
NewSimulateRecipe = new RelayCommand(() => | |||
{ | |||
RawMaterials.Clear(); | |||
@@ -80,6 +86,14 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
ClearAllRecipe = new RelayCommand(() => | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Clear(); | |||
Json<RemoteRecipeDataColl>.Save(); | |||
}); | |||
RemoveCommand = new RelayCommand<long>((recipeCode) => { | |||
var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode); | |||
if(res!=null) | |||
Recipes.Remove(res); | |||
}); | |||
} | |||
@@ -88,6 +102,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public RelayCommand NewSimulateRecipe { get; set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } | |||
public RelayCommand NewRecipe { get; set; } | |||
public RelayCommand<long> RemoveCommand { get; set; } | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
} | |||
} |
@@ -178,9 +178,11 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
timer.Interval = TimeSpan.FromMilliseconds(TimeCount); | |||
timer.Tick += Timer_Tick; ; | |||
timer.Start(); | |||
Checked += TheCheckBox_Checked; | |||
Unchecked += TheCheckBox_Unchecked; | |||
this.Click += SwitchButton_Click; | |||
} | |||
/// <summary> | |||
/// 属性刷新事件 | |||
/// </summary> | |||
@@ -214,7 +216,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = _checked.ToString(),DataType = eDataType }); | |||
this.GetType().GetProperty("IsChecked").SetValue(this,_checked); | |||
timer.Stop(); | |||
} | |||
} | |||
} | |||
@@ -226,8 +227,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
} | |||
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e) | |||
private void SwitchButton_Click(object sender,RoutedEventArgs e) | |||
{ | |||
timer.Stop(); | |||
foreach (var item in propertyBing) | |||
{ | |||
//{Binding 测试设备.VAR_A_2} | |||
@@ -241,36 +243,16 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "Flase",DataType = eDataType }); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = this.IsChecked.ToString(),DataType = eDataType }); | |||
} | |||
} | |||
} | |||
} | |||
Config.GetInstance().RunJsScipt(UnCheckedExec); | |||
if(this.IsChecked==true) Config.GetInstance().RunJsScipt(CheckedExec); | |||
else Config.GetInstance().RunJsScipt(UnCheckedExec); | |||
timer.Start(); | |||
} | |||
private void TheCheckBox_Checked(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in propertyBing) | |||
{ | |||
//{Binding 测试设备.VAR_A_2} | |||
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split("."); | |||
if (str.Length > 1) | |||
{ | |||
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0])) | |||
{ | |||
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]]; | |||
if (b != null && b.ContainsKey(str[1])) | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "True",DataType = eDataType }); | |||
} | |||
} | |||
} | |||
} | |||
Config.GetInstance().RunJsScipt(CheckedExec); | |||
} | |||
public string ControlType => "控件"; | |||
} | |||
@@ -40,31 +40,43 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
Height = 30; | |||
Width = 80; | |||
FontSize = 16; | |||
this.KeyDown += TheTextBox_KeyDown; | |||
this.TextChanged += TheTextBox_TextChanged; | |||
} | |||
bool isRun=false; | |||
private void TheTextBox_KeyDown(object sender,KeyEventArgs e) | |||
{ | |||
isRun = true; | |||
} | |||
private void TheTextBox_TextChanged(object sender,TextChangedEventArgs e) | |||
{ | |||
foreach (var item in propertyBing) | |||
if (isRun) | |||
{ | |||
//{Binding 测试设备.VAR_A_2} | |||
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split("."); | |||
if (str.Length > 1) | |||
timer.Stop(); | |||
foreach (var item in propertyBing) | |||
{ | |||
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0])) | |||
//{Binding 测试设备.VAR_A_2} | |||
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split("."); | |||
if (str.Length > 1) | |||
{ | |||
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]]; | |||
if (b != null && b.ContainsKey(str[1])) | |||
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0])) | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
ChangedText = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = Text,DataType = eDataType }); | |||
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]]; | |||
if (b != null && b.ContainsKey(str[1])) | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
ChangedText = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = Text,DataType = eDataType }); | |||
} | |||
} | |||
} | |||
} | |||
Config.GetInstance().RunJsScipt(ValueChangedExecute); | |||
timer.Start(); | |||
isRun=false; | |||
} | |||
Config.GetInstance().RunJsScipt(ValueChangedExecute); | |||
} | |||
public string ControlType => "控件"; | |||
@@ -161,7 +173,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
this.GetType().GetProperty(item.Key).SetValue(this,_value); | |||
timer.Stop(); | |||
} | |||
} | |||
} | |||
@@ -130,9 +130,13 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
timer.Interval = TimeSpan.FromMilliseconds(TimeCount); | |||
timer.Tick += Timer_Tick; ; | |||
timer.Start(); | |||
Click += TheToggleButton_Click; | |||
Checked += TheCheckBox_Checked; | |||
Unchecked += TheCheckBox_Unchecked; | |||
} | |||
/// <summary> | |||
/// 属性刷新事件 | |||
/// </summary> | |||
@@ -166,7 +170,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = _checked.ToString(),DataType = eDataType }); | |||
this.GetType().GetProperty("IsChecked").SetValue(this,_checked); | |||
timer.Stop(); | |||
} | |||
} | |||
} | |||
@@ -177,8 +181,10 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
} | |||
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e) | |||
private void TheToggleButton_Click(object sender,RoutedEventArgs e) | |||
{ | |||
timer.Stop(); | |||
foreach (var item in propertyBing) | |||
{ | |||
//{Binding 测试设备.VAR_A_2} | |||
@@ -192,35 +198,25 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "Flase",DataType = eDataType }); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "False",DataType = eDataType }); | |||
} | |||
} | |||
} | |||
} | |||
Config.GetInstance().RunJsScipt(UnCheckedExec); | |||
if (this.IsChecked == true) Config.GetInstance().RunJsScipt(CheckedExec); | |||
else Config.GetInstance().RunJsScipt(UnCheckedExec); | |||
timer.Start(); | |||
} | |||
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
private void TheCheckBox_Checked(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in propertyBing) | |||
{ | |||
//{Binding 测试设备.VAR_A_2} | |||
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split("."); | |||
if (str.Length > 1) | |||
{ | |||
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0])) | |||
{ | |||
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]]; | |||
if (b != null && b.ContainsKey(str[1])) | |||
{ | |||
object _value = b[str[1]].VarVaule; | |||
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType); | |||
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "True",DataType = eDataType }); | |||
} | |||
} | |||
} | |||
} | |||
Config.GetInstance().RunJsScipt(CheckedExec); | |||
} | |||
} | |||
} |
@@ -36,7 +36,7 @@ | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
<Style x:Key="ListViewStyle" TargetType="ListView" /> | |||
<!--<Style x:Key="ListViewStyle" TargetType="ListView" />--> | |||
</UserControl.Resources> | |||
@@ -236,12 +236,12 @@ | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--<Image | |||
<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||