ltwork 1 rok pred
rodič
commit
d4d1ad38fe

+ 33 - 27
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/AutoTestViewModel.cs

@@ -141,6 +141,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 int id = Convert.ToInt32(findDtlMsg.scheme_dtl_id);
                 // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
                 globalSchDetailId = id;
+                selctStartDetailId = id;
                 GetDetailInfo(id);
             }
         }
@@ -630,10 +631,10 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                     m.WaitOne(); //当m等于true,才会往下执行,否则一直在此等待
                     long schDetailId = item.scheme_dtl_id;
                     ////编号小于当前选择的就不测试了,
-                    //if (schDetailId < selctStartDetailId)
-                    //{
-                    //    continue;
-                    //}
+                    if (schDetailId < selctStartDetailId)
+                    {
+                        continue;
+                    }
                     globalSchDetailId = schDetailId;
                    
                     //当前选择的项不在更新显示,更新后面的显示
@@ -651,30 +652,39 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                     _logger.LogInformation($"开始自动测试。方案名{ScheduleName},测试项{TestName}");
                     SendLogToDis($"开始自动测试。方案名{ScheduleName},测试项{TestName}");
                     //测试
+                    start: // 标记位置
                     bool isExec=await ExecTest();
                     //条件不满足,直接退出
                     if(!isExec)
                     {
-                        return;
+                        MessageBox.Show("前置项条件不满足,请确认前置条件!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+
+                        System.Windows.Application.Current.Dispatcher.Invoke((delegate
+                        {
+                        
+                            StopOrContinueCont = "继续";
+                            
+                           
+                        }));
+                        m.Reset();  //阻塞线程
+                        m.WaitOne(); //当m等于true,才会往下执行,否则一直在此等待
+                        goto start;
                     }
+                  
+                    //条件满足
                     SendLogToDis($"自动测试完成。方案名{ScheduleName},测试项{TestName}");
-                    _logger.LogInformation($"自动测试完成。方案名{ScheduleName},测试项{TestName}");
-                
-                   
-                    await Task.Delay(2000);
-                    System.Windows.Application.Current.Dispatcher.Invoke((delegate
-                    {
-                        //listbox 的index+1
-                        SelectItemIndex++;
-                    }));
+                        _logger.LogInformation($"自动测试完成。方案名{ScheduleName},测试项{TestName}");
+
+
+                        await Task.Delay(2000);
+                        System.Windows.Application.Current.Dispatcher.Invoke((delegate
+                        {
+                            //listbox 的index+1
+                            SelectItemIndex++;
+                        }));
+
                     
-                    //最后一项必须要测试
-                    //if (globalSchDetailId == basicSchDtls.Max(x => x.scheme_dtl_id))
-                    //{
-                        
-                    //    MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
 
-                    //}
 
                 }
                 System.Windows.Application.Current.Dispatcher.Invoke((delegate
@@ -702,13 +712,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             int preceditionResult = GetPrecedtionResult();
             if (preceditionResult == 0)
             {
-                MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,若继续运行,点击确认按钮;若取消运行,点击取消按钮", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
-                if (boxResult != MessageBoxResult.OK)
-                {
-                    // 立即取消线程
-                    tokensource.Cancel();
-                    return false;
-                }
+                
+                return false;
+
             }
             //输入项
             bool isAction = TestActionMethod();

+ 4 - 5
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ManualTestViewModel.cs

@@ -676,11 +676,10 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             int preceditionResult=GetPrecedtionResult();
             if( preceditionResult == 0 )
             {
-                MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,若继续运行,点击确认按钮;若取消运行,点击取消按钮", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
-                if (boxResult != MessageBoxResult.OK)
-                {
-                    return;
-                }
+                MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,请确认前置条件!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                StartEnalbe = true;
+                return;
+                
             }
             //输入项
             bool isAction=TestActionMethod();

+ 3 - 7
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/RetryTestViewModel.cs

@@ -676,13 +676,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             int preceditionResult = GetPrecedtionResult();
             if (preceditionResult == 0)
             {
-                MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,若继续运行,点击确认按钮;若取消运行,点击取消按钮", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
-                if (boxResult != MessageBoxResult.OK)
-                {
-                    // 立即取消线程
-
-                    return;
-                }
+                MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,请确认前置条件!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                StartEnalbe = true;
+                return;
             }
             //输出项
             bool isJudgeResult = await TestJudgementMethod();