Browse Source

修改轴精度

wanghan 7 months ago
parent
commit
af40f203a3

+ 73 - 19
TeamAAS-VM/ViewModels/Product/VisionDynamicAccuracyAnalyzerViewModel.cs

@@ -241,6 +241,36 @@ namespace TeamAAS_VP.ViewModels.Product
             get { return _precisionResult; }
             set { SetProperty(ref _precisionResult, value); }
         }
+
+        private int _ADelay = 300;
+        /// <summary>
+        /// A点延时时间
+        /// </summary>
+        public int ADelay
+        {
+            get { return _ADelay; }
+            set { SetProperty(ref _ADelay, value); }
+        }
+
+        private int _BDelay = 500;
+        /// <summary>
+        /// B点延时时间
+        /// </summary>
+        public int BDelay
+        {
+            get { return _BDelay; }
+            set { SetProperty(ref _BDelay, value); }
+        }
+
+        private bool _IsTakePhoto = true;
+        /// <summary>
+        /// 是否启用拍照
+        /// </summary>
+        public bool IsTakePhoto
+        {
+            get { return _IsTakePhoto; }
+            set { SetProperty(ref _IsTakePhoto, value); }
+        }
         #endregion
 
         #region 命令
@@ -385,7 +415,7 @@ namespace TeamAAS_VP.ViewModels.Product
                     SendTaskMessage("机器人移动到A点失败!");
                     return;
                 }
-                await Task.Delay(200);
+                await Task.Delay(ADelay);
 
                 //移动机器人至B点
                 isSuccess1 = await Robot.CalibMotionAsync(PointB, null);
@@ -394,10 +424,12 @@ namespace TeamAAS_VP.ViewModels.Product
                     SendTaskMessage("机器人移动到B点失败!");
                     return;
                 }
-                await Task.Delay(300);
-                //相机拍照并处理
-                (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
-
+                await Task.Delay(BDelay);
+                if (IsTakePhoto)
+                {
+                    //相机拍照并处理
+                    (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
+                }
                 CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
             }
             catch (Exception ex)
@@ -434,6 +466,17 @@ namespace TeamAAS_VP.ViewModels.Product
                 {
                     return;
                 }
+                if (Robot == null || !Robot.IsConnected)
+                {
+                    SendTaskMessage("机器人未连接,无法示教!");
+                    return;
+                }
+
+                if (Camera == null || !Camera.IsConnected)
+                {
+                    SendTaskMessage("相机未连接,无法示教!");
+                    return;
+                }
 
                 //为机器人设置移动速度
                 await Robot.CalibParameAsync(new PickInfo(), MoveSpeed, 0, false, 0, 0);
@@ -454,7 +497,7 @@ namespace TeamAAS_VP.ViewModels.Product
                         SendTaskMessage("机器人移动到A点失败!");
                         return;
                     }
-                    await Task.Delay(200);
+                    await Task.Delay(ADelay);
                     if (_cts.Token.IsCancellationRequested)
                     {
                         Message = "测试已取消!";
@@ -468,30 +511,41 @@ namespace TeamAAS_VP.ViewModels.Product
                         SendTaskMessage("机器人移动到B点失败!");
                         return;
                     }
-                    await Task.Delay(300);
+                    await Task.Delay(BDelay);
                     if (_cts.Token.IsCancellationRequested)
                     {
                         Message = "测试已取消!";
                         break;
                     }
 
-                    //相机拍照并处理
-                    (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
-                    CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
-
-                    if (isSuccess)
+                    if (IsTakePhoto)
                     {
-                        SuccessCount++;
+                        //相机拍照并处理
+                        (bool isSuccess, double pixelX, double pixelY, double angleU, double transformX, double transformY) = await ExecutePhotoEx(CurrentProgress);
+
+                        CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
+
+                        if (isSuccess)
+                        {
+                            SuccessCount++;
+                        }
+                        else
+                        {
+                            FailCount++;
+                        }
+                        TestResults.Add(new DynamicTestResult(CurrentProgress, isSuccess, PointB, CycleTime, pixelX, pixelY, angleU, transformX, transformY));
+                        OnTestResultAdded();
+
+                        CurrentProgress++;
+                        SuccessRate = (double)SuccessCount / CurrentProgress * 100;
                     }
                     else
                     {
-                        FailCount++;
+                        CycleTime = DateTime.Now.Subtract(startTime).TotalSeconds;
+                        SuccessCount++;
+                        CurrentProgress++;
+                        SuccessRate = (double)SuccessCount / CurrentProgress * 100;
                     }
-                    TestResults.Add(new DynamicTestResult(CurrentProgress,isSuccess,PointB,CycleTime,pixelX,pixelY,angleU,transformX,transformY));
-                    OnTestResultAdded();
-
-                    CurrentProgress++;
-                    SuccessRate = (double)SuccessCount / CurrentProgress * 100;
                     SendTaskMessage($"测试进行中... {CurrentProgress}/{RepeatCount}");
                 }
                 if (CurrentProgress >= RepeatCount)

+ 10 - 0
TeamAAS-VM/ViewModels/Product/VisionStaticAccuracyAnalyzerViewModel.cs

@@ -205,6 +205,15 @@ namespace TeamAAS_VP.ViewModels.Product
             set { SetProperty(ref _StabilityMetrics, value); }
         }
 
+        private int _DelayTime = 200;
+        /// <summary>
+        /// 延时时间
+        /// </summary>
+        public int DelayTime
+        {
+            get { return _DelayTime; }
+            set { SetProperty(ref _DelayTime, value); }
+        }
         #endregion
 
         #region 命令
@@ -329,6 +338,7 @@ namespace TeamAAS_VP.ViewModels.Product
                     }
                     TestResult.Rows.Add(Result);
                     ExecuteSelectColumnCommand();
+                    await Task.Delay(DelayTime);
 
                     CurrentProgress++;
                     SuccessRate = (double)SuccessCount / CurrentProgress * 100;

+ 253 - 218
TeamAAS-VM/Views/Product/VisionDynamicAccuracyAnalyzer.xaml

@@ -43,7 +43,7 @@
             <Setter Property="WindowState"
                     Value="Maximized" />
             <Setter Property="Topmost"
-                    Value="True" />
+                    Value="False" />
         </Style>
     </prism:Dialog.WindowStyle>
 
@@ -113,10 +113,10 @@
         </Grid.ColumnDefinitions>
 
         <!-- 左侧控制面板 -->
-        <ScrollViewer >
+        <ScrollViewer>
             <Border Grid.Column="0"
-        BorderBrush="#BDC3C7"
-        BorderThickness="0 0 1 0">
+                    BorderBrush="#BDC3C7"
+                    BorderThickness="0 0 1 0">
                 <Grid>
                     <Grid.RowDefinitions>
                         <RowDefinition Height="Auto" />
@@ -124,17 +124,17 @@
                         <RowDefinition Height="Auto" />
                         <RowDefinition Height="Auto" />
                         <RowDefinition Height="*"
-                           MinHeight="150" />
+                                       MinHeight="150" />
                         <RowDefinition Height="Auto" />
                     </Grid.RowDefinitions>
 
                     <!-- 机器人位置设置 -->
                     <Border Grid.Row="0"
-                Background="#ECF0F1"
-                Padding="10">
+                            Background="#ECF0F1"
+                            Padding="10">
                         <StackPanel>
                             <TextBlock Style="{StaticResource TitleStyle}"
-                           Text="机器人位置设置" />
+                                       Text="机器人位置设置" />
 
                             <Grid Margin="0 10 0 0">
                                 <Grid.RowDefinitions>
@@ -145,7 +145,7 @@
 
                                 <!-- A点坐标 -->
                                 <Grid Grid.Row="0"
-                          Margin="0 0 0 10">
+                                      Margin="0 0 0 10">
                                     <Grid.ColumnDefinitions>
                                         <ColumnDefinition Width="Auto" />
                                         <ColumnDefinition Width="*" />
@@ -153,36 +153,36 @@
                                     </Grid.ColumnDefinitions>
 
                                     <TextBlock Text="A点坐标:"
-                                   Grid.Column="0"
-                                   VerticalAlignment="Center" />
+                                               Grid.Column="0"
+                                               VerticalAlignment="Center" />
                                     <TextBox Grid.Column="1"
-                                 d:Text="X:0.000 Y:0.000 Z:0.000 U:0.000 V:0.000 W:0.000"
-                                 ToolTip="机器人A点位置坐标"
-                                 IsReadOnly="True"
-                                 Background="#F8F9FA">
+                                             d:Text="X:0.000 Y:0.000 Z:0.000 U:0.000 V:0.000 W:0.000"
+                                             ToolTip="机器人A点位置坐标"
+                                             IsReadOnly="True"
+                                             Background="#F8F9FA">
                                         <TextBox.Text>
                                             <MultiBinding StringFormat="X:{0:f3} Y:{1:f3} Z:{2:f3} U:{3:f3} V:{4:f3} W:{5:f3}">
-                                                <Binding Path="PointA.X"/>
-                                                <Binding Path="PointA.Y"/>
-                                                <Binding Path="PointA.Z"/>
-                                                <Binding Path="PointA.U"/>
-                                                <Binding Path="PointA.V"/>
-                                                <Binding Path="PointA.W"/>
+                                                <Binding Path="PointA.X" />
+                                                <Binding Path="PointA.Y" />
+                                                <Binding Path="PointA.Z" />
+                                                <Binding Path="PointA.U" />
+                                                <Binding Path="PointA.V" />
+                                                <Binding Path="PointA.W" />
                                             </MultiBinding>
                                         </TextBox.Text>
                                     </TextBox>
                                     <Button Grid.Column="2"
-                                Content="示教"
-                                Command="{Binding TeachPointACommand}"
-                                Background="#3498DB"
-                                Foreground="White"
-                                Width="60"
-                                Margin="5,0,0,0" />
+                                            Content="示教"
+                                            Command="{Binding TeachPointACommand}"
+                                            Background="#3498DB"
+                                            Foreground="White"
+                                            Width="60"
+                                            Margin="5,0,0,0" />
                                 </Grid>
 
                                 <!-- B点坐标 -->
                                 <Grid Grid.Row="1"
-                          Margin="0 0 0 10">
+                                      Margin="0 0 0 10">
                                     <Grid.ColumnDefinitions>
                                         <ColumnDefinition Width="Auto" />
                                         <ColumnDefinition Width="*" />
@@ -190,31 +190,31 @@
                                     </Grid.ColumnDefinitions>
 
                                     <TextBlock Text="B点坐标:"
-                                   Grid.Column="0"
-                                   VerticalAlignment="Center" />
+                                               Grid.Column="0"
+                                               VerticalAlignment="Center" />
                                     <TextBox Grid.Column="1"
-                                 d:Text="X:100.000 Y:50.000 Z:0.000 U:0.000 V:0.000 W:0.000"
-                                 ToolTip="机器人B点拍照位置坐标"
-                                 IsReadOnly="True"
-                                 Background="#F8F9FA" >
+                                             d:Text="X:100.000 Y:50.000 Z:0.000 U:0.000 V:0.000 W:0.000"
+                                             ToolTip="机器人B点拍照位置坐标"
+                                             IsReadOnly="True"
+                                             Background="#F8F9FA">
                                         <TextBox.Text>
                                             <MultiBinding StringFormat="X:{0:f3} Y:{1:f3} Z:{2:f3} U:{3:f3} V:{4:f3} W:{5:f3}">
-                                                <Binding Path="PointB.X"/>
-                                                <Binding Path="PointB.Y"/>
-                                                <Binding Path="PointB.Z"/>
-                                                <Binding Path="PointB.U"/>
-                                                <Binding Path="PointB.V"/>
-                                                <Binding Path="PointB.W"/>
+                                                <Binding Path="PointB.X" />
+                                                <Binding Path="PointB.Y" />
+                                                <Binding Path="PointB.Z" />
+                                                <Binding Path="PointB.U" />
+                                                <Binding Path="PointB.V" />
+                                                <Binding Path="PointB.W" />
                                             </MultiBinding>
                                         </TextBox.Text>
                                     </TextBox>
                                     <Button Grid.Column="2"
-                                Content="示教"
-                                Command="{Binding TeachPointBCommand}"
-                                Background="#3498DB"
-                                Foreground="White"
-                                Width="60"
-                                Margin="5,0,0,0" />
+                                            Content="示教"
+                                            Command="{Binding TeachPointBCommand}"
+                                            Background="#3498DB"
+                                            Foreground="White"
+                                            Width="60"
+                                            Margin="5,0,0,0" />
                                 </Grid>
 
                                 <!-- 视觉流程选择 -->
@@ -225,12 +225,12 @@
                                     </Grid.ColumnDefinitions>
 
                                     <TextBlock Text="视觉流程:"
-                                   Grid.Column="0"
-                                   VerticalAlignment="Center" />
+                                               Grid.Column="0"
+                                               VerticalAlignment="Center" />
                                     <ComboBox Grid.Column="1"
-                                  ItemsSource="{Binding ProcedureModels}"
-                                  SelectedItem="{Binding SelectProcedure, Mode=TwoWay}"
-                                  ToolTip="选择视觉处理流程">
+                                              ItemsSource="{Binding ProcedureModels, Mode=TwoWay}"
+                                              SelectedItem="{Binding SelectProcedure, Mode=TwoWay}"
+                                              ToolTip="选择视觉处理流程">
                                         <ComboBox.ItemTemplate>
                                             <DataTemplate>
                                                 <TextBlock Text="{Binding Name}" />
@@ -249,44 +249,72 @@
 
                     <!-- 测试参数设置 -->
                     <Border Grid.Row="1"
-                Background="#F8F9FA"
-                Padding="10">
+                            Background="#F8F9FA"
+                            Padding="10">
                         <StackPanel>
                             <TextBlock Style="{StaticResource TitleStyle}"
-                           Text="测试参数设置" />
+                                       Text="测试参数设置" />
 
                             <Grid Margin="0 10 0 0">
                                 <Grid.ColumnDefinitions>
                                     <ColumnDefinition Width="*" />
                                     <ColumnDefinition Width="*" />
+                                    <ColumnDefinition Width="*" />
+                                    <ColumnDefinition Width="*" />
                                 </Grid.ColumnDefinitions>
 
                                 <!-- 重复次数 -->
                                 <StackPanel Grid.Column="0">
                                     <TextBlock Text="重复次数:" />
                                     <mah:NumericUpDown Value="{Binding RepeatCount, Mode=TwoWay}"
-                                           Minimum="1"
-                                           Maximum="1000"
-                                           d:Value="50"
-                                           TextAlignment="Center"
-                                           HorizontalContentAlignment="Center"
-                                           HorizontalAlignment="Stretch"
-                                           IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
+                                                       Minimum="1"
+                                                       Maximum="1000"
+                                                       d:Value="50"
+                                                       TextAlignment="Center"
+                                                       HorizontalContentAlignment="Center"
+                                                       HorizontalAlignment="Stretch"
+                                                       IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
                                 </StackPanel>
 
                                 <!-- 移动速度 -->
                                 <StackPanel Grid.Column="1"
-                                Margin="10,0,0,0">
+                                            Margin="10,0,0,0">
                                     <TextBlock Text="移动速度(%):" />
                                     <mah:NumericUpDown Value="{Binding MoveSpeed, Mode=TwoWay}"
-                                           Minimum="1"
-                                           Maximum="100"
-                                           d:Value="50"
-                                           TextAlignment="Center"
-                                           HorizontalContentAlignment="Center"
-                                           HorizontalAlignment="Stretch"
-                                           IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
+                                                       Minimum="1"
+                                                       Maximum="100"
+                                                       d:Value="50"
+                                                       TextAlignment="Center"
+                                                       HorizontalContentAlignment="Center"
+                                                       HorizontalAlignment="Stretch"
+                                                       IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
+                                </StackPanel>
+                                <!-- A点延时 -->
+                                <StackPanel Grid.Column="2">
+                                    <TextBlock Text="A点延时(ms):"
+                                               Margin="10,0,0,0" />
+                                    <mah:NumericUpDown Value="{Binding ADelay, Mode=TwoWay}"
+                                                       Minimum="50"
+                                                       d:Value="300"
+                                                       TextAlignment="Center"
+                                                       HorizontalContentAlignment="Center"
+                                                       HorizontalAlignment="Stretch"
+                                                       IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
+                                </StackPanel>
+
+                                <!-- B点延时 -->
+                                <StackPanel Grid.Column="3"
+                                            Margin="10,0,0,0">
+                                    <TextBlock Text="B点延时(ms):" />
+                                    <mah:NumericUpDown Value="{Binding BDelay, Mode=TwoWay}"
+                                                       Minimum="50"
+                                                       d:Value="500"
+                                                       TextAlignment="Center"
+                                                       HorizontalContentAlignment="Center"
+                                                       HorizontalAlignment="Stretch"
+                                                       IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
                                 </StackPanel>
+
                             </Grid>
 
 
@@ -295,55 +323,62 @@
 
                     <!-- 测试控制区域 -->
                     <Border Grid.Row="2"
-                Background="#ECF0F1"
-                Padding="10">
+                            Background="#ECF0F1"
+                            Padding="10">
                         <StackPanel>
                             <TextBlock Style="{StaticResource TitleStyle}"
-                           Text="测试控制" />
+                                       Text="测试控制" />
 
                             <WrapPanel HorizontalAlignment="Center"
-                           Margin="0 10 0 0">
+                                       Margin="0 10 0 0">
+                                <CheckBox Content="启用拍照"
+                                          Foreground="Black"
+                                          Style="{StaticResource MaterialDesignCheckBox}"
+                                          VerticalAlignment="Center"
+                                          IsChecked="{Binding IsTakePhoto}"
+                                          Margin="10,0"
+                                          FontSize="15" />
                                 <Button Content="单次测试"
-                            Background="#3498DB"
-                            Foreground="White"
-                            MinWidth="100"
-                            Height="35"
-                            FontWeight="Bold"
-                            Command="{Binding SingleTestCommand}"
-                            IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
+                                        Background="#3498DB"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Height="35"
+                                        FontWeight="Bold"
+                                        Command="{Binding SingleTestCommand}"
+                                        IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
 
                                 <Button Content="连续测试"
-                            Background="#27AE60"
-                            Foreground="White"
-                            MinWidth="100"
-                            Height="35"
-                            FontWeight="Bold"
-                            Command="{Binding StartTestCommand}" />
+                                        Background="#27AE60"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Height="35"
+                                        FontWeight="Bold"
+                                        Command="{Binding StartTestCommand}" />
 
                                 <Button Content="停止"
-                            Background="#E74C3C"
-                            Foreground="White"
-                            MinWidth="100"
-                            Height="35"
-                            Command="{Binding StopTestCommand}" />
+                                        Background="#E74C3C"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Height="35"
+                                        Command="{Binding StopTestCommand}" />
 
                                 <Button Content="暂停"
-                            Background="#F39C12"
-                            Foreground="White"
-                            MinWidth="100"
-                            Height="35"
-                            Command="{Binding PauseTestCommand}" />
+                                        Background="#F39C12"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Height="35"
+                                        Command="{Binding PauseTestCommand}" />
                             </WrapPanel>
                         </StackPanel>
                     </Border>
 
                     <!-- 进度显示 -->
                     <Border Grid.Row="3"
-                Background="White"
-                Padding="10">
+                            Background="White"
+                            Padding="10">
                         <StackPanel>
                             <TextBlock Style="{StaticResource TitleStyle}"
-                           Text="测试进度" />
+                                       Text="测试进度" />
 
                             <Grid Margin="0 10 0 0">
                                 <Grid.RowDefinitions>
@@ -352,74 +387,74 @@
                                 </Grid.RowDefinitions>
 
                                 <ProgressBar Grid.Row="0"
-                                 Height="25"
-                                 Margin="5"
-                                 Minimum="0"
-                                 Maximum="{Binding RepeatCount}"
-                                 Value="{Binding CurrentProgress}"
-                                 IsEnabled="False"
-                                 d:Maximum="100"
-                                 d:Value="50" />
+                                             Height="25"
+                                             Margin="5"
+                                             Minimum="0"
+                                             Maximum="{Binding RepeatCount}"
+                                             Value="{Binding CurrentProgress}"
+                                             IsEnabled="False"
+                                             d:Maximum="100"
+                                             d:Value="50" />
 
                                 <TextBlock Grid.Row="1"
-                               HorizontalAlignment="Center"
-                               FontSize="12"
-                               Foreground="#7F8C8D"
-                               d:Text="等待开始..."
-                               Text="{Binding Message}" />
+                                           HorizontalAlignment="Center"
+                                           FontSize="12"
+                                           Foreground="#7F8C8D"
+                                           d:Text="等待开始..."
+                                           Text="{Binding Message}" />
                             </Grid>
 
                             <!-- 实时统计信息 -->
                             <WrapPanel Margin="0 15 0 0"
-                           HorizontalAlignment="Center">
+                                       HorizontalAlignment="Center">
                                 <Border Background="#3498DB"
-                            Padding="10 5"
-                            Margin="5"
-                            CornerRadius="3">
+                                        Padding="10 5"
+                                        Margin="5"
+                                        CornerRadius="3">
                                     <StackPanel>
                                         <TextBlock Text="当前循环"
-                                       Foreground="White"
-                                       FontSize="11" />
+                                                   Foreground="White"
+                                                   FontSize="11" />
                                         <TextBlock Text="{Binding CurrentProgress}"
-                                       d:Text="1"
-                                       Foreground="White"
-                                       FontSize="16"
-                                       FontWeight="Bold"
-                                       HorizontalAlignment="Center" />
+                                                   d:Text="1"
+                                                   Foreground="White"
+                                                   FontSize="16"
+                                                   FontWeight="Bold"
+                                                   HorizontalAlignment="Center" />
                                     </StackPanel>
                                 </Border>
 
                                 <Border Background="#2ECC71"
-                            Padding="10 5"
-                            Margin="5"
-                            CornerRadius="3">
+                                        Padding="10 5"
+                                        Margin="5"
+                                        CornerRadius="3">
                                     <StackPanel>
                                         <TextBlock Text="成功率"
-                                       Foreground="White"
-                                       FontSize="11" />
+                                                   Foreground="White"
+                                                   FontSize="11" />
                                         <TextBlock Text="{Binding SuccessRate, StringFormat={}{0:F1}%}"
-                                       d:Text="100%"
-                                       Foreground="White"
-                                       FontSize="16"
-                                       FontWeight="Bold"
-                                       HorizontalAlignment="Center" />
+                                                   d:Text="100%"
+                                                   Foreground="White"
+                                                   FontSize="16"
+                                                   FontWeight="Bold"
+                                                   HorizontalAlignment="Center" />
                                     </StackPanel>
                                 </Border>
 
                                 <Border Background="#9B59B6"
-                            Padding="10 5"
-                            Margin="5"
-                            CornerRadius="3">
+                                        Padding="10 5"
+                                        Margin="5"
+                                        CornerRadius="3">
                                     <StackPanel>
                                         <TextBlock Text="往返时间"
-                                       Foreground="White"
-                                       FontSize="11" />
+                                                   Foreground="White"
+                                                   FontSize="11" />
                                         <TextBlock Text="{Binding CycleTime, StringFormat={}{0:F2}s}"
-                                       d:Text="2.34s"
-                                       Foreground="White"
-                                       FontSize="16"
-                                       FontWeight="Bold"
-                                       HorizontalAlignment="Center" />
+                                                   d:Text="2.34s"
+                                                   Foreground="White"
+                                                   FontSize="16"
+                                                   FontWeight="Bold"
+                                                   HorizontalAlignment="Center" />
                                     </StackPanel>
                                 </Border>
                             </WrapPanel>
@@ -428,8 +463,8 @@
 
                     <!-- 测试结果列表 -->
                     <Border Grid.Row="4"
-                Background="White"
-                Padding="10">
+                            Background="White"
+                            Padding="10">
                         <Grid>
                             <Grid.RowDefinitions>
                                 <RowDefinition Height="Auto" />
@@ -437,51 +472,51 @@
                             </Grid.RowDefinitions>
 
                             <StackPanel Grid.Row="0"
-                            Orientation="Horizontal">
+                                        Orientation="Horizontal">
                                 <TextBlock Style="{StaticResource TitleStyle}"
-                               Text="测试结果列表" />
+                                           Text="测试结果列表" />
                                 <TextBlock Margin="10,0,0,0"
-                               VerticalAlignment="Center"
-                               Foreground="#7F8C8D"
-                               Text="(显示最近20次结果)" />
+                                           VerticalAlignment="Center"
+                                           Foreground="#7F8C8D"
+                                           Text="(显示最近20次结果)" />
                             </StackPanel>
 
                             <DataGrid x:Name="dgResults"
-                          Grid.Row="1"
-                          Style="{StaticResource DataGridStyle}"
-                          MaxHeight="250"
-                          AutoGenerateColumns="False"
-                          CanUserAddRows="False"
-                          IsReadOnly="True"
-                          ItemsSource="{Binding TestResults}">
+                                      Grid.Row="1"
+                                      Style="{StaticResource DataGridStyle}"
+                                      MaxHeight="250"
+                                      AutoGenerateColumns="False"
+                                      CanUserAddRows="False"
+                                      IsReadOnly="True"
+                                      ItemsSource="{Binding TestResults}">
                                 <DataGrid.Columns>
                                     <DataGridTextColumn Header="序号"
-                                            Binding="{Binding Index}"
-                                            MinWidth="50" />
+                                                        Binding="{Binding Index}"
+                                                        MinWidth="50" />
                                     <DataGridTextColumn Header="状态"
-                                            Binding="{Binding IsPhotoSuccess}"
-                                            MinWidth="60" />
+                                                        Binding="{Binding IsPhotoSuccess}"
+                                                        MinWidth="60" />
                                     <DataGridTextColumn Header="像素X"
-                                            Binding="{Binding PixelX, StringFormat={}{0:F3}}"
-                                            MinWidth="70" />
+                                                        Binding="{Binding PixelX, StringFormat={}{0:F3}}"
+                                                        MinWidth="70" />
                                     <DataGridTextColumn Header="像素Y"
-                                            Binding="{Binding PixelY, StringFormat={}{0:F3}}"
-                                            MinWidth="70" />
+                                                        Binding="{Binding PixelY, StringFormat={}{0:F3}}"
+                                                        MinWidth="70" />
                                     <DataGridTextColumn Header="角度"
-                                            Binding="{Binding AngleU, StringFormat={}{0:F2}}"
-                                            MinWidth="60" />
+                                                        Binding="{Binding AngleU, StringFormat={}{0:F2}}"
+                                                        MinWidth="60" />
                                     <DataGridTextColumn Header="绝对X"
-                                            Binding="{Binding TransformX, StringFormat={}{0:F3}}"
-                                            MinWidth="70" />
+                                                        Binding="{Binding TransformX, StringFormat={}{0:F3}}"
+                                                        MinWidth="70" />
                                     <DataGridTextColumn Header="绝对Y"
-                                            Binding="{Binding TransformY, StringFormat={}{0:F3}}"
-                                            MinWidth="70" />
+                                                        Binding="{Binding TransformY, StringFormat={}{0:F3}}"
+                                                        MinWidth="70" />
                                     <DataGridTextColumn Header="循环时间"
-                                            Binding="{Binding CycleTime, StringFormat={}{0:F2}s}"
-                                            MinWidth="80" />
+                                                        Binding="{Binding CycleTime, StringFormat={}{0:F2}s}"
+                                                        MinWidth="80" />
                                     <DataGridTextColumn Header="时间戳"
-                                            Binding="{Binding Timestamp}"
-                                            MinWidth="120" />
+                                                        Binding="{Binding Timestamp}"
+                                                        MinWidth="120" />
                                 </DataGrid.Columns>
                             </DataGrid>
                         </Grid>
@@ -489,39 +524,39 @@
 
                     <!-- 导出和精度分析 -->
                     <Border Grid.Row="5"
-                Background="#ECF0F1"
-                Padding="10">
+                            Background="#ECF0F1"
+                            Padding="10">
                         <StackPanel>
                             <!-- 导出按钮 -->
                             <WrapPanel HorizontalAlignment="Right">
                                 <Button Content="导出CSV"
-                            Background="#3498DB"
-                            Foreground="White"
-                            MinWidth="100"
-                            Command="{Binding ExportCSVCommand}" />
+                                        Background="#3498DB"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Command="{Binding ExportCSVCommand}" />
 
                                 <Button Content="生成报告"
-                            Background="#9B59B6"
-                            Foreground="White"
-                            MinWidth="100"
-                            Command="{Binding ExportReportCommand}" />
+                                        Background="#9B59B6"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Command="{Binding ExportReportCommand}" />
 
                                 <Button Content="清空数据"
-                            Background="#95A5A6"
-                            Foreground="White"
-                            MinWidth="100"
-                            Command="{Binding ClearDataCommand}" />
+                                        Background="#95A5A6"
+                                        Foreground="White"
+                                        MinWidth="100"
+                                        Command="{Binding ClearDataCommand}" />
                             </WrapPanel>
 
                             <!-- 动态精度分析 -->
                             <Border Margin="0 10 0 0"
-                        Background="#F8F9FA"
-                        Padding="10"
-                        CornerRadius="5">
+                                    Background="#F8F9FA"
+                                    Padding="10"
+                                    CornerRadius="5">
                                 <StackPanel>
                                     <TextBlock Text="动态重复精度分析"
-                                   FontWeight="Bold"
-                                   Margin="0 0 0 5" />
+                                               FontWeight="Bold"
+                                               Margin="0 0 0 5" />
 
                                     <Grid Margin="0 5 0 0">
                                         <Grid.ColumnDefinitions>
@@ -533,23 +568,23 @@
                                             <TextBlock>
                                     <Run Text="X方向精度: " />
                                     <Run Text="{Binding PrecisionResult.XPrecision, StringFormat={}{0:F3}mm}"
-                                         d:Text="0.023mm"
-                                         Foreground="#2C3E50"
-                                         FontWeight="Bold" />
+                                                d:Text="0.023mm"
+                                                Foreground="#2C3E50"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                             <TextBlock>
                                     <Run Text="Y方向精度: " />
                                     <Run Text="{Binding PrecisionResult.YPrecision, StringFormat={}{0:F3}mm}"
-                                         d:Text="0.018mm"
-                                         Foreground="#2C3E50"
-                                         FontWeight="Bold" />
+                                                d:Text="0.018mm"
+                                                Foreground="#2C3E50"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                             <TextBlock>
                                     <Run Text="角度精度: " />
                                     <Run Text="{Binding PrecisionResult.AnglePrecision, StringFormat={}{0:F2}°}"
-                                         d:Text="0.12°"
-                                         Foreground="#2C3E50"
-                                         FontWeight="Bold" />
+                                                d:Text="0.12°"
+                                                Foreground="#2C3E50"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                         </StackPanel>
 
@@ -557,35 +592,35 @@
                                             <TextBlock>
                                     <Run Text="3σ范围: " />
                                     <Run Text="{Binding PrecisionResult.OverallThreeSigmaRange, StringFormat={}±{0:F3}mm}"
-                                         d:Text="±0.065mm"
-                                         Foreground="#2C3E50"
-                                         FontWeight="Bold" />
+                                                d:Text="±0.065mm"
+                                                Foreground="#2C3E50"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                             <TextBlock>
                                     <Run Text="CPK: " />
                                     <Run Text="{Binding PrecisionResult.OverallPrecision, StringFormat={}{0:F2}}"
-                                         d:Text="1.85"
-                                         Foreground="#2C3E50"
-                                         FontWeight="Bold" />
+                                                d:Text="1.85"
+                                                Foreground="#2C3E50"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                             <TextBlock>
                                     <Run Text="评级: " />
                                     <Run Text="{Binding ProcessRating}"
-                                         d:Text="优秀"
-                                         Foreground="#27AE60"
-                                         FontWeight="Bold" />
+                                                d:Text="优秀"
+                                                Foreground="#27AE60"
+                                                FontWeight="Bold" />
                                             </TextBlock>
                                         </StackPanel>
                                     </Grid>
 
                                     <!-- 趋势图按钮 -->
                                     <Button Content="显示趋势图"
-                                Background="#E67E22"
-                                Foreground="White"
-                                HorizontalAlignment="Right"
-                                Margin="0 10 0 0"
-                                MinWidth="100"
-                                Command="{Binding ShowTrendChartCommand}" />
+                                            Background="#E67E22"
+                                            Foreground="White"
+                                            HorizontalAlignment="Right"
+                                            Margin="0 10 0 0"
+                                            MinWidth="100"
+                                            Command="{Binding ShowTrendChartCommand}" />
                                 </StackPanel>
                             </Border>
                         </StackPanel>

+ 13 - 1
TeamAAS-VM/Views/Product/VisionStaticAccuracyAnalyzer.xaml

@@ -41,7 +41,7 @@
             <Setter Property="WindowState"
                     Value="Maximized" />
             <Setter Property="Topmost"
-                    Value="True" />
+                    Value="False" />
         </Style>
     </prism:Dialog.WindowStyle>
 
@@ -135,6 +135,7 @@
                                 <ColumnDefinition Width="Auto" />
                                 <ColumnDefinition Width="*" />
                                 <ColumnDefinition Width="Auto" />
+                                <ColumnDefinition Width="*" />
                             </Grid.ColumnDefinitions>
 
                             <TextBlock Text="重复次数:"
@@ -147,6 +148,17 @@
                                                HorizontalContentAlignment="Center"
                                                HorizontalAlignment="Stretch"
                                                IsEnabled="{Binding IsRunning,Converter={StaticResource InvertBooleanConverter}}" />
+
+                            <TextBlock Text="延时时间(ms):"
+                                       Grid.Column="2" />
+                            <mah:NumericUpDown Grid.Column="3"
+                                               Value="{Binding DelayTime, Mode=TwoWay}"
+                                               Minimum="50"
+                                               d:Value="200"
+                                               TextAlignment="Center"
+                                               HorizontalContentAlignment="Center"
+                                               HorizontalAlignment="Stretch"
+                                               IsEnabled="{Binding IsRunning,Converter={StaticResource InvertBooleanConverter}}" />
                             <!--<Button x:Name="btnSetCount"
                                     Grid.Column="2"
                                     Content="设置"