Compare commits

1 Commits

Author SHA1 Message Date
c3c4564548 Filter copy for InfinityQS
Reactor 43 and 56
2025-08-05 15:53:58 -07:00
2 changed files with 25 additions and 25 deletions

View File

@ -120,12 +120,16 @@ public class FileRead : Shared.FileRead, IFileRead
if (File.Exists(checkFile)) if (File.Exists(checkFile))
File.Delete(checkFile); File.Delete(checkFile);
File.Copy(_Logistics.FileInfo.FullName, checkFile); File.Copy(_Logistics.FileInfo.FullName, checkFile);
if (jsonElements.Length == 1 && jsonElements[0].ValueKind == JsonValueKind.Object) if (jsonElements.Length != 1 || jsonElements[0].ValueKind != JsonValueKind.Object)
File.Delete(_Logistics.FileInfo.FullName);
else
{ {
try try
{ {
Six six = JsonSerializer.Deserialize(jsonElements[0].GetRawText(), SixSourceGenerationContext.Default.Six) ?? throw new Exception($"{nameof(Six)} deserialization failed"); Six six = JsonSerializer.Deserialize(jsonElements[0].GetRawText(), SixSourceGenerationContext.Default.Six) ?? throw new Exception($"{nameof(Six)} deserialization failed");
if (six.VP12Count >= _IQSVP12Count) if (six.VP12Count < _IQSVP12Count)
File.Delete(_Logistics.FileInfo.FullName);
else
{ {
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName); string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
if (!Directory.Exists(duplicateDirectory)) if (!Directory.Exists(duplicateDirectory))
@ -134,10 +138,7 @@ public class FileRead : Shared.FileRead, IFileRead
File.Move(_Logistics.FileInfo.FullName, duplicateFile); File.Move(_Logistics.FileInfo.FullName, duplicateFile);
} }
} }
catch (Exception) catch (Exception) { File.Delete(_Logistics.FileInfo.FullName); }
{
File.Delete(_Logistics.FileInfo.FullName);
}
} }
} }

View File

@ -518,6 +518,8 @@ internal class ProcessDataStandardFormat
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults) internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
{ {
List<string> results = new(); List<string> results = new();
if (processDataStandardFormat.InputPDSF is null)
throw new NullReferenceException(nameof(processDataStandardFormat.InputPDSF));
if (processDataStandardFormat.Sequence is null) if (processDataStandardFormat.Sequence is null)
throw new NullReferenceException(nameof(processDataStandardFormat.Sequence)); throw new NullReferenceException(nameof(processDataStandardFormat.Sequence));
string endOffset = "E#######T"; string endOffset = "E#######T";
@ -555,25 +557,22 @@ internal class ProcessDataStandardFormat
} }
} }
results.Add("END_HEADER"); results.Add("END_HEADER");
if (processDataStandardFormat.InputPDSF is not null) results.Add(string.Empty);
{ List<char> hyphens = new();
results.Add(string.Empty); results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
List<char> hyphens = new(); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|")); results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
results.Add(string.Empty); for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|"); hyphens.Add('-');
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++) results.Add($"|{string.Join("|", hyphens)}|");
hyphens.Add('-'); results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add($"|{string.Join("|", hyphens)}|"); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|")); results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|")); results.Add("EOF");
results.Add(string.Empty); results.Add(string.Empty);
results.Add("EOF"); string json = GetJson(processDataStandardFormat);
results.Add(string.Empty); results.Add(json);
string json = GetJson(processDataStandardFormat);
results.Add(json);
}
File.WriteAllText(path, string.Join(Environment.NewLine, results)); File.WriteAllText(path, string.Join(Environment.NewLine, results));
} }