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
@@ -14,6 +14,12 @@ static class DistintaBaseImporter
|
||||
private static readonly XNamespace Ss = "urn:schemas-microsoft-com:office:spreadsheet";
|
||||
private const string NomeFoglio = "Distinta Base";
|
||||
|
||||
// Il gestionale esporta la distinta come "DBP_<codice assieme generale>_<timestamp>.xls":
|
||||
// il foglio elenca solo i componenti SOTTO l'assieme, non l'assieme generale in sé, quindi
|
||||
// va aggiunto a parte al CSV leggendo questo codice dal nome del file di input.
|
||||
private static readonly System.Text.RegularExpressions.Regex NomeFileDistintaRegex =
|
||||
new(@"^DBP_(?<codice>\d+)_\d+$", System.Text.RegularExpressions.RegexOptions.Compiled);
|
||||
|
||||
static DistintaBaseImporter()
|
||||
{
|
||||
Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
@@ -29,6 +35,14 @@ static class DistintaBaseImporter
|
||||
.Where(r => r.Componente.Length > 0 || r.Descrizione.Length > 0)
|
||||
.ToList();
|
||||
|
||||
var matchGenerale = NomeFileDistintaRegex.Match(Path.GetFileNameWithoutExtension(percorsoInput));
|
||||
if (matchGenerale.Success)
|
||||
{
|
||||
string codiceGenerale = matchGenerale.Groups["codice"].Value;
|
||||
if (!righe.Any(r => string.Equals(r.Componente, codiceGenerale, StringComparison.OrdinalIgnoreCase)))
|
||||
righe.Insert(0, (codiceGenerale, "Assieme generale"));
|
||||
}
|
||||
|
||||
var percorsoCsv = Path.Combine(
|
||||
Path.GetDirectoryName(Path.GetFullPath(percorsoInput))!,
|
||||
Path.GetFileNameWithoutExtension(percorsoInput) + ".csv");
|
||||
|
||||
Reference in new issue
Block a user