From 12e606635c42ea20f4b7c2bdda5204237a4b4c96 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 02 三月 2026 16:14:49 +0800
Subject: [PATCH] 优化
---
Plugin.TestResult/TestResultView.xaml.cs | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 105 insertions(+), 11 deletions(-)
diff --git a/Plugin.TestResult/TestResultView.xaml.cs b/Plugin.TestResult/TestResultView.xaml.cs
index 8db8a85..1c93201 100644
--- a/Plugin.TestResult/TestResultView.xaml.cs
+++ b/Plugin.TestResult/TestResultView.xaml.cs
@@ -1,8 +1,9 @@
-锘縰sing HMI.Core.Util;
+锘縰sing HMI.Core.Entity;
+using HMI.Core.Manager;
+using HMI.Core.Util;
using HMI.UI.Util;
using NationalInstruments.TestStand.Interop.API;
using NationalInstruments.TestStand.Interop.UI.Ax;
-using NationalInstruments.TestStand.Utility;
using Plugin.TestResult_WPF.Model;
using Plugin.TsSupport;
using System;
@@ -20,11 +21,13 @@
private int rowCount;
private int colCount;
private int cellCount;
- private DataTable[] tables;
- public Dictionary<string, DataTable> nameTables { get; private set; }
+
+ public static DataTable[] tables { get; private set; }
+ public static Dictionary<string, DataTable> nameTables { get; private set; } = new Dictionary<string, DataTable>();
private readonly BaseConfig config;
public AxApplicationMgr testApp;
+ public string testModelFile;
public string testSeqFile;
/// <summary>
/// 娴嬭瘯搴忓垪
@@ -48,8 +51,73 @@
public bool IsRunning { get; set; } = false;
+ public void RefreshCooler()
+ {
+
+ }
+
+ private void RefreshNumberConfig(BaseConfig config)
+ {
+ ParameterData value = null;
+ try
+ {
+ value = ParameterManager.GetCommonParameterByName("BurnInOvenCount");
+ string[] datas = value.Value.Trim().Split(',');
+ config.Row = int.Parse(datas[0]);
+ config.Column = int.Parse(datas[1]);
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+ try
+ {
+ value = ParameterManager.GetCommonParameterByName("BurnInOvenName");
+ config.NameStr = value.Value;
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+ try
+ {
+ value = ParameterManager.GetCommonParameterByName("BurnInOvenPort");
+ config.PortStart = int.Parse(value.Value);
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+ try
+ {
+ value = ParameterManager.GetCommonParameterByName("BurnInCellCount");
+ string[] datas = value.Value.Trim().Split(',');
+ config.PositionColumn = int.Parse(datas[0]);
+ config.PositionCount = int.Parse(datas[1]);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
public TestResultView(BaseConfig config)
{
+ try
+ {
+ var value = ParameterManager.GetCommonParameterByName("TsModelPath");
+ testModelFile = value?.Value ?? @"C:\Users\Public\Documents\National Instruments\TestStand 2020 (64-bit)\Components\Models\ParallelModel.seq";
+ }
+ catch
+ {
+ //@"C:\Program Files\National Instruments\TestStand 2020\Components\Models\TestStandModels\ParallelModel.seq"
+ testModelFile = @"C:\Users\Public\Documents\National Instruments\TestStand 2020 (64-bit)\Components\Models\ParallelModel.seq";
+ }
+
+ RefreshNumberConfig(config);
this.rowCount = config.Row;
this.colCount = config.Column;
this.config = config;
@@ -83,6 +151,9 @@
{
}
+ /// <summary>
+ /// 鎺㈤拡璁℃暟閰嶇疆璺緞
+ /// </summary>
private string CountIniPath;
public void SetCountIniPath(string countIniPath)
{
@@ -137,7 +208,7 @@
this.testApp.IsEditor = true;
this.testApp.LoginOnStart = false;
this.testApp.Start();
- this.modeSeq = this.engine.GetSequenceFileEx(@"C:\Program Files\National Instruments\TestStand 2020\Components\Models\TestStandModels\ParallelModel.seq");
+ this.modeSeq = this.engine.GetSequenceFileEx(testModelFile);
}
catch (Exception ex)
{
@@ -186,7 +257,7 @@
private void axApplicationMgr_ExitApplication(object sender, EventArgs e)
{
Environment.ExitCode = testApp.ExitCode;
- TSHelper.DoSynchronousGCForCOMObjectDestruction();
+ //TSHelper.DoSynchronousGCForCOMObjectDestruction();
}
private void axApplicationMgr_ExecutionClosed(object sender, _ApplicationMgrEvents_ExecutionClosedEvent e)
@@ -249,13 +320,19 @@
strData = e.uiMsg.StringData;
string[] datas_10014 = strData.Split(';');
int ovenIndex = int.Parse(datas_10014[0]);
-
string startTime = datas_10014[1];
string consumeTime = datas_10014[2];
string planEndTime = datas_10014[3];
+
tables[ovenIndex].SetStartTime(startTime);
- tables[ovenIndex].SetConsumeTime(double.Parse(consumeTime));
tables[ovenIndex].SetEndTime(planEndTime);
+ double? leftTime = null;
+ /// 涓轰簡鍏煎鏃х増鏈紝濡傛灉鏈夊墿浣欐椂闂村氨浼狅紝娌℃湁灏变紶null
+ if (datas_10014.Length >= 5)
+ {
+ leftTime = double.Parse(datas_10014[4]);
+ }
+ tables[ovenIndex].UpdateConsumeTime(double.Parse(consumeTime), leftTime);
return;
}
if (MethodCode == 4)
@@ -371,13 +448,16 @@
tables[ovenIndex].GetSingleCell(cellIndex).AddElectricData(eData);
return;
}
+
if (MethodCode == 14)
{
/// 娓呯┖鐢垫祦鍜岀數鍘嬫暟鎹�
strData = e.uiMsg.StringData;
int ovenIndex = int.Parse(strData);
- tables[ovenIndex].ClearElectricData();
- tables[ovenIndex].ClearVData();
+ tables[ovenIndex].ClearCellData();
+ //tables[ovenIndex].ClearElectricData();
+ //tables[ovenIndex].ClearVData();
+ //tables[ovenIndex].ClearWaterData();
return;
}
@@ -395,7 +475,7 @@
if (MethodCode == 16)
{
- /// 娣诲姞鐢靛帇鏁版嵁
+ /// 娣诲姞鐢靛帇鍥捐〃鏁版嵁
strData = e.uiMsg.StringData;
string[] datas = strData.Split(';');
int ovenIndex = int.Parse(datas[0]);
@@ -449,6 +529,20 @@
return;
}
+ if (MethodCode == 21)
+ {
+ /// 娣诲姞姘存祦鍥捐〃鏁版嵁
+ strData = e.uiMsg.StringData;
+ string[] datas = strData.Split(';');
+ int ovenIndex = int.Parse(datas[0]);
+ int cellIndex = int.Parse(datas[1]);
+ double waterTemp = double.Parse(datas[2]);
+ double backWaterTemp = double.Parse(datas[3]);
+ double waterPressure = double.Parse(datas[4]);
+ tables[ovenIndex].GetSingleCell(cellIndex).AddWaterData(waterTemp, backWaterTemp, waterPressure);
+ return;
+ }
+
if (MethodCode == 99)
{
strData = e.uiMsg.StringData;
--
Gitblit v1.9.1