Zum Hauptinhalt springen

8. Tag-Service

Der Zugriff erfolgt über client.tag(). Ein Tag ist die Definition (Metadaten) eines Datenpunkts (Sensorwert, Zähler, Status). In V5 lassen sich über 10 tab-spezifische PATCH-Methoden Detaileinstellungen wie Alarm, Aggregation oder Berechnung sicher teilweise ändern.

ID-Regel: Präfix TAG_ erforderlich. Näheres siehe Domänen-ID-Regeln.

8.1 Methodenübersicht

CRUD

MethodeRückgabetypHTTPEndpunkt
create(TagRequestV5)TagResponseV5 oder nullPOST/api/v5/tag
update(tag_id, TagRequestV5)TagResponseV5 oder nullPUT/api/v5/tag/{id}
delete(tag_id)booleanDELETE/api/v5/tag/{id}
get(tag_id)TagResponseV5 oder nullGET/api/v5/tag/{id}
exists(tag_id)booleanGET/api/v5/tag/{id}/exists

Liste / Anzahl

MethodeRückgabetypHTTPEndpunkt
list()List<TagResponseV5>GET/api/v5/tag
listBySite(site_id)List<TagResponseV5>GET/api/v5/tag?site_id=...
listByOpc(opc_id)List<TagResponseV5>GET/api/v5/tag?opc_id=...
listByAsset(asset_id)List<TagResponseV5>GET/api/v5/tag?asset_id=...
count()longGET/api/v5/tag/count
countBySite(site_id)longGET/api/v5/tag/count?site_id=...
countByOpc(opc_id)longGET/api/v5/tag/count?opc_id=...
countByAsset(asset_id)longGET/api/v5/tag/count?asset_id=...

PATCH — tab-spezifische Teiländerung (V5-Kernfunktion)

Die 10 PATCH-Methoden folgen der Regel null-Feld = keine Änderung (Verarbeitung über COALESCE im Server-DAO). Einige PATCH-Aufrufe führen serverseitig zusätzlich ein automatisches CEP/EQL-Redeployment durch.

MethodeHTTPEndpunktNebeneffekt
patchBasic(id, TagBasicPatchRequestV5)PATCH/api/v5/tag/{id}/basic
patchAlarm(id, TagAlarmPatchRequestV5)PATCH/api/v5/tag/{id}/alarmCEP/EQL-Redeployment
patchMetadata(id, TagMetadataPatchRequestV5)PATCH/api/v5/tag/{id}/metadata
patchCalculation(id, TagCalculationPatchRequestV5)PATCH/api/v5/tag/{id}/calculationErneuter Aufruf von deployCalculation
patchSampling(id, TagSamplingPatchRequestV5)PATCH/api/v5/tag/{id}/sampling
patchAggregation(id, TagAggregationPatchRequestV5)PATCH/api/v5/tag/{id}/aggregationErneuter Aufruf von deployAggregation
patchAi(id, TagAiPatchRequestV5)PATCH/api/v5/tag/{id}/ai
patchPublish(id, TagPublishPatchRequestV5)PATCH/api/v5/tag/{id}/publish
patchAttribute(id, TagAttributePatchRequestV5)PATCH/api/v5/tag/{id}/attribute
patchLink(id, TagLinkPatchRequestV5)PATCH/api/v5/tag/{id}/link

8.2 TagRequestV5 / TagResponseV5 (für vollständige Anlage/Änderung)

FeldTypBeschreibung
tag_idStringTag-ID (PK, TAG_ erforderlich)
tag_nameStringAnzeigename
opc_idStringZugehöriger OPC (FK)
site_idStringZugehöriger Standort
linked_asset_idStringVerknüpftes Asset (Equipment)
java_typeStringWertedatentyp — Double, Float, Int, Long, Short, Boolean, String, Date
unitStringEinheit (z. B. , RPM, kPa)
tag_sourceStringDatenquelle (z. B. OPC, API, FILE)
descriptionStringBeschreibung

8.3 PATCH-DTO-Felder (nach Tab)

TagBasicPatchRequestV5 (Basis)

FeldBeschreibung
tag_nameAnzeigename
java_typeDatentyp
descriptionBeschreibung

TagMetadataPatchRequestV5 (Metadaten)

FeldBeschreibung
tag_typeTag-Typ
importanceWichtigkeit (1–10)
tag_sourceQuelle
use_metricMetrik verwenden ja/nein
rateErfassungsintervall (ms)
rwLesen/Schreiben (R/W/RW)
alias_nameAlias
min_value / max_valueMessbereich
display_formatUI-Anzeigeformat
unitEinheit
number_round / number_scaleRundung / Dezimalstellen
io_address / source_tag_nameE/A-Adresse · ursprünglicher Tag-Name
lat / lngBreiten-/Längengrad

TagAlarmPatchRequestV5 (Alarm)

FeldBeschreibung
trip_hi, hi_hi, hi, lo, lo_lo, trip_loGrenzwerte (6 Stufen)
bool_true, bool_true_priority, bool_true_messageBoolescher TRUE-Alarm
bool_false, bool_false_priority, bool_false_messageBoolescher FALSE-Alarm
band_messageMeldung für Normalband
duplicate_check_minutesUnterdrückung doppelter Alarme (Minuten)
user_defined_alarm_classBenutzerdefinierte Klasse
use_alarmAlarm aktiv (Y/N)
recieve_me, recieve_othersEmpfang durch eigene/andere Person
send_email, send_smsVersand per E-Mail/SMS

TagCalculationPatchRequestV5 (Berechnung)

FeldBeschreibung
calculation_eqlEQL-Ausdruck
use_calculationVerwendung (Y/N)

TagSamplingPatchRequestV5 (Sampling)

FeldBeschreibung
use_samplingVerwendung (Y/N)

TagAggregationPatchRequestV5 (Aggregation)

FeldBeschreibung
use_aggregationVerwendung
aggregation_1_minutes ~ aggregation_1_hoursAktivierungsflags für 5 Intervalle

TagAiPatchRequestV5 (KI-Anomaliediagnose)

FeldBeschreibung
use_targetLernziel
use_categoryKategorieklassifizierung verwenden

TagPublishPatchRequestV5 (Publizierung)

FeldBeschreibung
publish_mqttMQTT-Publizierung (Y/N)
publish_kafkaKafka-Publizierung (Y/N)

TagAttributePatchRequestV5 (Notiz)

FeldBeschreibung
noteFreitextnotiz

TagLinkPatchRequestV5 (Anlagenzuordnung)

FeldBeschreibung
linked_asset_idID des verknüpften Assets. Leerer String = Zuordnung aufheben

8.4 Anwendungsbeispiele

Tag anlegen (mit OPC verbundenes Tag)

import plantpulse.api.v5.dto.request.TagRequestV5;
import plantpulse.api.v5.dto.response.TagResponseV5;

TagRequestV5 req = new TagRequestV5();
req.setTag_id("TAG_EDGE_00303_90007");
req.setTag_name("Spindle RPM");
req.setOpc_id("OPC_EDGE_00303");
req.setSite_id("SITE_DJ");
req.setLinked_asset_id("ASSET_DJ_M_0001");
req.setJava_type("Double");
req.setUnit("RPM");
req.setTag_source("OPC");
req.setDescription("Spindle 회전수");

TagResponseV5 created = client.tag().create(req);

Einzelabfrage / Existenzprüfung

TagResponseV5 tag = client.tag().get("TAG_EDGE_00303_90007");
if (tag != null) {
System.out.println(tag.getTag_name() + " (" + tag.getUnit() + ")");
}

boolean exists = client.tag().exists("TAG_EDGE_00303_90007");

Liste nach Standort / OPC / Asset

List<TagResponseV5> siteTags = client.tag().listBySite("SITE_DJ");
List<TagResponseV5> opcTags = client.tag().listByOpc("OPC_PLC_L1_001");
List<TagResponseV5> assetTags = client.tag().listByAsset("ASSET_DJ_M_0001");

Anzahl

long total = client.tag().count();
long siteTotal = client.tag().countBySite("SITE_DJ");
long opcTotal = client.tag().countByOpc("OPC_PLC_L1_001");
long assetTotal = client.tag().countByAsset("ASSET_DJ_M_0001");

Vollständige Änderung (PUT)

Wenn alle Felder erneut gesendet werden:

TagRequestV5 update = new TagRequestV5();
update.setTag_id("TAG_EDGE_00303_90007");
update.setTag_name("Spindle RPM (변경됨)");
update.setOpc_id("OPC_EDGE_00303");
update.setSite_id("SITE_DJ");
update.setJava_type("Double");
update.setUnit("RPM");
// ... 모든 필드 ...
client.tag().update("TAG_EDGE_00303_90007", update);

Teiländerung — patchBasic

Nur Name und Beschreibung ändern:

import plantpulse.api.v5.dto.request.TagBasicPatchRequestV5;

TagBasicPatchRequestV5 patch = new TagBasicPatchRequestV5();
patch.setTag_name("Spindle RPM (보정 후)");
patch.setDescription("2026-05-14 보정 적용");
// java_type 은 null 로 두면 변경 안 함
client.tag().patchBasic("TAG_EDGE_00303_90007", patch);

Teiländerung — patchAlarm

Alarmgrenzwerte setzen (serverseitiges CEP/EQL-Redeployment):

import plantpulse.api.v5.dto.request.TagAlarmPatchRequestV5;

TagAlarmPatchRequestV5 alarm = new TagAlarmPatchRequestV5();
alarm.setUse_alarm("Y");
alarm.setLo_lo("0");
alarm.setLo("10");
alarm.setHi("80");
alarm.setHi_hi("95");
alarm.setTrip_hi("100");
alarm.setDuplicate_check_minutes(5);
alarm.setSend_email("Y");
client.tag().patchAlarm("TAG_EDGE_00303_90007", alarm);

Teiländerung — patchMetadata

Alias und Anzeigeformat ändern:

import plantpulse.api.v5.dto.request.TagMetadataPatchRequestV5;

TagMetadataPatchRequestV5 meta = new TagMetadataPatchRequestV5();
meta.setAlias_name("HMI_TAG_RPM_01");
meta.setDisplay_format("#,##0");
meta.setNumber_scale(0);
meta.setImportance(8);
client.tag().patchMetadata("TAG_EDGE_00303_90007", meta);

Teiländerung — patchCalculation

EQL-Formel zuweisen (serverseitig erneuter Aufruf von deployCalculation):

import plantpulse.api.v5.dto.request.TagCalculationPatchRequestV5;

TagCalculationPatchRequestV5 calc = new TagCalculationPatchRequestV5();
calc.setUse_calculation("Y");
calc.setCalculation_eql("VAL('TAG_RAW_RPM') * 60 / 1000"); // 가상의 EQL
client.tag().patchCalculation("TAG_EDGE_00303_90007", calc);

Teiländerung — patchAggregation

Aggregation über 5 Intervalle aktivieren (erneuter Aufruf von deployAggregation):

import plantpulse.api.v5.dto.request.TagAggregationPatchRequestV5;

TagAggregationPatchRequestV5 agg = new TagAggregationPatchRequestV5();
agg.setUse_aggregation("Y");
agg.setAggregation_1_minutes("Y");
agg.setAggregation_5_minutes("Y");
agg.setAggregation_10_minutes("Y");
agg.setAggregation_30_minutes("N");
agg.setAggregation_1_hours("Y");
client.tag().patchAggregation("TAG_EDGE_00303_90007", agg);

Teiländerung — patchPublish

MQTT/Kafka-Publizierung umschalten:

import plantpulse.api.v5.dto.request.TagPublishPatchRequestV5;

TagPublishPatchRequestV5 pub = new TagPublishPatchRequestV5();
pub.setPublish_mqtt("Y");
pub.setPublish_kafka("N");
client.tag().patchPublish("TAG_EDGE_00303_90007", pub);
import plantpulse.api.v5.dto.request.TagLinkPatchRequestV5;

// 자산에 연결
TagLinkPatchRequestV5 link = new TagLinkPatchRequestV5();
link.setLinked_asset_id("ASSET_DJ_M_0001");
client.tag().patchLink("TAG_EDGE_00303_90007", link);

// 매핑 해제 — 빈 문자열
TagLinkPatchRequestV5 unlink = new TagLinkPatchRequestV5();
unlink.setLinked_asset_id("");
client.tag().patchLink("TAG_EDGE_00303_90007", unlink);

Löschen

boolean ok = client.tag().delete("TAG_EDGE_00303_90007");

8.5 Anwendungsszenarien

Szenario — Tags einer neuen Linie automatisch klassifizieren und gesammelt konfigurieren

// 1) 자동 등록된 태그 목록 (OPC 연결 직후)
List<TagResponseV5> tags = client.tag().listByOpc("OPC_PLC_L2_001");

// 2) 이름 패턴으로 자산 자동 연결 + 알람 일괄 설정
for (TagResponseV5 t : tags) {
String name = t.getTag_name();

// 자산 매핑
TagLinkPatchRequestV5 link = new TagLinkPatchRequestV5();
if (name.contains("CNC1")) {
link.setLinked_asset_id("ASSET_DJ_M_CNC1");
} else if (name.contains("CNC2")) {
link.setLinked_asset_id("ASSET_DJ_M_CNC2");
} else {
continue;
}
client.tag().patchLink(t.getTag_id(), link);

// 온도 태그는 알람 임계치 자동 설정
if (name.endsWith("_TEMP")) {
TagAlarmPatchRequestV5 alarm = new TagAlarmPatchRequestV5();
alarm.setUse_alarm("Y");
alarm.setHi("80");
alarm.setHi_hi("95");
client.tag().patchAlarm(t.getTag_id(), alarm);
}
}

Szenario — Aggregation und Publizierung gemeinsam aktivieren

String tagId = "TAG_EDGE_00303_90007";

TagAggregationPatchRequestV5 agg = new TagAggregationPatchRequestV5();
agg.setUse_aggregation("Y");
agg.setAggregation_1_minutes("Y");
agg.setAggregation_1_hours("Y");
client.tag().patchAggregation(tagId, agg);

TagPublishPatchRequestV5 pub = new TagPublishPatchRequestV5();
pub.setPublish_mqtt("Y");
client.tag().patchPublish(tagId, pub);

Nächste Schritte