Add wizard UI, general-assembly resolution, and test suite
Restructure Form1 into a sequential wizard (database -> import -> raw -> recursive component resolution -> completeness/STEP report), fix case-sensitivity bugs in codice/tipo_file lookups and a word-boundary gap in the assembly scanner that missed _D100-style sub-assembly references, and treat the distinta's general assembly as an ordinary CSV row (derived from the DBP_<codice>_<timestamp> filename) instead of special-casing it throughout. Also adds CadSearchGui.Tests (xUnit) covering the scanner, filename parsing, and the case-insensitive DB lookup behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
146ce78eae
commit
52483177f0
16 files changed
+1144
-249
No files matched your search
@@ -0,0 +1,66 @@
|
||||
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>
|
||||
public class ReportStepForm : Form
|
||||
{
|
||||
public ReportStepForm(List<(string Componente, string Descrizione, bool Realizzato)> righe, string cartellaStep)
|
||||
{
|
||||
int realizzati = righe.Count(r => r.Realizzato);
|
||||
|
||||
Text = "Report STEP realizzati";
|
||||
ClientSize = new Size(720, 440);
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Font = new Font("Segoe UI", 9.5f);
|
||||
|
||||
var lblInfo = new Label
|
||||
{
|
||||
Dock = DockStyle.Top,
|
||||
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}\".",
|
||||
};
|
||||
|
||||
var grid = new DataGridView
|
||||
{
|
||||
Dock = DockStyle.Fill,
|
||||
ReadOnly = true,
|
||||
AllowUserToAddRows = false,
|
||||
AllowUserToDeleteRows = false,
|
||||
RowHeadersVisible = false,
|
||||
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
||||
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
|
||||
};
|
||||
grid.Columns.Add("componente", "Componente");
|
||||
grid.Columns.Add("descrizione", "Descrizione");
|
||||
grid.Columns.Add("step", "STEP");
|
||||
grid.Columns["componente"]!.FillWeight = 20;
|
||||
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))
|
||||
{
|
||||
int i = grid.Rows.Add(componente, descrizione, realizzato ? "Realizzato" : "Mancante");
|
||||
grid.Rows[i].DefaultCellStyle.ForeColor = realizzato ? Color.DarkGreen : Color.DarkRed;
|
||||
}
|
||||
|
||||
var btnApriCartella = new Button { Text = "Apri cartella step", Dock = DockStyle.Bottom, Height = 34 };
|
||||
btnApriCartella.Click += (_, _) =>
|
||||
{
|
||||
try { Process.Start("explorer.exe", cartellaStep); }
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
};
|
||||
|
||||
Controls.Add(grid);
|
||||
Controls.Add(lblInfo);
|
||||
Controls.Add(btnApriCartella);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user