Browse Source

小炒锅菜品库检测功能增加

样式分支
yahaha 2 years ago
parent
commit
97bcb7a87f
5 changed files with 1669 additions and 3 deletions
  1. +23
    -1
      BPASmartClient.MorkF/Control_MorkF.cs
  2. +685
    -0
      BPASmartClient.MorkF/View/MaterialCalibration.xaml
  3. +28
    -0
      BPASmartClient.MorkF/View/MaterialCalibration.xaml.cs
  4. +931
    -0
      BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
  5. +2
    -2
      BPASmartClient/AssemblyInfo.cs

+ 23
- 1
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -14,6 +14,7 @@ using System.Text;
using System.Collections.Concurrent;
using System.Windows.Documents;
using BPASmartClient.Business;
using Microsoft.CodeAnalysis;

namespace BPASmartClient.MorkF
{
@@ -466,11 +467,32 @@ namespace BPASmartClient.MorkF
{
if (list_int.Count == 2)
{
SetNowPosition(list_int[0], list_int[1]);
SetArmPosition(list_int[0], list_int[1]);
}
}
}), "SetNowPosition");
}), "SetNowPosition");
ActionManage.GetInstance.Register(new Action<object>((list) =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
if (list is List<object> list_object)
{
if (list_object.Count != 3)
{
return;
}

if (list_object[0] is string No && list_object[1] is int x && list_object[2] is int y)
{
if (SetArmPosition(x, y))
{
ActionManage.GetInstance.Send("CalibrationCallBack", new List<string> { No });//设定机械臂当前位置
}
}
}
}), "CalibrationCoordination");
}), "CalibrationCoordination");
#endregion
//ActionManage.GetInstance.Register(PLCInite, "InitCommand");
#region 配料控制


+ 685
- 0
BPASmartClient.MorkF/View/MaterialCalibration.xaml View File

@@ -0,0 +1,685 @@
<UserControl x:Class="BPASmartClient.MorkF.View.MaterialCalibration"
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.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1200" d:DesignWidth="1300">
<UserControl.DataContext>
<vm:MaterialCalibrationViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<!--<Setter Property="Background" Value="Transparent" />-->
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="#a2c2e8"
Text="数据有效值为1-100"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>
</UserControl.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="300" ></RowDefinition>
</Grid.RowDefinitions>

<GroupBox Grid.Row="0" Header="菜品库第一层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionOne}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding OneX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding OneY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwoX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwoY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置3" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ThreeX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ThreeY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置4" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFour}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FourX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FourY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置5" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFive}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FiveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FiveY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置6" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSix}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SixX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SixY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置7" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSeven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SevenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置8" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEight}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding EightX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding EightY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置9" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionNine}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding NineX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding NineY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>

<GroupBox Grid.Row="1" Header="菜品库第二层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置10" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置11" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEleven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ElevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ElevenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置12" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwelve}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwelveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwelveY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置13" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionThirteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ThirteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ThirteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置14" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFourteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FourteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FourteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置15" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFifteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FifteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FifteenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置16" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSixteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SixteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SixteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置17" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSeventeen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SeventeenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeventeenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置18" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEighteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding EighteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding EighteenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>

<GroupBox Grid.Row="2" Header="菜品库第三层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置19" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionNineteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding NineteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding NineteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置20" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwenty}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置21" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyOne}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyOneX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyOneY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置22" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyTwoX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyTwoY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置23" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyThreeX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyThreeY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置24" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyFour}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyFourX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyFourY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置25" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyFive}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyFiveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyFiveY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置26" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentySix}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentySixX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeventeenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置27" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentySeven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentySevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentySevenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>


<GroupBox Grid.Row="3" Header="操作" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<WrapPanel>
<TextBlock Text="移动系数:"></TextBlock>
<TextBox
Style="{DynamicResource UserTextBoxStyle}"
Foreground="#a2c2e8" Text="{Binding Str}"/>
</WrapPanel>
<WrapPanel Grid.Row="1">
<TextBlock Text="移动方式:"></TextBlock>
<RadioButton Content="上" Margin="5,0" IsChecked="{Binding Up}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsChecked="{Binding Down}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsChecked="{Binding Left}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsChecked="{Binding Right}" GroupName="ArmRun"/>
<RadioButton Content="定点" Margin="5,0 " IsChecked="{Binding Point}" GroupName="ArmRun"/>
<Button Content="移动" Command="{Binding SetNowPosition}"/>
</WrapPanel>
<WrapPanel Grid.Row="2">
<Button Content="自动计算" Margin="20,0,50,0" Command="{Binding AutoCalculation}"/>
<Button Content="保存" Margin="20,0,50,0" Command="{Binding SaveCoordinate}"/>
<Button Content="读取" Command="{Binding ReadCoordinate}"/>
</WrapPanel>
</Grid>
</GroupBox>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkF/View/MaterialCalibration.xaml.cs View File

@@ -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.MorkF.View
{
/// <summary>
/// MaterialCalibration.xaml 的交互逻辑
/// </summary>
public partial class MaterialCalibration : UserControl
{
public MaterialCalibration()
{
InitializeComponent();
}
}
}

+ 931
- 0
BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs View File

@@ -0,0 +1,931 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkF.Model;
using Google.Protobuf.WellKnownTypes;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MorkF.ViewModel
{
internal class MaterialCalibrationViewModel : ObservableObject
{
#region 菜品库控制
#region 点位1
public bool PositionOne { get { return _PositionOne; } set { _PositionOne = value; OnPropertyChanged(); } }
private bool _PositionOne;
public int OneX { get { return _OneX; } set { _OneX = value; OnPropertyChanged(); } }
private int _OneX;
public int OneY { get { return _OneY; } set { _OneY = value; OnPropertyChanged(); } }
private int _OneY;
#endregion
#region 点位2
public bool PositionTwo { get { return _PositionTwo; } set { _PositionTwo = value; OnPropertyChanged(); } }
private bool _PositionTwo;
public int TwoX { get { return _TwoX; } set { _TwoX = value; OnPropertyChanged(); } }
private int _TwoX;
public int TwoY { get { return _TwoY; } set { _TwoY = value; OnPropertyChanged(); } }
private int _TwoY;
#endregion
#region 点位3
public bool PositionThree { get { return _PositionThree; } set { _PositionThree = value; OnPropertyChanged(); } }
private bool _PositionThree;
public int ThreeX { get { return _ThreeX; } set { _ThreeX = value; OnPropertyChanged(); } }
private int _ThreeX;
public int ThreeY { get { return _ThreeY; } set { _ThreeY = value; OnPropertyChanged(); } }
private int _ThreeY;
#endregion
#region 点位4
public bool PositionFour { get { return _PositionFour; } set { _PositionFour = value; OnPropertyChanged(); } }
private bool _PositionFour;
public int FourX { get { return _FourX; } set { _FourX = value; OnPropertyChanged(); } }
private int _FourX;
public int FourY { get { return _FourY; } set { _FourY = value; OnPropertyChanged(); } }
private int _FourY;
#endregion
#region 点位5
public bool PositionFive { get { return _PositionFive; } set { _PositionFive = value; OnPropertyChanged(); } }
private bool _PositionFive;
public int FiveX { get { return _FiveX; } set { _FiveX = value; OnPropertyChanged(); } }
private int _FiveX;
public int FiveY { get { return _FiveY; } set { _FiveY = value; OnPropertyChanged(); } }
private int _FiveY;
#endregion
#region 点位6
public bool PositionSix { get { return _PositionSix; } set { _PositionSix = value; OnPropertyChanged(); } }
private bool _PositionSix;
public int SixX { get { return _SixX; } set { _SixX = value; OnPropertyChanged(); } }
private int _SixX;
public int SixY { get { return _SixY; } set { _SixY = value; OnPropertyChanged(); } }
private int _SixY;
#endregion
#region 点位7
public bool PositionSeven { get { return _PositionSeven; } set { _PositionSeven = value; OnPropertyChanged(); } }
private bool _PositionSeven;
public int SevenX { get { return _SevenX; } set { _SevenX = value; OnPropertyChanged(); } }
private int _SevenX;
public int SevenY { get { return _SevenY; } set { _SevenY = value; OnPropertyChanged(); } }
private int _SevenY;
#endregion
#region 点位8
public bool PositionEight { get { return _PositionEight; } set { _PositionEight = value; OnPropertyChanged(); } }
private bool _PositionEight;
public int EightX { get { return _EightX; } set { _EightX = value; OnPropertyChanged(); } }
private int _EightX;
public int EightY { get { return _EightY; } set { _EightY = value; OnPropertyChanged(); } }
private int _EightY;
#endregion
#region 点位9
public bool PositionNine { get { return _PositionNine; } set { _PositionNine = value; OnPropertyChanged(); } }
private bool _PositionNine;
public int NineX { get { return _NineX; } set { _NineX = value; OnPropertyChanged(); } }
private int _NineX;
public int NineY { get { return _NineY; } set { _NineY = value; OnPropertyChanged(); } }
private int _NineY;
#endregion
#region 点位10
public bool PositionTen { get { return _PositionTen; } set { _PositionTen = value; OnPropertyChanged(); } }
private bool _PositionTen;
public int TenX { get { return _TenX; } set { _TenX = value; OnPropertyChanged(); } }
private int _TenX;
public int TenY { get { return _TenY; } set { _TenY = value; OnPropertyChanged(); } }
private int _TenY;
#endregion
#region 点位11
public bool PositionEleven { get { return _PositionEleven; } set { _PositionEleven = value; OnPropertyChanged(); } }
private bool _PositionEleven;
public int ElevenX { get { return _ElevenX; } set { _ElevenX = value; OnPropertyChanged(); } }
private int _ElevenX;
public int ElevenY { get { return _ElevenY; } set { _ElevenY = value; OnPropertyChanged(); } }
private int _ElevenY;
#endregion
#region 点位12
public bool PositionTwelve { get { return _PositionTwelve; } set { _PositionTwelve = value; OnPropertyChanged(); } }
private bool _PositionTwelve;
public int TwelveX { get { return _TwelveX; } set { _TwelveX = value; OnPropertyChanged(); } }
private int _TwelveX;
public int TwelveY { get { return _TwelveY; } set { _TwelveY = value; OnPropertyChanged(); } }
private int _TwelveY;
#endregion
#region 点位13
public bool PositionThirteen { get { return _PositionThirteen; } set { _PositionThirteen = value; OnPropertyChanged(); } }
private bool _PositionThirteen;
public int ThirteenX { get { return _ThirteenX; } set { _ThirteenX = value; OnPropertyChanged(); } }
private int _ThirteenX;
public int ThirteenY { get { return _ThirteenY; } set { _ThirteenY = value; OnPropertyChanged(); } }
private int _ThirteenY;
#endregion
#region 点位14
public bool PositionFourteen { get { return _PositionFourteen; } set { _PositionFourteen = value; OnPropertyChanged(); } }
private bool _PositionFourteen;
public int FourteenX { get { return _FourteenX; } set { _FourteenX = value; OnPropertyChanged(); } }
private int _FourteenX;
public int FourteenY { get { return _FourteenY; } set { _FourteenY = value; OnPropertyChanged(); } }
private int _FourteenY;
#endregion
#region 点位15
public bool PositionFifteen { get { return _PositionFifteen; } set { _PositionFifteen = value; OnPropertyChanged(); } }
private bool _PositionFifteen;
public int FifteenX { get { return _FifteenX; } set { _FifteenX = value; OnPropertyChanged(); } }
private int _FifteenX;
public int FifteenY { get { return _FifteenY; } set { _FifteenY = value; OnPropertyChanged(); } }
private int _FifteenY;
#endregion
#region 点位16
public bool PositionSixteen { get { return _PositionSixteen; } set { _PositionSixteen = value; OnPropertyChanged(); } }
private bool _PositionSixteen;
public int SixteenX { get { return _SixteenX; } set { _SixteenX = value; OnPropertyChanged(); } }
private int _SixteenX;
public int SixteenY { get { return _SixteenY; } set { _SixteenY = value; OnPropertyChanged(); } }
private int _SixteenY;
#endregion
#region 点位17
public bool PositionSeventeen { get { return _PositionSeventeen; } set { _PositionSeventeen = value; OnPropertyChanged(); } }
private bool _PositionSeventeen;
public int SeventeenX { get { return _SeventeenX; } set { _SeventeenX = value; OnPropertyChanged(); } }
private int _SeventeenX;
public int SeventeenY { get { return _SeventeenY; } set { _SeventeenY = value; OnPropertyChanged(); } }
private int _SeventeenY;
#endregion
#region 点位18
public bool PositionEighteen { get { return _PositionEighteen; } set { _PositionEighteen = value; OnPropertyChanged(); } }
private bool _PositionEighteen;
public int EighteenX { get { return _EighteenX; } set { _EighteenX = value; OnPropertyChanged(); } }
private int _EighteenX;
public int EighteenY { get { return _EighteenY; } set { _EighteenY = value; OnPropertyChanged(); } }
private int _EighteenY;
#endregion
#region 点位19
public bool PositionNineteen { get { return _PositionNineteen; } set { _PositionNineteen = value; OnPropertyChanged(); } }
private bool _PositionNineteen;
public int NineteenX { get { return _NineteenX; } set { _NineteenX = value; OnPropertyChanged(); } }
private int _NineteenX;
public int NineteenY { get { return _NineteenY; } set { _NineteenY = value; OnPropertyChanged(); } }
private int _NineteenY;
#endregion
#region 点位20
public bool PositionTwenty { get { return _PositionTwenty; } set { _PositionTwenty = value; OnPropertyChanged(); } }
private bool _PositionTwenty;
public int TwentyX { get { return _TwentyX; } set { _TwentyX = value; OnPropertyChanged(); } }
private int _TwentyX;
public int TwentyY { get { return _TwentyY; } set { _TwentyY = value; OnPropertyChanged(); } }
private int _TwentyY;
#endregion
#region 点位21
public bool PositionTwentyOne { get { return _PositionTwentyOne; } set { _PositionTwentyOne = value; OnPropertyChanged(); } }
private bool _PositionTwentyOne;
public int TwentyOneX { get { return _TwentyOneX; } set { _TwentyOneX = value; OnPropertyChanged(); } }
private int _TwentyOneX;
public int TwentyOneY { get { return _TwentyOneY; } set { _TwentyOneY = value; OnPropertyChanged(); } }
private int _TwentyOneY;
#endregion
#region 点位22
public bool PositionTwentyTwo { get { return _PositionTwentyTwo; } set { _PositionTwentyTwo = value; OnPropertyChanged(); } }
private bool _PositionTwentyTwo;
public int TwentyTwoX { get { return _TwentyTwoX; } set { _TwentyTwoX = value; OnPropertyChanged(); } }
private int _TwentyTwoX;
public int TwentyTwoY { get { return _TwentyTwoY; } set { _TwentyTwoY = value; OnPropertyChanged(); } }
private int _TwentyTwoY;
#endregion
#region 点位23
public bool PositionTwentyThree { get { return _PositionTwentyThree; } set { _PositionTwentyThree = value; OnPropertyChanged(); } }
private bool _PositionTwentyThree;
public int TwentyThreeX { get { return _TwentyThreeX; } set { _TwentyThreeX = value; OnPropertyChanged(); } }
private int _TwentyThreeX;
public int TwentyThreeY { get { return _TwentyThreeY; } set { _TwentyThreeY = value; OnPropertyChanged(); } }
private int _TwentyThreeY;
#endregion
#region 点位24
public bool PositionTwentyFour { get { return _PositionTwentyFour; } set { _PositionTwentyFour = value; OnPropertyChanged(); } }
private bool _PositionTwentyFour;
public int TwentyFourX { get { return _TwentyFourX; } set { _TwentyFourX = value; OnPropertyChanged(); } }
private int _TwentyFourX;
public int TwentyFourY { get { return _TwentyFourY; } set { _TwentyFourY = value; OnPropertyChanged(); } }
private int _TwentyFourY;
#endregion
#region 点位25
public bool PositionTwentyFive { get { return _PositionTwentyFive; } set { _PositionTwentyFive = value; OnPropertyChanged(); } }
private bool _PositionTwentyFive;
public int TwentyFiveX { get { return _TwentyFiveX; } set { _TwentyFiveX = value; OnPropertyChanged(); } }
private int _TwentyFiveX;
public int TwentyFiveY { get { return _TwentyFiveY; } set { _TwentyFiveY = value; OnPropertyChanged(); } }
private int _TwentyFiveY;
#endregion
#region 点位26
public bool PositionTwentySix { get { return _PositionTwentySix; } set { _PositionTwentySix = value; OnPropertyChanged(); } }
private bool _PositionTwentySix;
public int TwentySixX { get { return _TwentySixX; } set { _TwentySixX = value; OnPropertyChanged(); } }
private int _TwentySixX;
public int TwentySixY { get { return _TwentySixY; } set { _TwentySixY = value; OnPropertyChanged(); } }
private int _TwentySixY;
#endregion
#region 点位27
public bool PositionTwentySeven { get { return _PositionTwentySeven; } set { _PositionTwentySeven = value; OnPropertyChanged(); } }
private bool _PositionTwentySeven;
public int TwentySevenX { get { return _TwentySevenX; } set { _TwentySevenX = value; OnPropertyChanged(); } }
private int _TwentySevenX;
public int TwentySevenY { get { return _TwentySevenY; } set { _TwentySevenY = value; OnPropertyChanged(); } }
private int _TwentySevenY;
#endregion

public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } }
private bool _Up;

public bool Down { get { return _Down; } set { _Down = value; OnPropertyChanged(); } }
private bool _Down;

public bool Left { get { return _Left; } set { _Left = value; OnPropertyChanged(); } }
private bool _Left;

public bool Right { get { return _Right; } set { _Right = value; OnPropertyChanged(); } }
private bool _Right;

public bool Point { get { return _Point; } set { _Point = value; OnPropertyChanged(); } }
private bool _Point;

public string Str { get { return _str; }set { _str = value;OnPropertyChanged(); } }

private string _str;

/// <summary>
/// 操作时,x轴移动的距离
/// </summary>
public int OperationX { get; set; } = 0;

/// <summary>
/// 操作时,y轴移动的距离
/// </summary>
public int OperationY { get; set; } = 0;

/// <summary>
/// Y轴大菜品库的间隙
/// </summary>
private const int bigMaterialClearanceY = 9000;

/// <summary>
/// Y轴小菜品库的间隙
/// </summary>
private const int smartMaterialClearanceY = 15000;

/// <summary>
/// X轴菜品库的间隙
/// </summary>
private const int materialClearanceX = 34500;

/// <summary>
/// 移动系数
/// </summary>
public int Factor = 1;

/// <summary>
/// 移动基础点位
/// </summary>
private int BasicPosition { get; set; } = 100;

public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标

public RelayCommand SaveCoordinate { get; set; }//设置机械臂基于当前坐标往左移动

public RelayCommand ReadCoordinate { get; set; }//设置机械臂基于当前坐标往右移动

public RelayCommand AutoCalculation { get; set; }//设置机械臂基于当前坐标往上移动

public RelayCommand SetNowDownPosition { get; set; }//设置机械臂基于当前坐标往下移动

private static object saveMaterialCoordinateLock = new object();
/// <summary>
/// 保存当前的坐标系
/// </summary>
public void SaveMaterialCoordinate()
{
MaterialCoordinate materialCoordinate = new MaterialCoordinate();

foreach(var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate)
{
switch(dicNoMaterialCoordinate.Key)
{
case "1":
dicNoMaterialCoordinate.Value.X = OneX;
dicNoMaterialCoordinate.Value.Y = OneY;
break;
case "2":
dicNoMaterialCoordinate.Value.X = TwoX;
dicNoMaterialCoordinate.Value.Y = TwoY;
break;
case "3":
dicNoMaterialCoordinate.Value.X = ThreeX;
dicNoMaterialCoordinate.Value.Y = ThreeY;
break;
case "4":
dicNoMaterialCoordinate.Value.X = FourX;
dicNoMaterialCoordinate.Value.Y = FourY;
break;
case "5":
dicNoMaterialCoordinate.Value.X = FiveX;
dicNoMaterialCoordinate.Value.Y = FiveY;
break;
case "6":
dicNoMaterialCoordinate.Value.X = SixX;
dicNoMaterialCoordinate.Value.Y = SixY;
break;
case "7":
dicNoMaterialCoordinate.Value.X = SevenX;
dicNoMaterialCoordinate.Value.Y = SevenY;
break;
case "8":
dicNoMaterialCoordinate.Value.X = EightX;
dicNoMaterialCoordinate.Value.Y = EightY;
break;
case "9":
dicNoMaterialCoordinate.Value.X = NineX;
dicNoMaterialCoordinate.Value.Y = NineY;
break;
case "10":
dicNoMaterialCoordinate.Value.X = TenX;
dicNoMaterialCoordinate.Value.Y = TenY;
break;
case "11":
dicNoMaterialCoordinate.Value.X = ElevenX;
dicNoMaterialCoordinate.Value.Y = ElevenY;
break;
case "12":
dicNoMaterialCoordinate.Value.X = TwelveX;
dicNoMaterialCoordinate.Value.Y = TwelveY;
break;
case "13":
dicNoMaterialCoordinate.Value.X = ThirteenX;
dicNoMaterialCoordinate.Value.Y = ThirteenY;
break;
case "14":
dicNoMaterialCoordinate.Value.X = FourteenX;
dicNoMaterialCoordinate.Value.Y = FourteenY;
break;
case "15":
dicNoMaterialCoordinate.Value.X = FifteenX;
dicNoMaterialCoordinate.Value.Y = FifteenY;
break;
case "16":
dicNoMaterialCoordinate.Value.X = SixteenX;
dicNoMaterialCoordinate.Value.Y = SixteenY;
break;
case "17":
dicNoMaterialCoordinate.Value.X = SeventeenX;
dicNoMaterialCoordinate.Value.Y = SeventeenY;
break;
case "18":
dicNoMaterialCoordinate.Value.X = EighteenX;
dicNoMaterialCoordinate.Value.Y = EighteenY;
break;
case "19":
dicNoMaterialCoordinate.Value.X = NineteenX;
dicNoMaterialCoordinate.Value.Y = NineteenY;
break;
case "20":
dicNoMaterialCoordinate.Value.X = TwentyX;
dicNoMaterialCoordinate.Value.Y = TwentyY;
break;
case "21":
dicNoMaterialCoordinate.Value.X = TwentyOneX;
dicNoMaterialCoordinate.Value.Y = TwentyOneY;
break;
case "22":
dicNoMaterialCoordinate.Value.X = TwentyTwoX;
dicNoMaterialCoordinate.Value.Y = TwentyTwoY;
break;
case "23":
dicNoMaterialCoordinate.Value.X = TwentyThreeX;
dicNoMaterialCoordinate.Value.Y = TwentyThreeX;
break;
case "24":
dicNoMaterialCoordinate.Value.X = TwentyFourX;
dicNoMaterialCoordinate.Value.Y = TwentyFourY;
break;
case "25":
dicNoMaterialCoordinate.Value.X = TwentyFiveX;
dicNoMaterialCoordinate.Value.Y = TwentyFiveY;
break;
case "26":
dicNoMaterialCoordinate.Value.X = TwentySixX;
dicNoMaterialCoordinate.Value.Y = TwentySixY;
break;
case "27":
dicNoMaterialCoordinate.Value.X = TwentySevenX;
dicNoMaterialCoordinate.Value.Y = TwentySevenY;
break;
default:
break;
}
}

Json<MaterialCoordinate>.Data = materialCoordinate;
Json<MaterialCoordinate>.Save();
}

/// <summary>
/// 读取坐标系
/// </summary>
/// <returns></returns>
private MaterialCoordinate ReadMaterialCoordinate()
{
try
{
Json<MaterialCoordinate>.Read();
MaterialCoordinate materialCoordinate = Json<MaterialCoordinate>.Data;
return materialCoordinate;
}
catch (Exception ex)
{
return null;
}
}

private void PhysicalMaterialCoordinate()
{
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate();

if (materialCoordinate.dicNoMaterialCoordinate.Count == 27)
{
foreach (var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate)
{
switch (dicNoMaterialCoordinate.Key)
{
case "1":
OneX = dicNoMaterialCoordinate.Value.X;
OneY = dicNoMaterialCoordinate.Value.Y;
break;
case "2":
TwoX = dicNoMaterialCoordinate.Value.X;
TwoY = dicNoMaterialCoordinate.Value.Y;
break;
case "3":
ThreeX = dicNoMaterialCoordinate.Value.X;
ThreeY = dicNoMaterialCoordinate.Value.Y;
break;
case "4":
FourX = dicNoMaterialCoordinate.Value.X;
FourY = dicNoMaterialCoordinate.Value.Y;
break;
case "5":
FiveX = dicNoMaterialCoordinate.Value.X;
FiveY = dicNoMaterialCoordinate.Value.Y;
break;
case "6":
SixX = dicNoMaterialCoordinate.Value.X;
SixY = dicNoMaterialCoordinate.Value.Y;
break;
case "7":
SevenX = dicNoMaterialCoordinate.Value.X;
SevenY = dicNoMaterialCoordinate.Value.Y;
break;
case "8":
EightX = dicNoMaterialCoordinate.Value.X;
EightY = dicNoMaterialCoordinate.Value.Y;
break;
case "9":
NineX = dicNoMaterialCoordinate.Value.X;
NineY = dicNoMaterialCoordinate.Value.Y;
break;
case "10":
TenX = dicNoMaterialCoordinate.Value.X;
TenY = dicNoMaterialCoordinate.Value.Y;
break;
case "11":
ElevenX = dicNoMaterialCoordinate.Value.X;
ElevenY = dicNoMaterialCoordinate.Value.Y;
break;
case "12":
TwelveX = dicNoMaterialCoordinate.Value.X;
TwelveY = dicNoMaterialCoordinate.Value.Y;
break;
case "13":
ThirteenX = dicNoMaterialCoordinate.Value.X;
ThirteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "14":
FourteenX = dicNoMaterialCoordinate.Value.X;
FourteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "15":
FifteenX = dicNoMaterialCoordinate.Value.X;
FifteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "16":
SixteenX = dicNoMaterialCoordinate.Value.X;
SixteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "17":
SeventeenX = dicNoMaterialCoordinate.Value.X;
SeventeenY = dicNoMaterialCoordinate.Value.Y;
break;
case "18":
EighteenX = dicNoMaterialCoordinate.Value.X;
EighteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "19":
NineteenX = dicNoMaterialCoordinate.Value.X;
NineteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "20":
TwentyX = dicNoMaterialCoordinate.Value.X;
TwentyY = dicNoMaterialCoordinate.Value.Y;
break;
case "21":
TwentyOneX = dicNoMaterialCoordinate.Value.X;
TwentyOneY = dicNoMaterialCoordinate.Value.Y;
break;
case "22":
TwentyTwoX = dicNoMaterialCoordinate.Value.X;
TwentyTwoY = dicNoMaterialCoordinate.Value.Y;
break;
case "23":
TwentyThreeX = dicNoMaterialCoordinate.Value.X;
TwentyThreeY = dicNoMaterialCoordinate.Value.Y;
break;
case "24":
TwentyFourX = dicNoMaterialCoordinate.Value.X;
TwentyFourY = dicNoMaterialCoordinate.Value.Y;
break;
case "25":
TwentyFiveX = dicNoMaterialCoordinate.Value.X;
TwentyFiveY = dicNoMaterialCoordinate.Value.Y;
break;
case "26":
TwentySixX = dicNoMaterialCoordinate.Value.X;
TwentySixY = dicNoMaterialCoordinate.Value.Y;
break;
case "27":
TwentySevenX = dicNoMaterialCoordinate.Value.X;
TwentySevenY = dicNoMaterialCoordinate.Value.Y;
break;
default:
break;
}
}
}

}

private void Calibration(string Num)
{
switch (Num)
{
case "1":
OneX = OneX + OperationX;
OneY = OneY + OperationX;
break;
case "2":
TwoX = TwoX + OperationX;
TwoY = TwoY + OperationY;
break;
case "3":
ThreeX = ThreeX + OperationX;
ThreeY = ThreeY + OperationY;
break;
case "4":
FourX = FourX + OperationX;
FourY = FourY + OperationY;
break;
case "5":
FiveX = FiveX + OperationX;
FiveY = FiveY + OperationY;
break;
case "6":
SixX = SixX + OperationX;
SixY = SixY + OperationY;
break;
case "7":
SevenX = SevenX + OperationX;
SevenY = SevenY + OperationY;
break;
case "8":
EightX = EightX + OperationX;
EightY = EightY + OperationY;
break;
case "9":
NineX = NineX + OperationX;
NineY = NineY + OperationY;
break;
case "10":
TenX = TenX + OperationX;
TenY = TenY + OperationY;
break;
case "11":
ElevenX = ElevenX + OperationX;
ElevenY = ElevenY + OperationY;
break;
case "12":
TwelveX = TwelveX + OperationX;
TwelveY = TwelveY + OperationY;
break;
case "13":
ThirteenX = ThirteenX + OperationX;
ThirteenY = ThirteenY + OperationY;
break;
case "14":
FourteenX = FourteenX + OperationX;
FourteenY = FourteenY + OperationY;
break;
case "15":
FifteenX = FifteenX + OperationX;
FifteenY = FifteenY + OperationY;
break;
case "16":
SixteenX = SixteenX + OperationX;
SixteenY = SixteenY + OperationY;
break;
case "17":
SeventeenX = SeventeenX + OperationX;
SeventeenY = SeventeenY + OperationY;
break;
case "18":
EighteenX = EighteenX + OperationX;
EighteenY = EighteenY + OperationY;
break;
case "19":
NineteenX = NineteenX + OperationX;
NineteenY = NineteenY + OperationY;
break;
case "20":
TwentyX = TwentyX + OperationX;
TwentyY = TwentyY + OperationY;
break;
case "21":
TwentyOneX = TwentyOneX + OperationX;
TwentyOneY = TwentyOneY + OperationY;
break;
case "22":
TwentyTwoX = TwentyTwoX + OperationX;
TwentyTwoY = TwentyTwoY + OperationY;
break;
case "23":
TwentyThreeX = TwentyThreeX + OperationX;
TwentyThreeY = TwentyThreeY + OperationY;
break;
case "24":
TwentyFourX = TwentyFourX + OperationX;
TwentyFourY = TwentyFourY + OperationY;
break;
case "25":
TwentyFiveX = TwentyFiveX + OperationX;
TwentyFiveY = TwentyFiveY + OperationY;
break;
case "26":
TwentySixX = TwentySixX + OperationX;
TwentySixY = TwentySixY + OperationY;
break;
case "27":
TwentySevenX = TwentySevenX + OperationX;
TwentySevenY = TwentySevenY + OperationY;
break;
default:
break;
}
OperationX = 0;
OperationY = 0;
}

private void SetPosition()
{
//判断是否有选择下发的设备
if (!PositionOne && !PositionTwo && !PositionThree && !PositionFour && !PositionFive && !PositionSix && !PositionSeven && !PositionEight && !PositionNine
&& !PositionTen && !PositionEleven && !PositionTwelve && !PositionThirteen && !PositionFourteen && !PositionFifteen && !PositionSixteen && !PositionSeventeen && !PositionEighteen
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven)
{
MessageBox.Show("未选择点位");
return;
}

if (PositionOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
}
if (PositionTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "2", TwoX + OperationX, TwoY + OperationY });//设定机械臂当前位置
}
if (PositionThree)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "3", + OperationX, ThreeY + OperationY });//设定机械臂当前位置
}
if (PositionFour)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "4", FourX + OperationX, FourY + OperationY });//设定机械臂当前位置
}
if (PositionFive)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "5", FiveX + OperationX, FiveY + OperationY });//设定机械臂当前位置
}
if (PositionSix)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "6", SixX + OperationX, SixY + OperationY });//设定机械臂当前位置
}
if (PositionSeven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "7", SevenX + OperationX, SevenY + OperationY });//设定机械臂当前位置
}
if (PositionEight)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "8", EightX + OperationX, EightY + OperationY });//设定机械臂当前位置
}
if (PositionNine)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
}
if (PositionTen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
}
if (PositionEleven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "11", ElevenX + OperationX, ElevenY + OperationY });//设定机械臂当前位置
}
if (PositionTwelve)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "12", TwelveX + OperationX, TwelveY + OperationY });//设定机械臂当前位置
}
if (PositionThirteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "13", ThirteenX + OperationX, ThirteenY + OperationY });//设定机械臂当前位置
}
if (PositionFourteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "14", FourteenX + OperationX, FourteenY + OperationY });//设定机械臂当前位置
}
if (PositionFifteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "15", FifteenX + OperationX, FifteenY + OperationY });//设定机械臂当前位置
}
if (PositionSixteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "16", SixteenX + OperationX, SixteenY + OperationY });//设定机械臂当前位置
}
if (PositionSeventeen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "17", SeventeenX + OperationX, SeventeenY + OperationY });//设定机械臂当前位置
}
if (PositionEighteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
}
if (PositionNineteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
}
if (PositionTwenty)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "20", TwentyX + OperationX, TwentyY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "21", TwentyOneX + OperationX, TwentyOneY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "22", TwentyTwoX + OperationX, TwentyTwoY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyThree)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "23", TwentyThreeX + OperationX, TwentyThreeY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyFour)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "24", TwentyFourX + OperationX, TwentyFourY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyFive)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "25", TwentyFiveX + OperationX, TwentyFiveY + OperationY });//设定机械臂当前位置
}
if (PositionTwentySix)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "26", TwentySixX + OperationX, TwentySixY + OperationY });//设定机械臂当前位置
}
if (PositionTwentySeven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
}
}

public MaterialCalibrationViewModel()
{
PhysicalMaterialCoordinate();
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
if(o is List<string> nums)
{
Calibration(nums[0]);
}
}), "CalibrationCallBack");
}), "CalibrationCallBack");
SetNowPosition = new RelayCommand(() =>
{
if(!Point && !Left && !Right && !Down && !Up)
{
MessageBox.Show("请选择需要移动的方式");
return;
}

if (!Point)
{
if (!int.TryParse(Str, out Factor))
{
Factor = 1;
}
if(Factor > 100 || Factor<0)
{
MessageBox.Show("请输入有效系数");
return;
}
}

if(Left)
{
OperationX = -1 * BasicPosition * Factor;
}
else if(Right)
{
OperationX = BasicPosition * Factor;
}
else if(Down)
{
OperationY = BasicPosition * Factor;
}
else if(Up)
{
OperationY = -1 * BasicPosition * Factor;
}
else
{
OperationX = 0;
OperationY = 0;
}
SetPosition();
});
SaveCoordinate = new RelayCommand(() =>
{
SaveMaterialCoordinate();
});
ReadCoordinate = new RelayCommand(() =>
{
PhysicalMaterialCoordinate();
});
AutoCalculation = new RelayCommand(() =>
{
AutoCalculationCoordination();
});
}

/// <summary>
/// 自动计算坐标
/// </summary>
private void AutoCalculationCoordination()
{
#region 菜品库一层计算
//X轴改变
TwoX = ThreeX = FourX = FiveX = SixX = SevenX = EightX = NineX = OneX;
TwoY = OneY + smartMaterialClearanceY;
ThreeY = OneY + 2*smartMaterialClearanceY;
FourY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
FiveY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
SixY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY;
SevenY = OneY + 4 * smartMaterialClearanceY + 2*bigMaterialClearanceY;
EightY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
NineY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
#region 菜品库二层计算
//X轴改变
TenX = ElevenX = TwelveX = ThirteenX = FourteenX = FifteenX = SixteenX = SeventeenX = EighteenX = (OneX + materialClearanceX);
TenY = OneY;
ElevenY = OneY + smartMaterialClearanceY;
TwelveY = OneY + 2 * smartMaterialClearanceY;
ThirteenY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
FourteenY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
FifteenY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY;
SixteenY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
SeventeenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
EighteenY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
#region 菜品库三层计算
//X轴改变
NineteenX = TwentyX = TwentyOneX = TwentyTwoX = TwentyThreeX = TwentyFourX = TwentyFiveX = TwentySixX = TwentySevenX = (OneX + 2 * materialClearanceX);
NineteenY = OneY;
TwentyY = OneY + smartMaterialClearanceY;
TwentyOneY = OneY + 2 * smartMaterialClearanceY;
TwentyTwoY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
TwentyThreeY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
TwentyFourY = OneY + 4 * smartMaterialClearanceY + bigMaterialClearanceY;
TwentyFiveY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
TwentySixY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
TwentySevenY = OneY + 6 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
}

#endregion

}
}

+ 2
- 2
BPASmartClient/AssemblyInfo.cs View File

@@ -2,9 +2,9 @@ using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
//(used if Factor 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,
//(used if Factor resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

Loading…
Cancel
Save