@@ -102,29 +102,31 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public bool ShowDialog(string info, DialogType dialogType = DialogType.Information) | |||
{ | |||
PromptView PV = new PromptView(); | |||
PV.TextBlockInfo = info; | |||
switch (dialogType) | |||
{ | |||
case DialogType.Warning: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Yellow; | |||
PV.TextBlockInfo = $"警告:{info}"; | |||
PV.Cancel.Visibility = Visibility.Collapsed; | |||
PV.infoType.Text = "警告:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Error: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Red; | |||
PV.TextBlockInfo = $"错误:{info}"; | |||
PV.Cancel.Visibility = Visibility.Collapsed; | |||
PV.infoType.Text = "错误:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Information: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.DeepSkyBlue; | |||
PV.TextBlockInfo = $"提示:{info}"; | |||
PV.Cancel.Visibility = Visibility.Visible; | |||
PV.infoType.Text = "提示:"; | |||
//PV.Cancel.Visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
PV.infoType.Foreground = PV.TextBlockForeground; | |||
var res = PV.ShowDialog(); | |||
return res == null ? false : (bool)res; | |||
} | |||
@@ -29,7 +29,7 @@ | |||
</Style> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid Name="main"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" Stretch="Fill" /> | |||
</Grid.Background> | |||
@@ -44,24 +44,31 @@ | |||
BorderThickness="0" | |||
Click="Button_Click" /> | |||
<Grid> | |||
<Grid Margin="0,40,0,0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.15*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Name="infoType" | |||
Grid.Column="1" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
Foreground="DeepSkyBlue" /> | |||
<TextBlock | |||
Name="icon" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontFamily="../../Fonts/#iconfont" | |||
FontSize="30" | |||
Foreground="DeepSkyBlue" | |||
Text="" /> | |||
<TextBlock | |||
Name="info" | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="DeepSkyBlue" | |||
Text="警告:" | |||
TextWrapping="Wrap" /> | |||
@@ -77,7 +84,7 @@ | |||
Width="90" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Click="Cancel_Click" | |||
Click="Cancel_Click" | |||
Content="取消" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
@@ -98,10 +105,5 @@ | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -23,6 +23,7 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
public PromptView() | |||
{ | |||
InitializeComponent(); | |||
this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
} | |||
public string TextBlockIcon | |||
@@ -1,16 +1,73 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Border x:Name="br" > | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<Border x:Name="br"> | |||
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Canvas | |||
Width="{Binding ElementName=br, Path=ActualWidth}" | |||
Height="{Binding ElementName=br, Path=ActualHeight}" | |||
Margin="5"> | |||
<Rectangle | |||
Canvas.Top="20" | |||
Width="{Binding ElementName=br, Path=ActualWidth}" | |||
Height="5" | |||
HorizontalAlignment="Center" | |||
RadiusX="1" | |||
RadiusY="1"> | |||
<Rectangle.Fill> | |||
<LinearGradientBrush> | |||
<GradientStop Offset="0" Color="LightGray" /> | |||
<GradientStop Offset="0.5" Color="White" /> | |||
<GradientStop Offset="1" Color="LightGray" /> | |||
</LinearGradientBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<Rectangle | |||
x:Name="recDown" | |||
Width="{Binding ElementName=br, Path=ActualWidth}" | |||
Height="5" | |||
Margin="0,80,0,0" | |||
HorizontalAlignment="Center" | |||
RadiusX="1" | |||
RadiusY="1"> | |||
<Rectangle.Fill> | |||
<LinearGradientBrush> | |||
<GradientStop Offset="0" Color="LightGray" /> | |||
<GradientStop Offset="0.5" Color="White" /> | |||
<GradientStop Offset="1" Color="LightGray" /> | |||
</LinearGradientBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<Path | |||
x:Name="belt" | |||
Canvas.Left="10" | |||
Canvas.Top="20" | |||
StrokeDashArray="2" | |||
StrokeThickness="20"> | |||
<Path.Stroke> | |||
<LinearGradientBrush> | |||
<GradientStop Offset="0" Color="SlateGray" /> | |||
<GradientStop Offset="0.5" Color="White" /> | |||
<GradientStop Offset="1" Color="SlateGray" /> | |||
</LinearGradientBrush> | |||
</Path.Stroke> | |||
</Path> | |||
</Canvas> | |||
</Viewbox> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup Name="StockGroup"> | |||
<VisualState Name="RunState"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
Storyboard.TargetName="belt" | |||
Storyboard.TargetProperty="StrokeDashOffset" | |||
@@ -19,12 +76,11 @@ | |||
Duration="0:0:20" /> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="Stop"> | |||
</VisualState> | |||
<VisualState Name="Stop" /> | |||
</VisualStateGroup> | |||
<VisualStateGroup Name="DirectionGroup"> | |||
<VisualState Name="LeftState"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
Storyboard.TargetName="belt" | |||
Storyboard.TargetProperty="StrokeDashOffset" | |||
@@ -34,7 +90,7 @@ | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="RightState"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
Storyboard.TargetName="belt" | |||
Storyboard.TargetProperty="StrokeDashOffset" | |||
@@ -45,40 +101,5 @@ | |||
</VisualState> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Canvas Width="{Binding ElementName=br, Path=ActualWidth}" Height="{Binding ElementName=br, Path=ActualHeight}" Margin="5"> | |||
<Rectangle HorizontalAlignment="Center" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" Canvas.Top="20" RadiusX="1" RadiusY="1"> | |||
<Rectangle.Fill> | |||
<LinearGradientBrush > | |||
<GradientStop Color="LightGray" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.5"/> | |||
<GradientStop Color="LightGray" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<Rectangle HorizontalAlignment="Center" x:Name="recDown" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" RadiusX="1" RadiusY="1" Margin="0,80,0,0"> | |||
<Rectangle.Fill> | |||
<LinearGradientBrush > | |||
<GradientStop Color="LightGray" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.5"/> | |||
<GradientStop Color="LightGray" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<Path x:Name="belt" Canvas.Top="20" Canvas.Left="10" | |||
StrokeDashArray="2" StrokeThickness="20"> | |||
<Path.Stroke> | |||
<LinearGradientBrush> | |||
<GradientStop Color="SlateGray" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.5"/> | |||
<GradientStop Color="SlateGray" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Path.Stroke> | |||
</Path> | |||
</Canvas> | |||
</Viewbox> | |||
</Border> | |||
</UserControl> |
@@ -1,80 +1,25 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10"/> | |||
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10" /> | |||
</UserControl.Resources> | |||
<Border HorizontalAlignment="Center"> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup Name="StockGroup"> | |||
<VisualState Name="OpenState"> | |||
<Storyboard> | |||
<DoubleAnimation Duration="00:0:1" From="0" To="200" | |||
Storyboard.TargetProperty="Width" | |||
Storyboard.TargetName="stock"/> | |||
<DoubleAnimation Duration="00:0:1" From="0" To="70" | |||
Storyboard.TargetProperty="Height" | |||
Storyboard.TargetName="stock"/> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="CloseState"> | |||
<Storyboard> | |||
<DoubleAnimation Duration="00:0:1" From="200" To="0" | |||
Storyboard.TargetProperty="Width" | |||
Storyboard.TargetName="stock"/> | |||
<DoubleAnimation Duration="00:0:1" From="70" To="0" | |||
Storyboard.TargetProperty="Height" | |||
Storyboard.TargetName="stock"/> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup Name="RunStateGroup"> | |||
<VisualState Name="RunState"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames | |||
Storyboard.TargetName="gsGreen" | |||
Storyboard.TargetProperty="Color"> | |||
<DiscreteColorKeyFrame Value="Green" KeyTime="0"/> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="Stop"/> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="FaultStateGroup"> | |||
<VisualState Name="FaultState"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames RepeatBehavior="Forever" | |||
Storyboard.TargetName="gsRed1" | |||
Storyboard.TargetProperty="Color"> | |||
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:0.5"/> | |||
<DiscreteColorKeyFrame Value="Gray" KeyTime="0:0:1"/> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="NormalState"/> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="LayOffStateGroup"> | |||
<VisualState Name="LayOffState"> | |||
<Storyboard> | |||
<DoubleAnimationUsingPath Duration="0:0:1" PathGeometry="{StaticResource move}" RepeatBehavior="Forever" | |||
Storyboard.TargetName="arrow" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" Source="Y"></DoubleAnimationUsingPath> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="LayStopState"> | |||
</VisualState> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Canvas Width="205" Height="245" Margin="5"> | |||
<Polygon Points="0,80 20,40 205,40 185,80" Canvas.Left="67"> | |||
<Canvas | |||
Width="205" | |||
Height="245" | |||
Margin="5"> | |||
<Polygon Canvas.Left="67" Points="0,80 20,40 205,40 185,80"> | |||
<Polygon.RenderTransform> | |||
<SkewTransform AngleX="-40" /> | |||
</Polygon.RenderTransform> | |||
@@ -84,35 +29,49 @@ | |||
<GradientStop Color="WhiteSmoke" Offset="0.85"/> | |||
<GradientStop Color="LightGray" Offset="1"/> | |||
</LinearGradientBrush>--> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill"/> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill" /> | |||
</Polygon.Fill> | |||
</Polygon> | |||
<Polygon Width="200" Height="70" Points="45,70 60,50 170,50 155,70" Stroke="Gray" StrokeThickness="2" Canvas.Left="67"> | |||
<Polygon | |||
Canvas.Left="67" | |||
Width="200" | |||
Height="70" | |||
Points="45,70 60,50 170,50 155,70" | |||
Stroke="Gray" | |||
StrokeThickness="2"> | |||
<Polygon.RenderTransform> | |||
<SkewTransform AngleX="-40" /> | |||
</Polygon.RenderTransform> | |||
</Polygon> | |||
<Polygon x:Name="stock" Width="0" Height="0" Points="45,70 60,50 170,50 155,70" Canvas.Left="67" > | |||
<Polygon | |||
x:Name="stock" | |||
Canvas.Left="67" | |||
Width="0" | |||
Height="0" | |||
Points="45,70 60,50 170,50 155,70"> | |||
<Polygon.Fill> | |||
<SolidColorBrush Color="DimGray"/> | |||
<SolidColorBrush Color="DimGray" /> | |||
</Polygon.Fill> | |||
<Polygon.RenderTransform> | |||
<SkewTransform AngleX="-40" /> | |||
</Polygon.RenderTransform> | |||
</Polygon> | |||
<Polygon Points="-5,90 0,80 185,80 180,90" Panel.ZIndex="1" > | |||
<Polygon Panel.ZIndex="1" Points="-5,90 0,80 185,80 180,90"> | |||
<Polygon.Fill> | |||
<LinearGradientBrush> | |||
<GradientStop Color="LightGray" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.66"/> | |||
<GradientStop Color="LightGray" Offset="0.95"/> | |||
<GradientStop Offset="0" Color="LightGray" /> | |||
<GradientStop Offset="0.66" Color="White" /> | |||
<GradientStop Offset="0.95" Color="LightGray" /> | |||
</LinearGradientBrush> | |||
</Polygon.Fill> | |||
</Polygon> | |||
<Grid Width="185" Height="160" Canvas.Top="80"> | |||
<Grid | |||
Canvas.Top="80" | |||
Width="185" | |||
Height="160"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill"/> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill" /> | |||
</Grid.Background> | |||
<!--<Grid VerticalAlignment="Bottom" Height="20" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
@@ -134,7 +93,7 @@ | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button Width="60" Grid.Column="1"> | |||
@@ -156,37 +115,65 @@ | |||
</Button> | |||
</Grid>--> | |||
</Grid> | |||
<Grid Width="185" Height="60" Canvas.Top="90"> | |||
<Grid | |||
Canvas.Top="90" | |||
Width="185" | |||
Height="60"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg"/> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" /> | |||
</Grid.Background> | |||
<Grid.RenderTransform> | |||
<TranslateTransform X="-5"/> | |||
<TranslateTransform X="-5" /> | |||
</Grid.RenderTransform> | |||
<TextBox x:Name="stockName" Width="58" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Background="Transparent" | |||
BorderThickness="0" VerticalContentAlignment="Center" FontSize="13" Foreground="DarkSlateGray"> | |||
</TextBox> | |||
<TextBox | |||
x:Name="stockName" | |||
Width="58" | |||
Height="50" | |||
HorizontalAlignment="Left" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
FontSize="13" | |||
Foreground="DarkSlateGray" /> | |||
<Border Width="80" Height="50" BorderBrush="DimGray " BorderThickness="2" CornerRadius="5" Margin="15,0,0,0"> | |||
<StackPanel > | |||
<TextBlock HorizontalAlignment="Center" FontSize="12" Text="剩余重量" FontFamily="幼圆" Margin="0,2,0,5"/> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock x:Name="stockWeight" HorizontalAlignment="Center" FontSize="16" /> | |||
<TextBlock Text="Kg" FontSize="16"/> | |||
<Border | |||
Width="80" | |||
Height="50" | |||
Margin="15,0,0,0" | |||
BorderBrush="DimGray " | |||
BorderThickness="2" | |||
CornerRadius="5"> | |||
<StackPanel> | |||
<TextBlock | |||
Margin="0,2,0,5" | |||
HorizontalAlignment="Center" | |||
FontFamily="幼圆" | |||
FontSize="12" | |||
Text="剩余重量" /> | |||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> | |||
<TextBlock | |||
x:Name="stockWeight" | |||
HorizontalAlignment="Center" | |||
FontSize="16" /> | |||
<TextBlock FontSize="16" Text="Kg" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Border> | |||
</Grid> | |||
<Grid Width="40" Height="60" Canvas.Top="90" Canvas.Left="180"> | |||
<Grid | |||
Canvas.Left="180" | |||
Canvas.Top="90" | |||
Width="40" | |||
Height="60"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill"/> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill" /> | |||
</Grid.Background> | |||
<Grid.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform ScaleX="0.119"/> | |||
<SkewTransform AngleY="-65.5"/> | |||
<ScaleTransform ScaleX="0.119" /> | |||
<SkewTransform AngleY="-65.5" /> | |||
</TransformGroup> | |||
</Grid.RenderTransform> | |||
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10"> | |||
@@ -202,35 +189,44 @@ | |||
<Border Background="#FFAAAAAA" Margin="2"/> | |||
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/> | |||
</Grid>--> | |||
</Grid > | |||
<Path x:Name="arrow" Canvas.Top="175" Canvas.Left="113" Visibility="Collapsed" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z"> | |||
</Grid> | |||
<Path | |||
x:Name="arrow" | |||
Canvas.Left="113" | |||
Canvas.Top="175" | |||
Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z" | |||
Visibility="Collapsed"> | |||
<Path.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90"/> | |||
<TranslateTransform Y="0"/> | |||
<RotateTransform Angle="90" /> | |||
<TranslateTransform Y="0" /> | |||
</TransformGroup> | |||
</Path.RenderTransform> | |||
<Path.Fill> | |||
<LinearGradientBrush> | |||
<LinearGradientBrush.RelativeTransform> | |||
<RotateTransform Angle="-15"/> | |||
<RotateTransform Angle="-15" /> | |||
</LinearGradientBrush.RelativeTransform> | |||
<GradientStop Color="LightGray" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.4"/> | |||
<GradientStop Color="AntiqueWhite" Offset="1"/> | |||
<GradientStop Offset="0" Color="LightGray" /> | |||
<GradientStop Offset="0.4" Color="White" /> | |||
<GradientStop Offset="1" Color="AntiqueWhite" /> | |||
</LinearGradientBrush> | |||
</Path.Fill> | |||
</Path> | |||
<!--<Path Data="M 95,190 L 95,200" Stroke="Red"/>--> | |||
<Grid Width="185" Height="160" Canvas.Top="80" Canvas.Left="185"> | |||
<Grid | |||
Canvas.Left="185" | |||
Canvas.Top="80" | |||
Width="185" | |||
Height="160"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg"/> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" /> | |||
</Grid.Background> | |||
<Grid.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform ScaleX="0.288"/> | |||
<SkewTransform AngleY="-36.8"/> | |||
<ScaleTransform ScaleX="0.288" /> | |||
<SkewTransform AngleY="-36.8" /> | |||
</TransformGroup> | |||
</Grid.RenderTransform> | |||
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10"> | |||
@@ -264,24 +260,109 @@ | |||
</Grid>--> | |||
</Grid> | |||
<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="100"> | |||
<Border | |||
Canvas.Left="150" | |||
Canvas.Top="100" | |||
Width="18" | |||
Height="18" | |||
CornerRadius="10"> | |||
<Border.Background> | |||
<RadialGradientBrush> | |||
<GradientStop Color="Gray" Offset="0.6" x:Name="gsGreen"/> | |||
<GradientStop Color="White"/> | |||
<GradientStop x:Name="gsGreen" Offset="0.6" Color="Gray" /> | |||
<GradientStop Color="White" /> | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="125" > | |||
<Border | |||
Canvas.Left="150" | |||
Canvas.Top="125" | |||
Width="18" | |||
Height="18" | |||
CornerRadius="10"> | |||
<Border.Background> | |||
<RadialGradientBrush> | |||
<GradientStop Color="Gray" Offset="0.6" x:Name="gsRed1"/> | |||
<GradientStop Color="White"/> | |||
<GradientStop x:Name="gsRed1" Offset="0.6" Color="Gray" /> | |||
<GradientStop Color="White" /> | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
</Canvas> | |||
</Viewbox> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup Name="StockGroup"> | |||
<VisualState Name="OpenState"> | |||
<Storyboard> | |||
<DoubleAnimation | |||
Storyboard.TargetName="stock" | |||
Storyboard.TargetProperty="Width" | |||
From="0" | |||
To="200" | |||
Duration="00:0:1" /> | |||
<DoubleAnimation | |||
Storyboard.TargetName="stock" | |||
Storyboard.TargetProperty="Height" | |||
From="0" | |||
To="70" | |||
Duration="00:0:1" /> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="CloseState"> | |||
<Storyboard> | |||
<DoubleAnimation | |||
Storyboard.TargetName="stock" | |||
Storyboard.TargetProperty="Width" | |||
From="200" | |||
To="0" | |||
Duration="00:0:1" /> | |||
<DoubleAnimation | |||
Storyboard.TargetName="stock" | |||
Storyboard.TargetProperty="Height" | |||
From="70" | |||
To="0" | |||
Duration="00:0:1" /> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup Name="RunStateGroup"> | |||
<VisualState Name="RunState"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gsGreen" Storyboard.TargetProperty="Color"> | |||
<DiscreteColorKeyFrame KeyTime="0" Value="Green" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="Stop" /> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="FaultStateGroup"> | |||
<VisualState Name="FaultState"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames | |||
RepeatBehavior="Forever" | |||
Storyboard.TargetName="gsRed1" | |||
Storyboard.TargetProperty="Color"> | |||
<DiscreteColorKeyFrame KeyTime="0:0:0.5" Value="Red" /> | |||
<DiscreteColorKeyFrame KeyTime="0:0:1" Value="Gray" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="NormalState" /> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="LayOffStateGroup"> | |||
<VisualState Name="LayOffState"> | |||
<Storyboard> | |||
<DoubleAnimationUsingPath | |||
PathGeometry="{StaticResource move}" | |||
RepeatBehavior="Forever" | |||
Source="Y" | |||
Storyboard.TargetName="arrow" | |||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" | |||
Duration="0:0:1" /> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="LayStopState" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
</Border> | |||
</UserControl> |
@@ -210,7 +210,7 @@ namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null) | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1}); | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 }); | |||
} | |||
} | |||
else | |||
@@ -567,7 +567,7 @@ namespace BPASmartClient.Modbus | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show(ex.ToString()); | |||
ShowEx?.Invoke(ex.ToString()); | |||
tcpClient = null; | |||
Connect(); | |||
} | |||
@@ -38,6 +38,15 @@ namespace BPASmartClient.Model | |||
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } } | |||
private ushort _mRawMaterialSource; | |||
/// <summary> | |||
/// 选中索引 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } } | |||
private int _mSelectIndex; | |||
/// <summary> | |||
/// 原料类型 MW18 | |||
/// 1:液体 | |||
@@ -22,7 +22,7 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels | |||
RecipeName = tempRecipeInfo.RecipeName; | |||
tempRecipeInfo.SiloInfoModels.ToList()?.ForEach(item => | |||
{ | |||
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p.Contains(item.SiloName)); | |||
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p == item.SiloName); | |||
SiloInfos.Add(new RecipeRawMaterialInfo() { SiloName = item.SiloName, SiloWeight = item.SiloWeight, SelectIndex = tempIndex }); | |||
}); | |||
Index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == tempRecipeInfo.RecipeName); | |||
@@ -11,7 +11,6 @@ using BPASmartClient.CustomResource.Pages.Enums; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.CustomResource.Pages.ViewModel; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Nfc; | |||
@@ -27,10 +26,12 @@ namespace BPASmartClient.DosingSystem | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | |||
MenuInit(); | |||
DataInit(); | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
MainView mv = new MainView(); | |||
//mv.Show(); | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
@@ -55,7 +56,7 @@ namespace BPASmartClient.DosingSystem | |||
private void MenuInit() | |||
{ | |||
NfcServer.GetInstance.Init(); | |||
//NfcServer.GetInstance.Init(); | |||
#region 配方管理菜单 | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
@@ -1,28 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ActionMenu : ObservableObject | |||
{ | |||
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } } | |||
private string _mCommandParameter; | |||
//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } } | |||
//private Permission[] _mpermission; | |||
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } } | |||
private string _mMenuName; | |||
//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } } | |||
//private string _mNameSpace; | |||
} | |||
} |
@@ -5,7 +5,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class AlarmInfo | |||
{ | |||
@@ -1,17 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ConveyorServer | |||
{ | |||
public ConveyorServer() | |||
{ | |||
} | |||
} | |||
} |
@@ -5,7 +5,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class CylinderStatusModel : ObservableObject | |||
{ | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceAddress | |||
{ | |||
@@ -5,7 +5,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceCurrentStatus : ObservableObject | |||
{ | |||
@@ -12,7 +12,7 @@ using System.Net.NetworkInformation; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceInquire | |||
{ | |||
@@ -71,7 +71,11 @@ namespace BPASmartClient.DosingSystem.Model | |||
DeviceNum = i + 1, | |||
Weight = new Random().Next(100, 10000) / 100.0 | |||
}); | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() | |||
{ | |||
DeviceIp = $"192.168.1.{i + 1}", | |||
RawMaterialName = $"测试设备{i + 1}", | |||
}); | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
@@ -87,7 +91,11 @@ namespace BPASmartClient.DosingSystem.Model | |||
DeviceNum = i + 1, | |||
Weight = new Random().Next(100, 10000) / 100.0 | |||
}); | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() | |||
{ | |||
DeviceIp = $"192.168.1.{i + 1}", | |||
RawMaterialName = $"测试设备{i + 1}", | |||
}); | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
@@ -337,7 +345,7 @@ namespace BPASmartClient.DosingSystem.Model | |||
if (modbusTcp.Connected) | |||
{ | |||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||
string returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
//配料设备参数写入 | |||
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | |||
if (res != null) | |||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DevicePar | |||
{ | |||
@@ -5,7 +5,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceParModel : ObservableObject | |||
{ | |||
@@ -1,15 +0,0 @@ | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class GlobalData | |||
{ | |||
} | |||
} |
@@ -7,12 +7,12 @@ using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using BPASmartClient.Model; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class LocaPar | |||
{ | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||
} |
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class RawMaterialDeviceStatus | |||
{ | |||
@@ -8,7 +8,7 @@ using System.Threading.Tasks; | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
@@ -5,7 +5,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class RecipeProcess : ObservableObject | |||
{ | |||
@@ -5,15 +5,15 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
internal class StockStatusModel:ObservableObject | |||
public class StockStatusModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 料仓物料重量 | |||
/// </summary> | |||
private double _materialWeight; | |||
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value;OnPropertyChanged(); } } | |||
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 料仓物料名称 | |||
/// </summary> | |||
@@ -30,6 +30,13 @@ namespace BPASmartClient.DosingSystem.Model | |||
private bool _isLayOff; | |||
public bool IsLayOff { get { return _isLayOff; } set { _isLayOff = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 打开状态 | |||
/// </summary> | |||
public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } } | |||
private bool _mIsOpen; | |||
/// <summary> | |||
/// 是否故障报警 | |||
/// </summary> | |||
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class ViewModelBase : ObservableObject | |||
{ | |||
public int Index { get; set; } = -1; | |||
public RelayCommand AddCommand { get; set; }//添加 | |||
public RelayCommand CancelCommand { get; set; }//取消 | |||
public RelayCommand SaveCommand { get; set; }//保存 | |||
public RelayCommand<object> RemoveCommand { get; set; }//移除 | |||
public RelayCommand<object> DetailsCommand { get; set; }//编辑 | |||
/// <summary> | |||
/// 错误信息 | |||
/// </summary> | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo = string.Empty; | |||
} | |||
} |
@@ -104,14 +104,14 @@ | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding ConfirmCommand}" | |||
Command="{Binding AddCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="148" | |||
Height="30" | |||
Command="{Binding CancleCommand}" | |||
Command="{Binding CancelCommand}" | |||
Content="取消" /> | |||
</Grid> | |||
@@ -126,7 +126,7 @@ | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
FontSize="16" | |||
@@ -52,328 +52,311 @@ | |||
<UserControl.DataContext> | |||
<vm:ManualControlViewModel /> | |||
</UserControl.DataContext> | |||
<Grid Margin="8"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 升降气缸--> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="0" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
Height="{Binding ElementName=cy, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="升降气缸控制" /> | |||
<ListView | |||
Grid.Row="1" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding cylinderModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
<ScrollViewer> | |||
<StackPanel Margin="8"> | |||
<!--#region 升降气缸--> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="0" | |||
Margin="5"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
Height="{Binding ElementName=cy, Path=ActualHeight}" /> | |||
<StackPanel Background="Transparent"> | |||
<Grid Height="40"> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 阻挡气缸--> | |||
<Grid | |||
Name="zd" | |||
Grid.Row="1" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=zd, Path=ActualWidth}" | |||
Height="{Binding ElementName=zd, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="阻挡气缸控制" /> | |||
<ListView | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,10,0,0" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="升降气缸控制" /> | |||
</Grid> | |||
<ListView | |||
Name="list1" | |||
Grid.Row="1" | |||
Margin="0,0,0,20" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding cylinderModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</StackPanel> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 阻挡气缸--> | |||
<Grid | |||
Name="zd" | |||
Grid.Row="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BlockCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
Margin="5"> | |||
<pry:ImageBorder Width="{Binding ElementName=zd, Path=ActualWidth}" Height="{Binding ElementName=zd, Path=ActualHeight}" /> | |||
<StackPanel> | |||
<Grid Height="40"> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 托盘气缸--> | |||
<Grid | |||
Name="tp" | |||
Grid.Row="2" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
Height="{Binding ElementName=tp, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="托盘气缸控制" /> | |||
<ListView | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="阻挡气缸控制" /> | |||
</Grid> | |||
<ListView | |||
Name="list2" | |||
Grid.Row="1" | |||
Margin="0,0,0,20" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BlockCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</StackPanel> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 托盘气缸--> | |||
<Grid | |||
Name="tp" | |||
Grid.Row="2" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding PalletCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
Margin="5"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
Height="{Binding ElementName=tp, Path=ActualHeight}" /> | |||
<StackPanel> | |||
<Grid Height="40"> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="托盘气缸控制" /> | |||
</Grid> | |||
<ListView | |||
Name="list3" | |||
Grid.Row="2" | |||
Margin="0,0,0,20" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding PalletCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</StackPanel> | |||
</Grid> | |||
<!--#endregion--> | |||
</StackPanel> | |||
</ScrollViewer> | |||
</UserControl> |
@@ -23,6 +23,14 @@ namespace BPASmartClient.DosingSystem.View | |||
public ManualControlView() | |||
{ | |||
InitializeComponent(); | |||
this.SizeChanged += ManualControlView_SizeChanged; | |||
} | |||
private void ManualControlView_SizeChanged(object sender, SizeChangedEventArgs e) | |||
{ | |||
this.cy.Height = this.list1.ActualHeight + 40; | |||
this.zd.Height = this.list2.ActualHeight + 40; | |||
this.tp.Height = this.list3.ActualHeight + 40; | |||
} | |||
} | |||
} |
@@ -173,7 +173,7 @@ | |||
Foreground="#FF2AB2E7" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="0" | |||
SelectedIndex="{Binding SelectIndex}" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
@@ -101,10 +101,11 @@ | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
<!--<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
Columns="8" />--> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
@@ -113,6 +114,7 @@ | |||
<Grid | |||
Name="tt" | |||
Width="180" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
@@ -252,7 +254,7 @@ | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
@@ -270,7 +272,7 @@ | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
@@ -24,6 +25,12 @@ namespace BPASmartClient.DosingSystem.View | |||
public RecipeSettingsView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += RecipeSettingsView_Unloaded; | |||
} | |||
private void RecipeSettingsView_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<LocaPar>.Save(); | |||
} | |||
//public static void SetAlignment() | |||
@@ -1,37 +1,82 @@ | |||
<UserControl x:Class="BPASmartClient.DosingSystem.View.StockControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
xmlns:define="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.StockControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:define="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Opacity="0.8"> | |||
<ContentControl | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="{TemplateBinding FontSize}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="image" | |||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:StockControViewModel/> | |||
<vm:StockControViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid x:Name="TopGrid"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition Height="0.2*"/> | |||
<RowDefinition Height="0.2*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<ListView | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding statusTop}"> | |||
ItemsSource="{Binding statusTop}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid Columns="6" HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -39,107 +84,109 @@ | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.8*"/> | |||
<RowDefinition Height="0.2*"/> | |||
<RowDefinition Height="0.8*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<define:MaterialStock Margin="0,0,70,0" IsOpenState="False" IsFaultState="False" IsRunning="False" IsLayOffState="False"/> | |||
<Grid VerticalAlignment="Bottom" Margin="5,5,70,0" Grid.Row="1" > | |||
<define:MaterialStock | |||
Margin="35,0,35,0" | |||
IsFaultState="{Binding IsFault}" | |||
IsLayOffState="{Binding IsLayOff}" | |||
IsOpenState="{Binding IsOpen}" | |||
IsRunning="{Binding IsRunning}" /> | |||
<Grid Grid.Row="1" VerticalAlignment="Bottom"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button Margin="0,0,10,0"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br3" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="yellow" TargetName="br3"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button Grid.Column="1"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br2" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="lawngreen" TargetName="br2"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="开盖" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Grid.Column="1" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="出料" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<Grid Grid.Row="1" x:Name="midGrid" Margin="0,0,0,0"> | |||
<define:ConveyBelt2 IsRun="True" BeltWidth="{Binding ElementName=midGrid, Path=ActualWidth}" BeltHeight="{Binding ElementName=midGrid, Path=ActualHeight}" Margin="-12,0,10,0" BeltDashThickess="50"/> | |||
<Grid | |||
x:Name="midGrid" | |||
Grid.Row="1" | |||
Margin="0,0,0,0" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<define:ConveyBelt2 | |||
Grid.RowSpan="2" | |||
Margin="-12,0,10,0" | |||
BeltDashThickess="50" | |||
BeltHeight="{Binding ElementName=midGrid, Path=ActualHeight}" | |||
BeltWidth="{Binding ElementName=midGrid, Path=ActualWidth}" | |||
IsRun="False" /> | |||
<StackPanel | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
Orientation="Horizontal"> | |||
<RadioButton | |||
Width="130" | |||
Height="50" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="输送带启动" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Width="130" | |||
Height="50" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="输送带停止" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.2*"/> | |||
<RowDefinition/> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,40,0"> | |||
<Button HorizontalAlignment="Right" Margin="0,0,10,0"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br5" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="启动线体" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="lawngreen" TargetName="br5"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button HorizontalAlignment="Right" Margin="0,0,10,0"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br5" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Red"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="停止线体" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="PaleVioletRed" TargetName="br5"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</StackPanel> | |||
<ListView Grid.Row="1" Background="Transparent" VerticalAlignment="Center" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |||
BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding statusDown}"> | |||
<ListView | |||
Grid.Row="0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding statusDown}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid Columns="6" HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -147,50 +194,37 @@ | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.8*"/> | |||
<RowDefinition Height="0.2*"/> | |||
<RowDefinition Height="0.8*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<define:MaterialStock Margin="0,0,70,0" IsOpenState="False" IsFaultState="False" IsRunning="True" /> | |||
<Grid VerticalAlignment="Bottom" Margin="5,5,70,0" Grid.Row="1" > | |||
<define:MaterialStock | |||
Margin="35,0,35,0" | |||
IsFaultState="{Binding IsFault}" | |||
IsLayOffState="{Binding IsLayOff}" | |||
IsOpenState="{Binding IsOpen}" | |||
IsRunning="{Binding IsRunning}" /> | |||
<Grid Grid.Row="1" VerticalAlignment="Bottom"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button Margin="0,0,10,0"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="yellow" TargetName="br"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button Grid.Column="1"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="br1" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock VerticalAlignment="Center" Text="" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/> | |||
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" Value="lawngreen" TargetName="br1"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
<Button | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="开盖" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Grid.Column="1" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="出料" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</DataTemplate> | |||
@@ -4,14 +4,14 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ChangeDeviceNameViewModel : ObservableObject | |||
public class ChangeDeviceNameViewModel : ViewModelBase | |||
{ | |||
public ChangeDeviceNameViewModel() | |||
{ | |||
@@ -20,8 +20,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (o != null && o is string str) IpAddress = str; | |||
}), "ChangeDeviceNameViewOpen"); | |||
CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); }); | |||
ConfirmCommand = new RelayCommand(() => | |||
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); }); | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
if (string.IsNullOrEmpty(DeviceName)) | |||
{ | |||
@@ -58,13 +58,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
private static string IpAddress = string.Empty; | |||
public RelayCommand ConfirmCommand { get; set; } | |||
//public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand CancleCommand { get; set; } | |||
//public RelayCommand CancleCommand { get; set; } | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
//private string _mErrorInfo; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
@@ -10,15 +10,15 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceListViewModel : ObservableObject | |||
public class DeviceListViewModel : ViewModelBase | |||
{ | |||
public DeviceListViewModel() | |||
{ | |||
ChangeNameCommand = new RelayCommand<object>((o) => | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
@@ -30,7 +30,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
devices = DeviceInquire.GetInstance.devices; | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
//public RelayCommand<object> ChangeNameCommand { get; set; } | |||
//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
public ObservableCollection<Devices> devices { get; set; } | |||
@@ -5,7 +5,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
@@ -14,7 +14,7 @@ using System.Diagnostics; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceMaterialParViewModel : ObservableObject | |||
public class DeviceMaterialParViewModel : ViewModelBase | |||
{ | |||
public DeviceMaterialParViewModel() | |||
{ | |||
@@ -60,10 +60,10 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
//public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
//public RelayCommand AddCommand { get; set; } | |||
//public RelayCommand SaveCommand { get; set; } | |||
} | |||
} |
@@ -9,7 +9,7 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
@@ -1,5 +1,5 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
@@ -13,28 +13,28 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.ViewModel; | |||
public class NewMaterialViewModel:ObservableObject | |||
public class NewMaterialViewModel : ViewModelBase | |||
{ | |||
public ObservableCollection<RawMaterialModel> Materials { get; set; } = Json<LocaMaterial>.Data.LocalMaterails; | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName = string.Empty; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
//private string _mErrorInfo; | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
//public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
//public RelayCommand SaveCommand { get; set; } | |||
private void Remove(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
if (o is string id) | |||
{ | |||
var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id); | |||
var res = Materials.FirstOrDefault(p => p.RawMaterialId == id); | |||
Materials.Remove(res); | |||
Json<LocaMaterial>.Save(); | |||
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); | |||
@@ -47,10 +47,10 @@ public class NewMaterialViewModel:ObservableObject | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空";return; } | |||
if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称";return;} | |||
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;} | |||
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 }); | |||
if (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; } | |||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; } | |||
if (Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复"; return; } | |||
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString(), RawMaterialSource = 0 }); | |||
Json<LocaMaterial>.Save(); | |||
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); | |||
}); | |||
@@ -7,13 +7,14 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewRecipeViewModel : ObservableObject | |||
public class NewRecipeViewModel : ViewModelBase | |||
{ | |||
public NewRecipeViewModel() | |||
{ | |||
@@ -24,11 +25,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
RecipeName = rm.RecipeName; | |||
foreach (var item in rm.RawMaterials) | |||
{ | |||
item.SelectIndex = Array.FindIndex(RawMaterialNames.ToArray(), p => p == item.RawMaterialName); | |||
RawMaterials.Add(item); | |||
} | |||
RecipCode = rm.RecipCode; | |||
Index = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName); | |||
} | |||
}), "Details"); | |||
}), "Details", true); | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
@@ -55,72 +58,88 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
ErrorInfo = String.Empty; | |||
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; } | |||
for (int i = 0; i < RawMaterials.Count; i++) | |||
{ | |||
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (res != null) | |||
{ | |||
RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP | |||
RawMaterials.ElementAt(i).RawMaterialSource = 1; | |||
} | |||
var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (su != null) | |||
{ | |||
RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource; | |||
} | |||
} | |||
if (string.IsNullOrEmpty(RecipeName)) { ErrorInfo = "请输入配方名称"; return; } | |||
if (RecipCode.Length <= 0)//新建配方 | |||
//编辑配方 | |||
if (Index >= 0 && Index < Json<LocaPar>.Data.Recipes.Count) | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
if (res >= 0 && res != Index) | |||
{ | |||
ErrorInfo = "该配方已存在,请重新输入"; | |||
ErrorInfo = "配方名称已经存在!"; | |||
return; | |||
} | |||
else | |||
Json<LocaPar>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName; | |||
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Clear(); | |||
RawMaterials.ToList()?.ForEach(item => | |||
{ | |||
AddRecipes(); | |||
} | |||
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Add(item); | |||
}); | |||
Json<LocaPar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{RecipeName} 配方编辑完成"); | |||
} | |||
else//修改配方 | |||
else //新建配方 | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
if (Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RecipeName = RecipeName; | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Clear(); | |||
foreach (var item in RawMaterials) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Add(item); | |||
} | |||
ErrorInfo = "配方名称已存在!"; | |||
return; | |||
} | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
{ | |||
RecipeName = RecipeName, | |||
RawMaterials = RawMaterials, | |||
}); | |||
Json<LocaPar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方成功!"); | |||
} | |||
//for (int i = 0; i < RawMaterials.Count; i++) | |||
//{ | |||
// var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
// if (res != null) | |||
// { | |||
// RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP | |||
// RawMaterials.ElementAt(i).RawMaterialSource = 1; | |||
// } | |||
// var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName); | |||
// if (su != null) | |||
// { | |||
// RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource; | |||
// } | |||
//} | |||
//if (RecipCode.Length <= 0)//新建配方 | |||
//{ | |||
// var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName); | |||
// if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
// { | |||
// ErrorInfo = "该配方已存在,请重新输入"; | |||
// } | |||
// else | |||
// { | |||
// AddRecipes(); | |||
// } | |||
//} | |||
//else//修改配方 | |||
//{ | |||
// var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode); | |||
// if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
// { | |||
// Json<LocaPar>.Data.Recipes.ElementAt(res).RecipeName = RecipeName; | |||
// Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Clear(); | |||
// foreach (var item in RawMaterials) | |||
// { | |||
// Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Add(item); | |||
// } | |||
// } | |||
//} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
//RawMaterialNames.Add("乳化剂"); | |||
//RawMaterialNames.Add("酶制剂"); | |||
//RawMaterialNames.Add("增味剂"); | |||
//RawMaterialNames.Add("营养强化剂"); | |||
//RawMaterialNames.Add("抗结剂"); | |||
//RawMaterialNames.Add("消泡剂"); | |||
//RawMaterialNames.Add("膨松剂"); | |||
//RawMaterialNames.Add("防腐剂"); | |||
//RawMaterialNames.Add("着色剂"); | |||
//RawMaterialNames.Add("甜味剂"); | |||
//RawMaterialNames.Add("酸味剂"); | |||
//RawMaterialNames.Add("增白剂"); | |||
//RawMaterialNames.Add("香料"); | |||
//RawMaterialNames.Add("抗氧化剂"); | |||
//RawMaterialNames.Add("食用香料"); | |||
//RawMaterialNames.Add("增稠剂"); | |||
if (Global.userInfo.permission == CustomResource.Pages.Enums.Permission.管理员) | |||
{ | |||
foreach (var item in Global.DeviceRawMaterials) | |||
@@ -170,14 +189,14 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName = string.Empty; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
//private string _mErrorInfo; | |||
public RelayCommand AddCommand { get; set; } | |||
//public RelayCommand AddCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
//public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
//public RelayCommand SaveCommand { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
@@ -9,7 +9,7 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
using System.Threading; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
@@ -9,7 +9,6 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.Model; | |||
@@ -46,27 +45,31 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o is string str) | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
if (MessageLog.GetInstance.ShowDialog($"是否删除【{str}】配方")) | |||
if (MessageLog.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning)) | |||
{ | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res); | |||
MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}"); | |||
Json<LocaPar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!"); | |||
MessageLog.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}"); | |||
} | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
ActionManage.GetInstance.CancelRegister("Details"); | |||
NewRecipeView nrv = new NewRecipeView(); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
} | |||
//MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | |||
} | |||
}); | |||
@@ -1,29 +1,54 @@ | |||
using BPASmartClient.DosingSystem.Model; | |||
| |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
internal class StockControViewModel | |||
public class StockControViewModel : ObservableObject | |||
{ | |||
public StockControViewModel() | |||
{ | |||
for (int i = 0; i < 6; i++) | |||
Task.Factory.StartNew(() => | |||
{ | |||
statusTop.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85+i }); | |||
} | |||
for (int i =6; i < 12; i++) | |||
{ | |||
statusDown.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85 + i }); | |||
} | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
for (int i = 0; i < 6; i++) | |||
{ | |||
statusTop.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i + 1}号料仓", MaterialWeight = 85 + i }); | |||
} | |||
for (int i = 6; i < 12; i++) | |||
{ | |||
statusDown.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i + 1}号料仓", MaterialWeight = 85 + i }); | |||
} | |||
}); | |||
}); | |||
StartConveyerBeltCommand = new RelayCommand(() => { ConveyerBeltWork = !ConveyerBeltWork; }); | |||
} | |||
//启动输送带 | |||
public RelayCommand StartConveyerBeltCommand { get; set; } | |||
//停止输送带 | |||
//public RelayCommand StopConveyerBeltCommand { get; set; } | |||
//开盖控制 | |||
public RelayCommand<object> UnCapControlCommand { get; set; } | |||
//放料控制 | |||
public RelayCommand<object> BlowingControlCommand { get; set; } | |||
public bool ConveyerBeltWork { get { return _mConveyerBeltWork; } set { _mConveyerBeltWork = value; OnPropertyChanged(); } } | |||
private bool _mConveyerBeltWork; | |||
public ObservableCollection<StockStatusModel> statusTop { get; set; } = new ObservableCollection<StockStatusModel>(); | |||
public ObservableCollection<StockStatusModel> statusDown { get; set; } = new ObservableCollection<StockStatusModel>(); | |||
} | |||