Class UnitStation
Information about a unit at a workstation.
[DataContract(IsReference = true)]
[KnownType(typeof(Override))]
[KnownType(typeof(Unit))]
[KnownType(typeof(UnitBuyoff))]
[KnownType(typeof(UnitComponent))]
[KnownType(typeof(UnitDefectRepair))]
[KnownType(typeof(UnitDefect))]
[KnownType(typeof(UnitTest))]
[KnownType(typeof(UnitTransition))]
[KnownType(typeof(WorkerStation))]
public class UnitStation
- Inheritance
-
UnitStation
- Inherited Members
Constructors
UnitStation(int, DateTime, Unit, WorkerStation)
Initializes a new instance of the UnitStation class.
public UnitStation(int unitStationId, DateTime scanDateTime, Unit unit, WorkerStation workerStation)
Parameters
unitStationIdintThe unique identifier for this unit station.
scanDateTimeDateTimeThe date/time when the unit was scanned, in UTC.
unitUnitThe unit associated with this unit station.
workerStationWorkerStationThe worker station.
Properties
Overrides
Gets the list of overrides that were performed while the unit was at this station.
public IList<Override> Overrides { get; }
Property Value
ReleaseDateTime
Gets or sets the date/time when the unit was released from the station, in UTC, or null if there is no release date/time recorded.
[DataMember]
public DateTime? ReleaseDateTime { get; set; }
Property Value
ScanDateTime
Gets the date/time when the unit was scanned, in UTC.
[DataMember]
public DateTime ScanDateTime { get; }
Property Value
Unit
Gets the unit associated with this unit station. This will be null when this object is being returned from a unit update API (e.g., UnitStationChanges, or UnitComponent.UnitStation).
[DataMember]
public Unit Unit { get; }
Property Value
UnitBuyoffs
Gets the list of buyoff changes that occurred while the unit was at this station.
public IList<UnitBuyoff> UnitBuyoffs { get; }
Property Value
UnitComponents
Gets the list of component changes that occurred while the unit was at this station.
public IList<UnitComponent> UnitComponents { get; }
Property Value
UnitDefectRepairs
Gets the list of defect repairs added while the unit was at this station.
public IList<UnitDefectRepair> UnitDefectRepairs { get; }
Property Value
UnitDefects
Gets the list of defects added while the unit was at this station.
public IList<UnitDefect> UnitDefects { get; }
Property Value
UnitStationId
Gets the unique identifier for this unit station.
[DataMember]
public int UnitStationId { get; }
Property Value
UnitTests
Gets the list of tests that were performed while the unit was at this station.
public IList<UnitTest> UnitTests { get; }
Property Value
UnitTransitions
Gets the list of transitions that occurred while the unit was at this station.
public IList<UnitTransition> UnitTransitions { get; }
Property Value
WorkerStation
Gets the worker station. This will be null when this object is being returned from a unit update API (e.g., UnitStationChanges, or UnitComponent.UnitStation).
[DataMember]
public WorkerStation WorkerStation { get; }
Property Value
Methods
AddExternalTest(string, DateTimeOffset, bool, string?, string?, IDictionary?)
Add a unit test that represents a test at some external station (i.e., a third-party test station) to the unit station record.
public UnitTest AddExternalTest(string testTypeName, DateTimeOffset testDateTime, bool passed, string? reason, string? notes, IDictionary? data)
Parameters
testTypeNamestringThe test type name.
testDateTimeDateTimeOffsetThe date/time that the test was performed.
passedboolWhether the test passed.
reasonstringThe reason for a failed test. This can be null if the test passed.
notesstringOptional additional notes about the test. This can be null or empty.
dataIDictionaryOptional test data to be saved with the test, or null. See the remarks for more information.
Returns
Examples
The following demonstrates passing test data. Note that any data type is supported; the data value is converted to a string before saving.
var testData = new Hashtable();
testData["LowFan"] = 1.2;
testData["HighFan"] = 2.3;
testData["Thermistors"] = true;
testData["Compressor"] = 3.4;
testData["LowerElement"] = 4.5;
testData["UpperElement"] = 5.6;
testData["ParamCode"] = "EF12";
unitStation.AddExternalTest("Run Test", DateTimeOffset.Now, true, null, null, testData);
Remarks
If data is not null, it should be a dictionary of name/value pairs. Any collection that implements
IDictionary can be used, such as Hashtable, OrderedDictionary, or Dictionary<TKey, TValue>.
The name of each item in the dictionary should be a valid XML element name. These names must follow these naming rules:
- Names must start with a letter or underscore.
- Names can contain letters, digits, hyphens, underscores, and periods.
- Names cannot contain spaces.
- Names cannot start with the letters xml (or XML, or Xml, etc.).
Exceptions
- ArgumentNullException
testTypeNameis null.- XmlException
datacontains an item with an invalid XML name.
AddExternalTest(string, DateTimeOffset, bool, string?, string?, string?)
Add a unit test that represents a test at some external station (i.e., a third-party test station) to the unit station record. This requires that Unit be set.
public UnitTest AddExternalTest(string testTypeName, DateTimeOffset testDateTime, bool passed, string? reason, string? notes, string? dataXml)
Parameters
testTypeNamestringThe test type name.
testDateTimeDateTimeOffsetThe date/time that the test was performed.
passedboolWhether the test passed.
reasonstringThe reason for a failed test. This can be null if the test passed.
notesstringOptional additional notes about the test. This can be null or empty.
dataXmlstringOptional test-specific data, formatted as XML, or null.
Returns
Exceptions
- ArgumentNullException
testTypeNameis null.
ConvertTestDataToXml(IDictionary?)
Converts a dictionary containing custom test data to a valid XML fragment.
public static string? ConvertTestDataToXml(IDictionary? testData)
Parameters
testDataIDictionaryOptional test data to be saved with the test, or null.
Returns
- string
A valid XML fragment representing the data in
testData, or null if there is no test data, either becausetestDatais null, or becausetestDatacontains no elements.
Exceptions
- XmlException
testDatacontains an item with an invalid XML name.