option('supplier'); $fornitoreId = $this->option('fornitore-id') ? (int) $this->option('fornitore-id') : null; $dryRun = (bool) $this->option('dry-run'); $this->info("Inizio importazione seriali e prodotti per '{$supplier}' da contabilità MySQL..."); try { $stats = $importer->importForSupplier($supplier, $fornitoreId, $dryRun); $this->table(['Metrica', 'Valore'], [ ['Codice Fornitore', $stats['supplier_code']], ['ID Fornitore Locale', $stats['fornitore_id']], ['Fatture Trovate', $stats['invoices_count']], ['Righe Documento Elaborate', $stats['lines_processed']], ['Prodotti Creati', $stats['products_created']], ['Codici Articolo / Identifier Creati', $stats['identifiers_created']], ['Seriali Nuovi Inseriti', $stats['serials_created']], ['Seriali Aggiornati', $stats['serials_updated']], ['Modalità Dry-Run', $stats['dry_run'] ? 'Sì' : 'No'], ]); $this->info("Importazione completata con successo!"); return self::SUCCESS; } catch (\Throwable $e) { $this->error("Errore durante l'importazione: " . $e->getMessage()); return self::FAILURE; } } }