This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,323 @@
namespace DTS.Common.Storage
{
public partial class DbOperations
{
public abstract class TestSetups
{
public const string HardwareTable = "tblTestSetupHardware";
public enum HardwareFields
{
TestSetupName,
HardwareId,
AddOrRemove //0=remove,1=add
}
public const string DASSettingsTable = "tblTestSetupDASSettings";
public const string ChannelSettingsTable = "tblTestChannelSettings";
public enum ChannelSettingFields
{
TestName,
TestObjectName,
ChannelId,
Setting,
SensorSerial,
Disabled
}
public enum ChannelFields
{
ISOChannelName,
ISOCode,
UserChannelName,
UserCode,
Disabled,
Settings,
SensorId, //version 3
DASId, //version 3
DASChannelIdx, //version 3
TestSetupOrder, //version 3
GroupOrder, //version 3
Id //version 3
}
public enum SettingsFields
{
//Version 3 and earlier
Range,
CFC,
Polarity,
//Version 2 and earlier
LimitDuration,
Duration,
Delay,
OutputMode,
SQMode,
DIMode,
DefaultValue,
ActiveValue,
//version 4 (DataPRO 2.1)
SquibLimitDuration,
SquibDuration,
SquibDelay,
DigitalOutLimitDuration,
DigitalOutDuration,
DigitalOutDelay,
SquibCurrent,
UserValue1,
UserValue2,
UserValue3,
//Version 5? (DataPRO 2.4) [noticed these issues during testing of 3.0]
//15270 Sensor Import does not import most channel settings
ZeroMethod,
ZeroMethodStart,
ZeroMethodEnd,
//Version 6? (DataPRO 3.0)
//15270 Sensor Import does not import most channel settings
InitialOffset,
FilterClass,
//Version ?? (DataPRO 4.0)
//18363 Uart Channels
UartBaudRate,
UartDataBits,
UartStopBits,
UartParity,
UartFlowControl,
UartDataFormat,
//18364 Stream Out Channels
StreamOutUDPProfile,
StreamOutUDPAddress,
StreamOutUDPTimeChannelId,
StreamOutUDPDataChannelId,
StreamOutUDPTmNSConfig,
StreamOutIRIGTimeDataPacketIntervalMs,
//http://manuscript.dts.local/f/cases/29760/Implement-ACCoupleEnable-for-TSR-AIR
ACCouplingEnabled,
StreamOutTMATSIntervalMs,
//33415 Voltage insertion channel should be half bridge
BridgeType
}
public const string TestSetupsTable = "tblTestSetups";
public enum Fields
{
SetupName,
SetupDescription,
AutomaticTestProgression,
AutomaticProgressionDelayMS,
InvertTrigger,
InvertStart,
IgnoreShortedStart,
IgnoreShortedTrigger,
ViewDiagnostics,
VerifyChannels,
AutoVerifyChannels,
VerifyChannelsDelayMS,
RecordingMode,
SamplesPerSecond,
PreTriggerSeconds,
PostTriggerSeconds,
NumberOfEvents,
WakeUpMotionTimeout,
ScheduledStartDateTime,
IntervalBetweenEventStartsMinutes,
StartWithEvent,
WakeUpWithMotion,
StrictDiagnostics,
RequireConfirmationOnErrors,
ROIDownload,
ViewROIDownload,
DownloadAll,
ViewRealtime,
RealtimePlotCount,
RegionsOfInterest,
ROIStart,
ROIEnd,
ViewDownloadAll,
Export,
ExportFormat,
LabDetails,
UseLabDetails,
CustomerDetails,
UseCustomerDetails,
AllowMissingSensors,
AllowSensorIdToBlankChannel,
LocalOnly,
LastModified,
LastModifiedBy,
TurnOffExcitation,
TriggerCheckRealtime,
TriggerCheckStep,
PostTestDiagnostics,
ExportFolder,
DownloadFolder,
CommonStatusLine,
SameAsDownloadFolder,
UploadData,
UploadDataFolder,
UploadExportsOnly,
Settings,
WarnOnBatteryFail,
Dirty,
Complete,
ErrorMessage,
TestEngineerDetails,
UseTestEngineerDetails,
UserTags,
DoAutoArm,
DoEnableRepeat,
DoStreaming,
CheckoutMode,
QuitTestWithoutWarning,
SuppressMissingSensorsWarning,
ISFFile,
NotAllChannelsRealTime,
NotAllChannelsViewer,
CalibrationBehavior,
ClockSyncProfileMaster,
ClockSyncProfileSlave,
ExtraProperties,
MeasureSquibResistancesStep,
TestSetupUniqueId,
AlignUDPToPPS
}
public const string TestSetupObjectsTable = "tblTestSetupObjects";
public enum TestSetupObjectFields
{
TestObjectSerialNumber,
TestObjectName, //TestObjectSerialNumber was changed to TestObjectName in a later version
TestSetupName,
TargetSampleRate,
ExcitationWarmupTimeMS,
LocalOnly,
TestObjectType,
TestObjectPosition,
DisplayOrder
}
public enum TestSetupDASHardwareFields
{
SerialNumber,
SamplesPerSecond,
AntiAliasFilterRate,
IsClockMaster,
PTPDomainID
}
public enum TestSetupGroupFields
{
SerialNumber,
Name,
DisplayName,
Description,
TestSetupName,
DisplayOrder,
Position,
TestObjectType,
Id,
StaticGroupId
}
public const string TestObjectMetaDataTable = "tblTestSetupObjectMetaData";
public enum TestObjectMetaDataFields
{
TestObject,
ISOTestObject,
SetupName,
TestSetupName,
PropName,
PropValue,
Optional,
Version,
}
public const string TestObjectTemplatesTable = "tblTestObjectTemplates";
public enum TestObjectTemplatesFields
{
TemplateName,
Icon,
Description,
LocalOnly,
Version,
LastModifiedBy,
CRC32,
TestObject,
LastModified,
ParentTemplate,
SysBuilt
}
public const string TestObjectsTable = "tblTestObjects";
public enum TestObjectsFields
{
SerialNumber,
LastModifiedBy,
LastModified,
Template,
LocalOnly,
ParentObject,
SysBuilt,
Embedded,
OriginalTemplate,
OriginalSerialNumber
}
public enum GroupsGroupFields
{
Name,
LastModifiedBy,
LastModified,
Id,
Tags
}
public enum GroupsGroupChannelFields
{
IsoCode,
IsoChannelName,
UserCode,
UserChannelName,
DASId,
DASChannelIndex,
GroupChannelOrder,
Sensor,
SensorId,
Disabled,
LastModified,
LastModifiedBy
}
public enum GroupsGroupHardwareListFields
{
Hardware
}
public const string TestGraphsTable = "tblTestGraphs";
public enum GraphFields
{
GraphName,
GraphDescription,
TemplateName,
Channels,
UseDomainMin,
DomainMin,
UseDomainMax,
DomainMax,
UseRangeMin,
RangeMin,
UseRangeMax,
RangeMax,
Thresholds,
LocalOnly,
TestSetupName
}
}
}
}

View File

@@ -0,0 +1,166 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace DTS.Common.Storage.TestSetups
{
/// <summary>
/// this is a class representing test history
/// 3003 Attach Test History to Sensors
/// </summary>
[Serializable]
public class TestHistory
{
/// <summary>
/// the primary key/id for the record in the test history table
/// </summary>
public long TestHistoryId { get; set; }
/// <summary>
/// the id for the test setup in the db
/// </summary>
public int TestSetupId { get; set; }
/// <summary>
/// the name of the test setup
/// </summary>
public string TestSetupName { get; set; }
/// <summary>
/// the description for the test setup
/// </summary>
public string TestSetupDescription { get; set; }
/// <summary>
/// the user provided test id for the test run
/// </summary>
public string TestId { get; set; }
/// <summary>
/// whether the test was marked as destructive or not
/// </summary>
public bool Destructive { get; set; }
/// <summary>
/// the time the unit was armed or auto-armed
/// </summary>
public DateTime ArmTime { get; set; }
/// <summary>
/// bytes array representing the test setup xml in gzip'd compressed form
/// </summary>
public byte[] TestSetup { get; set; }
public TestHistory()
{
}
public TestHistory(IDataReader reader)
{
var o = reader["TestHistoryId"];
if (!DBNull.Value.Equals(o))
{
TestHistoryId = Convert.ToInt64(o);
}
o = reader["TestSetupId"];
if (!DBNull.Value.Equals(o))
{
TestSetupId = Convert.ToInt32(o);
}
o = reader["TestSetupName"];
if (!DBNull.Value.Equals(o))
{
TestSetupName = Convert.ToString(o);
}
o = reader["TestSetupDescription"];
if (!DBNull.Value.Equals(o))
{
TestSetupDescription = Convert.ToString(o);
}
o = reader["TestId"];
if (!DBNull.Value.Equals(o))
{
TestId = Convert.ToString(o);
}
o = reader["Destructive"];
if (!DBNull.Value.Equals(o))
{
Destructive = Convert.ToBoolean(o);
}
o = reader["ArmTime"];
if (!DBNull.Value.Equals(o))
{
ArmTime = Convert.ToDateTime(o);
}
o = reader["TestSetup"];
if (!DBNull.Value.Equals(o))
{
TestSetup = (byte[])o;
}
}
/// <summary>
/// retrieves all test histories matching the test name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static TestHistory[] GetTestHistory(string name)
{
var list = new List<TestHistory>();
using (var cmd = DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_TestHistoryGet";
cmd.Parameters.Add(new SqlParameter("@TestSetupName", SqlDbType.NVarChar)
{ Value = name });
var reader = cmd.ExecuteReader();
while (reader.Read())
{
var history = new TestHistory(reader);
list.Add(history);
}
}
finally
{
cmd.Connection.Dispose();
}
}
return list.ToArray();
}
/// <summary>
/// returns an xml document in string form representing all the input histories
/// </summary>
/// <param name="histories"></param>
/// <returns></returns>
public static string SerializeToString(TestHistory[] histories)
{
var serializer = new XmlSerializer(typeof(TestHistoryCollection));
using (var memoryStream = new MemoryStream())
{
serializer.Serialize(memoryStream, new TestHistoryCollection(histories));
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
}
/// <summary>
/// this is just a helper class for serialization
/// </summary>
[Serializable]
public class TestHistoryCollection
{
public TestHistory[] Histories { get; set; }
public TestHistoryCollection(TestHistory[] histories)
{
Histories = histories;
}
public TestHistoryCollection() { }
}
}
}