Redesign the final STEP phase to build a step_finali folder

Previously it only compared the top-level BOM against step/ and reported
matches, without copying anything. Now it unions the BOM codes with the
sub-components resolved in phase 4, copies every matching .stp into a new
step_finali/ folder, and reports what got created vs what's still missing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5 committed 2026-09-17 10:23:35 +02:00
1 parent ee408219bd
commit 52d126372d
4 files changed
+57 -32

No files matched your search

+12 -12
View File
@@ -2,15 +2,15 @@ using System.Diagnostics;
namespace CadSearchGui;
/// <summary>Mostra, per ogni componente della distinta base, se lo STEP corrispondente
/// è già stato esportato (file .stp presente in "step") o manca ancora.</summary>
/// <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 class ReportStepForm : Form
{
public ReportStepForm(List<(string Componente, string Descrizione, bool Realizzato)> righe, string cartellaStep)
public ReportStepForm(List<(string Componente, string Descrizione, bool Creato)> righe, string cartellaStepFinali)
{
int realizzati = righe.Count(r => r.Realizzato);
int creati = righe.Count(r => r.Creato);
Text = "Report STEP realizzati";
Text = "Report STEP finali";
ClientSize = new Size(720, 440);
StartPosition = FormStartPosition.CenterParent;
Font = new Font("Segoe UI", 9.5f);
@@ -21,8 +21,8 @@ public class ReportStepForm : Form
AutoSize = false,
Height = 32,
Padding = new Padding(12, 8, 12, 8),
Text = $"{realizzati} componenti realizzati su {righe.Count} ({righe.Count - realizzati} mancanti), "
+ $"confrontati con \"{cartellaStep}\".",
Text = $"{creati} componenti copiati su {righe.Count} ({righe.Count - creati} mancanti) "
+ $"in \"{cartellaStepFinali}\".",
};
var grid = new DataGridView
@@ -42,16 +42,16 @@ public class ReportStepForm : Form
grid.Columns["descrizione"]!.FillWeight = 55;
grid.Columns["step"]!.FillWeight = 25;
foreach (var (componente, descrizione, realizzato) in righe.OrderBy(r => r.Realizzato).ThenBy(r => r.Componente))
foreach (var (componente, descrizione, creato) in righe.OrderBy(r => r.Creato).ThenBy(r => r.Componente))
{
int i = grid.Rows.Add(componente, descrizione, realizzato ? "Realizzato" : "Mancante");
grid.Rows[i].DefaultCellStyle.ForeColor = realizzato ? Color.DarkGreen : Color.DarkRed;
int i = grid.Rows.Add(componente, descrizione, creato ? "Creato" : "Mancante");
grid.Rows[i].DefaultCellStyle.ForeColor = creato ? Color.DarkGreen : Color.DarkRed;
}
var btnApriCartella = new Button { Text = "Apri cartella step", Dock = DockStyle.Bottom, Height = 34 };
var btnApriCartella = new Button { Text = "Apri cartella step_finali", Dock = DockStyle.Bottom, Height = 34 };
btnApriCartella.Click += (_, _) =>
{
try { Process.Start("explorer.exe", cartellaStep); }
try { Process.Start("explorer.exe", cartellaStepFinali); }
catch (Exception ex)
{
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",