From 15bbd62b0b24b72c717ae91ab45348a2083ad04e Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 10 十月 2025 08:58:18 +0800
Subject: [PATCH] 优化bug;
---
HMI.UnitTest/MainWindow.xaml.cs | 98 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 92 insertions(+), 6 deletions(-)
diff --git a/HMI.UnitTest/MainWindow.xaml.cs b/HMI.UnitTest/MainWindow.xaml.cs
index cda9a3a..a267a28 100644
--- a/HMI.UnitTest/MainWindow.xaml.cs
+++ b/HMI.UnitTest/MainWindow.xaml.cs
@@ -1,8 +1,15 @@
锘縰sing ConnectionUtil;
using HMI.Core.Api;
using HMI.Core.Util;
+using HMI.Simple.Util;
+using log4net;
+using Panuon.WPF.UI;
+using Plugin.DataBoard;
using Plugin.TestResult_WPF;
+using Plugin.TsExecution;
using System;
+using System.Threading;
+using System.Threading.Tasks;
using System.Windows;
namespace UnitTest
@@ -10,10 +17,12 @@
/// <summary>
/// MainWindow.xaml 鐨勪氦浜掗�昏緫
/// </summary>
- public partial class MainWindow : Window
+ public partial class MainWindow : WindowX
{
+ private ILog log = LogManager.GetLogger("UnitTest");
public MainWindow()
{
+ ProductModelHelper.GetModelBySNR("cc123", out string model, out string msg);
LangUtil.Load();
InitializeComponent();
//page.Children.Add(new UserControl1());
@@ -25,6 +34,77 @@
private void Button_Click(object sender, RoutedEventArgs e)
{
+ Task.Run(() =>
+ {
+ for (int j = 0; j < 1000; j++)
+ {
+ string status = (j % 2 == 0) ? "Passed" : "Failed";
+ string d = (j % 2 == 0) ? "9" : "9999999999999999999999999999999999999999999999999999999999999999995";
+ tsExecution.AddTestData(0, $"ConnectivityCANRec,2,3,4,{d},6,{status}");
+ Thread.Sleep(5);
+ }
+ });
+
+ Task.Run(() =>
+ {
+ for (int j = 0; j < 1000; j++)
+ {
+ string status = (j % 2 == 0) ? "Passed" : "Failed";
+ string d = (j % 2 == 0) ? "9" : "9999999999999999999999999999999999999999999999999999999999999999995";
+ tsExecution.AddTestData(1, $"ConnectivityCANRec,2,3,4,{d},6,{status}");
+ Thread.Sleep(5);
+ }
+ });
+
+ Task.Run(() =>
+ {
+ for (int j = 0; j < 1000; j++)
+ {
+ string status = (j % 2 == 0) ? "Passed" : "Failed";
+ string d = (j % 2 == 0) ? "9" : "9999999999999999999999999999999999999999999999999999999999999999995";
+ tsExecution.AddTestData(2, $"ConnectivityCANRec,2,3,4,{d},6,{status}");
+ Thread.Sleep(5);
+ }
+ });
+
+ //Task.Run(() =>
+ //{
+ // for (int j = 0; j < 1000; j++)
+ // {
+ // string status = (j % 2 == 0) ? "Passed" : "Failed";
+ // string d = (j % 2 == 0) ? "9" : "9999999999999999999999999999999999999999999999999999999999999999995";
+ // tsExecution.AddTestData(3, $"ConnectivityCANRec,2,3,4,{d},6,{status}");
+ // Thread.Sleep(5);
+ // }
+ //});
+
+ //Task.Run(() =>
+ //{
+ // for (int j = 0; j < 1000; j++)
+ // {
+ // string status = (j % 2 == 0) ? "Passed" : "Failed";
+ // string d = (j % 2 == 0) ? "9" : "9999999999999999999999999999999999999999999999999999999999999999995";
+ // tsExecution.AddTestData(1, $"ConnectivityCANRec,2,3,4,{d},6,{status}");
+ // Thread.Sleep(5);
+ // }
+ //});
+
+ //tsExecution.UpdatePositionStatus(0, "Passed");
+ tsExecution.UpdatePositionStatus(0, "Failed");
+ //tsExecution.UpdatePositionProcessValue(0, 12);
+ //tsExecution.PausePosition(0);
+ //tsExecution.SetPositionBarcode(0, "123456789");
+ //tsExecution.SavePositionCSV(0);
+
+
+ //tsExecution.UpdatePositionStatus(1, "Failed");
+ //tsExecution.UpdatePositionStatus(2, "Ready");
+ //tsExecution.UpdatePositionStatus(3, "Testing");
+ //tsExecution.UpdatePositionProcessValue(1, 50);
+ //tsExecution.UpdatePositionProcessValue(2, 100);
+ //tsExecution.UpdatePositionProcessValue(3, 99);
+
+
//client = new PipeClient2("DAService");
////client.OnData += Client_OnData1;
//client.Connect();
@@ -32,7 +112,7 @@
//tcpClient = new TcpClientWrapper("127.0.0.1", 5555);
//tcpClient.Connect();
- viewControl.View.GetDataTable(0).GetSingleCell(0).SetStatus("testing");
+ //viewControl.View.GetDataTable(0).GetSingleCell(0).SetStatus("testing");
//new Thread(new ThreadStart(PipeServerMessage)).Start();
//new Thread(new ThreadStart(PipeClientMessage)).Start();
@@ -115,7 +195,8 @@
{
if (obj is IPlugin plugin)
{
- plugin.SetBaseFolder(PathHelper.AppFolder);
+ plugin.SetBaseFolder("C:\\Workspace\\VisualStudio\\WPFProject\\WPFProject\\bin\\x64\\Debug\\Config\\TsExecution");
+ plugin.SetLogger(log);
plugin.InitFinish();
}
@@ -123,11 +204,16 @@
private ViewControl viewControl;
+ private TsExecution tsExecution;
+
+ private DataBoard dataBoard;
+
private void Window_Loaded(object sender, RoutedEventArgs e)
{
- viewControl = new ViewControl();
- HandlePlugin(viewControl);
- border.Child = viewControl;
+ var plugin = new TsExecution();
+ HandlePlugin(plugin);
+ border.Child = plugin;
+ tsExecution = plugin;
this.Loaded -= Window_Loaded;
}
}
--
Gitblit v1.9.1