From 30d396896dff6c5d9033aec4d00e15b0a1583dec Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 21 Jul 2025 13:46:13 +0200 Subject: [PATCH] =?UTF-8?q?feat(service):=20CPL-Request=20verwendet=20DIA0?= =?UTF-8?q?,=20DIA1=20oder=20DIA2=20je=20nach=20Zeitraum=20f=C3=BCr=20anal?= =?UTF-8?q?oge=20Eing=C3=A4nge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- redux/thunks/getAnalogInputsThunk.ts | 2 +- services/fetchAnalogInputsHistoryService.ts | 16 ++++++++++------ services/fetchAnalogInputsService.ts | 2 +- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.env.development b/.env.development index 6cac53e..a612384 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.615 +NEXT_PUBLIC_APP_VERSION=1.6.616 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 3a3f48f..0d44aa8 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.615 +NEXT_PUBLIC_APP_VERSION=1.6.616 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dbcfd7c..9802968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.616] – 2025-07-21 + +- feat(service): Produktions-URL für CPL angepasst, erkennt Umgebung und baut Anfrage dynamisch + +--- ## [1.6.615] – 2025-07-21 - feat(chart): Zeitauswahl im Listbox nur lokal speichern, Daten-Fetch erst beim Button-Klick diff --git a/package-lock.json b/package-lock.json index 09978de..6612e24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.615", + "version": "1.6.616", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.615", + "version": "1.6.616", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index fa051b5..e774c1d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.615", + "version": "1.6.616", "private": true, "scripts": { "dev": "next dev", diff --git a/redux/thunks/getAnalogInputsThunk.ts b/redux/thunks/getAnalogInputsThunk.ts index cfb3670..4870f9f 100644 --- a/redux/thunks/getAnalogInputsThunk.ts +++ b/redux/thunks/getAnalogInputsThunk.ts @@ -12,7 +12,7 @@ export const getAnalogInputsThunk = createAsyncThunk( if (typeof window === "undefined") return; // Server-Side Execution blockieren try { const data = await fetchAnalogInputsService(); - console.log("📡 Analoge Eingänge geladen:", data); + //console.log("📡 Analoge Eingänge geladen:", data); if (data) { dispatch(setAnalogInputs(data)); // ✅ Redux mit API-Daten füllen } diff --git a/services/fetchAnalogInputsHistoryService.ts b/services/fetchAnalogInputsHistoryService.ts index fbe91bb..f2a52d4 100644 --- a/services/fetchAnalogInputsHistoryService.ts +++ b/services/fetchAnalogInputsHistoryService.ts @@ -35,12 +35,16 @@ export async function fetchAnalogInputsHistory( } const [vonJahr, vonMonat, vonTag] = vonDatum.split("-"); const [bisJahr, bisMonat, bisTag] = bisDatum.split("-"); - // CPL-Eingang: 1-8, Zeitraum: 1=Stündlich, 2=Täglich, 0=Alle Messwerte - let cplZeitraum = 1; - if (zeitraum === "DIA2") cplZeitraum = 2; - if (zeitraum === "DIA0") cplZeitraum = 0; - // Beispiel: /CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;2;4 - const url = `${window.location.origin}/CPL?seite.ACP&DIA1=${vonJahr};${vonMonat};${vonTag};${bisJahr};${bisMonat};${bisTag};${eingang};${cplZeitraum}`; + // CPL-Eingang: 100-107 für AE-Eingänge + // AE-Eingang: 100 + (eingang - 1) + const aeEingang = 100 + (eingang - 1); + // Zeitraum-Parameter: DIA0, DIA1, DIA2 + let diaType = "DIA1"; + if (zeitraum === "DIA0") diaType = "DIA0"; + if (zeitraum === "DIA2") diaType = "DIA2"; + // Beispiel: /CPL?seite.ACP&DIA1=2025;06;21;2025;07;21;100;1 + const url = `${window.location.origin}/CPL?seite.ACP&${diaType}=${vonJahr};${vonMonat};${vonTag};${bisJahr};${bisMonat};${bisTag};${aeEingang};1`; + console.log("CPL URL:", url); // Debug-Ausgabe const res = await fetch(url); if (!res.ok) { throw new Error("Fehler bei CPL-Server: " + res.status); diff --git a/services/fetchAnalogInputsService.ts b/services/fetchAnalogInputsService.ts index 31afa0e..68971ad 100644 --- a/services/fetchAnalogInputsService.ts +++ b/services/fetchAnalogInputsService.ts @@ -8,7 +8,7 @@ export const fetchAnalogInputsService = async () => { // ✅ PRODUKTIV: lädt JSON-Datei vom Gerät über CGI if (mode === "production") { - console.log("🔄 Lade analoge Eingänge im Produktionsmodus (JSON über CGI)"); + //console.log("🔄 Lade analoge Eingänge im Produktionsmodus (JSON über CGI)"); const res = await fetch("/CPL?/CPL/SERVICE/analogInputs.json", { headers: { Accept: "application/json" },