From 0f7f250517e5faa8b5894adad51d67d8425d4717 Mon Sep 17 00:00:00 2001 From: "HOME-LAPTOP\\kshkulev" Date: Tue, 16 Sep 2025 11:30:33 +0900 Subject: [PATCH] Add provide data export --- Hcs.Client/Client/Api/OrgRegistryCommonApi.cs | 21 ++++++++++- .../ExportDataProviderRequest.cs | 36 +++++++++++++++++++ Hcs.Client/Hcs.Client.csproj | 1 + 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Hcs.Client/Client/Api/Request/OrgRegistryCommon/ExportDataProviderRequest.cs diff --git a/Hcs.Client/Client/Api/OrgRegistryCommonApi.cs b/Hcs.Client/Client/Api/OrgRegistryCommonApi.cs index 62c2da4..09ad055 100644 --- a/Hcs.Client/Client/Api/OrgRegistryCommonApi.cs +++ b/Hcs.Client/Client/Api/OrgRegistryCommonApi.cs @@ -11,7 +11,26 @@ namespace Hcs.Client.Api public class OrgRegistryCommonApi(ClientBase client) : ApiBase(client) { /// - /// Возвращает сведения из реестра организаций + /// Экспорт сведений о поставщиках информации ИС + /// + /// Выгрузить только активных поставщиков данных + /// Токен отмены + /// Сведения о поставщиках данных + public async Task> ExportDataProviderAsync(bool isActual, CancellationToken token = default) + { + try + { + var request = new ExportDataProviderRequest(client); + return await request.ExecuteAsync(isActual, token); + } + catch (NoResultsRemoteException) + { + return []; + } + } + + /// + /// Экспорт сведений из реестра организаций /// /// ОГРН /// КПП diff --git a/Hcs.Client/Client/Api/Request/OrgRegistryCommon/ExportDataProviderRequest.cs b/Hcs.Client/Client/Api/Request/OrgRegistryCommon/ExportDataProviderRequest.cs new file mode 100644 index 0000000..ba5060c --- /dev/null +++ b/Hcs.Client/Client/Api/Request/OrgRegistryCommon/ExportDataProviderRequest.cs @@ -0,0 +1,36 @@ +using Hcs.Client.Internal; +using Hcs.Service.Async.OrgRegistryCommon; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Hcs.Client.Api.Request.OrgRegistryCommon +{ + internal class ExportDataProviderRequest(ClientBase client) : OrgRegistryCommonRequestBase(client) + { + internal async Task> ExecuteAsync(bool isActual, CancellationToken token) + { + // http://open-gkh.ru/OrganizationsRegistryCommon/exportDataProviderRequest.html + var request = new exportDataProviderRequest + { + Id = Constants.SIGNED_XML_ELEMENT_ID, + version = "10.0.2.1" + }; + + if (isActual) + { + request.IsActual = true; + request.IsActualSpecified = true; + } + + var result = await SendAndWaitResultAsync(request, async asyncClient => + { + var response = await asyncClient.exportDataProviderAsync(CreateRequestHeader(), request); + return response.AckRequest.Ack; + }, token); + + return result.Items.OfType(); + } + } +} diff --git a/Hcs.Client/Hcs.Client.csproj b/Hcs.Client/Hcs.Client.csproj index ee607ae..854af73 100644 --- a/Hcs.Client/Hcs.Client.csproj +++ b/Hcs.Client/Hcs.Client.csproj @@ -125,6 +125,7 @@ +