6.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:51:09.548515+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 574c22aeaf057df0 |
ChannelCalibrationList Documentation
1. Purpose
The ChannelCalibrationList class generates a calibration status report for sensor channels, aggregating calibration dates, next due dates, and status indicators (OK, Warn, Overdue) into structured Excel and/or PDF reports. It extends ReportBase and is responsible for transforming an array of ChannelHelper objects—containing channel-specific calibration data—into a formatted table report, applying conditional styling based on calibration status for the NextCal column. This report supports test-specific naming and optional dual-format output (Excel + PDF), and is used to provide auditable calibration traceability for test channels.
2. Public Interface
ChannelCalibrationList.Fields enum
Defines the column fields for the report table:
LocationSensorAxisSerialNoCalNextCal
ChannelHelper class
Encapsulates channel calibration data:
- Properties:
string Locationstring SensorAxisstring SerialNostring SerialNumberWithAxis(not used in current implementation)string Cal(calibration date string)string NextCal(next calibration due date string)ResultStatus CalStatus(enum:OK,Overdue,Warn)
- Constructors:
ChannelHelper()– initializes all string properties to"".ChannelHelper(string location, string sensorAxis, string serialNo, string cal, string nextCal)– initializes the first five properties.
ChannelHelper.ResultStatus enum
Indicates calibration status:
OKOverdueWarn
ChannelCalibrationList()
Default constructor; no side effects.
GetReportFilenamePath(string reportPath, string testId)
Signature: public static string GetReportFilenamePath(string reportPath, string testId)
Returns the full path for the report file. If testId is non-empty, prepends it to the filename (e.g., "T123 ChannelCalibrationList.xlsx"); otherwise, returns "ChannelCalibrationList.xlsx" in reportPath.
DoReport(...)
Signature: public void DoReport(ChannelHelper[] channels, string outputFileName, string folderNameId, string sensitivityDisplayFormat, bool generateExcelReports, bool generatePDFReports)
Generates the calibration report:
- Builds a
DataTable(dt) with columns fromFieldsenum. - Populates rows from
channels, mappingChannelHelperproperties to columns. - Applies styling to the
NextCalcolumn via a paralleldtStylesDataTable:OK→FillStyles.PassWarn→FillStyles.WarnOverdue→FillStyles.Fail- Only if
NextCalis non-empty and not"--".
- Deletes existing
outputFileNameif present (logs viaReportFileWillBeOverwritten/ReportFileInUse). - Sets
TemplateFilenameto the base template path (viaGetReportFilenamePath(GetTemplateReportPath(), string.Empty)). - If
generateExcelReports:- Calls
OutputReport(new DataTable[] { dt }, new DataTable[] { dtStyles }). - Copies result to
folderNameIdviaCopyReportIfNeeded.
- Calls
- If
generatePDFReports:- Replaces
.xlsxwith.pdfinoutputFileName. - Sets
DestinationTemplateFilenameto a temp file (.xlsx→.tmp). - Calls
OutputReportPDF(...)withsensitivityDisplayFormat. - Copies PDF result via
CopyReportIfNeeded.
- Replaces
3. Invariants
dtStylesis only populated forNextCalandCalcolumns (others default to-1).NextCalstyling is applied only when the value is non-null/whitespace and not"--".Calcolumn data is copied directly fromch.Calwithout styling.- Excel and PDF outputs share the same base template (from
GetTemplateReportPath()), but PDF generation uses a temporary template copy to avoid overwriting the Excel-filled template. outputFileNameis overwritten in-place for PDF generation only ifgeneratePDFReportsis true.channelsarray may be empty; no explicit validation is performed.
4. Dependencies
- Base class:
ReportBase(providesOutputReport,OutputReportPDF,CopyReportIfNeeded,ReportFileWillBeOverwritten,ReportFileInUse,GetTemplateReportPath,TemplateFilename,OutputFilename,DestinationTemplateFilename). - Enums used:
ReportBase.FillStyles(values:Pass,Warn,Fail,NotTested). - Namespaces:
System,System.Linq,System.Data,System.IO. - Consumers: Likely invoked by higher-level test orchestration logic (e.g., test runner or report generator) that provides
ChannelHelper[]data.
5. Gotchas
SerialNumberWithAxisproperty inChannelHelperis defined but never used inDoReport.Calcolumn has no styling applied, even thoughdtStylesis created for it—onlyNextCalusesdtStyles.- Date formatting for
Cal/NextCalis assumed to be handled by the caller (strings passed directly); no parsing or validation occurs inDoReport. - PDF generation reuses
outputFileName(replaces.xlsx→.pdf), meaning the Excel file is overwritten before PDF generation if both formats are requested. TheDestinationTemplateFilenameworkaround (... + ".tmp") is used to preserve the Excel template, but the original Excel output is overwritten. - No handling for
nullinchannelsarray ornull/emptyChannelHelperinstances—could throwNullReferenceException. GetReportFilenamePathdoes not usetestIdfor PDF naming inDiagnosticsReportorDASLayout; onlyDASLayoutusestestIdin its ownGetReportFilenamePath.ChannelHelperconstructor overloads do not initializeCalStatus; default isOK(enum default), but this may be misleading if not explicitly set by caller.- None identified from source alone.