117 lines
6.2 KiB
C#
117 lines
6.2 KiB
C#
namespace NTP.Application.Grains.Permits;
|
|
|
|
public sealed class OrderTotalsRow
|
|
{
|
|
public decimal TotalOwners { get; set; }
|
|
public decimal TotalComps { get; set; }
|
|
public decimal AllQuantity { get; set; }
|
|
}
|
|
|
|
public sealed class OrderUsedRow
|
|
{
|
|
public decimal UsedOwners { get; set; }
|
|
public decimal UsedComps { get; set; }
|
|
}
|
|
|
|
public sealed class QueueSharePick
|
|
{
|
|
public long Cnt { get; set; }
|
|
public long Scac { get; set; }
|
|
}
|
|
|
|
public sealed class QueuePermitPick
|
|
{
|
|
public long Id { get; set; }
|
|
public long Qid { get; set; }
|
|
public long Scac { get; set; }
|
|
public string? Pn { get; set; }
|
|
public string? Tn { get; set; }
|
|
}
|
|
|
|
public sealed class NextOrderPick
|
|
{
|
|
public long Id { get; set; }
|
|
public long Destenation { get; set; }
|
|
}
|
|
|
|
public sealed class OwnerNotificationRow
|
|
{
|
|
public string? Name { get; set; }
|
|
public string? OrderDate { get; set; }
|
|
public string? Shift { get; set; }
|
|
public string? Location { get; set; }
|
|
}
|
|
|
|
public sealed class OpenOrderBrief
|
|
{
|
|
public long Id { get; set; }
|
|
public long Destenation { get; set; }
|
|
public long Quantity { get; set; }
|
|
}
|
|
|
|
public sealed class GabanPermitRow
|
|
{
|
|
public long Id { get; set; }
|
|
public string? ShipmentStatusCode { get; set; }
|
|
}
|
|
|
|
/// <summary>Distribution of OPEN permits to tender orders: grains.cfc distributePackedBulk, releasePermit, procssOpenPermit*, ...</summary>
|
|
public interface IDistributionRepository
|
|
{
|
|
// distributePackedBulk
|
|
Task<OrderTotalsRow> GetOrderTotalsAsync(string distributionCode, string queueType, bool packed, CancellationToken ct = default);
|
|
Task<OrderUsedRow?> GetUsedOrdersAsync(string distributionCode, string queueType, bool packed, CancellationToken ct = default);
|
|
Task PrepareDataAsync(string cargoType, long badiyaScac, CancellationToken ct = default);
|
|
Task<IReadOnlyList<QueueSharePick>> GetCompanyShareAsync(string code, string? type, bool gallabCompany, long start, long queueAvailable,
|
|
CancellationToken ct = default);
|
|
Task<IReadOnlyList<QueuePermitPick>> GetCompanyQueuePermitsAsync(IReadOnlyList<QueueSharePick> shares, string distributionCode,
|
|
string permitCargoType, bool gallabCompany, bool bulkGallab, long badiyaScac, CancellationToken ct = default);
|
|
Task IncrementQueueCounterAsync(long queueId, CancellationToken ct = default);
|
|
Task IncrementCompanyQueueAsync(long scac, string code, string type, CancellationToken ct = default);
|
|
Task SetTrackingNoAsync(string pn, long queueId, CancellationToken ct = default);
|
|
Task<OwnerNotificationRow?> GetOwnerDistributionDataAsync(string tn, long badiyaScac, CancellationToken ct = default);
|
|
|
|
// releasePermit
|
|
Task<PermitRow?> GetOpenPermitWithFirmsAsync(string pn, long scac, CancellationToken ct = default);
|
|
Task<IReadOnlyList<long>> GetAllowedLocationsForReleaseAsync(PermitRow permit, long scac, long badiyaScac, CancellationToken ct = default);
|
|
Task<NextOrderPick?> GetNextOrderAsync(IReadOnlyList<long> locations, string cargoCode, string? queueType, CancellationToken ct = default);
|
|
Task SetRequestedWithOrderAsync(long permitId, long orderId, CancellationToken ct = default);
|
|
Task UpdateLastPermitAsync(long orderId, long badiyaScac, CancellationToken ct = default);
|
|
Task SetLastPermitAsync(long orderId, long permitId, CancellationToken ct = default);
|
|
Task DeletePendingDistributionAsync(long permitId, string tn, long? orderId, CancellationToken ct = default);
|
|
Task InsertDistributionLogAsync(long permitId, long orderId, DateTime orderDate, string tn, string notes, long? cargoType,
|
|
CancellationToken ct = default);
|
|
|
|
// procssOpenPermit*
|
|
Task<PermitRow?> GetFirstOpenPermitByTnAsync(string tn, string? cargoType, CancellationToken ct = default);
|
|
Task<IReadOnlyList<NextOrderPick>> GetNextOrdersForTruckAsync(string tn, CancellationToken ct = default);
|
|
Task<bool> IsLocationAllowedForCompanyAsync(long scac, long location, CancellationToken ct = default);
|
|
Task SetRequestedAsync(long permitId, CancellationToken ct = default);
|
|
Task<OrderForPermitRow?> GetOrderForManualAsync(long orderId, CancellationToken ct = default);
|
|
Task<long?> PickQueueIdAsync(long scac, string code, string? type, CancellationToken ct = default);
|
|
Task SetRequestedManualAsync(long permitId, long orderId, long queueId, CancellationToken ct = default);
|
|
Task<IReadOnlyList<PermitRow>> GetOpenCompanyPermitsAsync(long badiyaScac, CancellationToken ct = default);
|
|
Task<NextOrderPick?> GetAnyNextOrderAsync(CancellationToken ct = default);
|
|
|
|
// grids / inquiries
|
|
Task<IReadOnlyList<DistributionSummaryRow>> GetDistributedSummaryAsync(CancellationToken ct = default);
|
|
Task<IReadOnlyList<DistributionPivotRow>> GetDistributionPivotAsync(CancellationToken ct = default);
|
|
Task<IReadOnlyList<(long Id, string? Status, long? Company, long? Scrn)>> GetTruckPermitStatusesAsync(string tn, CancellationToken ct = default);
|
|
Task<string?> GetTruckLatestStatusCaptionAsync(string tn, CancellationToken ct = default);
|
|
Task<long?> GetTruckLatestCompanyAsync(string tn, CancellationToken ct = default);
|
|
Task<IReadOnlyList<OpenOrderBrief>> GetActiveOrdersInWindowAsync(ShiftWindow window, CancellationToken ct = default);
|
|
Task<IReadOnlyList<(long Id, string? Name)>> GetLocationNamesAsync(IReadOnlyList<long> ids, CancellationToken ct = default);
|
|
Task<IReadOnlyList<BlacklistedDistributionDto>> GetBlacklistedDistributionsAsync(string tn, CancellationToken ct = default);
|
|
Task<long> GetTripCountAsync(string tn, CancellationToken ct = default);
|
|
|
|
// admin / maintenance
|
|
Task<IReadOnlyList<PermitRow>> GetRequestedPermitsBelowOrderAsync(long scrnBelow, long badiyaScac, CancellationToken ct = default);
|
|
Task ResetPermitToOpenAsync(long permitId, string userId, CancellationToken ct = default);
|
|
Task<IReadOnlyList<GabanPermitRow>> GetUnloadedPermitsAsync(int shiftOneFirstHour, CancellationToken ct = default);
|
|
Task SetStatusOpenAsync(IReadOnlyList<long> ids, CancellationToken ct = default);
|
|
|
|
// auto call
|
|
Task<IReadOnlyList<AutoCallDriverRow>> GetCallingDriverRowsAsync(AutoCallRequest filter, DateTime? tenderDate, CancellationToken ct = default);
|
|
Task<long?> GetPermitIdByPnAsync(string pn, CancellationToken ct = default);
|
|
}
|