Class ShipmentManager
Manager to work with shipments
Inheritance
Inherited Members
Namespace: Simplic.PlugIn.Logistics.Disposition
Assembly: Simplic.PlugIn.Logistics.dll
Syntax
public class ShipmentManager
Constructors
| Improve this Doc View SourceShipmentManager()
Initialize new shipment manager
Declaration
public ShipmentManager()
Fields
| Improve this Doc View SourceDistancebasedItem
Declaration
public const string DistancebasedItem = "20136981-311b-4963-a18c-4433838a8cbd"
Field Value
Type | Description |
---|---|
System.String |
FixedpriceItem
Declaration
public const string FixedpriceItem = "5a8ff039-1f37-48b5-b034-910e3f848d78"
Field Value
Type | Description |
---|---|
System.String |
LoadingAidbasedItem
Declaration
public const string LoadingAidbasedItem = "8AEFF9F6-1A14-4B92-BD31-56B841F6289D"
Field Value
Type | Description |
---|---|
System.String |
ObjectbasedItem
Declaration
public const string ObjectbasedItem = "c8178b9b-689b-4755-b264-6bbbd476d160"
Field Value
Type | Description |
---|---|
System.String |
PythonbasedItem
Declaration
public const string PythonbasedItem = "5599ef91-a91b-44f5-9cd4-4cd2b59ec54d"
Field Value
Type | Description |
---|---|
System.String |
TariffbasedItem
Declaration
public const string TariffbasedItem = "2244ea00-3b8c-4427-942c-d5ae7207cbd3"
Field Value
Type | Description |
---|---|
System.String |
TimebasedItem
Declaration
public const string TimebasedItem = "9f77b1ed-7083-477f-b1e7-5770139afe1d"
Field Value
Type | Description |
---|---|
System.String |
WeightbasedItem
Declaration
public const string WeightbasedItem = "f2984102-90ca-4e55-8ad4-4bbac84808dd"
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceItemDefinition
Gets or sets a dictionary of item constructor
Declaration
public static IList<ShipmentItemConstructor> ItemDefinition { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<ShipmentItemConstructor> |
OutgoingTypeList
Contains all outgoing transaction types
Declaration
public static IDictionary<string, Guid> OutgoingTypeList { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Guid> |
Singleton
Gets an instance of the shipment manager
Declaration
public static ShipmentManager Singleton { get; }
Property Value
Type | Description |
---|---|
ShipmentManager |
Methods
| Improve this Doc View SourceAddItemDefinition<T>(Guid, Func<T>)
Add new item definitiom
Declaration
public static void AddItemDefinition<T>(Guid id, Func<T> constructor)
where T : ShipmentItem
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Item type id |
System.Func<T> | constructor | Delegate to create an item |
Type Parameters
Name | Description |
---|---|
T | Shipment item type |
CanDeleteShipment(Shipment)
Gets whether the shipment can be deleted.
Declaration
public bool CanDeleteShipment(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | Shipment to get whether it can be deleted or not |
Returns
Type | Description |
---|---|
System.Boolean | True if the shipment can be deleted, else false |
CreateNewItem(Guid, Shipment)
Create new shipment item by id
Declaration
public static ShipmentItem CreateNewItem(Guid typeId, Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | typeId | |
Shipment | shipment |
Returns
Type | Description |
---|---|
ShipmentItem | Shipment item instance if id is part of the item map |
CreateShipmentFromTranship(TranshipPartialShipment, Shipment, Boolean, Nullable<DateTime>)
Creates a shipment from a tranship
Declaration
public Shipment CreateShipmentFromTranship(TranshipPartialShipment tranship, Shipment parentShipment, bool save, DateTime? startDate)
Parameters
Type | Name | Description |
---|---|---|
TranshipPartialShipment | tranship | |
Shipment | parentShipment | |
System.Boolean | save | |
System.Nullable<System.DateTime> | startDate |
Returns
Type | Description |
---|---|
Shipment |
CreateShipmentFromTranship(Guid, Nullable<DateTime>)
Creates a shipment from a tranship
Declaration
public Shipment CreateShipmentFromTranship(Guid transhipId, DateTime? startDate)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | transhipId | |
System.Nullable<System.DateTime> | startDate |
Returns
Type | Description |
---|---|
Shipment |
CreateShipmentFromTranship(String, Nullable<DateTime>)
Creates a shipment from a tranship
Declaration
public Shipment CreateShipmentFromTranship(string partialShipmentNr, DateTime? startDate)
Parameters
Type | Name | Description |
---|---|---|
System.String | partialShipmentNr | |
System.Nullable<System.DateTime> | startDate |
Returns
Type | Description |
---|---|
Shipment |
Delete(Shipment, Boolean, Boolean)
Delete a shipment
Declaration
public void Delete(Shipment shipment, bool isSoftDelete = true, bool uploadCloud = true)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | Shipment instance |
System.Boolean | isSoftDelete | If is softdelete, only the delete flag will be set |
System.Boolean | uploadCloud |
DeleteAsync(Shipment, Boolean, Boolean)
Delete a shipment async
Declaration
public async Task DeleteAsync(Shipment shipment, bool isSoftDelete = true, bool uploadCloud = true)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | Shipment instance |
System.Boolean | isSoftDelete | If is softdelete, only the delete flag will be set |
System.Boolean | uploadCloud |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DeleteById(Guid, Boolean, Boolean)
Delete a shipment by its id
Declaration
public void DeleteById(Guid id, bool isSoftDelete = true, bool uploadCloud = true)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Unique shipment id |
System.Boolean | isSoftDelete | If is softdelete, only the delete flag will be set |
System.Boolean | uploadCloud |
DeleteByIdAsync(Guid, Boolean, Boolean)
Delete a shipment by its id async
Declaration
public async Task DeleteByIdAsync(Guid id, bool isSoftDelete = true, bool uploadCloud = true)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Unique shipment id |
System.Boolean | isSoftDelete | If is softdelete, only the delete flag will be set |
System.Boolean | uploadCloud |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DeleteItem(SAConnection, ShipmentItem)
Declaration
public void DeleteItem(SAConnection connection, ShipmentItem item)
Parameters
Type | Name | Description |
---|---|---|
SAConnection | connection | |
ShipmentItem | item |
DeleteWeightNote(Guid)
Remove a weight note by its id
Declaration
public void DeleteWeightNote(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Unique id of the weight note |
Get(Guid)
Gets a shipment by its id
Declaration
public Shipment Get(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Unique shipment id |
Returns
Type | Description |
---|---|
Shipment | Shipment instance if existing, else null |
GetAll()
Gets all shipment
Declaration
public IEnumerable<Shipment> GetAll()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Shipment> | Shipment instances |
GetAsync(Guid)
Gets a shipment by its id async
Declaration
public async Task<Shipment> GetAsync(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | Unique shipment id |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Shipment> | Shipment instance if existing, else null |
GetBySplitParentId(Guid)
Get shipments by split parent id
Declaration
public IEnumerable<Shipment> GetBySplitParentId(Guid splitParentId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | splitParentId | Split parent shipment id |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Shipment> | Enumerable of shipments |
GetByTransportOrder(Guid)
Gets a list of shipments by its transport order id
Declaration
public IEnumerable<Shipment> GetByTransportOrder(Guid transportOrderId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | transportOrderId |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Shipment> | Shipment instance if existing, else null |
GetDefaultItemStatus()
Declaration
public ShipmentItemStatus GetDefaultItemStatus()
Returns
Type | Description |
---|---|
ShipmentItemStatus |
GetItem(Guid)
Load a single shipment item
Declaration
public ShipmentItem GetItem(Guid shipmentItemId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | shipmentItemId | Unique shipment item id |
Returns
Type | Description |
---|---|
ShipmentItem | Shipment item instance |
GetItems(Shipment)
Load all shipment items that belongs to a shipment
Declaration
public IEnumerable<ShipmentItem> GetItems(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ShipmentItem> | Enumerable if shipment-items |
GetItemsAsync(Shipment)
Load all shipment items that belongs to a shipment
Declaration
public async Task<IList<ShipmentItem>> GetItemsAsync(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<ShipmentItem>> | Enumerable if shipment-items |
GetItemStatus(Guid)
Get a item status by Id
Declaration
public ShipmentItemStatus GetItemStatus(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
ShipmentItemStatus |
GetItemStatusList()
get a list of all item status
Declaration
public IList<ShipmentItemStatus> GetItemStatusList()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<ShipmentItemStatus> |
GetItemType(Guid)
Declaration
public ShipmentItemType GetItemType(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
ShipmentItemType |
GetItemTypes()
Declaration
public IEnumerable<ShipmentItemType> GetItemTypes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ShipmentItemType> |
GetSchedulerShipmentsAsync(DateTime, DateTime, Boolean)
Load shipments to show in the scheduler
Declaration
public async Task<IList<Shipment>> GetSchedulerShipmentsAsync(DateTime fromDate, DateTime toDate, bool useActualDateTimeData)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | fromDate | |
System.DateTime | toDate | |
System.Boolean | useActualDateTimeData |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<Shipment>> |
GetStatus(Guid)
Get a status by Id
Declaration
public ShipmentStatus GetStatus(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
ShipmentStatus |
GetStatusList()
get a list of all status
Declaration
public IList<ShipmentStatus> GetStatusList()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<ShipmentStatus> |
GetUnassignedShipments(DateTime, DateTime)
Get a list of shipments that are not assigned to a tour and are not deleted
Declaration
public IEnumerable<Shipment> GetUnassignedShipments(DateTime from = default(DateTime), DateTime to = default(DateTime))
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | from | Tour from load datetime |
System.DateTime | to | Tour to unload datetime |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Shipment> | Enumerable of shipments |
GetWeightNotesByItemId(Guid)
Gets the weightnotes to the position
Declaration
public IEnumerable<ShipmentWeightNote> GetWeightNotesByItemId(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ShipmentWeightNote> | A list of weight notes |
PostProcessShipment(IList<Shipment>, Boolean, Boolean, Boolean, Action<Shipment>)
Set shipment on tour and post process shipment, like status, ...
Declaration
public void PostProcessShipment(IList<Shipment> shipments, bool setTransportOrderStatus, bool calculateTourTotals, bool uploadCloud, Action<Shipment> shipmentCompleted = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Shipment> | shipments | ShiList of shipments |
System.Boolean | setTransportOrderStatus | If set to true, the transport order status will be set to |
System.Boolean | calculateTourTotals | If set to true, tour totals will be calculated |
System.Boolean | uploadCloud | If set to true all tours will uploaded to tour |
System.Action<Shipment> | shipmentCompleted | Called whenever a shipment is completed |
Save(Shipment)
Writes shipment to database
Declaration
public void Save(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | selected shipment |
SaveItem(SAConnection, ShipmentItem, Type)
Save a list of shipment items
Declaration
public int SaveItem(SAConnection connection, ShipmentItem item, Type t)
Parameters
Type | Name | Description |
---|---|---|
SAConnection | connection | SA Connection |
ShipmentItem | item | Item to save |
System.Type | t |
Returns
Type | Description |
---|---|
System.Int32 | Amound of affected data |
SaveItemType(ShipmentItemType)
Save a ShipmentItemType
Declaration
public void SaveItemType(ShipmentItemType obj)
Parameters
Type | Name | Description |
---|---|---|
ShipmentItemType | obj | Object to save |
SaveStatus(ShipmentStatus)
Writes a status to the database
Declaration
public void SaveStatus(ShipmentStatus status)
Parameters
Type | Name | Description |
---|---|---|
ShipmentStatus | status |
SaveWeightNote(ShipmentWeightNote)
Saves the weight note
Declaration
public void SaveWeightNote(ShipmentWeightNote obj)
Parameters
Type | Name | Description |
---|---|---|
ShipmentWeightNote | obj | Weight note to save |
Set(Shipment, Boolean, Boolean, Boolean, Boolean)
Create or update a shipment
Declaration
public Shipment Set(Shipment shipment, bool save = true, bool setTransportOrderStatus = true, bool postProcessShipments = true, bool uploadCloud = true)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | Unique shipment id |
System.Boolean | save | If set to true, the data will be saved to the database |
System.Boolean | setTransportOrderStatus | If set to true, the transport order status will be calculated |
System.Boolean | postProcessShipments | If set to true, the post process shipment method will be called |
System.Boolean | uploadCloud | If set to true the shipment and all tours will be uploaded to tour |
Returns
Type | Description |
---|---|
Shipment | Shipment which enriched with data |
SetHasBillableShipmentCarrier(Guid, Boolean)
Sets the HasBillableShipmentCarrier flag state
Declaration
public void SetHasBillableShipmentCarrier(Guid shipmentId, bool state)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | shipmentId | |
System.Boolean | state |
SetHasBillableShipmentCustomer(Guid, Boolean)
Sets the HasBillableShipmentCustomer flag state
Declaration
public void SetHasBillableShipmentCustomer(Guid shipmentId, bool state)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | shipmentId | |
System.Boolean | state |
SetProgressData(Shipment)
Set progress values of a shipment object
Declaration
public void SetProgressData(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment | Shipment instance |
ShipmentHasTour(Guid)
Returns whether a shipment has a tour
Declaration
public bool ShipmentHasTour(Guid shipmentId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | shipmentId | Unique shipment id |
Returns
Type | Description |
---|---|
System.Boolean | True if a shipment has a tour |
StopTranship(IList<Shipment>, Boolean)
Declaration
public void StopTranship(IList<Shipment> shipments, bool removeCustomerQuantity)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Shipment> | shipments | |
System.Boolean | removeCustomerQuantity |
UpdateContainerLocationByShipment(Shipment)
Updates the ContainerLocation absed on all shipent items
Declaration
public void UpdateContainerLocationByShipment(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment |
ValidateShipmentItemsIndex(Shipment)
Validate the sortindex of the shipmentitems
Declaration
public void ValidateShipmentItemsIndex(Shipment shipment)
Parameters
Type | Name | Description |
---|---|---|
Shipment | shipment |