66 lines
2.7 KiB
C#
66 lines
2.7 KiB
C#
using Hcs.Client;
|
|
using Hcs.Client.Api.Payload.DeviceMetering;
|
|
using Hcs.Client.Api.Registry;
|
|
using Hcs.Service.Async.DeviceMetering;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace Hcs.TestApp.Scenario
|
|
{
|
|
internal class DeviceMeteringScenario(UniClient client)
|
|
{
|
|
private readonly UniClient client = client;
|
|
|
|
internal void ExportMeteringDeviceHistory()
|
|
{
|
|
var result = client.DeviceMetering.ExportMeteringDeviceHistoryAsync(new ExportMeteringDeviceHistoryPayload()
|
|
{
|
|
fiasHouseGuid = ["c48e5025-f77a-494f-8aab-f773da623a25"],
|
|
meteringDeviceType = [Registry27.Element1]
|
|
}).Result;
|
|
Console.WriteLine("Scenario execution " + (result != null && result.Count() > 0 ? "succeeded" : "failed"));
|
|
}
|
|
|
|
internal void ImportMeteringDeviceValues()
|
|
{
|
|
var values = new importMeteringDeviceValuesRequestMeteringDevicesValues()
|
|
{
|
|
Item = "019932b2-93d0-7a0a-9300-1e38325dc146",
|
|
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(),
|
|
MunicipalResource = new nsiRef()
|
|
{
|
|
Code = Registry2.Element5.Code,
|
|
GUID = Registry2.Element5.GUID
|
|
},
|
|
MeteringValue = "100"
|
|
}],
|
|
ControlValue = [new OneRateMeteringValueImportType()
|
|
{
|
|
DateValue = new DateTime(2025, 9, 25),
|
|
TransportGUID = Guid.NewGuid().ToString(),
|
|
MunicipalResource = new nsiRef()
|
|
{
|
|
Code = Registry2.Element5.Code,
|
|
GUID = Registry2.Element5.GUID
|
|
},
|
|
MeteringValue = "100"
|
|
}]
|
|
}
|
|
};
|
|
var result = client.DeviceMetering.ImportMeteringDeviceValuesAsync(values).Result;
|
|
Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
|
|
}
|
|
}
|
|
}
|