Spoleto.Marking.TsPiot 1.0.13

dotnet add package Spoleto.Marking.TsPiot --version 1.0.13
                    
NuGet\Install-Package Spoleto.Marking.TsPiot -Version 1.0.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Spoleto.Marking.TsPiot" Version="1.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Spoleto.Marking.TsPiot" Version="1.0.13" />
                    
Directory.Packages.props
<PackageReference Include="Spoleto.Marking.TsPiot" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Spoleto.Marking.TsPiot --version 1.0.13
                    
#r "nuget: Spoleto.Marking.TsPiot, 1.0.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Spoleto.Marking.TsPiot@1.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Spoleto.Marking.TsPiot&version=1.0.13
                    
Install as a Cake Addin
#tool nuget:?package=Spoleto.Marking.TsPiot&version=1.0.13
                    
Install as a Cake Tool

Spoleto.Marking.TsPiot

alternate text is missing from this package README image alternate text is missing from this package README image Build

.NET 8 клиент для интеграции с Драйвером ТС ПИоТ (ЕСМ) через gRPC / REST.


📌 Описание

Пакет предназначен для интеграции программного обеспечения рабочего места кассира (ПМСР) с Драйвером ТС ПИоТ в рамках требований системы маркировки «Честный ЗНАК».

ТС ПИоТ выступает как единая точка входа для проверки кодов маркировки и берет на себя взаимодействие с ГИС МТ.


🎯 Назначение

  • Проверка кодов маркировки
  • Получение статуса товара
  • Поддержка онлайн и офлайн режимов (ЛМ ЧЗ)
  • Обработка ошибок и блокировка некорректных операций

🏗 Архитектура взаимодействия

Общий сценарий

  1. Пользователь сканирует код маркировки
  2. Код передаётся в ТС ПИоТ
  3. ТС ПИоТ возвращает результат:
    • ✅ разрешить продажу
    • ❌ запретить продажу

🔌 Протокол взаимодействия

ТС ПИоТ предоставляет локальный API:

  • gRPC
  • REST

🚀 Установка

dotnet add package Spoleto.Marking.TsPiot

⚙️ Конфигурация

Пример appsettings.json:

{
  "TsPiotClientOptions": {
    "ServiceUrl": "https://esm-emu.ao-esp.ru/",
    "RetryOptions": {
      "AttemptTimeoutSeconds": 30,
      "TotalTimeoutSeconds": 180,
      "BaseDelayMs": 500,
      "RetryCount": 3
    },
    "AppOptions": {
      "Name": "MyApp",
      "Version": "1.0",
      "Id": "my-app-id",
      "Token": "token"
    }
  }
}

⚙️ Инициализация

var options = configuration
    .GetSection("TsPiotClientOptions")
    .Get<TsPiotClientOptions>();

🔄 Создание клиента

REST

ITsPiotClient client = new TsPiotRestClient(options);

gRPC

ITsPiotClient client = new TsPiotGrpcClient(options);

✅ Примеры использования

Проверка кодов

var codes = new[]
{
    "код1",
    "код2"
};

var result = await client.CheckCodesAsync(codes);

if (result != null)
{
    Console.WriteLine("Проверка выполнена");
}

Проверка аварийного режима

var result = await client.CheckCodesAsync(codes);

if (result.IsEmergencyMode)
{
    Console.WriteLine("Аварийный режим (код ответа 203)");
}

Обработка ошибок

try
{
    var result = await client.CheckCodesAsync(codes);
}
catch (TsPiotException ex)
{
    Console.WriteLine($"Ошибка проверки: {ex.Message}");
}

🧪 Примеры (как в тестах)

Успешный сценарий

var settings = ConfigurationHelper.GetOptions();
var client = new TsPiotRestClient(settings);

var codes = ConfigurationHelper.GetSuccessfulCodes();

var res = await client.CheckCodesAsync(codes);

Assert.That(res, Is.Not.Null);

Аварийный режим (203)

var settings = ConfigurationHelper.GetOptions();
var client = new TsPiotGrpcClient(settings);

var codes = ConfigurationHelper.GetSuccessfulCodes203();

var res = await client.CheckCodesAsync(codes);

Assert.That(res.IsEmergencyMode, Is.True);

Ошибка проверки

var settings = ConfigurationHelper.GetOptions();
var client = new TsPiotRestClient(settings);

var codes = ConfigurationHelper.GetUnsuccessfulCodes();

Assert.ThrowsAsync<TsPiotException>(async () =>
{
    await client.CheckCodesAsync(codes);
});

⚠️ Важно

  • ТС ПИоТ должен быть доступен по ServiceUrl
  • Клиент не взаимодействует напрямую с ГИС МТ
  • Все проверки проходят через ТС ПИоТ
  • Retry/Timeout настраиваются через RetryOptions

📄 Лицензия

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.13 134 7/1/2026
1.0.11 114 6/30/2026
1.0.10 112 6/29/2026
1.0.9 114 6/27/2026
1.0.8 125 6/5/2026
1.0.7 122 4/28/2026
1.0.6 117 4/27/2026
1.0.5 118 4/27/2026
1.0.4 120 4/24/2026
1.0.3 112 4/24/2026
1.0.2 105 4/24/2026
1.0.1 106 4/24/2026
1.0.0 110 4/24/2026