Synced with other adaptations

This commit is contained in:
2025-06-16 11:00:32 -07:00
parent 449ee46896
commit c6fafbe6f4
15 changed files with 578 additions and 513 deletions

View File

@ -227,7 +227,7 @@ public class FromIQS
private static void FlagDuplicates(string connectionString, string json)
{
JsonElement[]? jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true};
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
if (jsonElements is not null && jsonElements.Length != 0 && jsonElements[0].ValueKind == JsonValueKind.Object)
{
Root? root;
@ -324,7 +324,7 @@ public class FromIQS
return new(result, count, commandText);
}
private static string GetJson(Logistics logistics, string logisticLines, SECS.Description description)
private static string GetJson(Logistics logistics, ProcessDataStandardFormat processDataStandardFormat, SECS.Description description)
{
string result;
StringBuilder stringBuilder = new();
@ -344,7 +344,7 @@ public class FromIQS
string safeValue;
string[] segments;
string serializerValue;
foreach (string line in logisticLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
foreach (string line in processDataStandardFormat.Logistics)
{
segments = line.Split('\t');
if (segments.Length < 2)
@ -375,11 +375,11 @@ public class FromIQS
return result;
}
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, string logisticLines, SECS.Description description, string lines, long? subGroupId, string weekOfYear)
internal static void Save(string openInsightApiECDirectory, Logistics logistics, string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, SECS.Description description, long? subGroupId, string weekOfYear)
{
string checkFile;
string fileName = Path.GetFileName(reportFullPath);
string json = GetJson(logistics, logisticLines, description);
string json = GetJson(logistics, processDataStandardFormat, description);
string? ecPathRoot = Path.GetPathRoot(openInsightApiECDirectory);
bool ecExists = ecPathRoot is not null && Directory.Exists(ecPathRoot);
string weekYear = $"{logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
@ -389,9 +389,6 @@ public class FromIQS
checkFile = Path.Combine(ecDirectory, fileName);
if (ecExists && !File.Exists(checkFile))
File.Copy(reportFullPath, checkFile);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.txt");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, lines);
checkFile = Path.Combine(ecDirectory, $"{logistics.DateTimeFromSequence.Ticks}.json");
if (ecExists && !File.Exists(checkFile))
File.WriteAllText(checkFile, json);