UniqueId replacement for attachments

Write input PDSF in output after EOF

GetPropertyValue for MoveMatchingFiles

MoveMatchingFile

ProcessDataStandardFormat over Tuple

MoveMatchingFiles to use ProcessDataStandardFormatMapping

MID Logic
This commit is contained in:
2025-04-14 10:00:36 -07:00
parent 4d41e545b3
commit 5a3469baa1
22 changed files with 2027 additions and 1463 deletions

View File

@ -139,15 +139,15 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath);
_Logistics = new Logistics(reportFullPath, processDataStandardFormat);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat);
List<txt.Description> descriptions = txt.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics[0]), tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -607,8 +607,12 @@ public class WSRequest
Details.Add(detail);
}
Date = logistics.DateTimeFromSequence.ToString();
if (UniqueID is null && Details.Count != 0)
UniqueID = Details[0].HeaderUniqueID;
UniqueID = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}";
for (int i = 0; i < Details.Count; i++)
{
Details[i].HeaderUniqueID = UniqueID;
Details[i].UniqueID = $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}";
}
}
/// <summary>
@ -664,7 +668,7 @@ public class WSRequest
List<WS.Attachment> dataAttachments = new();
List<WS.Attachment> headerAttachments = new()
{
new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0])
new WS.Attachment(subGroupId, headerId, headerIdDirectory, $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}", "Data.txt", summaryFiles[0])
};
int count;
if (pdfFiles.Count < descriptions.Count)
@ -674,7 +678,7 @@ public class WSRequest
for (int i = 0; i < count; i++)
{
if (!string.IsNullOrEmpty(pdfFiles[i]))
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, descriptions[i].UniqueId, "Image.pdf", pdfFiles[i]));
dataAttachments.Add(new WS.Attachment(subGroupId, headerId, headerIdDirectory, $"{logistics.JobID}_{logistics.MID}_{logistics.DateTimeFromSequence:yyyyMMddHHmmssffff}_Item-{i + 1}", "Image.pdf", pdfFiles[i]));
}
if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count)
throw new Exception($"Invalid attachment count! {dataAttachments.Count} != {descriptions.Count}");