Table of Contents

Class UnitStation

Namespace
Acuit.Pinpoint.Services.Entities
Assembly
Acuit.Pinpoint.Services.Entities.dll

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

unitStationId int

The unique identifier for this unit station.

scanDateTime DateTime

The date/time when the unit was scanned, in UTC.

unit Unit

The unit associated with this unit station.

workerStation WorkerStation

The 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

IList<Override>

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

DateTime?

ScanDateTime

Gets the date/time when the unit was scanned, in UTC.

[DataMember]
public DateTime ScanDateTime { get; }

Property Value

DateTime

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

Unit

UnitBuyoffs

Gets the list of buyoff changes that occurred while the unit was at this station.

public IList<UnitBuyoff> UnitBuyoffs { get; }

Property Value

IList<UnitBuyoff>

UnitComponents

Gets the list of component changes that occurred while the unit was at this station.

public IList<UnitComponent> UnitComponents { get; }

Property Value

IList<UnitComponent>

UnitDefectRepairs

Gets the list of defect repairs added while the unit was at this station.

public IList<UnitDefectRepair> UnitDefectRepairs { get; }

Property Value

IList<UnitDefectRepair>

UnitDefects

Gets the list of defects added while the unit was at this station.

public IList<UnitDefect> UnitDefects { get; }

Property Value

IList<UnitDefect>

UnitStationId

Gets the unique identifier for this unit station.

[DataMember]
public int UnitStationId { get; }

Property Value

int

UnitTests

Gets the list of tests that were performed while the unit was at this station.

public IList<UnitTest> UnitTests { get; }

Property Value

IList<UnitTest>

UnitTransitions

Gets the list of transitions that occurred while the unit was at this station.

public IList<UnitTransition> UnitTransitions { get; }

Property Value

IList<UnitTransition>

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

WorkerStation

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

testTypeName string

The test type name.

testDateTime DateTimeOffset

The date/time that the test was performed.

passed bool

Whether the test passed.

reason string

The reason for a failed test. This can be null if the test passed.

notes string

Optional additional notes about the test. This can be null or empty.

data IDictionary

Optional test data to be saved with the test, or null. See the remarks for more information.

Returns

UnitTest

The added UnitTest.

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

testTypeName is null.

XmlException

data contains 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

testTypeName string

The test type name.

testDateTime DateTimeOffset

The date/time that the test was performed.

passed bool

Whether the test passed.

reason string

The reason for a failed test. This can be null if the test passed.

notes string

Optional additional notes about the test. This can be null or empty.

dataXml string

Optional test-specific data, formatted as XML, or null.

Returns

UnitTest

The added UnitTest.

Exceptions

ArgumentNullException

testTypeName is null.

ConvertTestDataToXml(IDictionary?)

Converts a dictionary containing custom test data to a valid XML fragment.

public static string? ConvertTestDataToXml(IDictionary? testData)

Parameters

testData IDictionary

Optional 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 because testData is null, or because testData contains no elements.

Exceptions

XmlException

testData contains an item with an invalid XML name.