Add device metering values import
This commit is contained in:
@ -76,6 +76,7 @@
|
||||
<Compile Include="ClientDemo\Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestApp\Program.cs" />
|
||||
<Compile Include="TestApp\Scenario\DeviceMeteringScenario.cs" />
|
||||
<Compile Include="TestApp\Scenario\HouseManagementScenario.cs" />
|
||||
<Compile Include="TestApp\Scenario\NsiCommonScenario.cs" />
|
||||
<Compile Include="TestApp\Scenario\NsiScenario.cs" />
|
||||
|
||||
@ -36,12 +36,15 @@ namespace Hcs.TestApp
|
||||
|
||||
client.SetSigningCertificate(cert);
|
||||
|
||||
var deviceMeteringScenario = new DeviceMeteringScenario(client);
|
||||
var houseManagementScenario = new HouseManagementScenario(client);
|
||||
var nsiScenario = new NsiScenario(client);
|
||||
var nsiCommonScenario = new NsiCommonScenario(client);
|
||||
var orgRegistryCommonScenario = new OrgRegistryCommonScenario(client);
|
||||
try
|
||||
{
|
||||
//deviceMeteringScenario.ImportMeteringDeviceValues();
|
||||
|
||||
//houseManagementScenario.ExportAccount();
|
||||
|
||||
//houseManagementScenario.ExportHouse();
|
||||
|
||||
56
Hcs.TestApp/TestApp/Scenario/DeviceMeteringScenario.cs
Normal file
56
Hcs.TestApp/TestApp/Scenario/DeviceMeteringScenario.cs
Normal file
@ -0,0 +1,56 @@
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user