67 lines
2.2 KiB
C#
67 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Gebhardt.StoreWare.Wcs.Common.DbAccess.Model;
|
|
using Gebhardt.StoreWare.Wcs.Common.DbAccess.Model.Enums;
|
|
|
|
namespace Gebhardt.StoreWare.Wcs.ConveyorDispo
|
|
{
|
|
internal record OrderListItem(int OrdersHostId, TransportOrderStatus Status, Le Le, string Destination, int Priority, int? IdOrderWmsHead,
|
|
DateTime Created, string HostDestination, bool? DepartureFlag, string? DepartureLocation);
|
|
|
|
internal class OrderList : List<OrderListItem>
|
|
{
|
|
public OrderList(List<OrderListItem> items) : base(items)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes all order list items with the same LeNo and a higher list index.
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
public void RemoveSubsequentWithEqualLeNo(OrderListItem item)
|
|
{
|
|
if (item is {Le: { }})
|
|
{
|
|
RemoveAll(i => IndexOf(i) > IndexOf(item) && i.Le.LeNo == item.Le.LeNo);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes all order list items with the same destination and a higher list index.
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
public void RemoveSubsequentWithEqualDestination(OrderListItem item)
|
|
{
|
|
if (item != null)
|
|
{
|
|
RemoveAll(i => IndexOf(i) > IndexOf(item) && i.Destination == item.Destination);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes all order list items with the same aisle name / storage area and a higher list index.
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
public void RemoveSubsequentWithEqualAisle(OrderListItem item)
|
|
{
|
|
if (item?.Le?.StorageArea != null && item?.Le?.AisleName != null)
|
|
{
|
|
RemoveAll(i => IndexOf(i) > IndexOf(item) && i.Le.StorageArea == item.Le.StorageArea && i.Le.AisleName == item.Le.AisleName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes all order list items with a higher list index that have the same LeNo but lower priority.
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
public void RemoveSubsequentWithEqualLeNoButLowerPriority(OrderListItem item)
|
|
{
|
|
if (item is {Le: { }})
|
|
{
|
|
RemoveAll(i => IndexOf(i) > IndexOf(item) && i.Le.LeNo == item.Le.LeNo && i.Priority < item.Priority);
|
|
}
|
|
}
|
|
|
|
}
|
|
} |