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
@@ -2,13 +2,26 @@ using System.Diagnostics;
|
||||
|
||||
namespace CadSearchGui;
|
||||
|
||||
/// <summary>Mostra, per ogni componente (distinta base + sotto-componenti risolti in fase 4),
|
||||
/// se lo STEP corrispondente è stato trovato in "step" e copiato in "step_finali", o se manca.</summary>
|
||||
public enum EsitoStep
|
||||
{
|
||||
/// <summary>File .stp trovato in "step" e copiato in "step_finali".</summary>
|
||||
Creato,
|
||||
/// <summary>Il componente è nell'indice CAD (asm/prt trovato), ma nessuno STEP esportato.</summary>
|
||||
StepMancante,
|
||||
/// <summary>Il componente non è nemmeno nell'indice CAD.</summary>
|
||||
ComponenteNonTrovato,
|
||||
}
|
||||
|
||||
/// <summary>Mostra, per ogni componente della distinta base, se lo STEP corrispondente è stato
|
||||
/// trovato in "step" e copiato in "step_finali", se manca solo lo STEP (il CAD sorgente c'è,
|
||||
/// ma non è ancora stato esportato) o se manca anche il CAD sorgente nell'indice.</summary>
|
||||
public class ReportStepForm : Form
|
||||
{
|
||||
public ReportStepForm(List<(string Componente, string Descrizione, bool Creato)> righe, string cartellaStepFinali)
|
||||
public ReportStepForm(List<(string Componente, string Descrizione, EsitoStep Esito)> righe, string cartellaStepFinali)
|
||||
{
|
||||
int creati = righe.Count(r => r.Creato);
|
||||
int creati = righe.Count(r => r.Esito == EsitoStep.Creato);
|
||||
int stepMancanti = righe.Count(r => r.Esito == EsitoStep.StepMancante);
|
||||
int nonTrovati = righe.Count(r => r.Esito == EsitoStep.ComponenteNonTrovato);
|
||||
|
||||
Text = "Report STEP finali";
|
||||
ClientSize = new Size(720, 440);
|
||||
@@ -21,8 +34,8 @@ public class ReportStepForm : Form
|
||||
AutoSize = false,
|
||||
Height = 32,
|
||||
Padding = new Padding(12, 8, 12, 8),
|
||||
Text = $"{creati} componenti copiati su {righe.Count} ({righe.Count - creati} mancanti) "
|
||||
+ $"in \"{cartellaStepFinali}\".",
|
||||
Text = $"{creati} copiati, {stepMancanti} da esportare (CAD presente), "
|
||||
+ $"{nonTrovati} non nell'indice, su {righe.Count} totali. In \"{cartellaStepFinali}\".",
|
||||
};
|
||||
|
||||
var grid = new DataGridView
|
||||
@@ -42,10 +55,16 @@ public class ReportStepForm : Form
|
||||
grid.Columns["descrizione"]!.FillWeight = 55;
|
||||
grid.Columns["step"]!.FillWeight = 25;
|
||||
|
||||
foreach (var (componente, descrizione, creato) in righe.OrderBy(r => r.Creato).ThenBy(r => r.Componente))
|
||||
foreach (var (componente, descrizione, esito) in righe.OrderBy(r => r.Esito).ThenBy(r => r.Componente))
|
||||
{
|
||||
int i = grid.Rows.Add(componente, descrizione, creato ? "Creato" : "Mancante");
|
||||
grid.Rows[i].DefaultCellStyle.ForeColor = creato ? Color.DarkGreen : Color.DarkRed;
|
||||
var (testo, colore) = esito switch
|
||||
{
|
||||
EsitoStep.Creato => ("Creato", Color.DarkGreen),
|
||||
EsitoStep.StepMancante => ("Da esportare (CAD presente)", Color.DarkOrange),
|
||||
_ => ("Componente non trovato nel server", Color.DarkRed),
|
||||
};
|
||||
int i = grid.Rows.Add(componente, descrizione, testo);
|
||||
grid.Rows[i].DefaultCellStyle.ForeColor = colore;
|
||||
}
|
||||
|
||||
var btnApriCartella = new Button { Text = "Apri cartella step_finali", Dock = DockStyle.Bottom, Height = 34 };
|
||||
|
||||
Reference in new issue
Block a user