2using System.Collections.Generic;
4using System.Xml.Serialization;
12 [XmlAttribute(
"transportFormatVersion")]
15 [XmlArray(
"transportLanes"), XmlArrayItem(
"transportLane")]
18 [XmlArray(
"transportAssignments"), XmlArrayItem(
"transportAssignment")]
26 TransportLanes.SingleOrDefault(l => SameTransportWarehouse(l.Origin, origin) && SameTransportWarehouse(l.Destination, destination));
29 TransportAssignments.SingleOrDefault(a => a.LaneId == laneId && a.TransportResourceId == resourceId);
37 ArgumentNullException.ThrowIfNull(lane);
38 if (lane.
Id < 0)
throw new ArgumentOutOfRangeException(nameof(lane));
40 index.GetRequiredWarehouse(lane.
Origin);
43 throw new InvalidOperationException(
"A transport lane must connect different warehouses.");
45 throw new InvalidOperationException(
"Duplicate transport lane identifier or directed warehouse pair.");
52 ArgumentNullException.ThrowIfNull(assignment);
55 throw new InvalidOperationException(
"The assignment references a missing lane or resource.");
57 throw new InvalidOperationException(
"Duplicate lane-resource assignment.");
65 if (assignment is
null)
return false;
74 throw new InvalidOperationException(
"Remove referencing assignments explicitly before removing the lane.");
76 if (lane is
null)
return false;
86 throw new InvalidOperationException(
"Remove referencing assignments and characteristics explicitly before removing the resource.");
88 if (resource is
null)
return false;
95 first.Kind == second.Kind && first.ReferenceId == second.
ReferenceId;
int Id
Gets or sets the numerical identifier of the entity.
Provides fast access to the entities contained in a supply chain.
A runtime join of the central lane and assignment; stores no copied business data.
An authorized lane-resource pair, with its delay in periods.
Represents a transport lane between two warehouses.
WarehouseReference Destination
Gets or sets the destination warehouse.
WarehouseReference Origin
Gets or sets the origin warehouse.
Represents a serializable reference to a warehouse.
int ReferenceId
Gets or sets the referenced identifier.
Represents the complete supply-chain data model.
List< TransportResource > TransportResources
Gets the transport resources in the supply chain.
bool ShouldSerializeTransportAssignments()
IEnumerable< AssignedTransportLane > GetTransportLanes(int resourceId)
bool ShouldSerializeTransportFormatVersion()
bool RemoveTransportResource(int resourceId)
bool RemoveTransportLane(int laneId)
List< TransportLane > TransportLanes
TransportLane? FindTransportLane(WarehouseReference origin, WarehouseReference destination)
List< TransportCharacteristic > TransportCharacteristics
Gets the item-transport-resource characteristics.
void AddTransportAssignment(TransportAssignment assignment)
TransportAssignment? FindTransportAssignment(int laneId, int resourceId)
int TransportFormatVersion
List< TransportAssignment > TransportAssignments
bool RemoveTransportAssignment(int laneId, int resourceId)
bool ShouldSerializeTransportLanes()
void AddTransportLane(TransportLane lane)