From 0940f31b7eba1cf6b6a8c1fca72d97cf686e79f2 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 04 七月 2025 10:43:00 +0800
Subject: [PATCH] 优化插件,完善TreeListView
---
Plugin.TsExecution/TsExecution.xaml.cs | 50 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/Plugin.TsExecution/TsExecution.xaml.cs b/Plugin.TsExecution/TsExecution.xaml.cs
index fb1f427..89c3ac3 100644
--- a/Plugin.TsExecution/TsExecution.xaml.cs
+++ b/Plugin.TsExecution/TsExecution.xaml.cs
@@ -18,12 +18,10 @@
using System.ComponentModel;
using System.IO;
using System.Linq;
-using System.Reflection;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms.DataVisualization.Charting;
-using System.Xml.Linq;
namespace Plugin.TsExecution
{
@@ -212,7 +210,6 @@
}
}
-
public TsExecution()
{
DataContext = this;
@@ -283,15 +280,14 @@
if (!string.IsNullOrEmpty(lastModel))
{
var product = Products.FirstOrDefault(p => p.Name == lastModel);
- if (product != null) SelectedProduct = product;
- goto Write;
+ if (product != null)
+ {
+ SelectedProduct = product;
+ RefershUI();
+ return;
+ }
}
- goto Write;
-
- Write:
SelectedProduct = Products[0];
- engine?.Globals.SetValString("StationState.ProductModel", 1, Products[0].Name);
-
RefershUI();
}
SampleStatus = false;
@@ -461,6 +457,8 @@
fail = Convert.ToInt32(IniFileHelper.ReadIniData("Count", "Fail", "0", CountIniPath));
}
+ private string csvDir;
+
/// <summary>
/// 璇诲彇閰嶇疆鏂囦欢閲岀殑鍑犱釜灞炴��
/// </summary>
@@ -535,6 +533,21 @@
catch
{
UI_ShowInfoDock = false;
+ }
+
+ try
+ {
+
+ value = ParameterManager.GetCommonParameterByName("TestReportFolder");
+ csvDir = value.Value;
+ if (!Directory.Exists(csvDir))
+ {
+ Directory.CreateDirectory(csvDir);
+ }
+ }
+ catch
+ {
+ csvDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestReport");
}
//Convert.ToBoolean(IniFileHelper.ReadIniData("Config", "EnableMes", "true", CountIniPath));
@@ -647,8 +660,14 @@
//MaskWindow mask = new MaskWindow();
try
{
+ engine?.Globals.SetValString("StationState.ProductModel", 1, SelectedProduct?.Name);
+ engine?.CommitGlobalsToDisk(promptOnSaveConflicts: false);
this.modeSeq = this.engine.GetSequenceFileEx(@"C:\Program Files\National Instruments\TestStand 2020\Components\Models\TestStandModels\ParallelModel.seq");
this.testSeq = this.engine.GetSequenceFileEx(this.testSeqFile, 0, TypeConflictHandlerTypes.ConflictHandler_UseGlobalType);
+
+ //var sb = testSeq.GetSequenceByName("MainSequence");
+ //sb.
+
this.execution = this.engine.NewExecution(this.testSeq, "Test UUTs", this.modeSeq, false, 0, null, null, null);
IsTesting = true;
}
@@ -831,6 +850,15 @@
this.tsSockets[index].Barcode = barcode;
}
+ public void SavePositionCSV(int index)
+ {
+ var time = DateTime.Now;
+ string status = this.tsSockets[index].Status == "Passed" ? "PASS" : "FAIL";
+ string csvPath = Path.Combine(csvDir, SelectedProduct?.Name ?? "鏈煡浜у搧", time.ToString("yyyyMMdd"), status,
+ $"{this.tsSockets[index].Barcode}-{time.ToString("HHmmss")}.csv");
+ this.tsSockets[index].WriteToCSV(csvPath);
+ }
+
/// <summary>
/// TestStand鐢ㄦ埛浜や簰浜嬩欢
/// </summary>
@@ -939,7 +967,7 @@
this.tsSockets[Index].SetTestProcess(ProcessVal);
break;
case 10031://瀵煎嚭CSV
- this.tsSockets[Index].WriteToCSV(e.uiMsg.StringData);
+ SavePositionCSV(Index);
break;
case 10032://鎸変笅鏍囨殏鍋滄祴璇�
this.tsSockets[Index].ShowPausePanel();
--
Gitblit v1.9.1