Skip to content

Commit

Permalink
[ICP CON import] Check existring devices
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillGutyrchik committed Jan 10, 2025
1 parent 4b81c4a commit 148f789
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ProjectImportICP/DevicesImporter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using EasyEPlanner.PxcIolinkConfiguration.Models;
using Eplan.EplApi.Base;
using Eplan.EplApi.DataModel;
using Eplan.EplApi.DataModel.Graphics;
Expand Down Expand Up @@ -355,9 +356,19 @@ public void GenerateDevicesPages()
if (!generatePages)
return;

var deviceManager = DeviceManager.GetInstance();
foreach (var Object in ImportDevices.GroupBy(d => d.Object))
{
var devices = Object.ToList();
var devices = Object.Where(dev => deviceManager.GetDevice(dev.Object + dev.Type + dev.Number).Description == CommonConst.Cap).ToList();

// Установка стандартных параметров для определенных типов устройств
foreach (var device in devices)
{
foreach (var parameter in DefaultParameters.Where(p => p.DeviceType == device.Type))
{
device.Parameters.Add(parameter.Parameter, parameter.DefaultValue.ToString());
}
}

if (string.IsNullOrEmpty(Object.Key))
{ // Генерация страницы с сигналами DO/DO без объекта
Expand Down

0 comments on commit 148f789

Please sign in to comment.