sensorDigital, grafik Fest, drawPunkt eingefügt

This commit is contained in:
marco committed 2026-10-28 09:23:01 +01:00
1 parent f43053d7b3
commit 6e4bd5339f
51 files changed
+1203 -31

No files matched your search

@@ -9,6 +9,7 @@ import type { ProConZuordnung } from '../../_schemas/anlagen/procon-zuordnung';
import { SqlService } from '../../infrastructure/sql/sql.service';
import { validateSyncXml } from './sync-xml';
import { DrawService } from '../../draw/draw.service';
import { GraphicLibraryService } from '../../visualisierung/library/graphic-library.service';
import type { GrafikGeneratorDaten } from '../../_schemas/anlagen/procon-view-aggregate';
export interface SyncValues { x: number; y: number; width: number; height: number; show: boolean }
@@ -53,6 +54,7 @@ export class ProConSyncService {
@InjectModel('ProConZuordnung', 'anlagen') private readonly mappings: Model<ProConZuordnung>,
private readonly db: SqlService,
private readonly draw: DrawService,
private readonly library?: GraphicLibraryService,
) {}
private async verifyAggregate(pool: sql.ConnectionPool, aggregateId: number, mapping: ProConZuordnung) {
@@ -72,6 +74,7 @@ export class ProConSyncService {
if (!mapping) throw new BadRequestException('Aggregat zuerst unter ProCon → Zuordnung zuordnen');
const document = await this.graphics.findOne({ visuAggregateId: mapping.visuAggregateId }).exec();
if (!document) throw new BadRequestException('Eigene Grafikelemente fehlen');
if (this.library) document.elemente = await this.library.resolveElements(document.toObject().elemente, context.anlageId);
const pool = await this.db.getPool(context.anlageId);
await this.verifyAggregate(pool, aggregateId, mapping);
const rows = (await pool.request().input('agg', sql.Int, aggregateId)
@@ -211,6 +214,7 @@ export class ProConSyncService {
const link = mapping?.elemente.find(item => item.visualizationId === visualizationId);
if (!mapping || !link) throw new BadRequestException('Diese Visualisierung zuerst unter ProCon → Zuordnung zuordnen');
const document = await this.graphics.findOne({ visuAggregateId: mapping.visuAggregateId }).exec();
if (document && this.library) document.elemente = await this.library.resolveElements(document.toObject().elemente, context.anlageId);
const element = document?.elemente.find(item => item._id?.toString() === link.elementId);
if (!document || !element) throw new BadRequestException('Zugeordnetes eigenes Element fehlt. Zuordnung prüfen.');
const pool = await this.db.getPool(context.anlageId);