pengliangyang 2 лет назад
Родитель
Сommit
7f71e85781
50 измененных файлов: 4588 добавлений и 72 удалений
  1. +4
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +37
    -0
      BPASmartClient.CustomResource/Converters/OpacityConverter .cs
  3. Двоичные данные
     
  4. Двоичные данные
     
  5. Двоичные данные
     
  6. +10
    -0
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  7. +44
    -0
      BPASmartClient.MilkWithTea/App.config
  8. +591
    -0
      BPASmartClient.MilkWithTea/App.xaml
  9. +17
    -0
      BPASmartClient.MilkWithTea/App.xaml.cs
  10. +10
    -0
      BPASmartClient.MilkWithTea/AssemblyInfo.cs
  11. +27
    -0
      BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj
  12. +31
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml
  13. +88
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs
  14. +86
    -0
      BPASmartClient.MilkWithTea/DeviceInfo.xml
  15. +57
    -0
      BPASmartClient.MilkWithTea/GLobal.cs
  16. +139
    -0
      BPASmartClient.MilkWithTea/MainWindow.xaml
  17. +214
    -0
      BPASmartClient.MilkWithTea/MainWindow.xaml.cs
  18. +299
    -0
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml
  19. +28
    -0
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml.cs
  20. +221
    -0
      BPASmartClient.MilkWithTea/View/MainControlView.xaml
  21. +38
    -0
      BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs
  22. +56
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml
  23. +30
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs
  24. +113
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml
  25. +34
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml.cs
  26. +211
    -0
      BPASmartClient.MilkWithTea/ViewModel/LocalConfigureViewModel.cs
  27. +236
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainControlViewModel.cs
  28. +37
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainWindowVeiwModel.cs
  29. +123
    -0
      BPASmartClient.MilkWithTea/ViewModel/PatrameterSettiongViewModel.cs
  30. +24
    -25
      BPASmartClient.MorkT/View/DebugView.xaml
  31. +52
    -0
      BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj
  32. +303
    -21
      BPASmartClient.MorkTM/Control_MorkTM.cs
  33. +242
    -0
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  34. +55
    -0
      BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs
  35. +15
    -0
      BPASmartClient.MorkTM/Model/WritePar.cs
  36. +16
    -0
      BPASmartClient.MorkTM/OrderLocInfo.cs
  37. +150
    -14
      BPASmartClient.MorkTM/PolymerBatching.cs
  38. +271
    -0
      BPASmartClient.MorkTM/View/Debug.xaml
  39. +26
    -0
      BPASmartClient.MorkTM/View/Debug.xaml.cs
  40. +284
    -0
      BPASmartClient.MorkTM/View/RecipeView.xaml
  41. +36
    -0
      BPASmartClient.MorkTM/View/RecipeView.xaml.cs
  42. +241
    -0
      BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs
  43. +6
    -4
      BPASmartClient.MorkTSingle/OrderLocInfo.cs
  44. +1
    -0
      BPASmartClient.MorkTSingle/View/DebugView.xaml.cs
  45. +1
    -1
      BPASmartClient.Peripheral/BasePeripheral.cs
  46. +3
    -3
      BPASmartClient/App.config
  47. +1
    -2
      BPASmartClient/BPASmartClient.csproj
  48. +11
    -0
      BPASmartClient/DeviceInfo.xml
  49. +2
    -2
      BPASmartClient/MainWindow.xaml
  50. +67
    -0
      SmartClient.sln

+ 4
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Просмотреть файл

@@ -21,6 +21,8 @@
<ItemGroup>
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
<None Remove="Fonts\naicha.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
@@ -229,6 +231,8 @@
<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
<Resource Include="Fonts\naicha.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />


+ 37
- 0
BPASmartClient.CustomResource/Converters/OpacityConverter .cs Просмотреть файл

@@ -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();
}
}
}

Двоичные данные
Просмотреть файл


Двоичные данные
Просмотреть файл


Двоичные данные
Просмотреть файл


+ 10
- 0
BPASmartClient.CustomResource/Themes/MyStyle.xaml Просмотреть файл

@@ -830,6 +830,16 @@
</Style.Setters>
</Style>

<Style x:Key="boreder奶茶背景" TargetType="Border">
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/背景矢量/beijing.png"/>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>

<Style x:Key="border界面背景" TargetType="Border">
<Style.Setters>
<Setter Property="Background">


+ 44
- 0
BPASmartClient.MilkWithTea/App.config Просмотреть файл

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

<!--通用配置-->
<!--<add key="ClientId" value="43"/>-->
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="test1_HostComputer"/>
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--开发环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="HostComputer"/>
<add key ="Namespaces" value="DEV.Config"/>

<!--正式环境-->
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="HostComputer"/>
<add key ="Namespaces" value="TEST1.Config"/>-->

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->
<!--LOCAL:直接使用下方本地“设备连接信息”-->
<add key="StartupMode" value="API"/>
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqdzklb"/>
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/>
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/>


<!--外设配置-->
<add key="COM_Coffee" value="COM3"/>
<add key="BAUD_Coffee" value="115200"/>
<add key="COM_IceCream" value="COM12"/>
<add key="BAUD_IceCream" value="9600"/>
<add key="IceCream_CXB_Threshold" value="90"/>
<add key="COM_ICChip" value="COM6"/>
<add key="BAUD_IChip" value="9600"/>

</appSettings>
</configuration>

+ 591
- 0
BPASmartClient.MilkWithTea/App.xaml Просмотреть файл

@@ -0,0 +1,591 @@
<Application x:Class="BPASmartClient.MilkWithTea.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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>

+ 17
- 0
BPASmartClient.MilkWithTea/App.xaml.cs Просмотреть файл

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MilkWithTea
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmartClient.MilkWithTea/AssemblyInfo.cs Просмотреть файл

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 27
- 0
BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj Просмотреть файл

@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</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>
<None Update="DeviceInfo.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

+ 31
- 0
BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml Просмотреть файл

@@ -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 Просмотреть файл

@@ -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);
}
}

}
}


+ 86
- 0
BPASmartClient.MilkWithTea/DeviceInfo.xml Просмотреть файл

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8" ?>
<BPADevices>
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Peripherals>
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue>
</Parameters>
</Peripheral>

<Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>

<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->

<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Control_MorkT" DeviceId="29">
<Peripherals>
<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM4</PortName>
<BaudRate>115200</BaudRate>-->
<!--<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>-->
<!--
</Parameters>
</Peripheral>
<Peripheral Module="BPASmartClient.GSIceCream.IceCreamMachine">
<Parameters>
<PortName>COM6</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters>
<PortName>COM7</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
<!<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
<IpAddress>192.168.2.100</IpAddress>
<HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue>
</Parameters>
</Peripheral>-->
<!--</Peripherals>
</Device>-->-->
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<PLCReadAddress>M,M230.0,24</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->-->

</BPADevices>

+ 57
- 0
BPASmartClient.MilkWithTea/GLobal.cs Просмотреть файл

@@ -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> { };
}
}
}
}
}

+ 139
- 0
BPASmartClient.MilkWithTea/MainWindow.xaml Просмотреть файл

@@ -0,0 +1,139 @@
<Window x:Class="BPASmartClient.MilkWithTea.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns: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"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="AliceBlue"/>
<Setter Property="Margin" Value="0,20"/>
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont"/>
<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="IsDefaulted" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#63BCFB"/>
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#63BCFB"/>
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="#FF838383"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

</Style>
</Window.Resources>
<Border Background="#FF37A0EA" CornerRadius="20" BorderThickness="0">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions >
<Grid.RowDefinitions >
<RowDefinition Height="67"/>
<RowDefinition />
</Grid.RowDefinitions>


<Grid Grid.RowSpan="3" MouseDown="Grid_MouseDown">

<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="150"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="60"/>
<RowDefinition Height="80"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<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}" 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="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}" 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="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:MessageLogInfo/>
</ContentControl>
</Grid>
</Border>
</Border>
</Grid>
</Border>
</Window>

+ 214
- 0
BPASmartClient.MilkWithTea/MainWindow.xaml.cs Просмотреть файл

@@ -0,0 +1,214 @@
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;
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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </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);
}
});
});


}



private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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();
}
}
}

+ 221
- 0
BPASmartClient.MilkWithTea/View/MainControlView.xaml Просмотреть файл

@@ -0,0 +1,221 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.MainControlView"
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"
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>
<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>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="280"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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" 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>


<Border Grid.Column="1" Grid.RowSpan="5" BorderBrush="Black" BorderThickness="1" />
<Grid Opacity="{Binding MakeEnable ,Converter= {StaticResource OpacityConverter}}" Grid.Column="2" Grid.RowSpan="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<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>
</UserControl>

+ 38
- 0
BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs Просмотреть файл

@@ -0,0 +1,38 @@
using BPASmartClient.MilkWithTea.ViewModel;
using Model;
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>
/// MainControlView.xaml 的交互逻辑
/// </summary>
public partial class MainControlView : UserControl
{
public MainControlView()
{
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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 });
}));

}
}
}

+ 24
- 25
BPASmartClient.MorkT/View/DebugView.xaml Просмотреть файл

@@ -24,12 +24,12 @@
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="14*"/>
<RowDefinition Height="8*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="384*"/>
<RowDefinition Height="111*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>

<GroupBox Grid.ColumnSpan="2"
<GroupBox Grid.ColumnSpan="2" Visibility="Collapsed"
FontFamily="楷体"
FontSize="20"
Header=" 乐白机器人 ">
@@ -91,15 +91,15 @@
</ListBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2"
<GroupBox Grid.Row="0"
FontFamily="楷体"
FontSize="20"
Header=" 冰淇淋机器 ">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="10*" />
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding IceCreamConnected}"
@@ -166,17 +166,17 @@
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>冰淇淋</TextBlock>
<Button Command="{Binding Button_MakeIceCreamCommand}"
Margin="20,0"
Margin="40,5" Height="50" Width="170"
Content="制作" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Width="100"
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="70">
<TextBlock >模式</TextBlock>
<ComboBox Width="100" Height="40" FontSize="22"
Margin="20,0"
ItemsSource="{Binding IceCreamModes}"
SelectedItem="{Binding SelecteIceCreamdMode}" />
<Button Command="{Binding Button_SetIceCreamModelCommand}"
Margin="20,0"
Margin="20,0" Height="50" Width="150"
Content="设置" />
</StackPanel>
</StackPanel>
@@ -224,8 +224,8 @@
</ListBox>
</Grid>
</GroupBox>-->
<GroupBox Grid.Row="2" Grid.Column="1"
<GroupBox Grid.Row="0" Grid.Column="1"
FontFamily="楷体"
FontSize="20"
Header=" 咖啡机">
@@ -275,26 +275,25 @@
Text="{Binding CaffeeFault}" Height="22" Width="60" />
</Grid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<TextBlock>饮品</TextBlock>
<ComboBox Margin="10,0"
Width="100"
<ComboBox Margin="10,0" Height="40" FontSize="20"
Width="120"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SelectedCoffee}" />
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="制作"/>
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="停止制作" Cursor="Hand"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0"
Width="100"
<ComboBox Margin="10,0" Height="40" Width="120" FontSize="20"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="设置" Cursor="Hand"/>
</StackPanel>
@@ -307,11 +306,11 @@
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center" >
<Button Content="咖啡杯落杯" Height="30" Width="120"
<Button Content="咖啡杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_COFFEE"
Margin="10,10,50,10" Cursor="Hand"/>
<Button Content="冰淇淋杯落杯" Height="30" Width="120"
<Button Content="冰淇淋杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10"
/>


+ 52
- 0
BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj Просмотреть файл

@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<OutputType>Library</OutputType>
<UseWindowsForms>False</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

</Project>

+ 303
- 21
BPASmartClient.MorkTM/Control_MorkTM.cs Просмотреть файл

@@ -6,6 +6,7 @@ using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;
@@ -17,11 +18,61 @@ namespace BPASmartClient.MorkTM
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.TMC_MT; } }

GVL_MorkTM morkTM = new GVL_MorkTM();
PolymerBatching polymer = new PolymerBatching();

//浮点数放大倍数
const int expand = 100;

public override void DoMain()
{
ServerInit();
DataParse();
PolymerBatching.GetMaterialInfo();
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);
@@ -31,6 +82,8 @@ namespace BPASmartClient.MorkTM
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
morkTM.ReachPosions = new List<bool>() { morkTM.ReachOutPosion_0, morkTM.ReachPosion_1, morkTM.ReachPosion_2, morkTM.ReachPosion_3, morkTM.ReachPosion_4, morkTM.ReachPosion_5, morkTM.ReachPosion_6 };

DeviceProcessLogShow("设备初始化完成");

@@ -66,15 +119,16 @@ 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<string, int> OrderPushes = new Dictionary<string, int>();
Dictionary<int, float> OrderPushes = new Dictionary<int, float>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount);
OrderPushes.TryAdd(int.Parse(res.BatchingLoc), item.BatchingCount);
}
}

@@ -87,18 +141,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()
{
@@ -108,30 +166,253 @@ namespace BPASmartClient.MorkTM

private void MakeTeaWithMilkProcess()
{
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0)
if (morkTM.morkOrderPushesTeaWithMilk.Count > 0)
{
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc))
if (morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) //&&原点位置是否有杯子)
{
morkTM.MakeCount = 0;
SetMatertialWeight(orderLoc.GoodPushes);//设置物料出料量
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
foreach(var item in morkTM.RecipesPushes)
MakeProcess(orderLoc.GoodName, morkTM.MakeCount, morkTM.RecipesPushes.Count);
OrderChange(orderLoc.SuborderId, ORDER_STATUS.COOKING);
foreach (var item in morkTM.RecipesPushes)
{
WriteData(item.Key,item.Value);
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete))
{
Thread.Sleep(100);
}
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}制作完成");



}
}
}
/// <summary>
/// 打开出料通道
/// </summary>
private void OpenUsePassageWay(int pos)
{
string address = "";
foreach (var item in polymer.OutPosionPLCs)//根据位置筛选物料plc点位
{
if(item.posion is MaterialPosion posion)
{
if(posion == (MaterialPosion)pos)
{
WriteData(item.SetPLCPosion,true);
address = item.GetPLCPosion;
return;
}
}
}
while(!morkTM.outMaterialCompletes[pos]) //等待出料完成
{
Thread.Sleep(1000);
}
WriteData(address, false);


}

/// <summary>
/// 转盘旋转位置设定
/// </summary>
/// <param name="posion"></param>
private void PosionTurnOn(int posion)
{
int i = 0;
string address = "";
foreach (var item in polymer.GoodsMaterialPosion)
{
if (item.Key.Contains((MaterialPosion)posion))
{
WriteData(item.Value.SetPLCPosion,true);
i = Convert.ToInt32(item.Value.posion);
address = item.Value.GetPLCPosion;
return;
}
}
while(!morkTM.ReachPosions[i])//等待转盘到达信号
{
Thread.Sleep(1000);
}
if(address != null) WriteData(address, false);//把信号置为0


}

#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>
/// <param name="materials"></param>
private void SetMatertialWeight(Dictionary<int, float> materials)
{
foreach (var material in materials)
{
int value = Convert.ToInt32(material.Value*expand);
WriteData(polymer.MaterialPosionList[(MaterialPosion)material.Key], value);
Thread.Sleep(200);
}
}
public override void ReadData()
{
throw new NotImplementedException();
//启用通道的地址1
GetStatus("M0.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{

}
}));

GetStatus("M10.0",new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{
for (int i = 0; i < 28; i++)
{
if (morkTM.outMaterialCompletes.ContainsKey(i+1))
{
morkTM.outMaterialCompletes[i+1] = bools[i];
}
else
{
morkTM.outMaterialCompletes.Add(i+1, bools[i]);
}
}
}
}));
//转盘移动的地址
GetStatus("M4.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{

}
}));
//装盘移动到位的地址
GetStatus("M14.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
morkTM.ReachPosion_1 = bools[0];
morkTM.ReachPosion_2 = bools[1];
morkTM.ReachPosion_3 = bools[2];
morkTM.ReachPosion_4 = bools[3];
morkTM.ReachPosion_5 = bools[4];
morkTM.ReachPosion_6 = bools[5];
morkTM.ReachOutPosion_0 = bools[6];
for (int i = 0; i < 7; i++)
{
morkTM.ReachPosions[i] = bools[i];
}
}
}));


}

public override void ResetProgram()
@@ -155,6 +436,7 @@ namespace BPASmartClient.MorkTM
}
}
}

public override void SimOrder()
{


+ 242
- 0
BPASmartClient.MorkTM/GVL_MorkTM.cs Просмотреть файл

@@ -0,0 +1,242 @@
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.Model;
using BPASmartClient.MorkTM;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTM
{
public class GVL_MorkTM: IStatus
{
/// <summary>
/// 奶茶订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTeaWithMilk = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 当前正在制作的奶茶订单
/// </summary>
public OrderLocInfo CurrentOrderLoc = new OrderLocInfo();
/// <summary>
/// 奶茶配料的队列
/// </summary>
public Dictionary<int, float> RecipesPushes = new Dictionary<int, float>();
/// <summary>
/// PLC——转盘到达点位集合
/// </summary>
public List<bool> ReachPosions = new List<bool>();
/// <summary>
/// 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")]
public bool UsePassageWay_1 { get; set; }

[VariableMonitor("打开通道2", "M10.1", "401")]
public bool UsePassageWay_2 { get; set; }

[VariableMonitor("打开通道3", "M10.2", "402")]
public bool UsePassageWay_3 { get; set; }
[VariableMonitor("打开通道4", "M10.3", "403")]
public bool UsePassageWay_4 { get; set; }
[VariableMonitor("打开通道5", "M10.4", "404")]
public bool UsePassageWay_5 { get; set; }

[VariableMonitor("打开通道6", "M10.5", "405")]
public bool UsePassageWay_6 { get; set; }

[VariableMonitor("打开通道7", "M10.6", "406")]
public bool UsePassageWay_7 { get; set; }

[VariableMonitor("打开通道8", "M10.7", "407")]
public bool UsePassageWay_8 { get; set; }

[VariableMonitor("打开通道9", "M11.0", "408")]
public bool UsePassageWay_9 { get; set; }

[VariableMonitor("打开通道10", "M11.1", "409")]
public bool UsePassageWay_10 { get; set; }

[VariableMonitor("打开通道11", "M11.2", "410")]
public bool UsePassageWay_11 { get; set; }

[VariableMonitor("打开通道12", "M11.3", "411")]
public bool UsePassageWay_12 { get; set; }

[VariableMonitor("打开通道13", "M11.4", "412")]
public bool UsePassageWay_13 { get; set; }

[VariableMonitor("打开通道14", "M11.5", "413")]
public bool UsePassageWay_14 { get; set; }

[VariableMonitor("打开通道15", "M11.6", "414")]
public bool UsePassageWay_15 { get; set; }

[VariableMonitor("打开通道16", "M11.7", "415")]
public bool UsePassageWay_16 { get; set; }

[VariableMonitor("打开通道17", "M12.0", "416")]
public bool UsePassageWay_17 { get; set; }

[VariableMonitor("打开通道18", "M12.1", "417")]
public bool UsePassageWay_18 { get; set; }

[VariableMonitor("打开通道19", "M12.2", "418")]
public bool UsePassageWay_19 { get; set; }

[VariableMonitor("打开通道20", "M12.3", "419")]
public bool UsePassageWay_20 { get; set; }

[VariableMonitor("打开通道21", "M12.4", "420")]
public bool UsePassageWay_21 { get; set; }

[VariableMonitor("打开通道22", "M12.5", "421")]
public bool UsePassageWay_22 { get; set; }

[VariableMonitor("打开通道23", "M12.6", "422")]
public bool UsePassageWay_23 { get; set; }

[VariableMonitor("打开通道24", "M12.7", "423")]
public bool UsePassageWay_24 { get; set; }

[VariableMonitor("打开通道25", "M13.0", "424")]
public bool UsePassageWay_25 { get; set; }

[VariableMonitor("打开通道26", "M13.1", "425")]
public bool UsePassageWay_26 { get; set; }

[VariableMonitor("打开通道27", "M13.2", "426")]
public bool UsePassageWay_27 { get; set; }

[VariableMonitor("打开通道28", "M13.3", "427")]
public bool UsePassageWay_28 { get; set; }


[VariableMonitor("通道出料完成信号1", "M50.0", "720")]
public bool OutMateraiComplete_1 { get; set; }

[VariableMonitor("通道出料完成信号2", "M50.1", "721")]
public bool OutMateraiComplete_2 { get; set; }

[VariableMonitor("通道出料完成信号3", "M50.2", "722")]
public bool OutMateraiComplete_3 { get; set; }

[VariableMonitor("通道出料完成信号4", "M50.3", "723")]
public bool OutMateraiComplete_4 { get; set; }

[VariableMonitor("通道出料完成信号5", "M50.4", "724")]
public bool OutMateraiComplete_5 { get; set; }

[VariableMonitor("通道出料完成信号6", "M50.5", "725")]
public bool OutMateraiComplete_6 { get; set; }

[VariableMonitor("通道出料完成信号7", "M50.6", "726")]
public bool OutMateraiComplete_7 { get; set; }

[VariableMonitor("通道出料完成信号8", "M50.7", "727")]
public bool OutMateraiComplete_8 { get; set; }

[VariableMonitor("通道出料完成信号9", "M51.0", "728")]
public bool OutMateraiComplete_9 { get; set; }

[VariableMonitor("通道出料完成信号10", "M51.1", "729")]
public bool OutMateraiComplete_10 { get; set; }

[VariableMonitor("通道出料完成信号11", "M51.2", "730")]
public bool OutMateraiComplete_11 { get; set; }

[VariableMonitor("通道出料完成信号12", "M51.3", "731")]
public bool OutMateraiComplete_12 { get; set; }

[VariableMonitor("通道出料完成信号13", "M51.4", "732")]
public bool OutMateraiComplete_13 { get; set; }

[VariableMonitor("通道出料完成信号14", "M51.5", "733")]
public bool OutMateraiComplete_14 { get; set; }

[VariableMonitor("通道出料完成信号15", "M51.6", "734")]
public bool OutMateraiComplete_15 { get; set; }

[VariableMonitor("通道出料完成信号16", "M51.7", "735")]
public bool OutMateraiComplete_16 { get; set; }

[VariableMonitor("通道出料完成信号17", "M52.0", "736")]
public bool OutMateraiComplete_17 { get; set; }

[VariableMonitor("通道出料完成信号18", "M52.1", "737")]
public bool OutMateraiComplete_18 { get; set; }

[VariableMonitor("通道出料完成信号19", "M52.2", "738")]
public bool OutMateraiComplete_19 { get; set; }

[VariableMonitor("通道出料完成信号20", "M52.3", "739")]
public bool OutMateraiComplete_20 { get; set; }

[VariableMonitor("通道出料完成信号21", "M52.4", "740")]
public bool OutMateraiComplete_21 { get; set; }

[VariableMonitor("通道出料完成信号22", "M52.5", "741")]
public bool OutMateraiComplete_22 { get; set; }

[VariableMonitor("通道出料完成信号23", "M52.6", "742")]
public bool OutMateraiComplete_23 { get; set; }

[VariableMonitor("通道出料完成信号24", "M52.7", "743")]
public bool OutMateraiComplete_24 { get; set; }

[VariableMonitor("通道出料完成信号25", "M53.0", "744")]
public bool OutMateraiComplete_25 { get; set; }

[VariableMonitor("通道出料完成信号26", "M53.1", "744")]
public bool OutMateraiComplete_26 { get; set; }

[VariableMonitor("通道出料完成信号27", "M53.2", "745")]
public bool OutMateraiComplete_27 { get; set; }

[VariableMonitor("通道出料完成信号28", "M53.3", "746")]
public bool OutMateraiComplete_28 { get; set; }


[VariableMonitor("到达一号位置", "M14.0", "432")]
public bool ReachPosion_1 { get; set; }

[VariableMonitor("到达二号位置", "M14.1", "433")]
public bool ReachPosion_2 { get; set; }

[VariableMonitor("到达三号位置", "M14.2", "434")]
public bool ReachPosion_3 { get; set; }

[VariableMonitor("到达四号位置", "M14.3", "435")]
public bool ReachPosion_4 { get; set; }

[VariableMonitor("到达五号位置", "M14.4", "436")]
public bool ReachPosion_5 { get; set; }

[VariableMonitor("到达六号位置", "M14.5", "437")]
public bool ReachPosion_6 { get; set; }

[VariableMonitor("到达取料位置", "M14.6", "438")]
public bool ReachOutPosion_0 { get; set; }





}
}

+ 55
- 0
BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs Просмотреть файл

@@ -0,0 +1,55 @@
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace Model
{
public class LocalTeaWithMilkConfig: ObservableObject
{
/// <summary>
/// 奶茶名称
/// </summary>
public string GoodNames { get { return _goodNames; } set { _goodNames = value; OnPropertyChanged(); } }
private string _goodNames;
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes = new ObservableCollection<MaterialRecipe>();
}


public class MaterialRecipe:ObservableObject
{
/// <summary>
/// 物料ID
/// </summary>
public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
private int _materialID =1;
/// <summary>
/// 物料位置
/// </summary>
public string Material { get { return _material; } set { _material = value; OnPropertyChanged(); } }
private string _material ;
/// <summary>
/// 物料的出料量
/// </summary>
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } }
private int _materialWeight = 10;
}

public class MaterailNameAndPosion: ObservableObject
{
public string MaterialPosion { get { return _materaiPosion; } set { _materaiPosion = value; OnPropertyChanged(); } }
private string _materaiPosion;

public string MaterialName { get { return _materailName; } set { _materailName = value; OnPropertyChanged(); } }
private string _materailName;

}
}

+ 15
- 0
BPASmartClient.MorkTM/Model/WritePar.cs Просмотреть файл

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTM.Model
{
public class WritePar
{
public string Address { get; set; }
public object Value { get; set; }

}
}

+ 16
- 0
BPASmartClient.MorkTM/OrderLocInfo.cs Просмотреть файл

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace BPASmartClient.MorkTM
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort RecipeNumber { get; set; }
public string GoodName { get; set; }
public Dictionary<int, float> GoodPushes { get; set; }
}

}

+ 150
- 14
BPASmartClient.MorkTM/PolymerBatching.cs Просмотреть файл

@@ -8,33 +8,169 @@ namespace BPASmartClient.MorkTM
{
public enum MaterialPosion
{
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6,
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10,
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Bottom_4, Marerial_Bottom_5, Marerial_Bottom_6,
Matetial_Tea_1, Matetial_Tea_2, Matetial_Tea_3, Matetial_Tea_4, Matetial_Tea_5, Matetial_Tea_6
Top1 =1, Top2 =2, Top3 =3, Top4 = 4, Top5 = 5, Top6= 6, Top7 = 7, Top8=8, Top9 =9, Top10 =10,
Top11 = 11, Top12 =12, Top13 =13, Top14 =14, Top15= 15, Top16=16, Top17 =17, Top18 =18, Top19 =19, Top20 =20,
Top21 =21, Top22 =22, Top23 =23, Top24 =24, Top25 =25, Top26 =26, Top27 =27, Top28=28

}
public enum OutMaterialPosion
{
OutMaterial_1, OutMaterial_2, OutMaterial_3, OutMaterial_4, OutMaterial_5, OutMaterial_6, OutMaterial_7, OutMaterial_8, OutMaterial_9, OutMaterial_10
出料位=0, 一号位 = 1, 二号位 = 2, 三号位 = 3, 四号位 = 4, 五号位 = 5, 六号位 = 6
}
public class CommationPosionPLC
{
public CommationPosionPLC( string set,string get, Enum @enum)
{
SetPLCPosion = set;
GetPLCPosion = get;
posion = @enum;
}
public string SetPLCPosion;

public string GetPLCPosion;

public Enum posion;
}
public class PolymerBatching
{
public static void GetMaterialInfo()
/// <summary>
/// 物料对应的plc点位
/// </summary>
public Dictionary<MaterialPosion, string> MaterialPosionList = new Dictionary<MaterialPosion, string>()
{
Array arrayPosion = Enum.GetValues(typeof(MaterialPosion));
Array arrayOutPosion = Enum.GetValues(typeof(OutMaterialPosion));
for (int i = 0; i < arrayPosion.Length; i++)
{
int j = (int)Math.Ceiling((double)(i + 1) / 3) - 1;
GoodsMaterialPosion.Add((MaterialPosion)arrayPosion.GetValue(i), (OutMaterialPosion)arrayOutPosion.GetValue(j));
{MaterialPosion.Top1 , "VW304"},
{MaterialPosion.Top2 , "VW308"},
{MaterialPosion.Top3 , "VW312"},
{MaterialPosion.Top4 , "VW316"},
{MaterialPosion.Top5 , "VW320"},
{MaterialPosion.Top6 , "VW324"},
{MaterialPosion.Top7 , "VW328"},
{MaterialPosion.Top8 , "VW332"},
{MaterialPosion.Top9 , "VW336"},
{MaterialPosion.Top10, "VW340" },
{MaterialPosion.Top11, "VW344" },
{MaterialPosion.Top12, "VW348" },
{MaterialPosion.Top13, "VW352" },
{MaterialPosion.Top14, "VW356" },
{MaterialPosion.Top15, "VW360" },
{MaterialPosion.Top16, "VW364" },
{MaterialPosion.Top17, "VW368" },
{MaterialPosion.Top18, "VW372" },
{MaterialPosion.Top19, "VW376" },
{MaterialPosion.Top20, "VW380" },
{MaterialPosion.Top21, "VW384" },
{MaterialPosion.Top22, "VW388" },
{MaterialPosion.Top23, "VW392" },
{MaterialPosion.Top24, "VW396" },
{MaterialPosion.Top25, "VW400" },
{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.一号位),
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("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 -1; i++)
{
if (i == 2 || i == 3)
{
GoodsMaterialPosion.Add(materialPosions.Take(4).ToList(), TurnPosionPLCs[i]);
materialPosions.RemoveRange(0, 4);
}
else
{
GoodsMaterialPosion.Add(materialPosions.Take(5).ToList(), TurnPosionPLCs[i]);
materialPosions.RemoveRange(0, 5);
}
}

}

public static Dictionary<MaterialPosion, OutMaterialPosion> GoodsMaterialPosion = new Dictionary<MaterialPosion, OutMaterialPosion>();
public Dictionary<List<MaterialPosion>, CommationPosionPLC> GoodsMaterialPosion = new Dictionary<List<MaterialPosion>, CommationPosionPLC>();
}
}

+ 271
- 0
BPASmartClient.MorkTM/View/Debug.xaml Просмотреть файл

@@ -0,0 +1,271 @@
<UserControl x:Class="BPASmartClient.MorkTM.View.Debug"
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.MorkTM.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1000"
Name="调试界面">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<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>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="出料口" Margin="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}" Style="{StaticResource buttonNormal}"
Width="80" Height="20"/>
</StackPanel>

<Button Grid.Column="1" Style="{StaticResource buttonNormal}" Height="20"
Width="120" Margin="20,0" HorizontalAlignment="Left"
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"/>
<ComboBox ItemsSource="{Binding}" Width="120"/>
</StackPanel>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill">

</Viewbox>
<Button Content="制作"
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>


</Grid>
</UserControl>

+ 26
- 0
BPASmartClient.MorkTM/View/Debug.xaml.cs Просмотреть файл

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
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.MorkTM.View
{
/// <summary>
/// Debug1.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
{
public Debug()
{
InitializeComponent();
}
}
}

+ 284
- 0
BPASmartClient.MorkTM/View/RecipeView.xaml Просмотреть файл

@@ -0,0 +1,284 @@
<UserControl x:Class="View.RecipeView"
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:View"
xmlns:vm ="clr-namespace:ViewModel"
mc:Ignorable="d"
Name="参数设置界面"
d:DesignHeight="600" d:DesignWidth="800">
<UserControl.DataContext>
<vm:RecipeViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="button_Style" TargetType="Button">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="#a2c2e8" />
<Setter Property="Width" Value="80" />
<Setter Property="Height" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ControlTemplate.Resources>
<Storyboard x:Key="OnMouseEnter1">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF139DDB" />
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF135EC2" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Border
x:Name="BD"
Background="Transparent"
BorderBrush="#05408a"
BorderThickness="1"
CornerRadius="12">
<TextBlock
x:Name="textBlock"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="16"
Foreground="#a2c2e8"
Text="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="BD" Property="Background" Value="#009dff" />
<Setter TargetName="textBlock" Property="Foreground" Value="#a2c2e8" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BD" Property="Background" Value="#ff55" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DataGrid">
<Setter Property="CanUserResizeColumns" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4fade8" />
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4fade8" />
</Setter.Value>
</Setter>

</Style>
<!--标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="25" />
<Setter Property="Foreground" Value="#FF00EEF3" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
BorderBrush="#FF074B92"
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="#FF074B92" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<!--行样式触发-->
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="30" />
<Setter Property="Foreground" Value="#a2c2e8" />
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>

<!--单元格样式触发-->
<Style TargetType="DataGridCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Height="30" >
<ContentPresenter Height="28" />
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4fade8" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
</UserControl.Resources>
<Grid >
<Grid Margin="50" >
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="奶茶配方录入" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
<TextBlock Text="奶茶名称:" Foreground="#409EFF" FontSize="16" Margin="10,0" VerticalAlignment="Center"/>
<TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0"/>
<Button Content="添加配方" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding AddRecipeCommand}"/>
<Button Content="保存" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding SaveRecipeCommand}"/>
<Button Content="取消" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding RecipeCancelCommand}"/>
</StackPanel>
<DataGrid Grid.Row="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materialRecipes}"
x:Name="recipeDataGrid"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
<DataGrid.Columns >
<DataGridTemplateColumn Header="ID" Width="30">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<TextBlock Text="{ Binding MaterialID}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料" Width="*">
<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"
SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料量" Width="175">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
<TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
Style="{StaticResource button_Style}"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

<TextBlock Text="本地奶茶配方" Grid.Row="3" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" 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 RecipeName}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
Style="{StaticResource button_Style}"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>

<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="配料名称修改" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Wheat" FontSize="18"/>
<Button Content="更新物料位置名称" Grid.Column="2" Grid.Row="1" Style="{StaticResource button_Style}" Width="150" Command="{Binding UpdateMaterialPosionCommand}"/>
<DataGrid Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materailNameAndPosions}"
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="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding MaterialPosion}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="80" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

</Grid>
</Grid>

</UserControl>

+ 36
- 0
BPASmartClient.MorkTM/View/RecipeView.xaml.cs Просмотреть файл

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ViewModel;

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

private void DataGridComboBoxColumn_SourceUpdated(object sender, DataTransferEventArgs e)
{

}

}
}

+ 241
- 0
BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs Просмотреть файл

@@ -0,0 +1,241 @@
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.Text;
using System.Windows;

namespace ViewModel
{
public class RecipeViewModel : ObservableObject
{
//路径
string recipePath = string.Empty;
string posionPath = string.Empty;


#region 奶茶配方录入
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes { get; set;} = new ObservableCollection<MaterialRecipe>();
/// <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;
/// <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; } = new ObservableCollection<LocalTeaWithMilkConfig>();
/// <summary>
/// 删除配方奶茶
/// </summary>
public RelayCommand<object> DeleteRecipeCommand { get; set; }

#endregion

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

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

foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}


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();
}));

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>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
MessageBox.Show("保存成功");
}));


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

UpdateMaterialPosionCommand = new RelayCommand(new Action(() =>
{
UpdateLocalJosnData<MaterailNameAndPosion>(posionPath, materailNameAndPosions);//更新物料位置名称
}));

Init();
}

/// <summary>
/// 界面初始化加载
/// </summary>
private void Init()
{
string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes");
//判断文件夹是否存在,如果不存在就创建file文件夹
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
recipePath = Path.Combine(path, "LocalRecipes.json");
posionPath = Path.Combine(path, "MaterialPosion.json");

localMaterialRecipes = GetJsonToT<LocalTeaWithMilkConfig>(recipePath);
materailNameAndPosions = GetJsonToT<MaterailNameAndPosion>(posionPath);
if(materailNameAndPosions.Count == 0)
{
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}
}

foreach(MaterailNameAndPosion m in materailNameAndPosions)
{
if(m.MaterialName!=null) MaterailList.Add(m.MaterialName);

}


}

/// <summary>
/// 获取Json文件内容,转换成ObservableCollection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <returns></returns>
private 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> { };
}
}
}
/// <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));

}
}


}

+ 6
- 4
BPASmartClient.MorkTSingle/OrderLocInfo.cs Просмотреть файл

@@ -4,15 +4,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTSingle
namespace BPASmartClient.MorkTM
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort Loc { get; set; }
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }
public string makeID { get; set; }

public Dictionary<int, float> GoodPushes { get; set; }

}

}

+ 1
- 0
BPASmartClient.MorkTSingle/View/DebugView.xaml.cs Просмотреть файл

@@ -23,6 +23,7 @@ namespace BPASmartClient.MorkTSingle.View
public DebugView()
{
InitializeComponent();
}
}
}

+ 1
- 1
BPASmartClient.Peripheral/BasePeripheral.cs Просмотреть файл

@@ -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>();


+ 3
- 3
BPASmartClient/App.config Просмотреть файл

@@ -12,9 +12,9 @@
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="HostComputer"/>
<add key ="Namespaces" value="DEV.Config"/>

<!--正式环境-->
<add key="apollouri" value="http://47.108.65.220:28080/"/>


+ 1
- 2
BPASmartClient/BPASmartClient.csproj Просмотреть файл

@@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1185.39" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

<ItemGroup>
@@ -35,7 +35,6 @@
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj" />


+ 11
- 0
BPASmartClient/DeviceInfo.xml Просмотреть файл

@@ -85,6 +85,17 @@
</Peripheral>
</Peripherals>
</Device>-->-->
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">


+ 2
- 2
BPASmartClient/MainWindow.xaml Просмотреть файл

@@ -27,7 +27,7 @@
</ResourceDictionary>
</Window.Resources>

<Border x:Name="br" Style="{DynamicResource border主窗体背景}">
<Border Style="{DynamicResource border主窗体背景}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
@@ -40,7 +40,7 @@
<ColumnDefinition Width="300" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border
<Border x:Name="br"
Grid.ColumnSpan="2"
Height="52"
VerticalAlignment="Top"


+ 67
- 0
SmartClient.sln Просмотреть файл

@@ -96,6 +96,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "B
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IceMaker", "BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj", "{F61AC179-156D-4075-BFEB-355862231F48}"
@@ -116,6 +118,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTSingle", "BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj", "{2366AC9B-B662-4550-9486-AF848B4D2961}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MilkWithTea", "BPASmartClient.MilkWithTea\BPASmartClient.MilkWithTea.csproj", "{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -890,6 +894,26 @@ Global
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x64.Build.0 = Release|Any CPU
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x86.ActiveCfg = Release|Any CPU
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}.Release|x86.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|ARM64.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x64.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x64.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x86.ActiveCfg = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Debug|x86.Build.0 = Debug|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|Any CPU.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM64.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|ARM64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.Build.0 = Release|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1070,6 +1094,46 @@ Global
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.Build.0 = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM.Build.0 = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM64.Build.0 = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x64.ActiveCfg = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x64.Build.0 = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x86.ActiveCfg = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x86.Build.0 = Debug|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|Any CPU.Build.0 = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM.ActiveCfg = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM.Build.0 = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM64.ActiveCfg = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM64.Build.0 = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x64.ActiveCfg = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x64.Build.0 = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x86.ActiveCfg = Release|Any CPU
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x86.Build.0 = Release|Any CPU
{2366AC9B-B662-4550-9486-AF848B4D2961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2366AC9B-B662-4550-9486-AF848B4D2961}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2366AC9B-B662-4550-9486-AF848B4D2961}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1133,6 +1197,7 @@ Global
{C28A88B1-E449-484C-AC67-B5038FF2CA79} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{00C17D87-A323-4A97-BC21-7039E55614DE} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{F61AC179-156D-4075-BFEB-355862231F48} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
@@ -1142,6 +1207,8 @@ Global
{E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{76B6B333-0109-4EE8-A9B2-3E53A7421D92} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{2366AC9B-B662-4550-9486-AF848B4D2961} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution


Загрузка…
Отмена
Сохранить