42 lines
2.6 KiB
C#
42 lines
2.6 KiB
C#
using NTP.Application.Common;
|
|
|
|
namespace NTP.Application.Refinery.WageClaims;
|
|
|
|
/// <summary>A trip of a claim waiting for the Jopetrol transfer (REFINERY_TRIPS.TRIP_STATUS = 6).</summary>
|
|
public sealed class TransferTripRow
|
|
{
|
|
public long Id { get; set; }
|
|
public string? Pn { get; set; }
|
|
public string? StatusCode { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// SQL of refinery_wage_claimdao.cfc (+ the writes of refinery_wage_claimfactory.cfc). REFINERY_TRIPS is only read, except for the columns the
|
|
/// legacy claim code writes: WAGE_CLAIM_ID, STATUS_CODE (COMPLETE), TRIP_STATUS (7), LAST_UPDATE_DATE, UPDATED_BY.
|
|
/// </summary>
|
|
public interface IWageClaimRepository
|
|
{
|
|
Task<PagedResult<WageClaimRowDto>> SearchAsync(WageClaimQuery query, PageRequest page, CancellationToken ct = default);
|
|
Task<WageClaimRowDto?> GetAsync(long id, CancellationToken ct = default);
|
|
Task<PagedResult<ClaimTripRowDto>> ClaimTripsAsync(long claimId, PageRequest page, CancellationToken ct = default);
|
|
|
|
/// <summary>Trips of the given statuses without a wage claim (optionally limited to a loading date range): the create preview.</summary>
|
|
Task<PagedResult<ClaimTripRowDto>> CandidateTripsAsync(IReadOnlyList<string> statuses, DateOnly? from, DateOnly? to, PageRequest page, CancellationToken ct = default);
|
|
Task<int> CountCandidateTripsAsync(IReadOnlyList<string> statuses, DateOnly from, DateOnly to, CancellationToken ct = default);
|
|
|
|
/// <summary>Takes the next claim number (legacy GenerateSerialNumber) and inserts the claim as NEW; returns its id. Run inside a transaction.</summary>
|
|
Task<long> InsertClaimAsync(string createdBy, CancellationToken ct = default);
|
|
Task<int> AttachTripsAsync(long claimId, IReadOnlyList<string> statuses, DateOnly from, DateOnly to, CancellationToken ct = default);
|
|
|
|
Task SetClaimStatusAsync(long claimId, string status, string userLogin, CancellationToken ct = default);
|
|
|
|
Task<IReadOnlyList<TransferTripRow>> TripsToTransferAsync(long claimId, CancellationToken ct = default);
|
|
/// <summary>TRIP_STATUS 7 + REFINERY_TRIPS_LOG row TRANSFER_TO_REFINERY. Run inside a transaction.</summary>
|
|
Task MarkTripTransferredAsync(TransferTripRow trip, long userId, string? ip, CancellationToken ct = default);
|
|
|
|
Task AddLogAsync(long claimId, string method, string? oldData, string? newData, long userId, string? ip, CancellationToken ct = default);
|
|
Task<PagedResult<ClaimLogRowDto>> LogAsync(long claimId, PageRequest page, CancellationToken ct = default);
|
|
|
|
Task<IReadOnlyList<WageClaimReportRaw>> ReportRowsAsync(long claimId, CancellationToken ct = default);
|
|
}
|