8.6 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-17T15:52:39.056423+00:00 | zai-org/GLM-5-FP8 | 1 | 3fb37e33d15ad38b |
Documentation: DTS.Reports Report Classes
1. Purpose
This module contains three report generator classes (ChannelCalibrationList, DASLayout, DiagnosticsReport) that produce Excel and PDF reports for a data acquisition system. Each class inherits from ReportBase and transforms domain-specific data into tabular reports with conditional styling (pass/fail/warn indicators). The reports cover calibration status tracking, hardware channel configuration layouts, and diagnostic test results for DAS units, analog channels, and squib channels.
2. Public Interface
ChannelCalibrationList
Nested Types:
ChannelCalibrationList.Fields- Enum with values:Location,SensorAxis,SerialNo,Cal,NextCalChannelCalibrationList.ChannelHelper- Data transfer class with properties:string Location,string SensorAxis,string SerialNo,string SerialNumberWithAxis,string Cal,string NextCalResultStatus CalStatus- Enum with values:OK,Overdue,Warn- Two constructors: default (initializes strings to empty) and parameterized constructor
Methods:
public static string GetReportFilenamePath(string reportPath, string testId)
Returns a combined path for the report file. Prepends testId to filename if non-empty. Base filename is "ChannelCalibrationList.xlsx".
public void DoReport(ChannelHelper[] channels, string outputFileName, string folderNameId,
string sensitivityDisplayFormat, bool generateExcelReports, bool generatePDFReports)
Generates the calibration list report. Creates a DataTable with columns from Fields enum. Applies conditional styling to NextCal column based on CalStatus. Outputs Excel and/or PDF based on boolean flags.
DASLayout
Nested Types:
DASLayout.Fields- Enum with values:DCH,Module,Channel,Description,Sensor,ISOCode,Range,SquibFireMode,Sens,Filter,Delay,Volt,Duration,Trigger,ChannelTypeDASLayout.ChannelHelper- Data transfer class with properties:int DCH,string Module,string Channel,string Description,string SensorSerial,string Sensitivity,string ISOCode,string Range,string SquibFireMode,string Filter,string Voltage,string LevelTriggerdouble DelayMS,double DurationMS,int ChannelTypeIGroupChannel GroupChannel,ISensorCalibration Calibration- References for polarity verification
Methods:
public static string GetReportFilenamePath(string reportPath, string serialNumberDAS, string testId)
Returns combined path. Format: "{testId} {serialNumberDAS} - {timestamp}Layout.xlsx" if testId provided, otherwise "DAS Layout.xlsx".
public void DoReport(ChannelHelper[] channels, string outputFileName, string folderNameId,
string sensitivityDisplayFormat, bool generateExcelReports, bool generatePDFReports)
Generates the DAS layout report. Creates DataTable with typed columns (int for DCH and ChannelType, double for Delay and Duration, string for others). No styling DataTable is passed (null).
DiagnosticsReport
Nested Types:
DiagnosticsReport.DASFields- Private enum:DAS,FW,CalDate,DueDate,Connection,Input,BatteryDiagnosticsReport.AnalogFields- Private enum:ExportNum,DAS,Module,Channel,Object,Sens,Desc,Exc,Offset,Shunt,Range,NoiseDiagnosticsReport.SquibFields- Private enum:DAS,Module,Channel,Desc,ISO,FireMode,Delay,DurationDiagnosticsReport.DASHelper- Properties:string DAS,string Firmware,DateTime CalDate,DateTime DueDate,string Connection,string Input,string BatteryDiagnosticsReport.AnalogHelper- Properties includeint ExportNum, various strings, doubles for measurements (Exc,Offset,Shunt,Range,Noise), andResultStatusenums for each measurement.ResultStatusvalues:Passed,Failed,NotTestedDiagnosticsReport.SquibHelper- Properties include strings,double Delay,double Duration,double Resistance, andResultStatusfor delay/duration
Methods:
public static string GetReportFilename(bool isPreTest, string testId)
Returns filename like "{testId} Pretest Diagnostics {timestamp}.xlsx" or "{testId} Post-Test Diagnostics {timestamp}.xlsx". Returns "Diagnostic Results.xlsx" if testId is null/empty.
public static string GetReportFilenamePath(bool isPreTest, string reportPath, string testId)
Combines reportPath with filename from GetReportFilename.
public void DoReport(DASHelper[] das, AnalogHelper[] analog, SquibHelper[] squib,
string outputFileName, string folderNameId, string sensitivityDisplayFormat,
bool generateExcelReports, bool generatePDFReports)
Generates diagnostic report with three DataTables (DAS, Analog, Squibs). Applies conditional styling to analog measurement columns and squib delay/duration columns. Special handling for Range field (displays "Infinity" or "---" for special double values). Divides Exc value by 1000.
3. Invariants
- Column ordering: All reports iterate over
Fieldsenum values viaEnum.GetValues()to define column order; column order is determined by enum declaration order. - Styling defaults: Style values default to
-1(no styling) unless explicitly set based onResultStatus. - Date handling: In
DiagnosticsReport, dates with year < 1970 display as empty string; dates equal tominDate(1970-01-01) display as"--". - File existence: All
DoReportmethods check for existing output files and delete them before writing; if deletion fails (file in use),ReportFileInUseis called. - Template path:
TemplateFilenameis always set usingGetTemplateReportPath()with empty testId/serialNumber parameters before report generation. - PDF generation: When generating PDF,
DestinationTemplateFilenameis set to the Excel filename withCommon.Constants.TEMP_FILE_EXTENSIONto avoid overwriting the template.
4. Dependencies
This module depends on:
System,System.Linq,System.Data,System.IO(standard .NET libraries)DTS.Common.Interface.Channels.IGroupChannel(referenced inDASLayout.ChannelHelper)DTS.Common.Interface.Sensors.ISensorCalibration(referenced inDASLayout.ChannelHelper)DTS.Common.Constants.TEMP_FILE_EXTENSION(constant used in PDF generation)ReportBase(base class providingFillStylesenum,OutputReport,OutputReportPDF,CopyReportIfNeeded,GetTemplateReportPath,ReportFileWillBeOverwritten,ReportFileInUse, and propertiesTemplateFilename,OutputFilename,DestinationTemplateFilename)
What depends on this module:
- Not determinable from source alone. Callers would invoke
DoReportmethods andGetReportFilenamePathstatic methods.
5. Gotchas
-
Inconsistent null handling in DASLayout:
DASLayout.DoReportpassesnullfor the styles DataTable array toOutputReportandOutputReportPDF, whereas the other two classes always provide style DataTables. This may cause issues if the base class methods don't handle null gracefully. -
Exc value scaling: In
DiagnosticsReport, theExcfield is divided by 1000 (ch.Exc / 1000D) before output. This unit conversion is implicit and not documented in the method signature. -
Date comparison bug: In
DiagnosticsReport.DoReport, theDueDatehandling checksd.CalDate == minDateinstead ofd.DueDate == minDate, which appears to be a copy-paste error that could cause incorrect display of due dates. -
ChannelHelper class name collision: Both
ChannelCalibrationListandDASLayoutdefine nested classes namedChannelHelperwith completely different structures. This could cause confusion when reading code or debugging. -
File deletion exception handling: All three
DoReportmethods catchExceptionwhen deleting existing files and callReportFileInUse, but then continue execution. If the file couldn't be deleted, subsequent write operations may fail. -
Unused properties:
ChannelCalibrationList.ChannelHelper.SerialNumberWithAxisandDiagnosticsReport.AnalogHelper.SerialNumberWithAxisare defined but never used in report generation. -
Unused properties in AnalogHelper:
ScalefactorMilliVoltsPerADCandActualRangeMvare defined but never output to the report.