Bläddra i källkod

MILKTEA

样式分支
NXX 2 år sedan
förälder
incheckning
d25a7e6e83
29 ändrade filer med 2851 tillägg och 254 borttagningar
  1. +37
    -0
      BPASmartClient.CustomResource/Converters/OpacityConverter .cs
  2. Binär
     
  3. +583
    -1
      BPASmartClient.MilkWithTea/App.xaml
  4. +7
    -4
      BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj
  5. +31
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml
  6. +88
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs
  7. +57
    -0
      BPASmartClient.MilkWithTea/GLobal.cs
  8. +37
    -23
      BPASmartClient.MilkWithTea/MainWindow.xaml
  9. +178
    -1
      BPASmartClient.MilkWithTea/MainWindow.xaml.cs
  10. +299
    -0
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml
  11. +28
    -0
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml.cs
  12. +181
    -50
      BPASmartClient.MilkWithTea/View/MainControlView.xaml
  13. +12
    -2
      BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs
  14. +56
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml
  15. +30
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs
  16. +113
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml
  17. +34
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml.cs
  18. +211
    -0
      BPASmartClient.MilkWithTea/ViewModel/LocalConfigureViewModel.cs
  19. +236
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainControlViewModel.cs
  20. +37
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainWindowVeiwModel.cs
  21. +123
    -0
      BPASmartClient.MilkWithTea/ViewModel/PatrameterSettiongViewModel.cs
  22. +162
    -90
      BPASmartClient.MorkTM/Control_MorkTM.cs
  23. +9
    -2
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  24. +1
    -14
      BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs
  25. +79
    -40
      BPASmartClient.MorkTM/PolymerBatching.cs
  26. +213
    -18
      BPASmartClient.MorkTM/View/Debug.xaml
  27. +1
    -1
      BPASmartClient.MorkTM/View/Debug.xaml.cs
  28. +7
    -7
      BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs
  29. +1
    -1
      BPASmartClient.Peripheral/BasePeripheral.cs

+ 37
- 0
BPASmartClient.CustomResource/Converters/OpacityConverter .cs Visa fil

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class OpacityConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double returnValue = 0.2;
if (value != null && value is bool statusValue)
{
switch (statusValue)
{
case true:
returnValue = 1;
break;
case false:
returnValue = 0.2;
break;

}
}
return returnValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

Binär
Visa fil


+ 583
- 1
BPASmartClient.MilkWithTea/App.xaml Visa fil

@@ -4,6 +4,588 @@
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Grid">
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent"/>
<Border x:Name="Rectangle1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Tag" Value="Horizontal">
<Setter TargetName="Rectangle1" Property="Width" Value="Auto"/>
<Setter TargetName="Rectangle1" Property="Height" Value="7"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--滚动条样式-->
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Foreground" Value="LightGray"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="11"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="GridRoot" Width="14" Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--This is scrollbar track-->
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="True" Focusable="False">
<Track.Thumb>
<Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="PageUp" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="False"/>
</Track.IncreaseRepeatButton>
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="PageDown" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="False"/>
</Track.DecreaseRepeatButton>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Thumb" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter TargetName="GridRoot" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
<Setter TargetName="PART_Track" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="12"/>
<Setter TargetName="Thumb" Property="Tag" Value="Horizontal"/>
<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand"/>
<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--datagrid标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="Foreground" Value="DarkSlateGray" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="Black" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#FF31879E" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Height="{TemplateBinding Height}"
SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style x:Key="buttonNormal" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="#58B0ED"/>
<Setter Property="BorderBrush" Value="#FF707070"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#58B0ED "/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#58B0ED"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--下拉列表样式-->
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="IsExpanded" Value="False"></Setter>
<Setter Property="Margin" Value="40,20"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>

<Border BorderThickness="1" Background="White" BorderBrush="Black" CornerRadius="10" Padding="10,2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>

<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" VerticalAlignment="Center"/>
<ToggleButton x:Name="HeaderSite" Grid.Column="1" Background="Transparent"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource ExpanderToggleButtonStyle}" />
</Grid>
</Border>
<ContentPresenter x:Name="ExpandSite" Grid.Row="1"
ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value=" #E1FFFF"/>
</Trigger>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ExpanderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="宋体" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Width" Value="50"></Setter>
<Setter Property="Padding" Value="5 5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Canvas x:Name="canvNormal" Visibility="Visible"
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
<Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="10"/>
<Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
</Canvas>
<Canvas x:Name="canvChecked" Visibility="Hidden"
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
<Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
<Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="20"/>
</Canvas>

<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

</Canvas>

<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="SlateGray" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
<Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--GroupBox-->
<Style x:Key="GroupBoxStyle1" TargetType="{x:Type GroupBox}">
<Setter Property="BorderBrush" Value="#D5DFE5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="20"/>
<Setter Property="BorderThickness" Value="10"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupBox}">
<Grid SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="6"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="59"/>
<RowDefinition Height="*"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="0" Grid.RowSpan="4" Background="Transparent" Margin="0,-0.25,0,0.25">
<Border.Effect>
<DropShadowEffect Color="#FFAAAAAA" Direction="350"/>
</Border.Effect>
</Border>
<Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Right" Background="{x:Null}" Margin="0" Height="16.96" VerticalAlignment="Top"/>
<ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.RowSpan="1"/>
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
</Border>
</Border>
<Grid x:Name="HeaderGrid" Height="47.2" VerticalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="1" Margin="0,7.982,-16,3.818" Grid.Row="1" HorizontalAlignment="Right">
<Path Data="M12.19,0 L12.290733,14.847 -1.3000648E-08,14.847 z" Height="16.1" Margin="0,0,8.067,0" RenderTransformOrigin="0.499999978361064,0.499999995889058" Stretch="Fill" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="12.29" >
<Path.Fill>
<LinearGradientBrush EndPoint="0.466,2.201" StartPoint="0.5,0">
<GradientStop Color="#C66A6A6A" Offset="1"/>
<GradientStop Color="#E1434343" Offset="0.855"/>
<GradientStop Color="#FFC6C6C6" Offset="0.11"/>
</LinearGradientBrush>
</Path.Fill>
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90.087"/>
<TranslateTransform Y="-6.04399277075815" X="6.0531771644038841"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Border BorderBrush="Black" BorderThickness="0" Margin="0,8.061,0,0" CornerRadius="16,0,0,16" Background="White">
<Border.Effect>
<DropShadowEffect Direction="195" BlurRadius="10" Opacity="0.305" ShadowDepth="6"/>
</Border.Effect>
<Border x:Name="contentBorder" BorderBrush="Black" Margin="6,6,0,6" CornerRadius="16,0,0,16">
<Border.Background>
<LinearGradientBrush EndPoint="1.002,0.498" StartPoint="-0.024,0.502">
<GradientStop Color=" #4682B4" Offset="0.027"/>
<GradientStop Color=" #F0FFFF" Offset="0.994"/>
</LinearGradientBrush>
</Border.Background>
<Grid>
<ContentControl HorizontalAlignment="Left" Margin="20,0,23,0" VerticalAlignment="Center" Foreground="White">
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0" Width="212.323"/>
</ContentControl>
</Grid>
</Border>
</Border>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--Combox-->
<Style TargetType="{x:Type ComboBox}" x:Key="cmbstyle">
<Setter Property="Background" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border BorderThickness="0" CornerRadius="3" Width="{TemplateBinding Width}" Height="30" Background="{TemplateBinding Background}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="grid">
<ToggleButton
Width="{Binding ElementName=grid,Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}"
Content="{TemplateBinding Text}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5,0,0,0"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
>
<ToggleButton.Style >
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="0" >
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>

<Grid Grid.Column="1" >
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
ClickMode="Press">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<TextBlock Foreground="{TemplateBinding Foreground}" x:Name="arrow_tb" Text="&#xf02a9;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">

</Trigger>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>


<Border.Effect>
<DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>


</Style>
<!--开关按钮-->
<Style x:Key="OpenCheckBoxStyle1" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<ControlTemplate.Resources>
<Storyboard x:Key="OnChecking">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="45"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OnUnchecking">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.3000000" Value="1,1,1,1"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>

<DockPanel x:Name="dockPanel">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True" VerticalAlignment="Center"/>
<Grid Margin="5,5,0,5" Width="80" Background="#FFC0CCD9">
<TextBlock Text="OFF" TextWrapping="Wrap" FontWeight="Bold" FontSize="16" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0" Foreground="Red"/>
<TextBlock HorizontalAlignment="Left" Margin="2,0,0,0" FontSize="16" FontWeight="Bold" Text="ON" VerticalAlignment="Center" TextWrapping="Wrap" Foreground="#008000"/>
<Border HorizontalAlignment="Left" x:Name="slider" Width="33" BorderThickness="1,1,1,1" CornerRadius="3,3,3,3" RenderTransformOrigin="0.5,0.5" Margin="1,1,1,1">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Border.RenderTransform>
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0"/>
<GradientStop Color="#FF4490FF" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF8AB4FF" Offset="1"/>
<GradientStop Color="#FFD1E2FF" Offset="0"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</Grid>
</DockPanel>

<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource OnUnchecking}" x:Name="OnUnchecking_BeginStoryboard"/>
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource OnChecking}" x:Name="OnChecking_BeginStoryboard"/>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</Application.Resources>
</Application>

+ 7
- 4
BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj Visa fil

@@ -8,7 +8,14 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" />
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

<ItemGroup>
@@ -17,8 +24,4 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="ViewModel\" />
</ItemGroup>

</Project>

+ 31
- 0
BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml Visa fil

@@ -0,0 +1,31 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.Control.CircularProgressBar"
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.MilkWithTea.Control"
xmlns:ccontrols="http://schemas.microsoft.com/expression/2010/drawing"
mc:Ignorable="d" x:Name="circularProgress"
Height="100" Width="100">
<Grid x:Name="layout" Width="{Binding RelativeSource={RelativeSource Self}, Path=Width}" Height="100" >
<Ellipse Width="{Binding ElementName=layout, Path=Width}"
Height="{Binding ElementName=layout, Path=Height}"
StrokeThickness="10" Stroke="#ddd" >
<Ellipse.Effect >
<DropShadowEffect BlurRadius="8" ShadowDepth="0" Color="AliceBlue" ></DropShadowEffect>
</Ellipse.Effect>
</Ellipse>
<Path x:Name="cyclePath" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Stroke="#FF37A0EA" StrokeThickness="10" >
<Path.Effect>
<DropShadowEffect Color="WhiteSmoke" ShadowDepth="0" BlurRadius="5"/>
</Path.Effect>

</Path>
<Viewbox Margin="20">
<TextBlock Foreground="DarkSlateGray" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Run Text="{Binding Percent, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"></Run>
<Run Text="%"></Run>
</TextBlock>
</Viewbox>
</Grid>
</UserControl>

+ 88
- 0
BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs Visa fil

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MilkWithTea.Control
{
/// <summary>
/// CircularProgressBar.xaml 的交互逻辑
/// </summary>
public partial class CircularProgressBar : UserControl
{
public CircularProgressBar()
{
InitializeComponent();
UpdateValue(Percent * 3.6);
}
public double Percent
{
get { return (double)GetValue(PercentProperty); }
set
{
SetValue(PercentProperty, value);
UpdateValue(Percent * 3.6);
}

}

//public static DependencyProperty PercentProperty => percentProperty;

// Using a DependencyProperty as the backing store for Percent. This enables animation, styling, binding, etc...
private static readonly DependencyProperty PercentProperty =
DependencyProperty.Register("Percent", typeof(double), typeof(CircularProgressBar), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));


private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
CircularProgressBar _cycleProgess = d as CircularProgressBar;
_cycleProgess.UpdateValue(_cycleProgess.Percent * 3.6);
}
private void UpdateValue(double angle)
{

if (angle > 360) return;
if (angle <= 0) return;

int offset = 5;
if (angle > 359) angle = 359.8;
double radius = this.Width / 2 - offset;
if (radius < 0) return;
double b = radius * Math.Sin(angle * Math.PI / 180);
double x = radius + b;
double y = radius - radius * Math.Cos(angle * Math.PI / 180);
double startPositionX = radius + offset;
double startPositionY = offset;

if (angle > 180)
{

//string Data = string.Format("M {0} 0 A {0} {0} 0 1 1 {1} {2}", radius, Math.Round(x, 2), Math.Round(y, 2));
string Data = string.Format("M {0} {1} A {2} {2} 0 1 1 {3} {4}", startPositionX, startPositionY, radius, Math.Round(x, 2) + offset, Math.Round(y, 2) + offset);
this.cyclePath.Data = Geometry.Parse(Data);
}
else
{

//string Data = string.Format("M {0} 0 A {0} {0} 0 0 1 {1} {2}", radius, Math.Round(x,2), Math.Round(y, 2));

string Data = string.Format("M {0} {1} A {2} {2} 0 0 1 {3} {4}", startPositionX, startPositionY, radius, Math.Round(x, 2) + offset, Math.Round(y, 2) + offset);

this.cyclePath.Data = Geometry.Parse(Data);
}
}

}
}


+ 57
- 0
BPASmartClient.MilkWithTea/GLobal.cs Visa fil

@@ -0,0 +1,57 @@
using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MilkWithTea
{
public class GLobal
{
//路径
public static string recipePath = string.Empty;
public static string posionPath = string.Empty;

public static bool makeEnable = false;

public static ObservableCollection<LocalTeaWithMilkConfig> MaterialRecipes { get; set; } = new ObservableCollection<LocalTeaWithMilkConfig>();


/// <summary>
/// 获取Json文件内容,转换成ObservableCollection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <returns></returns>
public static ObservableCollection<T> GetJsonToT<T>(string path)
{
if (!File.Exists(path))
{
//创建该文件
File.Create(path);
return default;
}
else
{
using (StreamReader recipeReader = new StreamReader(path))//读取json文件
{
string datacache = "";
string line;
while ((line = recipeReader.ReadLine()) != null) //循环将每一行数据拼接为一个完整的字符串
{
datacache = datacache + line;
}

var res = JsonConvert.DeserializeObject<ObservableCollection<T>>(datacache); //将string转换为class类,从而达到json文件转换的目的
if (res != null)
return res;
else return new ObservableCollection<T> { };
}
}
}
}
}

+ 37
- 23
BPASmartClient.MilkWithTea/MainWindow.xaml Visa fil

@@ -5,8 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm ="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
Title="MainWindow" Height="1000" Width="1600" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStartupLocation="CenterScreen">
<Window.DataContext>
<vm:MainWindowVeiwModel/>
</Window.DataContext>
<Window.Resources>
<Style x:Key="menuButtonTemplate" TargetType="{x:Type Button}">
<Setter Property="Focusable" Value="False"/>
@@ -52,6 +56,7 @@
</ControlTemplate>
</Setter.Value>
</Setter>

</Style>
</Window.Resources>
<Border Background="#FF37A0EA" CornerRadius="20" BorderThickness="0">
@@ -66,9 +71,9 @@
<RowDefinition />
</Grid.RowDefinitions>

<Grid Grid.RowSpan="3" MouseDown="Grid_MouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="150"/>
@@ -77,45 +82,54 @@
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="40"/>
<RowDefinition Height="60"/>
<RowDefinition Height="80"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Height="76" Width="114">
<TextBlock Text="奶茶" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti" HorizontalAlignment="Center"/>
<TextBlock Text="味魔方" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti"/>
</StackPanel>
<Button Grid.Row="2" Style="{StaticResource menuButtonTemplate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe61c;" Margin="5,0"/>
<TextBlock Text="主页"/>
</StackPanel>
</Button>
<Button Grid.Row="3" Style="{StaticResource menuButtonTemplate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe626;" Margin="5,0"/>
<TextBlock Text="日志"/>
</StackPanel>
<Button Grid.Row="2" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="MainControlView" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe61c;" Margin="5,0"/>
<TextBlock Text="主页"/>
</StackPanel>
</Button>
<Button Grid.Row="4" Style="{StaticResource menuButtonTemplate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe63f;" Margin="5,0"/>
<TextBlock Text="配置"/>
</StackPanel>
<Button Grid.Row="3" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="MessageLogInfo" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe626;" Margin="5,0"/>
<TextBlock Text="日志"/>
</StackPanel>
</Button>
<Button Grid.Row="4" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="LocalConfigureView" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe63f;" Margin="5,0"/>
<TextBlock Text="配置"/>
</StackPanel>
</Button>
<Button Grid.Row="5" Style="{StaticResource menuButtonTemplate}">
<Button Grid.Row="5" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="ParameterSetting" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe62a;" Margin="5,0"/>
<TextBlock Text="参数"/>
</StackPanel>
</Button>
<control:DateTimeUI Grid.Row="7" HorizontalContentAlignment="Center" />
<control:DateTimeUI Grid.Row="8" HorizontalContentAlignment="Center" />
<Button Grid.Row="9" Style="{StaticResource menuButtonTemplate}" Click="CloseButton_Click" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe892;" Margin="5,0"/>
<TextBlock Text="退出"/>
</StackPanel>
</Button>
<CheckBox Content="开机自启" Grid.Row="7" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="16,0"
IsChecked="{Binding AutoStart}"/>
</Grid>
<Border Grid.Column="1" Grid.RowSpan="3" Background="Transparent">
<Border Background="White" CornerRadius="20" BorderThickness="0">
<Grid>
<ContentControl x:Name="contentRegion">
<local:MainControlView/>
<local:MessageLogInfo/>
</ContentControl>
</Grid>
</Border>


+ 178
- 1
BPASmartClient.MilkWithTea/MainWindow.xaml.cs Visa fil

@@ -1,6 +1,17 @@
using System;
using BPASmartClient.Business;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Device;
using BPASmartClient.Helper;
using BPASmartClient.IoT;
using BPASmartClient.Message;
using BPASmartClient.Peripheral;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -20,12 +31,153 @@ namespace BPASmartClient.MilkWithTea
/// </summary>
public partial class MainWindow : Window
{
public MainConsole mainConsole;
public MainWindow()
{
InitializeComponent();

Initialize();

}


private void Initialize()
{
ThreadManage.GetInstance().Start(new Action(() =>
{
GetDevices();
mainConsole = new MainConsole();
mainConsole.Start();
}), "启动主控制台", false);

ActionManage.GetInstance.Register(new Action(() =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
try
{
DataVClient.GetInstance().Initialize();
DataVClient.GetInstance().Start();
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}), "启动主IoT", false);
}), "配置初始化完成Iot启动");

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
if (o is IOTCommandModel iot)
{
switch (iot.CommandName)
{
case 0://控制类
if (iot.CommandValue != null && iot.CommandValue.Count > 0)
{
switch (iot.CommandValue.Keys.ToList()[0])
{
case "程序启动":
//mainConsole.Start();
break;
//mainConsole.Stop();
case "程序停止":
break;
case "程序复位":
//mainConsole.Stop();
//mainConsole.Start();
break;
default:
break;
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏控制", iot.CommandValue.Keys.ToList()[0]);
}
break;
case 1://设置类
break;
case 2://通知类
if (iot.CommandValue != null && iot.CommandValue.ContainsKey("text"))
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏通知", iot.CommandValue["text"]);
}
break;
default:
break;
}
}
}));
}), "IotBroadcast");
NavButton_Click(new Button() { Tag = "MainControlView" },null);

}

/// <summary>
/// 获取设备集合
/// </summary>
private void GetDevices()
{
//List<string> IDevices = new List<string>();
//List<string> IPeripherals = new List<string>();

DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
var files = directoryInfo.GetFiles().Where(p => p.FullName.Contains("BPASmartClient.") && p.FullName.Contains("dll")).ToList();
List<string> fileList = new List<string>();

var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var dlls = assemblies?.Where(p => p.FullName.Contains("BPASmartClient.")).ToList();
List<string> dllList = new List<string>();

if (files != null)
{
foreach (var item in files)
{
var res = System.IO.Path.GetFileNameWithoutExtension(item.FullName);
if (res != null && res.Length > 0 && res.Contains(".") && !res.Contains("dll")) fileList.Add(res);
}
}

if (dlls != null)
{
dlls.ForEach((item) =>
{
item.GetTypes().ToList().ForEach((type) =>
{
if (type.GetInterfaces().Contains(typeof(IDevice)))
{
if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName);
}
else if (type.GetInterfaces().Contains(typeof(IPeripheral)))
{
if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName);
}
});

dllList.Add(System.IO.Path.GetFileNameWithoutExtension(item.EscapedCodeBase));
});
}

dllList.ForEach((item) => { if (fileList.Contains(item)) fileList.Remove(item); });

fileList.ForEach((item) =>
{
Assembly.Load(item).GetTypes().ToList().ForEach((type) =>
{
if (type.GetInterfaces().Contains(typeof(IDevice)))
{
if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName);
}
else if (type.GetInterfaces().Contains(typeof(IPeripheral)))
{
if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName);
}
});
});


}



@@ -33,5 +185,30 @@ namespace BPASmartClient.MilkWithTea
{
this.DragMove();
}


private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private void NavButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender is Button bt )
{
Type type = Type.GetType($"BPASmartClient.MilkWithTea.View.{bt.Tag?.ToString()}");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]");
}
}
}
}

+ 299
- 0
BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml Visa fil

@@ -0,0 +1,299 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.LocalConfigureView"
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.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.DataContext>
<vm:LocalConfigureViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="TextBlock.FontSize" Value="13" />
<Setter Property="Padding" Value="10" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<!--HorizontalAlignment 可以设置内容展示位置-->
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="Black"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="Black"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="#666666"/>
<Setter Property="Background" Value="Black" />
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".56"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,5"/>
<Style.Triggers>
<!-- 隔行换色 -->
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFAFAFA" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF5F5F7" />
</Trigger>

<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F0FFFF" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Button">
<Setter Property="Width" Value="90"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="#43a9c7"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#2f96b4"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#2a89a4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<!--奶茶配方录入-->
<Expander Style="{StaticResource ExpanderStyle}">
<Expander.Header>
<TextBlock Text="奶茶配方录入" />
</Expander.Header>
<Expander.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
<TextBlock Text="奶茶名称:" Foreground="DarkSlateGray" FontSize="20" Margin="10,0" VerticalAlignment="Center" />
<TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0" VerticalContentAlignment="Center" Padding="2"/>
<Button Content="添加配方" Margin="10,0" Width="120" Command="{Binding AddRecipeCommand}" Style="{StaticResource buttonNormal}"/>
<Button Content="保存" Margin="10,0" Width="80" Command="{Binding SaveRecipeCommand}" Style="{StaticResource buttonNormal}"/>
<Button Content="清空" Margin="10,0" Width="80" Command="{Binding RecipeCancelCommand}" Style="{StaticResource buttonNormal}"/>
</StackPanel>
<DataGrid Grid.Row="1" Margin="100,5,100,20" AutoGenerateColumns="False" RowHeight="30" ItemsSource="{Binding materialRecipes}"
x:Name="recipeDataGrid"
FrozenColumnCount="1"
VerticalAlignment="Center" HorizontalAlignment="Center"
Background="#F3F6F9"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
<DataGrid.Columns >
<DataGridTemplateColumn Header="ID" Width="40">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<TextBlock Text="{ Binding MaterialID}" Foreground="Black"
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料" Width="200">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<ComboBox x:Name="combox" FontSize="16" Width="100"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
IsReadOnly="True" Style="{StaticResource cmbstyle}" Height="30"
SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料量" Width="175" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3" >
<TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
<TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16" Foreground="Black"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="操作" Width="300">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Margin="4"
Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Expander.Content>
</Expander>
<!--配料录入-->
<Expander Grid.Row="1" Style="{StaticResource ExpanderStyle}">
<Expander.Header>
<TextBlock Text="本地配料录入" />
</Expander.Header>
<Expander.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="更新物料位置名称" Grid.ColumnSpan="2" Style="{StaticResource buttonNormal}" Height="34" Width="200" Command="{Binding UpdateMaterialPosionCommand}"/>
<DataGrid Grid.Row="1" Margin="100,5" AutoGenerateColumns="False" ItemsSource="{Binding materail1,Mode=TwoWay}"
FrozenColumnCount="1" RowHeight="30"
VerticalAlignment="Top" HorizontalAlignment="Center"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="物料位置" Width="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="250">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalContentAlignment="Center"
Margin="2"
Width="160" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="1" Grid.Column="1" Margin="100,5" AutoGenerateColumns="False" ItemsSource="{Binding materail2,Mode=TwoWay}"
FrozenColumnCount="1" RowHeight="30"
VerticalAlignment="Top" HorizontalAlignment="Center"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="物料位置" Width="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="250">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalContentAlignment="Center"
Margin="2"
Width="160" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Expander.Content>
</Expander>
<!--奶茶清单-->
<Expander Grid.Row="2" Style="{StaticResource ExpanderStyle}" >
<Expander.Header>
<TextBlock Text="本地奶茶配方"/>
</Expander.Header>
<Expander.Content>
<DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="30" ItemsSource="{Binding localMaterialRecipes}" Width="500"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="奶茶" Width="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding GoodNames}" Foreground="Black"
VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="5,2" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Margin="2"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Expander.Content>
</Expander>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml.cs Visa fil

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MilkWithTea.View
{
/// <summary>
/// LocalConfigureView.xaml 的交互逻辑
/// </summary>
public partial class LocalConfigureView : UserControl
{
public LocalConfigureView()
{
InitializeComponent();
}
}
}

+ 181
- 50
BPASmartClient.MilkWithTea/View/MainControlView.xaml Visa fil

@@ -4,40 +4,83 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
xmlns:controls="clr-namespace:BPASmartClient.MilkWithTea.Control"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.DataContext>
<vm:MainControlViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<!--标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="Foreground" Value="DarkSlateGray" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="1,1,1,1"
BorderBrush="Black"
Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="Black" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:OpacityConverter x:Key="OpacityConverter"/>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="28"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>

<Style TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border x:Name="Bd" BorderBrush="Transparent" BorderThickness="0"
Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ScrollViewer Focusable="false">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch"/>
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Height" Value="28"/>
<Style.Triggers>
<!-- 隔行换色 -->
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFAFAFA" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF5F5F7" />
</Trigger>

<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#4fade8" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>




</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20">
<Grid.ColumnDefinitions>
@@ -46,31 +89,47 @@
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="280"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="订单队列" FontWeight="Bold" Foreground="DarkSlateGray" VerticalAlignment="Center" Margin="15,30,0,0" FontSize="28"/>
<DataGrid Grid.Row="1" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding }"
FrozenColumnCount="1" Margin="10"
<GroupBox Header="订单队列" Style="{StaticResource GroupBoxStyle1}" FontSize="18">
<DataGrid ItemsSource="{Binding orderStatusLists}"
Grid.Row="1" AutoGenerateColumns="False" RowHeight="250"
FrozenColumnCount="1" Margin="30,5"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="取餐号" Width="*"/>
<DataGridTextColumn Header="商品名" Width="2*" />
<DataGridTextColumn Header="开始时间" Width="2*"/>
<DataGridTextColumn Header="结束时间" Width="2*"/>
<DataGridTextColumn Header="制作状态" Width="2*"/>
<DataGridTextColumn Header="完成时间" Width="2*" />
</DataGrid.Columns>
CanUserReorderColumns="False" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="取餐号" Binding="{Binding OrderPush.SortNum}" Width="*"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}">
</DataGridTextColumn>
<DataGridTextColumn Header="商品名" Binding="{Binding OrderPush.GoodsName}" Width="2*" />
<DataGridTextColumn Header="开始时间" Binding="{Binding StartDate}" Width="2*"/>
<DataGridTextColumn Header="结束时间" Binding="{Binding EndDate}" Width="2*"/>
<DataGridTextColumn Header="制作状态" Binding="{Binding OrderStatus, Converter={StaticResource TextConverter}}" Width="2*"/>
<DataGridTextColumn Header="完成时间" Binding="{Binding CompleteDate}" Width="2*" />
</DataGrid.Columns>
</DataGrid>
</GroupBox>
<GroupBox Grid.Row="2" Header="当前奶茶进度" Style="{StaticResource GroupBoxStyle1}" FontSize="18">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="{Binding CurrentGood}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
<controls:CircularProgressBar Grid.Column="2" Percent="{Binding MakePercent}" />
</Grid>
</GroupBox>

</DataGrid>

<Border Grid.Column="1" Grid.RowSpan="5" BorderBrush="Black" BorderThickness="1" />
<Grid Grid.Column="2" Grid.RowSpan="5">
<Grid Opacity="{Binding MakeEnable ,Converter= {StaticResource OpacityConverter}}" Grid.Column="2" Grid.RowSpan="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
@@ -79,11 +138,83 @@
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Text="本地奶茶下单" FontWeight="Bold" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="28"/>
<TextBlock Grid.ColumnSpan="2" Text="本地奶茶下单" HorizontalAlignment="Center" />
<Border Grid.ColumnSpan="2" Grid.Row="1" Background="Transparent" Visibility="{Binding Visibility}" Margin="5">
<Border Background="White" Height="50" CornerRadius="10" HorizontalAlignment="Stretch">
<Grid Height="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe62f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" FontSize="28"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBox Grid.Column="1" x:Name="searchQuery"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" TextAlignment="Left"
BorderThickness="0" Background="Transparent"
IsEnabled="{Binding MakeEnable}"/>
<TextBlock Grid.Column="1" Margin="3,0,0,0" Text="搜索本地奶茶" FontWeight="Bold" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="LightGray" IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Text, ElementName=searchQuery}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Border>
</Border>
<TextBlock Text="奶茶" Grid.Row="2" Margin="20,10" FontSize="22" />
<TextBlock Text="配方" Grid.Row="2" Grid.Column="1" Margin="10" FontSize="22"/>
<Border BorderBrush="#D5DFE5" BorderThickness="4" Grid.Row="3" Margin="20,0,0,0">
<ListBox ItemsSource="{Binding localTeaWithMilks}" SelectionChanged="ListBox_SelectionChanged" IsEnabled="{Binding MakeEnable}"
Foreground="LightSlateGray">
<ListBox.ItemTemplate>
<DataTemplate >
<Grid>
<TextBlock Text="{Binding GoodNames}" Margin="5,10" FontSize="22"
Background="Transparent" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<ListBox x:Name="recipeList" Grid.Row="3" Grid.Column="1" Margin="5,10"
ItemsSource="{Binding materialRecipes}" FontSize="18"
Width="200" HorizontalAlignment="Left" Foreground="LightSlateGray">
<ListBox.ItemTemplate>
<DataTemplate >
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Material}" Margin="20,10"/>
<TextBlock Text="{Binding MaterialWeight}" Margin="20,10,0,10"/>
<TextBlock Text="g" Margin="0,10"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="4" Style="{StaticResource buttonNormal}" VerticalAlignment="Top" Height="40" Width="150" Margin="20"
Command="{Binding MakeGoodCommand}" IsEnabled="{Binding MakeEnable}">
<Button.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe607;" VerticalAlignment="Center" Foreground="White" FontSize="18" HorizontalAlignment="Center" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont"/>
<TextBlock Grid.Column="1" Text="制作奶茶" TextAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="White" FontSize="16"/>
</Grid>
</Button.Content>
</Button>
</Grid>

</Grid>


+ 12
- 2
BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs Visa fil

@@ -1,4 +1,6 @@
using System;
using BPASmartClient.MilkWithTea.ViewModel;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -22,7 +24,15 @@ namespace BPASmartClient.MilkWithTea.View
{
public MainControlView()
{
InitializeComponent();
InitializeComponent();
}

private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if((sender as ListBox).SelectedItem is LocalTeaWithMilkConfig config)
{
recipeList.ItemsSource = config.materialRecipes;
}
}
}
}

+ 56
- 0
BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml Visa fil

@@ -0,0 +1,56 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.MessageLogInfo"
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.MilkWithTea.View"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.Resources>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="#F3F6F9 "/>
</Style>
</UserControl.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Border Background="White" BorderBrush="#D5DFE5 " BorderThickness="12" CornerRadius="5">
<DataGrid Margin="20" ItemsSource="{Binding LogDataGrid, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"
AutoGenerateColumns="False"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="日志时间" Width="300">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding time, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="日志类型" Width="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="日志内容" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Left" Text="{Binding message, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs Visa fil

@@ -0,0 +1,30 @@
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MilkWithTea.View
{
/// <summary>
/// MessageLogInfo.xaml 的交互逻辑
/// </summary>
public partial class MessageLogInfo : UserControl
{
public MessageLogInfo()
{
InitializeComponent();
this.DataContext = LogViewModel.GetInstance();
}
}
}

+ 113
- 0
BPASmartClient.MilkWithTea/View/ParameterSetting.xaml Visa fil

@@ -0,0 +1,113 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.ParameterSetting"
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.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent" >
<UserControl.DataContext>
<vm:PatrameterSettiongViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="18"/>
</Style>
</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="300"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Grid.ColumnSpan="2" Header="参数调试" FontSize="20" Style="{StaticResource GroupBoxStyle1}" Padding="40,20">
<GroupItem>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="通道口:"/>
<ComboBox ItemsSource="{Binding materialPosions}"
SelectedIndex="{Binding MaterialID ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Margin="10,0" Width="120 " Style="{StaticResource cmbstyle}"/>
<TextBlock Text="出料量:" Margin="10,0,0,0" />
<TextBox Text="{Binding OutMaterailWeight}" Width="60" Margin="10,0" VerticalContentAlignment="Center"/>
<TextBlock Text="g" Margin="2,0"/>
<Button Content="出料" Style="{StaticResource buttonNormal}" Height="36" Width="100" Margin="30,0" Command="{Binding OutMaterailCommad}"/>
<TextBlock Text="转盘位置:" Margin="60,0,10,0"/>
<ComboBox ItemsSource="{Binding TurntablePosion}"
SelectedIndex="{Binding TurntableID,Mode=TwoWay ,UpdateSourceTrigger=PropertyChanged}"
Margin="10,0" Width="100 " Style="{StaticResource cmbstyle}"/>
<Button Content="转动" Style="{StaticResource buttonNormal}" Height="36" Width="80" Margin="30,0"
Command="{Binding TurntableCommad}"/>
</StackPanel>
<CheckBox Grid.Row="2" Content="禁用本地奶茶下单" HorizontalAlignment="Left" Margin="0,10"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
IsChecked="{Binding IsEnable}"/>
</Grid>
</GroupItem>
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="1" Header="通道矫正" FontSize="20" BorderThickness="10" Style="{StaticResource GroupBoxStyle1}">
<GroupItem>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="通道" />
<TextBlock Text="名称" Grid.Column="1"/>
<TextBlock Text="开关" Grid.Column="2"/>
<TextBlock Text="校正后的重量" Grid.Column="5"/>
<TextBlock Text="出料时间" Grid.Column="3"/>

<ComboBox Grid.Row="1" Width="100" Style="{StaticResource cmbstyle}" ItemsSource="{Binding materialPosions}"
SelectedIndex="{Binding CorrectPassway ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="ComboBox_SelectionChanged" />
<TextBlock Grid.Row="1" Grid.Column="1" ></TextBlock>
<CheckBox x:Name="OpenIsCheck"
Grid.Row="1" Grid.Column="2" Style="{StaticResource OpenCheckBoxStyle1}" Height="40"
IsChecked="{Binding PasswayIsOpen,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Command="{Binding OpenPasswayCommand}"/>
<TextBox Text="{Binding CorrectMatetailWeight,Mode=TwoWay}" Grid.Row="1" Grid.Column="5" Width="60" Height="30"></TextBox>
<TextBlock Text="克" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<TextBox Text="{Binding OutTime}" Grid.Row="1" Grid.Column="3" Width="60" Height="30"></TextBox>
<TextBlock Text="秒" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Right" Margin="0,0,16,0"></TextBlock>
<TextBlock Text="矫正方法" Grid.Column="7"/>
<Button Content="开始矫正" Style="{StaticResource buttonNormal}"
Grid.Row="1" Grid.Column="4" HorizontalAlignment="Center"
Height="40" Width="120"
Command="{Binding CheckPasswayCommad}"/>
<Button Content="确认重量" Style="{StaticResource buttonNormal}"
Grid.Row="1" Grid.Column="6" HorizontalAlignment="Center"
Height="40" Width="120"
Command="{Binding CheckMaterailWeightCommand}"/>
<TextBlock Text=" 准备好校正电子秤,打开需要校正的通道,点击“开始校正”的按钮,填入校正后的重量并确认。"
Margin="6,0" TextWrapping="Wrap"
Grid.Column="7" Grid.Row="1" />
</Grid>
</GroupItem>
</GroupBox>
</Grid>
</UserControl>

+ 34
- 0
BPASmartClient.MilkWithTea/View/ParameterSetting.xaml.cs Visa fil

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MilkWithTea.View
{
/// <summary>
/// ParameterSetting.xaml 的交互逻辑
/// </summary>
public partial class ParameterSetting : UserControl
{
public ParameterSetting()
{
InitializeComponent();
}

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(this.OpenIsCheck!=null) this.OpenIsCheck.IsChecked = false;

}
}
}

+ 211
- 0
BPASmartClient.MilkWithTea/ViewModel/LocalConfigureViewModel.cs Visa fil

@@ -0,0 +1,211 @@
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class LocalConfigureViewModel : ObservableObject

{
#region 奶茶配方录入
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes { get => materialRecipes1; set => materialRecipes1 = value; }
/// <summary>
/// 出料集合
/// </summary>
public ObservableCollection<string> MaterailList { get; set; } = new ObservableCollection<string>();
/// <summary>
/// 奶茶名称
/// </summary>
public string LocalGoodName { get { return _localGoodName; } set { _localGoodName = value; OnPropertyChanged(); } }
private string _localGoodName;

private ObservableCollection<MaterialRecipe> materialRecipes1 = new ObservableCollection<MaterialRecipe>();

/// <summary>
/// 添加一条配方
/// </summary>
public RelayCommand AddRecipeCommand { get; set; }
/// <summary>
/// 删除一条配方
/// </summary>
public RelayCommand<object> RemoveRecipeCommand { get; set; }
/// <summary>
/// 取消配方
/// </summary>
public RelayCommand RecipeCancelCommand { get; set; }
/// <summary>
/// 保存配方
/// </summary>
public RelayCommand SaveRecipeCommand { get; set; }

#endregion

#region 本地奶茶配方
/// <summary>
/// 本地奶茶配方列表
/// </summary>
public ObservableCollection<LocalTeaWithMilkConfig> localMaterialRecipes { get; set; } = GLobal.MaterialRecipes;

/// <summary>
/// 删除配方奶茶
/// </summary>
public RelayCommand<object> DeleteRecipeCommand { get; set; }

#endregion

#region 物料位置名称
/// <summary>
/// 物料位置名称集合
/// </summary>
public ObservableCollection<MaterailNameAndPosion> materailNameAndPosions { get; set; } = new ObservableCollection<MaterailNameAndPosion>();
public List<MaterailNameAndPosion> materail1 { get; set; } = new List<MaterailNameAndPosion>();
public List<MaterailNameAndPosion> materail2 { get; set; } = new List<MaterailNameAndPosion>();
/// <summary>
/// 更新物料位置
/// </summary>
public RelayCommand UpdateMaterialPosionCommand { get; set; }
#endregion

public LocalConfigureViewModel()
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialWeight = 10
});




AddRecipeCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialID = materialRecipes.Count() + 1
});

}));

RemoveRecipeCommand = new RelayCommand<object>((o =>
{
if (o != null && o is int index)
{
materialRecipes.RemoveAt(index);
for (int i = 0; i < materialRecipes.Count; i++)//ID排序
{
materialRecipes[i].MaterialID = i + 1;
}
}

}));

RecipeCancelCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Clear();
LocalGoodName = String.Empty;
}));

SaveRecipeCommand = new RelayCommand(new Action(() =>
{
if (LocalGoodName == "" || LocalGoodName == null) return;
if (materialRecipes.Count == 0) return;

localMaterialRecipes.Insert(0, new LocalTeaWithMilkConfig()
{
GoodNames = LocalGoodName,
materialRecipes = materialRecipes

});

UpdateLocalJosnData<LocalTeaWithMilkConfig>(GLobal.recipePath, localMaterialRecipes);//更新奶茶配方json文件
MessageBox.Show("保存成功");
}));


DeleteRecipeCommand = new RelayCommand<object>((o =>
{
if (o != null && o is int index)
{
localMaterialRecipes.RemoveAt(index);
UpdateLocalJosnData<LocalTeaWithMilkConfig>(GLobal.recipePath, localMaterialRecipes);//更新奶茶配方json文件
}
}));

UpdateMaterialPosionCommand = new RelayCommand(new Action(() =>
{
materailNameAndPosions.Clear();
foreach(var item in materail1)
{
materailNameAndPosions.Add(item);
}
foreach (var item in materail2)
{
materailNameAndPosions.Add(item);
}
UpdateLocalJosnData<MaterailNameAndPosion>(GLobal.posionPath, materailNameAndPosions);//更新物料位置名称
MaterailList.Clear();
foreach (MaterailNameAndPosion m in materailNameAndPosions)
{
if (m.MaterialName != null) MaterailList.Add(m.MaterialName);

}
}));

Init();
}

/// <summary>
/// 界面初始化加载
/// </summary>
private void Init()
{

materailNameAndPosions = GLobal.GetJsonToT<MaterailNameAndPosion>(GLobal.posionPath);
if (materailNameAndPosions.Count == 0)
{
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}
}
materail1 = materailNameAndPosions.Take<MaterailNameAndPosion>(14).ToList();
materail2 = materailNameAndPosions.TakeLast<MaterailNameAndPosion>(14).ToList();
foreach (MaterailNameAndPosion m in materailNameAndPosions)
{
if (m.MaterialName != null) MaterailList.Add(m.MaterialName);

}
}

/// <summary>
/// 更新Json文件数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <param name="ts"></param>
private void UpdateLocalJosnData<T>(string path, ObservableCollection<T> ts)
{
if (ts != null) File.WriteAllText(path, JsonConvert.SerializeObject(ts));

}
}
}

+ 236
- 0
BPASmartClient.MilkWithTea/ViewModel/MainControlViewModel.cs Visa fil

@@ -0,0 +1,236 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class MainControlViewModel: ObservableObject
{

public ObservableCollection<LocalTeaWithMilkConfig> localTeaWithMilks { get; set; } = GLobal.MaterialRecipes;

public ObservableCollection<MaterialRecipe> materialRecipes { get; set; } = new ObservableCollection<MaterialRecipe>();

/// <summary>
/// 订单状态列表
/// </summary>
public ObservableCollection<MorkOrder> orderStatusLists { get; set; } = new ObservableCollection<MorkOrder>();

/// <summary>
/// 等待取餐列表
/// </summary>
public ObservableCollection<MorkOrder> WaitTakeMeal { get; set; } = new ObservableCollection<MorkOrder>();

/// <summary>
/// 当前正在制作的奶茶
/// </summary>
public string CurrentGood { get { return _currentGood; } set { _currentGood = value; OnPropertyChanged(); } }
private string _currentGood = "无";
/// <summary>
/// 奶茶制作百分比
/// </summary>
public string MakePercent { get { return _makePercent; } set { _makePercent = value; OnPropertyChanged(); } }
private string _makePercent = "100";

/// <summary>
/// 当前正在制作的奶茶
/// </summary>
public bool MakeEnable { get { return GLobal.makeEnable; } set { GLobal.makeEnable = value; OnPropertyChanged(); } }

/// <summary>
/// 本地奶茶制作
/// </summary>
public RelayCommand MakeGoodCommand { get; set; }

public MainControlViewModel()
{
MakeGoodCommand = new RelayCommand(new Action(() =>
{

}));
Init();
MorkOrderPush morkOrderPush = new MorkOrderPush() { GoodsName = "水果奶茶", SortNum = 1 };

orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",EndDate ="15",CompleteDate ="4",OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",
EndDate = "15",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",
EndDate = "15",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});



}


/// <summary>
/// MQTT 大屏取餐通知委托
/// </summary>
public void Init()
{
//清除订单数据
//ActionManage.GetInstance.Register(new Action(() =>
//{
// Application.Current.Dispatcher.Invoke(() =>
// {
// orderStatusLists.Clear();
// WaitTakeMeal.Clear();
// });
//}), "ClearOrders");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o is object[] obj)
{
if (o.Length == 2)
{
if (o[0] is MorkOrderPush morkOrderpush && o[1] is IDevice device)
{
ObservableCollection<MorkOrder> observableCollection = new ObservableCollection<MorkOrder>();
MorkOrder morkOrder = new MorkOrder()
{
OrderPush = morkOrderpush,
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
};
observableCollection.Add(morkOrder);
Application.Current?.Dispatcher.BeginInvoke((Action)delegate
{
int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString());
if (index < 0)
{
Json<KeepDataBase>.Data.orderLists.Add(new OrderData()
{
DeviceId = device.DeviceId.ToString(),
IsAllSelect = true,
morkOrderPushes = observableCollection,

});
}
else
{
Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder);
}

orderStatusLists.Add(new MorkOrder()
{
OrderPush = morkOrderpush,
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
});
});

}
}
}

}), "AddOrder");

EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);

ActionManage.GetInstance.Register(new Action<object[]>((o)=>
{
if (o is object[] obj)
{
if (o.Length == 2)
{
CurrentGood = o[0].ToString();
MakePercent = o[1].ToString();
}
}
}), "奶茶制作进度");


}

private void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack)
{
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent;
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
{
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
{
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);
}

});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest && index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
break;
default:
break;

}
}
}
}

+ 37
- 0
BPASmartClient.MilkWithTea/ViewModel/MainWindowVeiwModel.cs Visa fil

@@ -0,0 +1,37 @@
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class MainWindowVeiwModel : ObservableObject
{
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }

public MainWindowVeiwModel()
{
init();
}

private void init()
{
string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes");
//判断文件夹是否存在,如果不存在就创建file文件夹
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
GLobal.recipePath = Path.Combine(path, "LocalRecipes.json");
GLobal.posionPath = Path.Combine(path, "MaterialPosion.json");

GLobal.MaterialRecipes = GLobal.GetJsonToT<LocalTeaWithMilkConfig>(GLobal.recipePath);
}

}
}

+ 123
- 0
BPASmartClient.MilkWithTea/ViewModel/PatrameterSettiongViewModel.cs Visa fil

@@ -0,0 +1,123 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class PatrameterSettiongViewModel: ObservableObject
{
/// <summary>
/// 物料通道口列表
/// </summary>
public ObservableCollection<MaterialPosion> materialPosions { get; set; } = new ObservableCollection<MaterialPosion>();
/// <summary>
/// 转盘位置列表
/// </summary>
public ObservableCollection<OutMaterialPosion> TurntablePosion { get; set; } = new ObservableCollection<OutMaterialPosion>();

/// <summary>
/// 出料位置ID
/// </summary>
public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
private int _materialID = 0;
/// <summary>
/// 出料重量
/// </summary>
public float OutMaterailWeight { get { return _outMaterilWeight; } set { _outMaterilWeight = value; OnPropertyChanged(); } }
private float _outMaterilWeight;
/// <summary>
/// 装盘ID
/// </summary>
public int TurntableID { get { return _turntableID; } set { _turntableID = value; OnPropertyChanged(); } }
private int _turntableID = 0;
/// <summary>
/// 矫正的通道号
/// </summary>
public int CorrectPassway { get { return _CorrectPassway; } set { _CorrectPassway = value; OnPropertyChanged(); } }
private int _CorrectPassway = 0;
/// <summary>
/// 通道是否开启
/// </summary>
public bool PasswayIsOpen { get { return _passwayIsOpen; } set { _passwayIsOpen = value; OnPropertyChanged(); } }
private bool _passwayIsOpen ;
/// <summary>
/// 矫正重量
/// </summary>
public float CorrectMatetailWeight { get { return _CorrectMatetailWeight; } set { _CorrectMatetailWeight = value; OnPropertyChanged(); } }
private float _CorrectMatetailWeight = 0;
/// <summary>
/// 矫正时间
/// </summary>
public int OutTime { get { return _0utTime; } set { _0utTime = value; OnPropertyChanged(); } }
private int _0utTime = 0;

public bool IsEnable { get { return !GLobal.makeEnable; } set { GLobal.makeEnable = !value; OnPropertyChanged(); } }
/// <summary>
/// 出料动作
/// </summary>
public RelayCommand OutMaterailCommad { get; set; }
/// <summary>
/// 转动转盘
/// </summary>
public RelayCommand TurntableCommad { get; set; }
/// <summary>
/// 开始矫正
/// </summary>
public RelayCommand CheckPasswayCommad { get; set; }
/// <summary>
/// 开启通道
/// </summary>
public RelayCommand OpenPasswayCommand { get; set; }
/// <summary>
/// 确认重量
/// </summary>
public RelayCommand CheckMaterailWeightCommand { get; set; }

public PatrameterSettiongViewModel()
{
foreach(MaterialPosion materialPosion in Enum.GetValues(typeof(MaterialPosion)))
{
materialPosions.Add(materialPosion);
}

foreach(OutMaterialPosion outMaterialPosion in Enum.GetValues(typeof(OutMaterialPosion)))
{
TurntablePosion.Add(outMaterialPosion);
}

OutMaterailCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("通道口出料", new object[] { MaterialID +1, OutMaterailWeight });
}));

TurntableCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("转盘转动", new object[] { TurntableID });
}));

OpenPasswayCommand = new RelayCommand(new Action(() =>
{
if(PasswayIsOpen) ActionManage.GetInstance.Send("开启通道", new object[] { CorrectPassway + 1 });

}));

CheckPasswayCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("开始矫正", new object[] { CorrectPassway + 1,OutTime });
}));

CheckMaterailWeightCommand = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("矫正重量", new object[] { CorrectPassway + 1, CorrectMatetailWeight });
}));

}
}
}

+ 162
- 90
BPASmartClient.MorkTM/Control_MorkTM.cs Visa fil

@@ -28,6 +28,50 @@ namespace BPASmartClient.MorkTM
ServerInit();
DataParse();
polymer.GetMaterialInfo();
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if(o.Length > 0)
{
Dictionary<int, float> res = new Dictionary<int, float>();
res.Add(Convert.ToInt32(o[0]), Convert.ToSingle(o[1]));
SetMatertialWeight(res);
Thread.Sleep(1000);
OpenUsePassageWay(Convert.ToInt32(o[0]));
}
}), "通道口出料");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if(o.Length > 0)
{
PosionTurnOnTest(Convert.ToInt32(o[0]));
}
}), "转盘转动");
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
OpenPassway(Convert.ToInt32(o[0]));
}
}), "开启通道");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
CheckPassway(Convert.ToInt32(o[0]), Convert.ToInt32(o[1]));
}
}), "开始矫正");
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
CheckMaterailWeight(Convert.ToInt32(o[0]), Convert.ToInt32(o[1]));
}
}), "矫正重量");


ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
@@ -74,7 +118,8 @@ namespace BPASmartClient.MorkTM
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT);
morkTM.doOrderEvents.Add(order);
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<int, float> OrderPushes = new Dictionary<int, float>();
foreach (var item in order.MorkOrder.GoodBatchings)
@@ -95,17 +140,22 @@ namespace BPASmartClient.MorkTM
}
});
}
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS)
{
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = morkTM.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = orderPush.SortNum.ToString(),
GoodName = orderPush.GoodsName,
SortNum = res.MorkOrder. SortNum.ToString(),
GoodName = res.MorkOrder.GoodsName,
Status = oRDER_STATUS,
SubOrderId = orderPush.SuborderId,
SubOrderId = res.MorkOrder.SuborderId,
deviceClientType = DeviceType
});
if(oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) morkTM.doOrderEvents.Remove(res);
}

public override void MainTask()
{
@@ -119,18 +169,27 @@ namespace BPASmartClient.MorkTM
{
if (morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) //&&原点位置是否有杯子)
{
morkTM.MakeCount = 0;
SetMatertialWeight(orderLoc.GoodPushes);//设置物料出料量
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
MakeProcess(orderLoc.GoodName, morkTM.MakeCount, morkTM.RecipesPushes.Count);
OrderChange(orderLoc.SuborderId, ORDER_STATUS.COOKING);
foreach (var item in morkTM.RecipesPushes)
{
morkTM.MakeCount++;
PosionTurnOn(item.Key);//设定转盘位置并等待到位信号
Thread.Sleep(1000);
OpenUsePassageWay(item.Key);//打开通道并等待出料完成

DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}");
MakeProcess(orderLoc.GoodName,morkTM.MakeCount,morkTM.RecipesPushes.Count);
}
TurnOutPosion();
OrderChange(orderLoc.SuborderId, ORDER_STATUS.COMPLETED_COOK);
MakeProcess(orderLoc.GoodName, 1, 1);
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}制作完成");



}
}
@@ -141,7 +200,7 @@ namespace BPASmartClient.MorkTM
private void OpenUsePassageWay(int pos)
{
string address = "";
foreach (var item in polymer.OutPosionPLCs)
foreach (var item in polymer.OutPosionPLCs)//根据位置筛选物料plc点位
{
if(item.posion is MaterialPosion posion)
{
@@ -189,6 +248,95 @@ namespace BPASmartClient.MorkTM

}

#region 调试功能
/// <summary>
/// 转盘回原点
/// </summary>
private void TurnOutPosion()
{
WriteData("M4.6", true);
while (!morkTM.ReachPosions[6])
{
Thread.Sleep(1000);
}
WriteData("M14.6", false);
}
/// <summary>
/// 调试转盘
/// </summary>
/// <param name="posion"></param>
private void PosionTurnOnTest(int posion)
{
if(posion==0) TurnOutPosion();
else
{
string address = string.Empty;
int i = 0;
foreach (var item in polymer.TurnPosionPLCs)
{
if ((OutMaterialPosion)item.posion == (OutMaterialPosion)posion)
{
WriteData(item.SetPLCPosion, true);
address = item.GetPLCPosion;
i = Convert.ToInt32(item.posion);
return ;
}
}
while(morkTM.ReachPosions[i-1])
{
Thread.Sleep(1000);
}
WriteData(address,false);
}
}

/// <summary>
/// 开启通道
/// </summary>
private void OpenPassway(int posion)
{
foreach(var item in polymer.OutPosionPLCs)
{
if((MaterialPosion)item.posion == (MaterialPosion)posion)
{
WriteData(item.SetPLCPosion,true);
return ;
}
}
}
/// <summary>
/// 开始校正
/// </summary>
/// <param name="passway"></param>
/// <param name="time"></param>
private void CheckPassway(int passway,int time)
{
WriteData(polymer.PasswayPosionList[(MaterialPosion)passway], Convert.ToInt32(time * expand));//写入出料时间
WriteData("M5.0", true);//开始校正
}

/// <summary>
/// 确认校正重量
/// </summary>
private void CheckMaterailWeight(int passway,float weight)
{
WriteData(polymer.PasswayPosionList[(MaterialPosion)passway], weight*expand);
}

/// <summary>
/// 奶茶制作进度
/// </summary>
private void MakeProcess(string goodName,int percent,int count)
{
int res = Convert.ToInt32(Math.Floor((double)percent / count)) * 100;
ActionManage.GetInstance.Send("奶茶制作进度",new object[] {goodName, res });
}
#endregion

/// <summary>
/// 把每一个物料的用量写入plc
/// </summary>
@@ -199,102 +347,26 @@ namespace BPASmartClient.MorkTM
{
int value = Convert.ToInt32(material.Value*expand);
WriteData(polymer.MaterialPosionList[(MaterialPosion)material.Key], value);
Thread.Sleep(100);
Thread.Sleep(200);
}
}
public override void ReadData()
{
//启用通道的地址1
GetStatus("M0.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{

}
}));

//启用通道的地址2
GetStatus("M1.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{

}
}));

//启用通道的地址3
GetStatus("M2.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{

}
}));
//打开通道的地址1
GetStatus("M10.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{
morkTM.UsePassageWay_1 = bools[0];
morkTM.UsePassageWay_2 = bools[1];
morkTM.UsePassageWay_3 = bools[2];
morkTM.UsePassageWay_4 = bools[3];
morkTM.UsePassageWay_5 = bools[4];
morkTM.UsePassageWay_6 = bools[5];
morkTM.UsePassageWay_7 = bools[6];
morkTM.UsePassageWay_8 = bools[7];
}
}));
//打开通道的地址2
GetStatus("M11.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{
morkTM.UsePassageWay_9 = bools[0];
morkTM.UsePassageWay_10 = bools[1];
morkTM.UsePassageWay_11 = bools[2];
morkTM.UsePassageWay_12 = bools[3];
morkTM.UsePassageWay_13 = bools[4];
morkTM.UsePassageWay_14 = bools[5];
morkTM.UsePassageWay_15 = bools[6];
morkTM.UsePassageWay_16 = bools[7];
}
}));
//打开通道的地址3
GetStatus("M12.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{
morkTM.UsePassageWay_17 = bools[0];
morkTM.UsePassageWay_18 = bools[1];
morkTM.UsePassageWay_19 = bools[2];
morkTM.UsePassageWay_20 = bools[3];
morkTM.UsePassageWay_21 = bools[4];
morkTM.UsePassageWay_22 = bools[5];
morkTM.UsePassageWay_23 = bools[6];
morkTM.UsePassageWay_24 = bools[7];

}
}));

//打开通道的地址4
GetStatus("M13.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 4)
{
morkTM.UsePassageWay_25 = bools[0];
morkTM.UsePassageWay_26 = bools[1];
morkTM.UsePassageWay_27 = bools[2];
morkTM.UsePassageWay_28 = bools[3];
}
}));

GetStatus("M50.0",new Action<object>((obj) =>
GetStatus("M10.0",new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{


+ 9
- 2
BPASmartClient.MorkTM/GVL_MorkTM.cs Visa fil

@@ -1,5 +1,6 @@
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -31,8 +32,14 @@ namespace BPASmartClient.MorkTM
/// PLC-- 通道出料完成信号集合
/// </summary>
public Dictionary< int,bool> outMaterialCompletes = new Dictionary<int,bool>();

/// <summary>
/// 订单暂存列表
/// </summary>
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();
/// <summary>
/// 奶茶制作进度分数
/// </summary>
public int MakeCount = 0;


[VariableMonitor("打开通道1", "M10.0", "400")]


+ 1
- 14
BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs Visa fil

@@ -40,20 +40,7 @@ namespace Model
private int _materialWeight = 10;
}

public class LocalMaterialRecipes: ObservableObject
{
/// <summary>
/// 奶茶名称
/// </summary>
public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }
private string _recipeName;
/// <summary>
/// 配方信息
/// </summary>
public ObservableCollection<MaterialRecipe> RecipeNotes = new ObservableCollection<MaterialRecipe>();
}

public class MaterailNameAndPosion: ObservableObject
{


+ 79
- 40
BPASmartClient.MorkTM/PolymerBatching.cs Visa fil

@@ -15,7 +15,7 @@ namespace BPASmartClient.MorkTM
}
public enum OutMaterialPosion
{
OutMaterial_1 = 1, OutMaterial_2 = 2, OutMaterial_3 =3, OutMaterial_4 = 4, OutMaterial_5 = 5, OutMaterial_6 = 6
出料位=0, 一号位 = 1, 二号位 = 2, 三号位 = 3, 四号位 = 4, 五号位 = 5, 六号位 = 6
}
public class CommationPosionPLC
{
@@ -36,8 +36,8 @@ namespace BPASmartClient.MorkTM
/// <summary>
/// 物料对应的plc点位
/// </summary>
public Dictionary<MaterialPosion,string > MaterialPosionList = new Dictionary<MaterialPosion, string>()
{
public Dictionary<MaterialPosion, string> MaterialPosionList = new Dictionary<MaterialPosion, string>()
{
{MaterialPosion.Top1 , "VW304"},
{MaterialPosion.Top2 , "VW308"},
{MaterialPosion.Top3 , "VW312"},
@@ -66,56 +66,95 @@ namespace BPASmartClient.MorkTM
{MaterialPosion.Top26, "VW404" },
{MaterialPosion.Top27, "VW408" },
{MaterialPosion.Top28, "VW412" },
};
/// <summary>
/// 通道校正PLC点位
/// </summary>
public Dictionary<MaterialPosion, string> PasswayPosionList = new Dictionary<MaterialPosion, string>()
{
{MaterialPosion.Top1 , "VW104"},
{MaterialPosion.Top2 , "VW108"},
{MaterialPosion.Top3 , "VW112"},
{MaterialPosion.Top4 , "VW116"},
{MaterialPosion.Top5 , "VW120"},
{MaterialPosion.Top6 , "VW124"},
{MaterialPosion.Top7 , "VW128"},
{MaterialPosion.Top8 , "VW132"},
{MaterialPosion.Top9 , "VW136"},
{MaterialPosion.Top10, "VW140" },
{MaterialPosion.Top11, "VW144" },
{MaterialPosion.Top12, "VW148" },
{MaterialPosion.Top13, "VW152" },
{MaterialPosion.Top14, "VW156" },
{MaterialPosion.Top15, "VW160" },
{MaterialPosion.Top16, "VW164" },
{MaterialPosion.Top17, "VW168" },
{MaterialPosion.Top18, "VW172" },
{MaterialPosion.Top19, "VW176" },
{MaterialPosion.Top20, "VW180" },
{MaterialPosion.Top21, "VW184" },
{MaterialPosion.Top22, "VW188" },
{MaterialPosion.Top23, "VW192" },
{MaterialPosion.Top24, "VW196" },
{MaterialPosion.Top25, "VW200" },
{MaterialPosion.Top26, "VW204" },
{MaterialPosion.Top27, "VW208" },
{MaterialPosion.Top28, "VW212" },

};
/// <summary>
/// plc转盘点位
/// </summary>
public List<CommationPosionPLC> TurnPosionPLCs = new List<CommationPosionPLC>()
{
new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.OutMaterial_1),
new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.OutMaterial_2),
new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.OutMaterial_3),
new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.OutMaterial_4),
new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.OutMaterial_5),
new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.OutMaterial_6),
new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.一号位),
new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.二号位),
new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.三号位),
new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.四号位),
new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.五号位),
new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.六号位),
};

/// <summary>
/// plc出料点位
/// </summary>
public List<CommationPosionPLC> OutPosionPLCs = new List<CommationPosionPLC>()
{
new CommationPosionPLC("M10.0","M50.0",MaterialPosion.Top1),
new CommationPosionPLC("M10.1","M50.1",MaterialPosion.Top2),
new CommationPosionPLC("M10.2","M50.2",MaterialPosion.Top3),
new CommationPosionPLC("M10.3","M50.3",MaterialPosion.Top4),
new CommationPosionPLC("M10.4","M50.4",MaterialPosion.Top5),
new CommationPosionPLC("M10.5","M50.5",MaterialPosion.Top6),
new CommationPosionPLC("M10.6","M50.6",MaterialPosion.Top7),
new CommationPosionPLC("M10.7","M50.7",MaterialPosion.Top8),
new CommationPosionPLC("M11.0","M51.0",MaterialPosion.Top9),
new CommationPosionPLC("M11.1","M51.1",MaterialPosion.Top10),
new CommationPosionPLC("M11.2","M51.2",MaterialPosion.Top11),
new CommationPosionPLC("M11.3","M51.3",MaterialPosion.Top12),
new CommationPosionPLC("M11.4","M51.4",MaterialPosion.Top13),
new CommationPosionPLC("M11.5","M51.5",MaterialPosion.Top14),
new CommationPosionPLC("M11.6","M51.6",MaterialPosion.Top15),
new CommationPosionPLC("M11.7","M51.7",MaterialPosion.Top16),
new CommationPosionPLC("M12.0","M52.0",MaterialPosion.Top17),
new CommationPosionPLC("M12.1","M52.1",MaterialPosion.Top18),
new CommationPosionPLC("M12.2","M52.2",MaterialPosion.Top19),
new CommationPosionPLC("M12.3","M52.3",MaterialPosion.Top20),
new CommationPosionPLC("M12.4","M52.4",MaterialPosion.Top21),
new CommationPosionPLC("M12.5","M52.5",MaterialPosion.Top22),
new CommationPosionPLC("M12.6","M52.6",MaterialPosion.Top23),
new CommationPosionPLC("M12.7","M52.7",MaterialPosion.Top24),
new CommationPosionPLC("M13.0","M53.0",MaterialPosion.Top25),
new CommationPosionPLC("M13.1","M53.1",MaterialPosion.Top26),
new CommationPosionPLC("M13.2","M53.2",MaterialPosion.Top27),
new CommationPosionPLC("M13.3","M53.3",MaterialPosion.Top28),
new CommationPosionPLC("M0.0","M10.0",MaterialPosion.Top1),
new CommationPosionPLC("M0.1","M10.1",MaterialPosion.Top2),
new CommationPosionPLC("M0.2","M10.2",MaterialPosion.Top3),
new CommationPosionPLC("M0.3","M10.3",MaterialPosion.Top4),
new CommationPosionPLC("M0.4","M10.4",MaterialPosion.Top5),
new CommationPosionPLC("M0.5","M10.5",MaterialPosion.Top6),
new CommationPosionPLC("M0.6","M10.6",MaterialPosion.Top7),
new CommationPosionPLC("M0.7","M10.7",MaterialPosion.Top8),
new CommationPosionPLC("M1.0","M11.0",MaterialPosion.Top9),
new CommationPosionPLC("M1.1","M11.1",MaterialPosion.Top10),
new CommationPosionPLC("M1.2","M11.2",MaterialPosion.Top11),
new CommationPosionPLC("M1.3","M11.3",MaterialPosion.Top12),
new CommationPosionPLC("M1.4","M11.4",MaterialPosion.Top13),
new CommationPosionPLC("M1.5","M11.5",MaterialPosion.Top14),
new CommationPosionPLC("M1.6","M11.6",MaterialPosion.Top15),
new CommationPosionPLC("M1.7","M11.7",MaterialPosion.Top16),
new CommationPosionPLC("M2.0","M12.0",MaterialPosion.Top17),
new CommationPosionPLC("M2.1","M12.1",MaterialPosion.Top18),
new CommationPosionPLC("M2.2","M12.2",MaterialPosion.Top19),
new CommationPosionPLC("M2.3","M12.3",MaterialPosion.Top20),
new CommationPosionPLC("M2.4","M12.4",MaterialPosion.Top21),
new CommationPosionPLC("M2.5","M12.5",MaterialPosion.Top22),
new CommationPosionPLC("M2.6","M12.6",MaterialPosion.Top23),
new CommationPosionPLC("M2.7","M12.7",MaterialPosion.Top24),
new CommationPosionPLC("M3.0","M13.0",MaterialPosion.Top25),
new CommationPosionPLC("M3.1","M13.1",MaterialPosion.Top26),
new CommationPosionPLC("M3.2","M13.2",MaterialPosion.Top27),
new CommationPosionPLC("M3.3","M13.3",MaterialPosion.Top28),
};

public void GetMaterialInfo()
{
List<MaterialPosion> materialPosions = Enum.GetValues(typeof(MaterialPosion)).Cast<MaterialPosion>().ToList();
for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length; i++)
for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length -1; i++)
{
if (i == 2 || i == 3)
{


+ 213
- 18
BPASmartClient.MorkTM/View/Debug.xaml Visa fil

@@ -13,12 +13,212 @@
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<Style x:Key="buttonNormal" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="#58B0ED"/>
<Setter Property="BorderBrush" Value="#FF707070"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#58B0ED "/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#58B0ED"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Combox-->
<Style TargetType="{x:Type ComboBox}" x:Key="cmbstyle">
<Setter Property="Background" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border BorderThickness="0" CornerRadius="3" Width="100" Height="30" Background="{TemplateBinding Background}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="grid">
<ToggleButton
Width="{Binding ElementName=grid,Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}"
Content="{TemplateBinding Text}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5,0,0,0"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
>
<ToggleButton.Style >
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="0" >
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>

<Grid Grid.Column="1" >
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
ClickMode="Press">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<TextBlock Foreground="{TemplateBinding Foreground}" x:Name="arrow_tb" Text="&#xf02a9;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">

</Trigger>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>


<Border.Effect>
<DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>


</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
@@ -34,15 +234,16 @@
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="出料口" Margin="10,0"/>
<ComboBox ItemsSource="{Binding Materials}" Width="80" Margin="20,0"/>
<TextBlock Text="出料量" Margin="40,0,10,0"/>
<ComboBox ItemsSource="{Binding Materials}" Margin="20,0" Width="120 " Style="{StaticResource cmbstyle}" />
<TextBlock Text="出料量" Margin="10,0,10,0"/>
<TextBox Text="{Binding MaertialsWight}" Width="60" Margin="10,0"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}" Style="{StaticResource buttonNormal}"
Width="80" Height="20"/>
</StackPanel>
<Button Grid.Column="1"
<Button Grid.Column="1" Style="{StaticResource buttonNormal}" Height="20"
Width="120" Margin="20,0" HorizontalAlignment="Left"
Content="转盘转动" Command="{Binding TurnOn}"/>
Content="转盘转动" Command="{Binding TurnOn}" />
<Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="奶茶" Margin="20,0"/>
@@ -64,13 +265,7 @@
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>
<Grid Grid.Row="3" Grid.ColumnSpan="2">
<wv2:WebView2
Name="webView" Grid.Row="3" Grid.ColumnSpan="2"
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}"/>

</Grid>
</Grid>
</UserControl>

+ 1
- 1
BPASmartClient.MorkTM/View/Debug.xaml.cs Visa fil

@@ -23,7 +23,7 @@ namespace BPASmartClient.MorkTM.View
public Debug()
{
InitializeComponent();
webView.Source = new Uri("https://www.baidu.com/");
}
}
}

+ 7
- 7
BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs Visa fil

@@ -56,7 +56,7 @@ namespace ViewModel
/// <summary>
/// 本地奶茶配方列表
/// </summary>
public ObservableCollection<LocalMaterialRecipes> localMaterialRecipes { get; set; } = new ObservableCollection<LocalMaterialRecipes>();
public ObservableCollection<LocalTeaWithMilkConfig> localMaterialRecipes { get; set; } = new ObservableCollection<LocalTeaWithMilkConfig>();
/// <summary>
/// 删除配方奶茶
/// </summary>
@@ -124,14 +124,14 @@ namespace ViewModel
if(LocalGoodName == "" || LocalGoodName == null) return;
if(materialRecipes.Count == 0) return;
localMaterialRecipes.Insert(0, new LocalMaterialRecipes()
localMaterialRecipes.Insert(0, new LocalTeaWithMilkConfig()
{
RecipeName = LocalGoodName,
RecipeNotes = materialRecipes
GoodNames = LocalGoodName,
materialRecipes = materialRecipes

});

UpdateLocalJosnData<LocalMaterialRecipes>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
UpdateLocalJosnData<LocalTeaWithMilkConfig>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
MessageBox.Show("保存成功");
}));

@@ -141,7 +141,7 @@ namespace ViewModel
if (o != null && o is int index)
{
localMaterialRecipes.RemoveAt(index);
UpdateLocalJosnData<LocalMaterialRecipes>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
UpdateLocalJosnData<LocalTeaWithMilkConfig>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
}
}));

@@ -167,7 +167,7 @@ namespace ViewModel
recipePath = Path.Combine(path, "LocalRecipes.json");
posionPath = Path.Combine(path, "MaterialPosion.json");

localMaterialRecipes = GetJsonToT<LocalMaterialRecipes>(recipePath);
localMaterialRecipes = GetJsonToT<LocalTeaWithMilkConfig>(recipePath);
materailNameAndPosions = GetJsonToT<MaterailNameAndPosion>(posionPath);
if(materailNameAndPosions.Count == 0)
{


+ 1
- 1
BPASmartClient.Peripheral/BasePeripheral.cs Visa fil

@@ -30,7 +30,7 @@ namespace BPASmartClient.Peripheral
public ConcurrentDictionary<string, object> status { get; set; } = new ConcurrentDictionary<string, object>();
public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();

/// <summary>
/// <summary>q
/// 外设状态集合
/// </summary>
//protected ConcurrentDictionary<string, object> status = new ConcurrentDictionary<string, object>();


Laddar…
Avbryt
Spara