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:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user