Compare commits
1 Commits
08-05-d
...
2355259ae9
| Author | SHA1 | Date | |
|---|---|---|---|
| 2355259ae9 |
@ -120,16 +120,12 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (File.Exists(checkFile))
|
||||
File.Delete(checkFile);
|
||||
File.Copy(_Logistics.FileInfo.FullName, checkFile);
|
||||
if (jsonElements.Length != 1 || jsonElements[0].ValueKind != JsonValueKind.Object)
|
||||
File.Delete(_Logistics.FileInfo.FullName);
|
||||
else
|
||||
if (jsonElements.Length == 1 && jsonElements[0].ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
try
|
||||
{
|
||||
Six six = JsonSerializer.Deserialize(jsonElements[0].GetRawText(), SixSourceGenerationContext.Default.Six) ?? throw new Exception($"{nameof(Six)} deserialization failed");
|
||||
if (six.VP12Count < _IQSVP12Count)
|
||||
File.Delete(_Logistics.FileInfo.FullName);
|
||||
else
|
||||
if (six.VP12Count >= _IQSVP12Count)
|
||||
{
|
||||
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
@ -138,7 +134,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
File.Move(_Logistics.FileInfo.FullName, duplicateFile);
|
||||
}
|
||||
}
|
||||
catch (Exception) { File.Delete(_Logistics.FileInfo.FullName); }
|
||||
catch (Exception)
|
||||
{
|
||||
File.Delete(_Logistics.FileInfo.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -518,8 +518,6 @@ internal class ProcessDataStandardFormat
|
||||
internal static void Write(string path, ProcessDataStandardFormat processDataStandardFormat, List<Metrology.WS.Results>? wsResults)
|
||||
{
|
||||
List<string> results = new();
|
||||
if (processDataStandardFormat.InputPDSF is null)
|
||||
throw new NullReferenceException(nameof(processDataStandardFormat.InputPDSF));
|
||||
if (processDataStandardFormat.Sequence is null)
|
||||
throw new NullReferenceException(nameof(processDataStandardFormat.Sequence));
|
||||
string endOffset = "E#######T";
|
||||
@ -557,22 +555,25 @@ internal class ProcessDataStandardFormat
|
||||
}
|
||||
}
|
||||
results.Add("END_HEADER");
|
||||
results.Add(string.Empty);
|
||||
List<char> hyphens = new();
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
|
||||
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
|
||||
hyphens.Add('-');
|
||||
results.Add($"|{string.Join("|", hyphens)}|");
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.Add("EOF");
|
||||
results.Add(string.Empty);
|
||||
string json = GetJson(processDataStandardFormat);
|
||||
results.Add(json);
|
||||
if (processDataStandardFormat.InputPDSF is not null)
|
||||
{
|
||||
results.Add(string.Empty);
|
||||
List<char> hyphens = new();
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
|
||||
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
|
||||
hyphens.Add('-');
|
||||
results.Add($"|{string.Join("|", hyphens)}|");
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||
results.Add(string.Empty);
|
||||
results.Add("EOF");
|
||||
results.Add(string.Empty);
|
||||
string json = GetJson(processDataStandardFormat);
|
||||
results.Add(json);
|
||||
}
|
||||
File.WriteAllText(path, string.Join(Environment.NewLine, results));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user