Add more variants
This commit is contained in:
@ -12,13 +12,45 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
||||
{
|
||||
protected override bool EnableMinimalResponseWaitDelay => false;
|
||||
|
||||
internal async Task<IEnumerable<exportSupplyResourceContractResultType>> ExecuteAsync(CancellationToken token)
|
||||
{
|
||||
var result = new List<exportSupplyResourceContractResultType>();
|
||||
|
||||
void OnResultReceived(exportSupplyResourceContractResultType[] contracts)
|
||||
{
|
||||
if (contracts?.Length > 0)
|
||||
{
|
||||
result.AddRange(contracts);
|
||||
}
|
||||
}
|
||||
|
||||
var pageNum = 0;
|
||||
Guid? exportContractRootGuid = null;
|
||||
while (true)
|
||||
{
|
||||
pageNum++;
|
||||
|
||||
client.TryLog($"Querying page #{pageNum}...");
|
||||
|
||||
var data = await QueryBatchAsync(null, null, exportContractRootGuid, OnResultReceived, token);
|
||||
if (data.IsLastPage)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
exportContractRootGuid = data.NextGuid;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal async Task<exportSupplyResourceContractResultType> ExecuteAsync(Guid contractRootGuid, CancellationToken token)
|
||||
{
|
||||
exportSupplyResourceContractResultType result = null;
|
||||
|
||||
void OnResultReceived(exportSupplyResourceContractResultType[] contracts)
|
||||
{
|
||||
result = contracts.Length > 0 ? contracts[0] : null;
|
||||
result = contracts?.Length > 0 ? contracts[0] : null;
|
||||
}
|
||||
|
||||
await QueryBatchAsync(contractRootGuid, null, null, OnResultReceived, token);
|
||||
@ -26,6 +58,20 @@ namespace Hcs.Client.Api.Request.HouseManagement
|
||||
return result;
|
||||
}
|
||||
|
||||
internal async Task<exportSupplyResourceContractResultType> ExecuteAsync(string contractNumber, CancellationToken token)
|
||||
{
|
||||
exportSupplyResourceContractResultType result = null;
|
||||
|
||||
void OnResultReceived(exportSupplyResourceContractResultType[] contracts)
|
||||
{
|
||||
result = contracts?.Length > 0 ? contracts[0] : null;
|
||||
}
|
||||
|
||||
await QueryBatchAsync(null, contractNumber, null, OnResultReceived, token);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<PaginationData> QueryBatchAsync(
|
||||
Guid? contractRootGuid, string contractNumber, Guid? exportContractRootGuid,
|
||||
Action<exportSupplyResourceContractResultType[]> onResultReceived,
|
||||
|
||||
Reference in New Issue
Block a user