徐孝锋 il y a 8 mois
Parent
commit
30a6484322

+ 26 - 7
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -623,29 +623,48 @@ namespace TeamAAS_VP.ViewModels.Product
                 //如果当前的选项卡处于锁付点位,则提示用户当前模式不允许进行示教
                 if (SelectedIndex == 4)
                 {
-                    //如果local为空,则必须先通过相机定位产品,否则无法示教锁付点位
-                    if (toolCoord == null)
+                    ////如果local为空,则必须先通过相机定位产品,否则无法示教锁付点位
+                    //if (toolCoord == null)
+                    //{
+                    //    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "当前模式不允许直接示教贴敷点位,请先通过相机定位产品和定位辅料!", Duration = 1 });
+                    //    return;
+                    //}
+
+                    //弹窗用户是否确认要示教该点位
+                    if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                     {
-                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "当前模式不允许直接示教贴敷点位,请先通过相机定位产品和定位辅料!", Duration = 1 });
                         return;
                     }
+                    double upCameraU = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)_PutPoints[0].X, (float)_PutPoints[0].Y), new PointF((float)_PutPoints[1].X, (float)_PutPoints[1].Y));
 
+                    var curpos1 = await Robot.GetRobotPosAsync();
+                    var addpos = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[1].Name);
+                    //将当前点位转换为产品Local坐标系下的点位
+                    SelectedPoint.X_Position = (float)curpos1.X;
+                    SelectedPoint.Y_Position = (float)curpos1.Y;
+                    SelectedPoint.Z_Position_Start = curpos1.Z;
+                    SelectedPoint.U_Position = curpos1.U;
+                    SelectedPoint.R_Position = curpos1.V;
+                    SelectedPoint.Z_Position_Stop = addpos;
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                    return;
+                }
+                else if (SelectedIndex == 1)
+                {
                     //弹窗用户是否确认要示教该点位
                     if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                     {
                         return;
                     }
-                    double upCameraU = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)_PutPoints[0].X, (float)_PutPoints[0].Y), new PointF((float)_PutPoints[1].X, (float)_PutPoints[1].Y));
-
                     var curpos1 = await Robot.GetRobotPosAsync();
+                    var addpos = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[0].Name);
                     //将当前点位转换为产品Local坐标系下的点位
                     SelectedPoint.X_Position = (float)curpos1.X;
                     SelectedPoint.Y_Position = (float)curpos1.Y;
                     SelectedPoint.Z_Position_Start = curpos1.Z;
+                    SelectedPoint.Z_Position_Stop = addpos;
                     SelectedPoint.U_Position = curpos1.U;
                     SelectedPoint.R_Position = curpos1.V;
-                    SelectProduct.FixedUpCameraTempletAngle = _FixedUpCameraTempletAngle;
-                    SelectProduct.MoveDownCamerTempletAngle = upCameraU;
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
                     return;
                 }

+ 1 - 308
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -366,314 +366,7 @@
                                                     HorizontalAlignment="Left">
                                             <ScrollViewer>
                                                 <StackPanel Orientation="Horizontal">
-                                                    <GroupBox Header="托盘1">
-                                                        <Grid>
-                                                            <Grid.RowDefinitions>
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                            </Grid.RowDefinitions>
-                                                            <Grid.ColumnDefinitions>
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                            </Grid.ColumnDefinitions>
-                                                            <Grid.Resources>
-                                                                <Style TargetType="TextBlock">
-                                                                    <Setter Property="HorizontalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="VerticalAlignment"
-                                                                            Value="Center" />
-                                                                </Style>
-                                                                <Style TargetType="TextBox">
-                                                                    <Setter Property="HorizontalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="VerticalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="MinWidth"
-                                                                            Value="50" />
-                                                                </Style>
-                                                            </Grid.Resources>
-                                                            <TextBlock Text="X"
-                                                                       Grid.Column="1" />
-                                                            <TextBlock Text="Y"
-                                                                       Grid.Column="2" />
-                                                            <TextBlock Text="Z"
-                                                                       Grid.Column="3" />
-                                                            <TextBlock Text="U"
-                                                                       Grid.Column="4" />
-                                                            <TextBlock Text="附加轴"
-                                                                       Grid.Column="5" />
-                                                            <TextBlock Text="点1:"
-                                                                       Grid.Row="1"
-                                                                       Grid.Column="0" />
-                                                            <TextBlock Text="点2:"
-                                                                       Grid.Row="2"
-                                                                       Grid.Column="0" />
-                                                            <TextBlock Text="点3:"
-                                                                       Grid.Row="3"
-                                                                       Grid.Column="0" />
-                                                            <TextBox Text="{Binding Pallet1.P0.X_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet1.P0.Y_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet1.P0.Z_Position_Start}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet1.P0.U_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet1.P0.Z_Position_Stop}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="1"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="1-1" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="1"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="1-1" />
-                                                            <TextBox Text="{Binding Pallet1.P1.X_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet1.P1.Y_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet1.P1.Z_Position_Start}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet1.P1.U_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet1.P1.Z_Position_Stop}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="2"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="1-2" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="2"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="1-2" />
-                                                            <TextBox Text="{Binding Pallet1.P2.X_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet1.P2.Y_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet1.P2.Z_Position_Start}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet1.P2.U_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet1.P2.Z_Position_Stop}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="3"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="1-3" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="3"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="1-3" />
-                                                            <TextBlock Text="行数:"
-                                                                       Grid.Row="4"
-                                                                       Grid.Column="0" />
-                                                            <TextBox Text="{Binding Pallet1.Row}"
-                                                                     Grid.Row="4"
-                                                                     Grid.Column="1" />
-                                                            <TextBlock Text="列数:"
-                                                                       Grid.Row="4"
-                                                                       Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet1.Column}"
-                                                                     Grid.Row="4"
-                                                                     Grid.Column="3" />
-                                                            <Button Content="计算取料点"
-                                                                    Grid.Row="4"
-                                                                    Grid.ColumnSpan="4"
-                                                                    Margin="5,0"
-                                                                    HorizontalAlignment="Left"
-                                                                    Grid.Column="4"
-                                                                    Command="{Binding CalPickPosCommand}" 
-                                                                    CommandParameter="1"/>
-                                                        </Grid>
-                                                    </GroupBox>
-                                                    <GroupBox Header="托盘2" Margin="2,0">
-                                                        <Grid>
-                                                            <Grid.RowDefinitions>
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                                <RowDefinition Height="auto" />
-                                                            </Grid.RowDefinitions>
-                                                            <Grid.ColumnDefinitions>
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                                <ColumnDefinition Width="auto" />
-                                                            </Grid.ColumnDefinitions>
-                                                            <Grid.Resources>
-                                                                <Style TargetType="TextBlock">
-                                                                    <Setter Property="HorizontalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="VerticalAlignment"
-                                                                            Value="Center" />
-                                                                </Style>
-                                                                <Style TargetType="TextBox">
-                                                                    <Setter Property="HorizontalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="VerticalAlignment"
-                                                                            Value="Center" />
-                                                                    <Setter Property="MinWidth"
-                                                                            Value="50" />
-                                                                </Style>
-                                                            </Grid.Resources>
-                                                            <TextBlock Text="X"
-                                                                       Grid.Column="1" />
-                                                            <TextBlock Text="Y"
-                                                                       Grid.Column="2" />
-                                                            <TextBlock Text="Z"
-                                                                       Grid.Column="3" />
-                                                            <TextBlock Text="U"
-                                                                       Grid.Column="4" />
-                                                            <TextBlock Text="附加轴"
-                                                                       Grid.Column="5" />
-                                                            <TextBlock Text="点1:"
-                                                                       Grid.Row="1"
-                                                                       Grid.Column="0" />
-                                                            <TextBlock Text="点2:"
-                                                                       Grid.Row="2"
-                                                                       Grid.Column="0" />
-                                                            <TextBlock Text="点3:"
-                                                                       Grid.Row="3"
-                                                                       Grid.Column="0" />
-                                                            <TextBox Text="{Binding Pallet2.P0.X_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet2.P0.Y_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet2.P0.Z_Position_Start}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet2.P0.U_Position}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet2.P0.Z_Position_Stop}"
-                                                                     Grid.Row="1"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="1"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="2-1" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="1"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="2-1" />
-                                                            <TextBox Text="{Binding Pallet2.P1.X_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet2.P1.Y_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet2.P1.Z_Position_Start}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet2.P1.U_Position}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet2.P1.Z_Position_Stop}"
-                                                                     Grid.Row="2"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="2"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="2-2" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="2"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="2-2" />
-                                                            <TextBox Text="{Binding Pallet2.P2.X_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="1" />
-                                                            <TextBox Text="{Binding Pallet2.P2.Y_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet2.P2.Z_Position_Start}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="3" />
-                                                            <TextBox Text="{Binding Pallet2.P2.U_Position}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="4" />
-                                                            <TextBox Text="{Binding Pallet2.P2.Z_Position_Stop}"
-                                                                     Grid.Row="3"
-                                                                     Grid.Column="5" />
-                                                            <Button Content="示教"
-                                                                    Grid.Row="3"
-                                                                    Grid.Column="6"
-                                                                    Margin="5,0"
-                                                                    Command="{Binding PickTechCommand}"
-                                                                    CommandParameter="2-3" />
-                                                            <Button Content="移动"
-                                                                    Grid.Row="3"
-                                                                    Grid.Column="7"
-                                                                    Command="{Binding PickMoveCommand}"
-                                                                    CommandParameter="2-3" />
-                                                            <TextBlock Text="行数:"
-                                                                       Grid.Row="4"
-                                                                       Grid.Column="0" />
-                                                            <TextBox Text="{Binding Pallet2.Row}"
-                                                                     Grid.Row="4"
-                                                                     Grid.Column="1" />
-                                                            <TextBlock Text="列数:"
-                                                                       Grid.Row="4"
-                                                                       Grid.Column="2" />
-                                                            <TextBox Text="{Binding Pallet2.Column}"
-                                                                     Grid.Row="4"
-                                                                     Grid.Column="3" />
-                                                            <Button Content="计算取料点"
-                                                                    Grid.Row="4"
-                                                                    Grid.ColumnSpan="4"
-                                                                    Margin="5,0"
-                                                                    HorizontalAlignment="Left"
-                                                                    Grid.Column="4"
-                                                                    Command="{Binding CalPickPosCommand}"
-                                                                    CommandParameter="2"/>
-                                                        </Grid>
-                                                    </GroupBox>
+                                                    
                                                 </StackPanel>
                                             </ScrollViewer>
                                             <StackPanel Orientation="Horizontal">