Files
hcs/Hcs.TestApp/TestApp/Scenario/DeviceMeteringScenario.cs

57 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Hcs.Client;
using Hcs.Client.Api.Registry;
using Hcs.Service.Async.DeviceMetering;
using System;
namespace Hcs.TestApp.Scenario
{
internal class DeviceMeteringScenario(UniClient client)
{
private readonly UniClient client = client;
internal void ImportMeteringDeviceValues()
{
var values = new importMeteringDeviceValuesRequestMeteringDevicesValues()
{
// TODO: Вставить айди ПУ
Item = "",
ItemElementName = ItemChoiceType.MeteringDeviceRootGUID,
Item1 = new importMeteringDeviceValuesRequestMeteringDevicesValuesOneRateDeviceValue()
{
CurrentValue = [new importMeteringDeviceValuesRequestMeteringDevicesValuesOneRateDeviceValueCurrentValue()
{
Period = new YearMonth()
{
Year = 2025,
Month = 9
},
DateValue = new DateTime(2025, 9, 25),
TransportGUID = Guid.NewGuid().ToString(),
// TODO: Переделать работу с НСИ
MunicipalResource = new nsiRef()
{
Code = Registry239.Element4.Code,
GUID = Registry239.Element4.GUID
},
MeteringValue = "100"
}],
ControlValue = [new OneRateMeteringValueImportType()
{
DateValue = new DateTime(2025, 9, 25),
TransportGUID = Guid.NewGuid().ToString(),
// TODO: Переделать работу с НСИ
MunicipalResource = new nsiRef()
{
Code = Registry239.Element4.Code,
GUID = Registry239.Element4.GUID
},
MeteringValue = "100"
}]
}
};
var result = client.DeviceMetering.ImportMeteringDeviceValuesAsync(values).Result;
Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
}
}
}