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" />
<PackageReference Include="Spoleto.Marking.TsPiot" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Spoleto.Marking.TsPiot&version=1.0.13
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Spoleto.Marking.TsPiot
.NET 8 клиент для интеграции с Драйвером ТС ПИоТ (ЕСМ) через gRPC / REST.
📌 Описание
Пакет предназначен для интеграции программного обеспечения рабочего места кассира (ПМСР) с Драйвером ТС ПИоТ в рамках требований системы маркировки «Честный ЗНАК».
ТС ПИоТ выступает как единая точка входа для проверки кодов маркировки и берет на себя взаимодействие с ГИС МТ.
🎯 Назначение
- Проверка кодов маркировки
- Получение статуса товара
- Поддержка онлайн и офлайн режимов (ЛМ ЧЗ)
- Обработка ошибок и блокировка некорректных операций
🏗 Архитектура взаимодействия
Общий сценарий
- Пользователь сканирует код маркировки
- Код передаётся в ТС ПИоТ
- ТС ПИоТ возвращает результат:
- ✅ разрешить продажу
- ❌ запретить продажу
🔌 Протокол взаимодействия
ТС ПИоТ предоставляет локальный 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 | Versions 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.
-
net8.0
- Google.Protobuf (>= 3.34.1)
- Grpc.Net.Client (>= 2.76.0)
- Polly (>= 8.6.6)
- Spoleto.RestClient (>= 1.0.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.