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))
|
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))
|
||||||
@ -138,7 +134,10 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
File.Move(_Logistics.FileInfo.FullName, duplicateFile);
|
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)
|
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";
|
||||||
@ -557,22 +555,25 @@ internal class ProcessDataStandardFormat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
results.Add("END_HEADER");
|
results.Add("END_HEADER");
|
||||||
results.Add(string.Empty);
|
if (processDataStandardFormat.InputPDSF is not null)
|
||||||
List<char> hyphens = new();
|
{
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
|
results.Add(string.Empty);
|
||||||
results.Add(string.Empty);
|
List<char> hyphens = new();
|
||||||
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
|
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||||
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
|
results.Add(string.Empty);
|
||||||
hyphens.Add('-');
|
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
|
||||||
results.Add($"|{string.Join("|", hyphens)}|");
|
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
|
hyphens.Add('-');
|
||||||
results.Add(string.Empty);
|
results.Add($"|{string.Join("|", hyphens)}|");
|
||||||
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
|
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||||
results.Add(string.Empty);
|
results.Add(string.Empty);
|
||||||
results.Add("EOF");
|
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
|
||||||
results.Add(string.Empty);
|
results.Add(string.Empty);
|
||||||
string json = GetJson(processDataStandardFormat);
|
results.Add("EOF");
|
||||||
results.Add(json);
|
results.Add(string.Empty);
|
||||||
|
string json = GetJson(processDataStandardFormat);
|
||||||
|
results.Add(json);
|
||||||
|
}
|
||||||
File.WriteAllText(path, string.Join(Environment.NewLine, results));
|
File.WriteAllText(path, string.Join(Environment.NewLine, results));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user