13 KiB
13 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T02:40:36.766589+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 2f1b395f0369a2ed |
Documentation: Group Import and Database Record Classes
1. Purpose
This module provides data structures and helper utilities for importing, representing, and managing group-based test configurations—specifically for .GRP files (TDC group files)—and their corresponding database records. It enables parsing of .GRP files into structured in-memory objects (GroupGRPImportGroup, GroupGRPImportChannel), tracking import errors (GroupGRPImportError), and mapping between in-memory group/channel representations and database entities (GroupDbRecord, ChannelDbRecord, GroupHardwareDbRecord, TestSetupGroupRecord). The module serves as the foundational data layer for group import workflows, supporting validation, error reporting, and persistence of group configurations in the DTS system.
2. Public Interface
GroupGRPImportError
Errorsenum
Defines all possible error types during.GRPfile import:FileEmpty,InvalidISOCodeInput,InvalidFullScaleInput,InvalidSensorInput,InvalidInvertInput,SensorNotFound,InvalidInputMode,InvalidDefaultValue,InvalidActiveValue,InvalidFireMode,InvalidDelay,InvalidLimitDuration,InvalidDuration,InvalidCurrent
ErrorCode(property,Errors)
The specific error encountered during import.File(property,string)
Path or name of the file where the error occurred.Line(property,int)
Line number in the file where the error occurred.ExtraInfo(property,string)
Additional human-readable context for the error.ToString()
ReturnsExtraInfo.
GroupGRPImportGroup
Included(property,bool, defaulttrue)
Indicates whether the group should be included in the import operation.Overwrite(property,bool, defaulttrue)
Indicates whether existing group data should be overwritten during import.GroupName(property,string)
Name of the group (from the.GRPfile).GroupTags(property,string)
Tags associated with the group.ImportingUserTags(property,string)
User-provided tags during import.SourceFile(property,string)
Path to the source.GRPfile.Channels(property,GroupGRPImportChannel[], default empty array)
Array of channels parsed from the.GRPfile.GroupErrors(property,GroupGRPImportError[], defaultnull)
List of errors encountered during import of the group (e.g., file-level errors).GroupNameHasError(property,bool)
Indicates whether the group name itself has an error; used for UI validation (e.g., red border on textbox).
GroupGRPImportChannel
- Field index constants (
public const uint)
SerialNumberField,DisplayNameField,ISOCodeField,InvertField,CapacityField,InputModeField,DefaultValueField,ActiveValueField,FireModeField,DelayField,LimitDurationField,DurationField,CurrentField
Represent column indices in.GRPfile rows. SensorSerialNumber(property,string)
Serial number of the sensor associated with this channel.DisplayName(property,string)
Human-readable name for the channel.ISOCode(property,string)
ISO-compliant code for the channel.Invert(property,bool)
Whether the channel signal should be inverted.FullScale(property,double)
Full-scale value for analog channels.InputMode(property,InputModes?, defaultnull)
Input mode for digital channels; enum values:na,TLH,THL,CCNO,CCNC. Default:InputModes.CCNO.DefaultValue,ActiveValue,Delay,Duration,Current(properties,double?, defaults0.0,1.0,0.0,10.0,1.5respectively)
Optional numeric parameters for channel configuration.FireMode(property,FireModes?, defaultnull)
Fire mode for squib channels; enum values:na,CD,CC. Default:FireModes.CD.LimitDuration(property,bool?, defaultnull)
Whether duration limiting is enabled. Default:true.Error(property,GroupGRPImportError, defaultnull)
Channel-specific import error (if any).ParentGroup(property,GroupGRPImportGroup)
Reference to the parent group.GroupName(property,string)
ReturnsParentGroup.GroupNameor"---"ifParentGroupisnull.GroupNameInvalidate()
RaisesPropertyChangedforGroupNameto force UI refresh.
GroupHardwareDbRecord
Id(property,int,[Key])
Primary key inGroupHardwaretable.GroupId(property,int)
Foreign key to group.DASId(property,int)
Foreign key to DAS (Data Acquisition System).SerialNumber(property,string)
Serial number of hardware device.- Constructors
GroupHardwareDbRecord()GroupHardwareDbRecord(IGroupHardwareDbRecord copy)GroupHardwareDbRecord(IDataReader reader)— populates from database reader.
TestSetupGroupRecord
GroupId(property,int)
Database ID of the group.DisplayOrder(property,int)
Order in which the group appears in UI/test setup.Position(property,string)
ISO 13499 position field (may be mixed across channels).TestObjectType(property,string)
ISO 13499 test object field (may be mixed across channels).TestSetupId(property,int)
Database ID of the test setup.- Constructors
TestSetupGroupRecord()TestSetupGroupRecord(ITestSetupGroupRecord copy)TestSetupGroupRecord(IDataReader reader)— populates from database reader.
GroupDbRecord
Id(property,int,[Key])
Primary key in group table.SerialNumber(property,string)
Serial number of the group (often derived from group name).Picture(property,string)
Path or identifier for group image.DisplayName(property,string)
Human-readable name.Description(property,string)
Optional description.Embedded(property,bool)
Whether the group is embedded (e.g., system-provided).LastModified(property,DateTime)
Timestamp of last modification.LastModifiedBy(property,string)
User who last modified the group.StaticGroupId(property,int?)
Optional ID for static groups.ExtraProperties(property,string)
JSON-serialized dictionary of additional properties.- Constructors
GroupDbRecord()GroupDbRecord(IGroupDbRecord copy)GroupDbRecord(IGroup copy, List<KeyValuePair<string,string>> extraProperties)GroupDbRecord(IDataReader reader)— populates from database reader.
ChannelDbRecord
Id(property,long,[Key])
Primary key in channel table.GroupId(property,int)
Foreign key to group.IsoCode,IsoChannelName(properties,string)
ISO-compliant identifiers.UserCode,UserChannelName(properties,string)
User-defined identifiers.DASId,DASChannelIndex(properties,int)
DAS device and channel index.GroupChannelOrder,TestSetupOrder(properties,int)
Ordering within group and test setup.SensorId(property,int)
Foreign key to sensor.Disabled(property,bool)
Whether channel is disabled.IsDisabled(property,bool)
Backward-compatible alias forDisabled.LastModified,LastModifiedBy(properties,DateTime,string)
Timestamp and user of last modification.- Constructors
ChannelDbRecord()ChannelDbRecord(IChannelDbRecord copy)ChannelDbRecord(IDataReader reader)— populates from database reader.
GroupHelper (abstract class)
- Static group metadata caches
All methods are static and operate on internal static dictionaries.ClearStaticGroupNames(),SetStaticGroupName(int, string),GetStaticGroupName(int)ClearEmbeddedGroupIdList(),SetEmbeddedGroupId(int),IsGroupEmbedded(int)ClearTestSetupGroupIds(),SetTestSetupGroupId(int, int),GetTestSetupGroupId(int)ClearGroupChannelIds(),AddGroupChannelId(int, int),GetGroupIdsFromChannels(int)ClearDASIds(),SetDASId(string, int),GetDASId(string)ClearBaseModuleChannelIndexList(),SetBaseModuleChannelIndexList(...),GetChannelIndexes(string, string)ClearDASIdChannelIndexGroupIdList(),SetDASIdChannelIndexGroupIdList(...),GetGroupIds(int, List<int>)ClearTestSetupHardwareIds(),AddTestSetupHardwareId(int, int),GetTestSetupHardwareIds(int)ClearGroupHardwareIds(),AddGroupHardwareId(int, int),GetGroupHardwareIds(int)
Note: These are caching utilities for runtime lookups, not persistent storage.
3. Invariants
GroupGRPImportChannel.InputMode
Must benullor one ofna,TLH,THL,CCNO,CCNC. Default isCCNO.GroupGRPImportChannel.FireMode
Must benullor one ofna,CD,CC. Default isCD.GroupGRPImportChannel.LimitDuration
Must benullortrue/false. Default istrue.GroupGRPImportChannel.DefaultValue,ActiveValue,Delay,Duration,Current
Must benullor a non-negativedouble. Defaults are defined as0.0,1.0,0.0,10.0,1.5respectively.GroupGRPImportChannel.Error
If non-null, indicates a channel-level import error; ifnull, the channel is valid.GroupGRPImportGroup.GroupErrors
If non-null, contains group-level errors (e.g., file corruption, invalid header). Ifnull, no group-level errors were recorded.GroupDbRecord.ExtraProperties
Must be valid JSON (serializedList<KeyValuePair<string,string>>).ChannelDbRecord.IsDisabled
Always mirrorsDisabled; setting either updates both.
4. Dependencies
Dependencies of this module:
DTS.Common.Base
ProvidesBasePropertyChanged(base class forGroupGRPImportGroup,GroupGRPImportChannel,GroupHardwareDbRecord,TestSetupGroupRecord,GroupDbRecord,ChannelDbRecord).DTS.Common.Interface.Groups
Defines interfaces:IGroupHardwareDbRecord,ITestSetupGroupRecord,IGroupDbRecord.DTS.Common.Interface.Channels
Defines interface:IChannelDbRecord.System.Data
Used forIDataReaderin constructors.Newtonsoft.Json
Used inGroupDbRecordconstructor to serializeExtraProperties.
Dependencies on this module:
- Import/Export logic (not shown)
Likely usesGroupGRPImportGroup,GroupGRPImportChannel, andGroupGRPImportErrorto parse.GRPfiles. - Database persistence layer
UsesGroupDbRecord,ChannelDbRecord,GroupHardwareDbRecord,TestSetupGroupRecordfor CRUD operations. - UI layer
Binds toGroupGRPImportGroup.GroupNameHasError,GroupGRPImportChannel.GroupName, andGroupGRPImportChannel.GroupNameInvalidate()for validation and refresh.
5. Gotchas
GroupGRPImportChannel.GroupNameis a computed property
ReturnsParentGroup.GroupNameor"---". UI bindings must callGroupNameInvalidate()afterParentGroupchanges to refresh.ChannelDbRecord.IsDisabledis a legacy alias
Directly reads/writesDisabled; new code should useDisabledfor clarity.GroupDbRecord.SerialNumberis derived fromIGroup.Name
In the constructorGroupDbRecord(IGroup, ...),SerialNumberis set tocopy.Name, not a separate serial field.GroupHelpercaches are static and global
State persists across operations; callers must explicitly clear caches (e.g.,ClearStaticGroupNames()) to avoid stale data.GroupHardwareDbRecord.Idusesint(notlong)
Contrasts withChannelDbRecord.Id, which useslong.GroupGRPImportChannel.InputMode,FireMode, etc., are nullable
nullindicates "not set" or "N/A", not a default value. Validation must handlenullexplicitly.GroupGRPImportGroup.Channelsdefaults to empty array (notnull)
Safe to enumerate without null checks.GroupGRPImportGroup.GroupErrorsdefaults tonull
Not an empty array—must check fornullbefore enumeration.GroupHelper.GetChannelIndexesandGetGroupIdsuse substring matching
GetChannelIndexesmatchesbaseSerialNumberSubstringexactly (not a substring search), despite the parameter name suggesting partial matching. Similarly,GetGroupIdsrequires exactdasIdandchannelIndexmatches.