feat(service): CPL-Request verwendet DIA0, DIA1 oder DIA2 je nach Zeitraum für analoge Eingänge

This commit is contained in:
ISA
2025-07-21 13:46:13 +02:00
parent fb68d59da4
commit 30d396896d
8 changed files with 22 additions and 13 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

4
package-lock.json generated
View File

@@ -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",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.615",
"version": "1.6.616",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -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
}

View File

@@ -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);

View File

@@ -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" },