Separaten Output-Ordner für INVRPT → VDA 4913 Konvertierungen hinzufügen
Der eingehende Watcher nutzt denselben Input-Ordner für alle Dateitypen, schreibt INVRPT-Konvertierungen nun aber in einen konfigurierbaren separaten Output-Ordner. Bleibt das Feld leer, wird der Standard- Output-Ordner als Fallback verwendet (abwärtskompatibel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
index.html
15
index.html
@@ -362,6 +362,21 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-card">
|
||||
<div class="settings-card-header">
|
||||
<i data-lucide="folder-output"></i>
|
||||
<span>Output-Ordner (INVRPT → VDA 4913)</span>
|
||||
</div>
|
||||
<div class="folder-input-row">
|
||||
<input type="text" id="invrptOutputPath" class="folder-path-input"
|
||||
placeholder="Leer = gleicher Output-Ordner" readonly>
|
||||
<button class="btn-secondary" id="btnSelectInvrptOutput" onclick="app.selectInvrptOutputFolder()">
|
||||
<i data-lucide="folder-open"></i>
|
||||
Wählen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Watcher Controls -->
|
||||
|
||||
17
js/app.js
17
js/app.js
@@ -88,9 +88,11 @@ class App {
|
||||
// Disable folder buttons
|
||||
const btnIn = document.getElementById('btnSelectInput');
|
||||
const btnOut = document.getElementById('btnSelectOutput');
|
||||
const btnInvrptOut = document.getElementById('btnSelectInvrptOutput');
|
||||
const btnStart = document.getElementById('btnStartWatcher');
|
||||
if (btnIn) btnIn.disabled = true;
|
||||
if (btnOut) btnOut.disabled = true;
|
||||
if (btnInvrptOut) btnInvrptOut.disabled = true;
|
||||
if (btnStart) btnStart.disabled = true;
|
||||
} else {
|
||||
// Load saved settings
|
||||
@@ -101,6 +103,9 @@ class App {
|
||||
if (settings.outputDir) {
|
||||
document.getElementById('outputDirPath').value = settings.outputDir;
|
||||
}
|
||||
if (settings.invrptOutputDir) {
|
||||
document.getElementById('invrptOutputPath').value = settings.invrptOutputDir;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1195,18 +1200,28 @@ class App {
|
||||
}
|
||||
}
|
||||
|
||||
async selectInvrptOutputFolder() {
|
||||
if (!this.watcher) return;
|
||||
const folder = await this.watcher.selectFolder();
|
||||
if (folder) {
|
||||
document.getElementById('invrptOutputPath').value = folder;
|
||||
this.watcher.saveSettings({ invrptOutputDir: folder });
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Settings: Watcher Controls ──────────────────────────────────
|
||||
async startWatcher() {
|
||||
if (!this.watcher) return;
|
||||
const inputDir = document.getElementById('inputDirPath').value;
|
||||
const outputDir = document.getElementById('outputDirPath').value;
|
||||
const invrptOutputDir = document.getElementById('invrptOutputPath').value;
|
||||
|
||||
if (!inputDir || !outputDir) {
|
||||
alert('Bitte beide Ordner (Input & Output) angeben.');
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await this.watcher.start(inputDir, outputDir);
|
||||
const result = await this.watcher.start(inputDir, outputDir, invrptOutputDir);
|
||||
if (result.error) {
|
||||
alert('Watcher-Fehler: ' + result.error);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class WatcherBridge {
|
||||
}
|
||||
|
||||
async _processDetectedFile(data) {
|
||||
const { filePath, fileName, content, outputDir } = data;
|
||||
const { filePath, fileName, content, outputDir, invrptOutputDir } = data;
|
||||
this._addLog('info', fileName, 'Datei erkannt, starte Konvertierung...');
|
||||
|
||||
let konvertierungsmodus = 'Unbekannt';
|
||||
@@ -71,7 +71,9 @@ class WatcherBridge {
|
||||
const baseName = fileName.replace(/\.[^.]+$/, '');
|
||||
const outExt = result.format === 'vda' ? '.vda' : (result.format === 'xml' ? '.xml' : '.edi');
|
||||
outFileName = baseName + '_converted' + outExt;
|
||||
const outPath = outputDir + '\\' + outFileName;
|
||||
const isInvrpt = result.type && result.type.includes('INVRPT');
|
||||
const effectiveOutputDir = (isInvrpt && invrptOutputDir) ? invrptOutputDir : outputDir;
|
||||
const outPath = effectiveOutputDir + '\\' + outFileName;
|
||||
|
||||
// Write converted file
|
||||
const writeResult = await window.electronAPI.writeFile(outPath, result.output);
|
||||
@@ -275,11 +277,11 @@ class WatcherBridge {
|
||||
if (this.onLogEntry) this.onLogEntry(entry);
|
||||
}
|
||||
|
||||
async start(inputDir, outputDir) {
|
||||
async start(inputDir, outputDir, invrptOutputDir) {
|
||||
if (!window.electronAPI) {
|
||||
return { error: 'Electron API nicht verfügbar. App läuft im Browser-Modus.' };
|
||||
}
|
||||
const result = await window.electronAPI.startWatcher({ inputDir, outputDir });
|
||||
const result = await window.electronAPI.startWatcher({ inputDir, outputDir, invrptOutputDir });
|
||||
if (result.success) {
|
||||
this.status = 'running';
|
||||
this._addLog('info', '', `Watcher gestartet. Überwache: ${inputDir}`);
|
||||
|
||||
10
main.js
10
main.js
@@ -15,7 +15,7 @@ const edifactValidator = require('./js/edifact-validator');
|
||||
let mainWindow = null;
|
||||
let watcher = null;
|
||||
let watcherPaused = false;
|
||||
let watcherConfig = { inputDir: '', outputDir: '', mode: 'auto' };
|
||||
let watcherConfig = { inputDir: '', outputDir: '', invrptOutputDir: '', mode: 'auto' };
|
||||
|
||||
let outboundWatcher = null;
|
||||
let outboundWatcherPaused = false;
|
||||
@@ -116,8 +116,8 @@ function loadSettings() {
|
||||
}
|
||||
} catch (e) { console.error('Settings load error:', e); }
|
||||
return {
|
||||
inputDir: '', outputDir: '', mode: 'auto',
|
||||
outboundInputDir: '', outboundOutputDir: '', mode: 'auto',
|
||||
inputDir: '', outputDir: '', invrptOutputDir: '', mode: 'auto',
|
||||
outboundInputDir: '', outboundOutputDir: '',
|
||||
werksInputDir: '', werksOutputDir: ''
|
||||
};
|
||||
}
|
||||
@@ -219,6 +219,7 @@ ipcMain.handle('start-watcher', (_, config) => {
|
||||
|
||||
const inputDir = watcherConfig.inputDir;
|
||||
const outputDir = watcherConfig.outputDir;
|
||||
const invrptOutputDir = watcherConfig.invrptOutputDir || '';
|
||||
|
||||
if (!inputDir || !outputDir) {
|
||||
return { error: 'Input- und Output-Ordner müssen angegeben werden.' };
|
||||
@@ -293,7 +294,8 @@ ipcMain.handle('start-watcher', (_, config) => {
|
||||
filePath,
|
||||
fileName,
|
||||
content,
|
||||
outputDir
|
||||
outputDir,
|
||||
invrptOutputDir
|
||||
});
|
||||
|
||||
console.log(`[Watcher] Sent to renderer: ${fileName} (${content.length} bytes)`);
|
||||
|
||||
Reference in New Issue
Block a user