Distinguish missing STEP from missing CAD source in the final report
A component with no .stp could mean two different things: the CAD source was never found in the index at all, or it's indexed but nobody exported the STEP yet. Cross-references the missing codes against cad_index.db (reusing the phase-2 verification cache when available) and reports each as EsitoStep.StepMancante vs ComponenteNonTrovato, colored differently. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f6cb2da00
commit
e6de563f60
3 files changed
+54
-18
No files matched your search
+22
-7
@@ -569,23 +569,38 @@ public partial class Form1 : Form
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
// Per i codici senza STEP, distingue "il CAD c'è ma lo STEP non è stato esportato" da
|
||||
// "il componente non è nemmeno nell'indice CAD" (riusa la verifica già fatta in fase 2/3
|
||||
// se disponibile, altrimenti la rifà).
|
||||
var cadTrovati = _ultimaVerifica ?? TrovaPercorsiCad(tuttiICodici);
|
||||
|
||||
var cartellaStepFinali = Path.Combine(radice, "step_finali");
|
||||
Directory.CreateDirectory(cartellaStepFinali);
|
||||
|
||||
var righeReport = new List<(string Componente, string Descrizione, bool Creato)>();
|
||||
var righeReport = new List<(string Componente, string Descrizione, EsitoStep Esito)>();
|
||||
foreach (var codice in tuttiICodici)
|
||||
{
|
||||
var percorsoStp = Path.Combine(cartellaStep, codice + ".stp");
|
||||
bool trovato = File.Exists(percorsoStp);
|
||||
if (trovato)
|
||||
EsitoStep esito;
|
||||
if (File.Exists(percorsoStp))
|
||||
{
|
||||
File.Copy(percorsoStp, Path.Combine(cartellaStepFinali, codice + ".stp"), overwrite: true);
|
||||
righeReport.Add((codice, descrizioni.GetValueOrDefault(codice, ""), trovato));
|
||||
esito = EsitoStep.Creato;
|
||||
}
|
||||
else
|
||||
{
|
||||
esito = cadTrovati.ContainsKey(codice) ? EsitoStep.StepMancante : EsitoStep.ComponenteNonTrovato;
|
||||
}
|
||||
righeReport.Add((codice, descrizioni.GetValueOrDefault(codice, ""), esito));
|
||||
}
|
||||
int creati = righeReport.Count(r => r.Creato);
|
||||
int creati = righeReport.Count(r => r.Esito == EsitoStep.Creato);
|
||||
int stepMancanti = righeReport.Count(r => r.Esito == EsitoStep.StepMancante);
|
||||
int nonTrovati = righeReport.Count(r => r.Esito == EsitoStep.ComponenteNonTrovato);
|
||||
|
||||
ImpostaStatoImport(
|
||||
$"STEP finali: {creati} componenti copiati su {righeReport.Count} "
|
||||
+ $"({righeReport.Count - creati} mancanti) in {cartellaStepFinali}.",
|
||||
$"STEP finali: {creati} copiati, {stepMancanti} da esportare (CAD presente), "
|
||||
+ $"{nonTrovati} componenti non nell'indice, su {righeReport.Count} totali. "
|
||||
+ $"Cartella: {cartellaStepFinali}.",
|
||||
Color.DarkGreen);
|
||||
|
||||
using var dialog = new ReportStepForm(righeReport, cartellaStepFinali);
|
||||
|
||||
Reference in new issue
Block a user