All checks were successful
Build and Deploy / deploy (push) Successful in 1m0s
进程重启或事务回滚不再丢掉 9610、轨迹和揽收;排货完成后再补轨迹、面单和计费相关触发。 Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
using Fake.Domain.Repositories;
|
||
using Oms.Domain.OrdersAggregate.Entities;
|
||
|
||
namespace Oms.Domain.OrdersAggregate.Repositories;
|
||
|
||
public interface IOrderSideEffectRepository : IRepository<OrderSideEffect>
|
||
{
|
||
/// <summary>
|
||
/// 是否已有未结束(以及可选的已完成)步骤。用于避免重复入队。
|
||
/// </summary>
|
||
Task<bool> ExistsAsync(
|
||
int orderId,
|
||
string step,
|
||
bool includeDone,
|
||
CancellationToken cancellationToken = default);
|
||
|
||
Task<List<int>> ListDueIdsAsync(int take, DateTime now, CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 取同一步骤最近一条入参,用于把创单时捕获的轨迹授权头带到排货后的刷新。
|
||
/// </summary>
|
||
Task<string?> FindLatestPayloadJsonAsync(
|
||
int orderId,
|
||
string step,
|
||
CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 仅当当前仍是 pending 时改为 running,并增加尝试次数。
|
||
/// </summary>
|
||
Task<bool> TryClaimAsync(int id, DateTime now, CancellationToken cancellationToken = default);
|
||
|
||
Task MarkDoneAsync(int id, DateTime now, CancellationToken cancellationToken = default);
|
||
|
||
Task MarkRetryAsync(
|
||
int id,
|
||
string status,
|
||
string? lastError,
|
||
DateTime? nextRunTime,
|
||
DateTime now,
|
||
CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 执行过程中进程退出时,把长时间停在 running 的步骤放回 pending。
|
||
/// </summary>
|
||
Task<int> ResetStaleRunningAsync(DateTime staleBefore, DateTime now, CancellationToken cancellationToken = default);
|
||
|
||
/// <summary>
|
||
/// 仍显示「预报计费/排货处理中」、且没有待执行、执行中或已完成预报步骤的订单。
|
||
/// </summary>
|
||
Task<List<int>> ListStuckForecastOrderIdsAsync(
|
||
string processingReason,
|
||
DateTime olderThan,
|
||
int take,
|
||
CancellationToken cancellationToken = default);
|
||
}
|