SECS/GEM log-to-trace (Day-Helper-2025-07-10)
java-script-object-notation-to-reactor (Day-Helper-2025-07-09) Dynamic extension for (Day-Helper-2025-07-01)
This commit is contained in:
47
.vscode/launch.json
vendored
47
.vscode/launch.json
vendored
@ -11,6 +11,41 @@
|
|||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
|
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
|
||||||
"args": [
|
"args": [
|
||||||
|
"s",
|
||||||
|
"X",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/Log",
|
||||||
|
"Day-Helper-2025-07-10",
|
||||||
|
"R*",
|
||||||
|
"EAF_INFO*",
|
||||||
|
"s",
|
||||||
|
"X",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/JavaScriptObjectNotation",
|
||||||
|
"Day-Helper-2025-07-09",
|
||||||
|
"*.json",
|
||||||
|
"987654321",
|
||||||
|
".agg",
|
||||||
|
"id93,vp93,ProcessState,id154,vp154,SystemState,id78,vp78,LL1State,id83,vp83,LL2State,id176,vp176,TotalWaferCount,id80,vp80,LL1Lotid,id85,vp85,LL2Lotid,id153,vp153,PPSTEPNAME,id221,vp221,LeftDefaultRecipe,id222,vp222,RightDefaultRecipe,id223,vp223,RecipeCompleteMsg",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/Reactor",
|
||||||
|
"s",
|
||||||
|
"X",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/PollPath",
|
||||||
|
"Day-Helper-2025-07-01",
|
||||||
|
"*.pdsf",
|
||||||
|
"987654321",
|
||||||
|
"Time",
|
||||||
|
".json",
|
||||||
|
"id12~CenterTemp,id13~CenterSetpt,id15~FrontTemp,id153~PPSTEPNAME,id154~SystemState,id16~FrontSetpt,id172~LVC1Ratio,id173~LVC1Carrier,id176~TotalWaferCount,i-d-1-7-8~TIME,id18~SideTemp,id183~SCRDrive4,id19~SideSetpt,id193~SCRLOAD4,id21~RearTemp,id22~RearSetpt,id221~LeftDefaultRecipe,id222~RightDefaultRecipe,id223~RecipeCompleteMsg,id25~N2H2Setpt,id26~N2H2Flow,id27~HCLSetpt,id28~HCLFlow,id29~HCLHISetpt,id30~HCLHIFlow,id37~NSRCSetpt,id38~NSRCFlow,id39~NDILSetpt,id40~NDILFlow,id41~NINJSetpt,id42~NINJFlow,id57~LVC1Setpt,id58~LVC1Flow,id61~ROTSetpt,id62~ROTSpeed,id78~LL1State,id79~LL1Init,id80~LL1Lotid,id81~LL1WafersIn,id82~LL1WfrCnt,id83~LL2State,id84~LL2Init,id85~LL2Lotid,id86~LL2WafersIn,id87~LL2WfrCnt,id93~ProcessState,vp93~ProcessState,vp154~SystemState,vp78~LL1State,vp83~LL2State,vp176~TotalWaferCount,vp80~LL1Lotid,vp85~LL2Lotid,vp153~PPSTEPNAME,vp221~LeftDefaultRecipe,vp222~RightDefaultRecipe,vp223~RecipeCompleteMsg",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/JavaScriptObjectNotation",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/Markdown",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/KeyValuePairs",
|
||||||
|
"654321",
|
||||||
|
"s",
|
||||||
|
"s",
|
||||||
|
"X",
|
||||||
|
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/R55",
|
||||||
|
"Day-Helper-2023-11-30",
|
||||||
|
"yyMMddhhmmssfff",
|
||||||
|
"\"vp154\"",
|
||||||
"s",
|
"s",
|
||||||
"X",
|
"X",
|
||||||
"V:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung",
|
"V:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung",
|
||||||
@ -21,18 +56,6 @@
|
|||||||
"0.259594,0.460161,0.1642,0.279605~0.45477,0.489035,0.195175,0.32383~0.328993,0.446263,0.0379464,0.0459656",
|
"0.259594,0.460161,0.1642,0.279605~0.45477,0.489035,0.195175,0.32383~0.328993,0.446263,0.0379464,0.0459656",
|
||||||
"9",
|
"9",
|
||||||
"x-825511723~x-444522128~831410304",
|
"x-825511723~x-444522128~831410304",
|
||||||
"s",
|
|
||||||
"X",
|
|
||||||
"\\\\mesfs.infineon.com\\EC_APC\\Production\\Traces\\DEP08CEPIEPSILON\\PollPath",
|
|
||||||
"Day-Helper-2025-07-01",
|
|
||||||
"*.pdsf",
|
|
||||||
"654321",
|
|
||||||
"Time",
|
|
||||||
"id12~CenterTemp,id13~CenterSetpt,id15~FrontTemp,id153~PPSTEPNAME,id154~SystemState,id16~FrontSetpt,id172~LVC1Ratio,id173~LVC1Carrier,id176~TotalWaferCount,i-d-1-7-8~TIME,id18~SideTemp,id183~SCRDrive4,id19~SideSetpt,id193~SCRLOAD4,id21~RearTemp,id22~RearSetpt,id221~LeftDefaultRecipe,id222~RightDefaultRecipe,id223~RecipeCompleteMsg,id25~N2H2Setpt,id26~N2H2Flow,id27~HCLSetpt,id28~HCLFlow,id29~HCLHISetpt,id30~HCLHIFlow,id37~NSRCSetpt,id38~NSRCFlow,id39~NDILSetpt,id40~NDILFlow,id41~NINJSetpt,id42~NINJFlow,id57~LVC1Setpt,id58~LVC1Flow,id61~ROTSetpt,id62~ROTSpeed,id78~LL1State,id79~LL1Init,id80~LL1Lotid,id81~LL1WafersIn,id82~LL1WfrCnt,id83~LL2State,id84~LL2Init,id85~LL2Lotid,id86~LL2WafersIn,id87~LL2WfrCnt,id93~ProcessState",
|
|
||||||
"\\\\mesfs.infineon.com\\EC_APC\\Production\\Traces\\DEP08CEPIEPSILON\\Markdown",
|
|
||||||
"\\\\mesfs.infineon.com\\EC_APC\\Production\\Traces\\DEP08CEPIEPSILON\\KeyValuePairs",
|
|
||||||
"\\\\mesfs.infineon.com\\EC_APC\\Production\\Traces\\DEP08CEPIEPSILON\\JavaScriptObjectNotation",
|
|
||||||
"s",
|
|
||||||
"X",
|
"X",
|
||||||
"F:/0-ISO-A",
|
"F:/0-ISO-A",
|
||||||
"Day-Helper-2025-06-28",
|
"Day-Helper-2025-06-28",
|
||||||
|
@ -14,6 +14,11 @@ internal static partial class Helper20250701 {
|
|||||||
internal partial class JsonElementSourceGenerationContext : JsonSerializerContext {
|
internal partial class JsonElementSourceGenerationContext : JsonSerializerContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(ReadOnlyDictionary<string, ReadOnlyDictionary<string, string>>))]
|
||||||
|
internal partial class ReadOnlyDictionaryStringReadOnlyDictionaryStringStringSourceGenerationContext : JsonSerializerContext {
|
||||||
|
}
|
||||||
|
|
||||||
internal static void ProcessDataStandardFormatTo(ILogger<Worker> logger, List<string> args) {
|
internal static void ProcessDataStandardFormatTo(ILogger<Worker> logger, List<string> args) {
|
||||||
logger.LogInformation(args[0]);
|
logger.LogInformation(args[0]);
|
||||||
logger.LogInformation(args[1]);
|
logger.LogInformation(args[1]);
|
||||||
@ -22,24 +27,27 @@ internal static partial class Helper20250701 {
|
|||||||
logger.LogInformation(args[4]);
|
logger.LogInformation(args[4]);
|
||||||
logger.LogInformation(args[5]);
|
logger.LogInformation(args[5]);
|
||||||
logger.LogInformation(args[6]);
|
logger.LogInformation(args[6]);
|
||||||
|
logger.LogInformation(args[7]);
|
||||||
string[] segments;
|
string[] segments;
|
||||||
|
string extension = args[5];
|
||||||
string timeColumn = args[4];
|
string timeColumn = args[4];
|
||||||
string searchPattern = args[2];
|
string searchPattern = args[2];
|
||||||
int sizeFilter = int.Parse(args[3]);
|
int sizeFilter = int.Parse(args[3]);
|
||||||
string[] columns = args[5].Split(',');
|
string[] columns = args[6].Split(',');
|
||||||
Dictionary<string, string> columnMapping = [];
|
Dictionary<string, string> columnMapping = [];
|
||||||
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||||
string destinationDirectory = Path.GetFullPath(args[6].Split('~')[0]);
|
string destinationDirectory = Path.GetFullPath(args[7].Split('~')[0]);
|
||||||
foreach (string column in columns) {
|
foreach (string column in columns) {
|
||||||
segments = column.Split('~');
|
segments = column.Split('~');
|
||||||
columnMapping.Add(segments[0], segments[1]);
|
columnMapping.Add(segments[0], segments[1]);
|
||||||
}
|
}
|
||||||
string[] directories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
string[] directories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
ProcessDataStandardFormatTo(logger, sourceDirectory, searchPattern, sizeFilter, timeColumn, columnMapping, destinationDirectory, directories);
|
ProcessDataStandardFormatTo(logger, sourceDirectory, searchPattern, sizeFilter, timeColumn, extension, columnMapping.AsReadOnly(), destinationDirectory, directories.AsReadOnly());
|
||||||
Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, sourceDirectory);
|
Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, sourceDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessDataStandardFormatTo(ILogger<Worker> logger, string sourceDirectory, string searchPattern, int sizeFilter, string timeColumn, Dictionary<string, string> columnMapping, string destinationDirectory, string[] directories) {
|
private static void ProcessDataStandardFormatTo(ILogger<Worker> logger, string sourceDirectory, string searchPattern, int sizeFilter, string timeColumn, string extension, ReadOnlyDictionary<string, string> columnMapping, string destinationDirectory, ReadOnlyCollection<string> directories) {
|
||||||
|
string text;
|
||||||
string? json;
|
string? json;
|
||||||
string[] files;
|
string[] files;
|
||||||
string markdown;
|
string markdown;
|
||||||
@ -51,7 +59,7 @@ internal static partial class Helper20250701 {
|
|||||||
string directoryName;
|
string directoryName;
|
||||||
string checkDirectory;
|
string checkDirectory;
|
||||||
foreach (string directory in directories) {
|
foreach (string directory in directories) {
|
||||||
if (Path.GetFileName(directory).Contains('-')) {
|
if (sizeFilter < 987654321 && Path.GetFileName(directory).Contains('-')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
|
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
@ -77,41 +85,49 @@ internal static partial class Helper20250701 {
|
|||||||
if (!Directory.Exists(checkDirectory)) {
|
if (!Directory.Exists(checkDirectory)) {
|
||||||
_ = Directory.CreateDirectory(checkDirectory);
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
}
|
}
|
||||||
checkFile = Path.Combine(checkDirectory, $"{fileInfo.Name}.md");
|
checkFile = Path.Combine(checkDirectory, $"{fileInfo.Name}{extension}");
|
||||||
if (File.Exists(checkFile)) {
|
if (File.Exists(checkFile)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
collections = GetMarkdown(logger, timeColumn, columnMapping, file, fileInfo.Name);
|
if (extension == ".md") {
|
||||||
if (string.IsNullOrEmpty(collections)) {
|
collections = GetMarkdown(logger, timeColumn, columnMapping, file, fileInfo.Name);
|
||||||
logger.LogWarning("collections is null");
|
if (string.IsNullOrEmpty(collections)) {
|
||||||
|
logger.LogWarning("collections is null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
text = collections;
|
||||||
|
} else if (extension == ".pipe.md") {
|
||||||
|
json = GetJavaScriptObjectNotation(logger, file);
|
||||||
|
if (string.IsNullOrEmpty(json)) {
|
||||||
|
logger.LogWarning("json is null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pipeTable = GetPipeTable(logger, json);
|
||||||
|
if (string.IsNullOrEmpty(pipeTable)) {
|
||||||
|
logger.LogWarning("pipeTable is null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
markdown = $"# {fileInfo.Name}{Environment.NewLine}{Environment.NewLine}{pipeTable}{Environment.NewLine}";
|
||||||
|
text = markdown;
|
||||||
|
} else if (extension == ".json") {
|
||||||
|
json = GetJavaScriptObjectNotation(logger, file);
|
||||||
|
if (string.IsNullOrEmpty(json)) {
|
||||||
|
logger.LogWarning("json is null");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
text = json;
|
||||||
|
} else {
|
||||||
|
logger.LogWarning("{extension} is not mapped!", extension);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
File.WriteAllText(checkFile, collections);
|
File.WriteAllText(checkFile, text);
|
||||||
File.SetLastWriteTime(checkFile, fileInfo.LastAccessTime);
|
File.SetLastWriteTime(checkFile, fileInfo.LastWriteTime);
|
||||||
if (!string.IsNullOrEmpty(destinationDirectory)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
json = GetJavaScriptObjectNotation(logger, file);
|
|
||||||
if (string.IsNullOrEmpty(json)) {
|
|
||||||
logger.LogWarning("json is null");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
File.WriteAllText($"{checkFile}.md", json);
|
|
||||||
File.SetLastWriteTime($"{checkFile}.md", fileInfo.LastAccessTime);
|
|
||||||
pipeTable = GetPipeTable(logger, json);
|
|
||||||
if (string.IsNullOrEmpty(pipeTable)) {
|
|
||||||
logger.LogWarning("pipeTable is null");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
markdown = $"# {fileInfo.Name}{Environment.NewLine}{Environment.NewLine}{pipeTable}{Environment.NewLine}";
|
|
||||||
File.WriteAllText($"{checkFile}.md", markdown);
|
|
||||||
File.SetLastWriteTime($"{checkFile}.md", fileInfo.LastAccessTime);
|
|
||||||
logger.LogInformation("<{checkFile}> was written", checkFile);
|
logger.LogInformation("<{checkFile}> was written", checkFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? GetMarkdown(ILogger<Worker> logger, string timeColumn, Dictionary<string, string> columnMapping, string file, string name) {
|
private static string? GetMarkdown(ILogger<Worker> logger, string timeColumn, ReadOnlyDictionary<string, string> columnMapping, string file, string name) {
|
||||||
string? result = null;
|
string? result = null;
|
||||||
string[] lines = File.ReadAllLines(file);
|
string[] lines = File.ReadAllLines(file);
|
||||||
int? columnTitlesLine = GetProcessDataStandardFormatColumnTitlesLine(lines);
|
int? columnTitlesLine = GetProcessDataStandardFormatColumnTitlesLine(lines);
|
||||||
@ -173,7 +189,7 @@ internal static partial class Helper20250701 {
|
|||||||
return results.AsReadOnly();
|
return results.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string? GetMarkdown(string timeColumn, Dictionary<string, string> columnMapping, string name, string[] lines, int? columnTitlesLine) {
|
private static string? GetMarkdown(string timeColumn, ReadOnlyDictionary<string, string> columnMapping, string name, string[] lines, int? columnTitlesLine) {
|
||||||
string? result;
|
string? result;
|
||||||
List<string> charts = [];
|
List<string> charts = [];
|
||||||
List<string> results = [];
|
List<string> results = [];
|
||||||
@ -239,42 +255,139 @@ internal static partial class Helper20250701 {
|
|||||||
if (lines.Length < columnTitlesLine.Value + 1) {
|
if (lines.Length < columnTitlesLine.Value + 1) {
|
||||||
logger.LogWarning("<{lines}>(s)", lines.Length);
|
logger.LogWarning("<{lines}>(s)", lines.Length);
|
||||||
} else {
|
} else {
|
||||||
result = GetJavaScriptObjectNotation(columnTitlesLine.Value, [], lines);
|
result = GetJavaScriptObjectNotation(columnTitlesLine.Value, lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetJavaScriptObjectNotation(int columnTitlesLine, string[] columns, string[] lines) {
|
private static string GetJavaScriptObjectNotation(int columnTitlesLine, string[] lines) {
|
||||||
#pragma warning disable CA1845, IDE0057
|
#pragma warning disable CA1845, IDE0057
|
||||||
string result = "[\n";
|
string result;
|
||||||
string line;
|
string record;
|
||||||
string value;
|
string value;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
if (columns.Length == 0) {
|
string? json = null;
|
||||||
columns = lines[columnTitlesLine].Split('\t');
|
List<string> records = [];
|
||||||
}
|
ReadOnlyCollection<string>? footerLines = null;
|
||||||
|
string[] columns = lines[columnTitlesLine].Split('\t');
|
||||||
for (int i = columnTitlesLine + 1; i < lines.Length; i++) {
|
for (int i = columnTitlesLine + 1; i < lines.Length; i++) {
|
||||||
if (lines[i].StartsWith("NUM_DATA_ROWS")) {
|
if (lines[i].StartsWith("NUM_DATA_ROWS")) {
|
||||||
|
footerLines = GetFooterLines(lines, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
line = "{";
|
record = "{";
|
||||||
segments = lines[i].Split('\t');
|
segments = lines[i].Split('\t');
|
||||||
if (segments.Length > columns.Length) {
|
if (segments.Length > columns.Length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int c = 0; c < segments.Length; c++) {
|
for (int c = 0; c < segments.Length; c++) {
|
||||||
value = segments[c].Replace("\\", "\\\\").Replace("\"", "\\\"");
|
value = segments[c].Replace("\\", "\\\\").Replace("\"", "\\\"");
|
||||||
line += '"' + columns[c].Trim('"') + '"' + ':' + '"' + value + '"' + ',';
|
record += string.Concat('"', columns[c].Trim('"'), '"', ':', '"', value, '"', ',');
|
||||||
}
|
}
|
||||||
line = line.Substring(0, line.Length - 1) + '}' + ',' + '\n';
|
record = string.Concat(record.Substring(0, record.Length - 1), '}');
|
||||||
result += line;
|
records.Add(record);
|
||||||
}
|
}
|
||||||
result = result.Substring(0, result.Length - 2) + ']';
|
if (footerLines is not null && footerLines.Count > 0) {
|
||||||
|
ReadOnlyDictionary<string, string> footerKeyValuePairs = GetFooterKeyValuePairs(footerLines);
|
||||||
|
ReadOnlyDictionary<string, ReadOnlyDictionary<string, string>> logisticKeyValuePairs = GetLogisticKeyValuePairs(footerLines, footerKeyValuePairs);
|
||||||
|
json = JsonSerializer.Serialize(logisticKeyValuePairs, ReadOnlyDictionaryStringReadOnlyDictionaryStringStringSourceGenerationContext.Default.ReadOnlyDictionaryStringReadOnlyDictionaryStringString);
|
||||||
|
}
|
||||||
|
string footerText = string.IsNullOrEmpty(json) || json == "{}" ? string.Empty : $",{Environment.NewLine}\"ProcessDataStandardFormat\":{Environment.NewLine}{json}";
|
||||||
|
result = string.Concat(
|
||||||
|
'{',
|
||||||
|
Environment.NewLine,
|
||||||
|
'"',
|
||||||
|
"Count",
|
||||||
|
'"',
|
||||||
|
": ",
|
||||||
|
records.Count,
|
||||||
|
',',
|
||||||
|
Environment.NewLine,
|
||||||
|
'"',
|
||||||
|
"Records",
|
||||||
|
'"',
|
||||||
|
": ",
|
||||||
|
Environment.NewLine,
|
||||||
|
'[',
|
||||||
|
Environment.NewLine,
|
||||||
|
string.Join($",{Environment.NewLine}", records),
|
||||||
|
Environment.NewLine,
|
||||||
|
']',
|
||||||
|
footerText,
|
||||||
|
'}');
|
||||||
return result;
|
return result;
|
||||||
#pragma warning restore CA1845, IDE0057
|
#pragma warning restore CA1845, IDE0057
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<string> GetFooterLines(string[] lines, int i) {
|
||||||
|
List<string> results = [];
|
||||||
|
for (int j = i; j < lines.Length; j++) {
|
||||||
|
results.Add(lines[j]);
|
||||||
|
if (lines[j].StartsWith("END_HEADER"))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return results.AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyDictionary<string, string> GetFooterKeyValuePairs(ReadOnlyCollection<string> footerLines) {
|
||||||
|
Dictionary<string, string> results = [];
|
||||||
|
string[] segments;
|
||||||
|
foreach (string footerLine in footerLines) {
|
||||||
|
segments = footerLine.Split('\t');
|
||||||
|
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (segments[1].Contains(';')) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
results.Add(segments[0], segments[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results.AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyDictionary<string, ReadOnlyDictionary<string, string>> GetLogisticKeyValuePairs(ReadOnlyCollection<string> footerLines, ReadOnlyDictionary<string, string> footerKeyValuePairs) {
|
||||||
|
Dictionary<string, ReadOnlyDictionary<string, string>> results = [];
|
||||||
|
string[] segments;
|
||||||
|
string[] subSegments;
|
||||||
|
string[] subSubSegments;
|
||||||
|
Dictionary<string, string>? keyValue;
|
||||||
|
results.Add("Footer", footerKeyValuePairs);
|
||||||
|
Dictionary<string, Dictionary<string, string>> keyValuePairs = [];
|
||||||
|
foreach (string footerLine in footerLines) {
|
||||||
|
segments = footerLine.Split('\t');
|
||||||
|
if (segments.Length != 2 || string.IsNullOrEmpty(segments[1].Trim())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!segments[1].Contains(';') || !segments[1].Contains('=')) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
subSegments = segments[1].Split(';');
|
||||||
|
if (subSegments.Length < 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!keyValuePairs.TryGetValue(segments[0], out keyValue)) {
|
||||||
|
keyValuePairs.Add(segments[0], []);
|
||||||
|
if (!keyValuePairs.TryGetValue(segments[0], out keyValue)) {
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (string segment in subSegments) {
|
||||||
|
subSubSegments = segment.Split('=');
|
||||||
|
if (subSubSegments.Length != 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
keyValue.Add(subSubSegments[0], subSubSegments[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (KeyValuePair<string, Dictionary<string, string>> keyValuePair in keyValuePairs) {
|
||||||
|
results.Add(keyValuePair.Key, keyValuePair.Value.AsReadOnly());
|
||||||
|
}
|
||||||
|
return results.AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
private static string? GetPipeTable(ILogger<Worker> logger, string json) {
|
private static string? GetPipeTable(ILogger<Worker> logger, string json) {
|
||||||
string? result = null;
|
string? result = null;
|
||||||
string? value;
|
string? value;
|
||||||
@ -310,4 +423,5 @@ internal static partial class Helper20250701 {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
234
ADO2025/PI6/Helper-2025-07-09.cs
Normal file
234
ADO2025/PI6/Helper-2025-07-09.cs
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace File_Folder_Helper.ADO2025.PI6;
|
||||||
|
|
||||||
|
internal static partial class Helper20250709 {
|
||||||
|
|
||||||
|
// [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
// [JsonSerializable(typeof(JsonElement[]))]
|
||||||
|
// internal partial class Helper20250709JsonElementSourceGenerationContext : JsonSerializerContext {
|
||||||
|
// }
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
[JsonSerializable(typeof(Raw))]
|
||||||
|
private partial class RawSourceGenerationContext : JsonSerializerContext {
|
||||||
|
}
|
||||||
|
|
||||||
|
private record Raw(int Count, JsonElement[] Records);
|
||||||
|
|
||||||
|
// cspell::disable
|
||||||
|
private record Reactor([property: JsonPropertyName("id12")] double? Id12,
|
||||||
|
[property: JsonPropertyName("id13")] double? Id13,
|
||||||
|
[property: JsonPropertyName("id15")] double? Id15,
|
||||||
|
[property: JsonPropertyName("id153")] string? Id153,
|
||||||
|
[property: JsonPropertyName("id154")] long? Id154,
|
||||||
|
[property: JsonPropertyName("id16")] double? Id16,
|
||||||
|
[property: JsonPropertyName("id172")] double? Id172,
|
||||||
|
[property: JsonPropertyName("id173")] double? Id173,
|
||||||
|
[property: JsonPropertyName("id176")] double? Id176,
|
||||||
|
[property: JsonPropertyName("id178")] string? Id178,
|
||||||
|
[property: JsonPropertyName("id18")] double? Id18,
|
||||||
|
[property: JsonPropertyName("id183")] double? Id183,
|
||||||
|
[property: JsonPropertyName("id19")] double? Id19,
|
||||||
|
[property: JsonPropertyName("id193")] double? Id193,
|
||||||
|
[property: JsonPropertyName("id21")] double? Id21,
|
||||||
|
[property: JsonPropertyName("id22")] double? Id22,
|
||||||
|
[property: JsonPropertyName("id221")] string? Id221,
|
||||||
|
[property: JsonPropertyName("id222")] string? Id222,
|
||||||
|
[property: JsonPropertyName("id223")] string? Id223,
|
||||||
|
[property: JsonPropertyName("id25")] double? Id25,
|
||||||
|
[property: JsonPropertyName("id26")] double? Id26,
|
||||||
|
[property: JsonPropertyName("id27")] double? Id27,
|
||||||
|
[property: JsonPropertyName("id28")] double? Id28,
|
||||||
|
[property: JsonPropertyName("id29")] double? Id29,
|
||||||
|
[property: JsonPropertyName("id30")] double? Id30,
|
||||||
|
[property: JsonPropertyName("id37")] double? Id37,
|
||||||
|
[property: JsonPropertyName("id38")] double? Id38,
|
||||||
|
[property: JsonPropertyName("id39")] double? Id39,
|
||||||
|
[property: JsonPropertyName("id40")] double? Id40,
|
||||||
|
[property: JsonPropertyName("id41")] double? Id41,
|
||||||
|
[property: JsonPropertyName("id42")] double? Id42,
|
||||||
|
[property: JsonPropertyName("id57")] double? Id57,
|
||||||
|
[property: JsonPropertyName("id58")] double? Id58,
|
||||||
|
[property: JsonPropertyName("id61")] double? Id61,
|
||||||
|
[property: JsonPropertyName("id62")] double? Id62,
|
||||||
|
[property: JsonPropertyName("id78")] long? Id78,
|
||||||
|
[property: JsonPropertyName("id79")] long? Id79,
|
||||||
|
[property: JsonPropertyName("id80")] string? Id80,
|
||||||
|
[property: JsonPropertyName("id81")] long? Id81,
|
||||||
|
[property: JsonPropertyName("id82")] long? Id82,
|
||||||
|
[property: JsonPropertyName("id83")] long? Id83,
|
||||||
|
[property: JsonPropertyName("id84")] long? Id84,
|
||||||
|
[property: JsonPropertyName("id85")] string? Id85,
|
||||||
|
[property: JsonPropertyName("id86")] long? Id86,
|
||||||
|
[property: JsonPropertyName("id87")] long? Id87,
|
||||||
|
[property: JsonPropertyName("id93")] long? Id93,
|
||||||
|
[property: JsonPropertyName("vp93")] long? Vp93,
|
||||||
|
[property: JsonPropertyName("vp154")] long? Vp154,
|
||||||
|
[property: JsonPropertyName("vp78")] long? Vp78,
|
||||||
|
[property: JsonPropertyName("vp83")] long? Vp83,
|
||||||
|
[property: JsonPropertyName("vp176")] double? Vp176,
|
||||||
|
[property: JsonPropertyName("vp80")] string? Vp80,
|
||||||
|
[property: JsonPropertyName("vp85")] string? Vp85,
|
||||||
|
[property: JsonPropertyName("vp153")] string? Vp153,
|
||||||
|
[property: JsonPropertyName("vp221")] string? Vp221,
|
||||||
|
[property: JsonPropertyName("vp222")] string? Vp222,
|
||||||
|
[property: JsonPropertyName("vp223")] string? Vp223,
|
||||||
|
[property: JsonPropertyName("YYYYMMDDhhmmsscc")] string? YYYYMMDDhhmmsscc,
|
||||||
|
[property: JsonPropertyName("CenterTemp")] double? CenterTemp,
|
||||||
|
[property: JsonPropertyName("CenterSetpt")] double? CenterSetpt,
|
||||||
|
[property: JsonPropertyName("FrontTemp")] double? FrontTemp,
|
||||||
|
[property: JsonPropertyName("PPSTEPNAME")] string? PPSTEPNAME,
|
||||||
|
[property: JsonPropertyName("SystemState")] long? SystemState,
|
||||||
|
[property: JsonPropertyName("FrontSetpt")] double? FrontSetpt,
|
||||||
|
[property: JsonPropertyName("LVC1Ratio")] double? LVC1Ratio,
|
||||||
|
[property: JsonPropertyName("LVC1Carrier")] double? LVC1Carrier,
|
||||||
|
[property: JsonPropertyName("TotalWaferCount")] double? TotalWaferCount,
|
||||||
|
[property: JsonPropertyName("TIME")] string? TIME,
|
||||||
|
[property: JsonPropertyName("SideTemp")] double? SideTemp,
|
||||||
|
[property: JsonPropertyName("SCRDrive4")] double? SCRDrive4,
|
||||||
|
[property: JsonPropertyName("SideSetpt")] double? SideSetpt,
|
||||||
|
[property: JsonPropertyName("SCRLOAD4")] double? SCRLOAD4,
|
||||||
|
[property: JsonPropertyName("RearTemp")] double? RearTemp,
|
||||||
|
[property: JsonPropertyName("RearSetpt")] double? RearSetpt,
|
||||||
|
[property: JsonPropertyName("LeftDefaultRecipe")] string? LeftDefaultRecipe,
|
||||||
|
[property: JsonPropertyName("RightDefaultRecipe")] string? RightDefaultRecipe,
|
||||||
|
[property: JsonPropertyName("RecipeCompleteMsg")] string? RecipeCompleteMsg,
|
||||||
|
[property: JsonPropertyName("N2H2Setpt")] double? N2H2Setpt,
|
||||||
|
[property: JsonPropertyName("N2H2Flow")] double? N2H2Flow,
|
||||||
|
[property: JsonPropertyName("HCLSetpt")] double? HCLSetpt,
|
||||||
|
[property: JsonPropertyName("HCLFlow")] double? HCLFlow,
|
||||||
|
[property: JsonPropertyName("HCLHISetpt")] double? HCLHISetpt,
|
||||||
|
[property: JsonPropertyName("HCLHIFlow")] double? HCLHIFlow,
|
||||||
|
[property: JsonPropertyName("NSRCSetpt")] double? NSRCSetpt,
|
||||||
|
[property: JsonPropertyName("NSRCFlow")] double? NSRCFlow,
|
||||||
|
[property: JsonPropertyName("NDILSetpt")] double? NDILSetpt,
|
||||||
|
[property: JsonPropertyName("NDILFlow")] double? NDILFlow,
|
||||||
|
[property: JsonPropertyName("NINJSetpt")] double? NINJSetpt,
|
||||||
|
[property: JsonPropertyName("NINJFlow")] double? NINJFlow,
|
||||||
|
[property: JsonPropertyName("LVC1Setpt")] double? LVC1Setpt,
|
||||||
|
[property: JsonPropertyName("LVC1Flow")] double? LVC1Flow,
|
||||||
|
[property: JsonPropertyName("ROTSetpt")] double? ROTSetpt,
|
||||||
|
[property: JsonPropertyName("ROTSpeed")] double? ROTSpeed,
|
||||||
|
[property: JsonPropertyName("LL1State")] long? LL1State,
|
||||||
|
[property: JsonPropertyName("LL1Init")] long? LL1Init,
|
||||||
|
[property: JsonPropertyName("LL1Lotid")] string? LL1Lotid,
|
||||||
|
[property: JsonPropertyName("LL1WafersIn")] long? LL1WafersIn,
|
||||||
|
[property: JsonPropertyName("LL1WfrCnt")] long? LL1WfrCnt,
|
||||||
|
[property: JsonPropertyName("LL2State")] long? LL2State,
|
||||||
|
[property: JsonPropertyName("LL2Init")] long? LL2Init,
|
||||||
|
[property: JsonPropertyName("LL2Lotid")] string? LL2Lotid,
|
||||||
|
[property: JsonPropertyName("LL2WafersIn")] long? LL2WafersIn,
|
||||||
|
[property: JsonPropertyName("LL2WfrCnt")] long? LL2WfrCnt,
|
||||||
|
[property: JsonPropertyName("ProcessState")] long? ProcessState);
|
||||||
|
// [property: JsonPropertyName("A_BASIC_TYPE")] string? ABasicType,
|
||||||
|
// [property: JsonPropertyName("A_INFO")] string? AInfo,
|
||||||
|
// [property: JsonPropertyName("A_INFO2")] string? AInfo2,
|
||||||
|
// [property: JsonPropertyName("A_JOBID")] string? AJobid,
|
||||||
|
// [property: JsonPropertyName("A_LAYER")] string? ALayer,
|
||||||
|
// [property: JsonPropertyName("A_LAYER2")] string? ALayer2,
|
||||||
|
// [property: JsonPropertyName("A_MES_ENTITY")] string? AMesEntity,
|
||||||
|
// [property: JsonPropertyName("A_MID")] string? AMID,
|
||||||
|
// [property: JsonPropertyName("A_NULL_DATA")] string? ANullData,
|
||||||
|
// [property: JsonPropertyName("A_PPID")] string? APPID,
|
||||||
|
// [property: JsonPropertyName("A_PROCESS_JOBID")] string? AProcessJobid,
|
||||||
|
// [property: JsonPropertyName("A_PRODUCT")] string? AProduct,
|
||||||
|
// [property: JsonPropertyName("A_SEQUENCE")] string? ASequence,
|
||||||
|
// [property: JsonPropertyName("A_WAFER_ID")] string? AWaferId,
|
||||||
|
// [property: JsonPropertyName("A_WAFER_POS")] string? AWaferPos
|
||||||
|
// cspell::enable,
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||||
|
[JsonSerializable(typeof(Reactor))]
|
||||||
|
private partial class ReactorSourceGenerationContext : JsonSerializerContext {
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void JavaScriptObjectNotationToReactor(ILogger<Worker> logger, List<string> args) {
|
||||||
|
logger.LogInformation(args[0]);
|
||||||
|
logger.LogInformation(args[1]);
|
||||||
|
logger.LogInformation(args[2]);
|
||||||
|
logger.LogInformation(args[3]);
|
||||||
|
logger.LogInformation(args[4]);
|
||||||
|
logger.LogInformation(args[5]);
|
||||||
|
string[] segments;
|
||||||
|
string extension = args[4];
|
||||||
|
string searchPattern = args[2];
|
||||||
|
int sizeFilter = int.Parse(args[3]);
|
||||||
|
string[] columns = args[5].Split(',');
|
||||||
|
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||||
|
string destinationDirectory = Path.GetFullPath(args[6].Split('~')[0]);
|
||||||
|
string[] directories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
JavaScriptObjectNotationTo(logger, sourceDirectory, searchPattern, sizeFilter, extension, columns.AsReadOnly(), destinationDirectory, directories.AsReadOnly());
|
||||||
|
Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, sourceDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void JavaScriptObjectNotationTo(ILogger<Worker> logger, string sourceDirectory, string searchPattern, int sizeFilter, string extension, ReadOnlyCollection<string> columnMapping, string destinationDirectory, ReadOnlyCollection<string> directories) {
|
||||||
|
Raw? raw;
|
||||||
|
string text;
|
||||||
|
string json;
|
||||||
|
string[] files;
|
||||||
|
string checkFile;
|
||||||
|
Reactor? reactor;
|
||||||
|
FileInfo fileInfo;
|
||||||
|
string directoryName;
|
||||||
|
string checkDirectory;
|
||||||
|
foreach (string directory in directories) {
|
||||||
|
if (sizeFilter < 987654321 && Path.GetFileName(directory).Contains('-')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string file in files) {
|
||||||
|
fileInfo = new(file);
|
||||||
|
if (fileInfo.LastWriteTime > DateTime.Now.AddSeconds(-5)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
directoryName = Path.GetFileName(fileInfo.DirectoryName);
|
||||||
|
if (fileInfo.Length > sizeFilter && !directoryName.StartsWith('Z')) {
|
||||||
|
checkDirectory = Path.Combine(sourceDirectory, $"Z{directoryName}");
|
||||||
|
if (!Directory.Exists(checkDirectory)) {
|
||||||
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
|
}
|
||||||
|
checkFile = Path.Combine(checkDirectory, fileInfo.Name);
|
||||||
|
if (File.Exists(checkFile)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
File.Move(file, checkFile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
checkDirectory = Path.Combine(destinationDirectory, directoryName);
|
||||||
|
if (!Directory.Exists(checkDirectory)) {
|
||||||
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
|
}
|
||||||
|
checkFile = Path.Combine(checkDirectory, $"{fileInfo.Name}{extension}");
|
||||||
|
if (File.Exists(checkFile)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (extension == ".agg") {
|
||||||
|
json = File.ReadAllText(fileInfo.FullName);
|
||||||
|
raw = JsonSerializer.Deserialize(json, RawSourceGenerationContext.Default.Raw);
|
||||||
|
if (raw is null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (JsonElement jsonElement in raw.Records) {
|
||||||
|
try {
|
||||||
|
reactor = JsonSerializer.Deserialize(jsonElement.ToString().Replace("\"\"", "null"), ReactorSourceGenerationContext.Default.Reactor);
|
||||||
|
} catch (Exception) {
|
||||||
|
reactor = null;
|
||||||
|
}
|
||||||
|
if (reactor is null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (reactor is null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
98
ADO2025/PI6/Helper-2025-07-10.cs
Normal file
98
ADO2025/PI6/Helper-2025-07-10.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace File_Folder_Helper.ADO2025.PI6;
|
||||||
|
|
||||||
|
internal static partial class Helper20250710 {
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^(?<stream>S[0-9]{1,2})(?<function>F[0-9]{1,2}) W-Bit=(?<wait>[01])")]
|
||||||
|
private static partial Regex StreamFunction();
|
||||||
|
|
||||||
|
internal static void StripLog(ILogger<Worker> logger, List<string> args) {
|
||||||
|
logger.LogInformation(args[0]);
|
||||||
|
logger.LogInformation(args[1]);
|
||||||
|
logger.LogInformation(args[2]);
|
||||||
|
logger.LogInformation(args[3]);
|
||||||
|
string[] segments;
|
||||||
|
string searchPattern = args[3];
|
||||||
|
string directoryPattern = args[2];
|
||||||
|
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||||
|
string[] directories = Directory.GetDirectories(sourceDirectory, directoryPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
LogToTrace(logger, sourceDirectory, searchPattern, directories.AsReadOnly());
|
||||||
|
Helpers.HelperDeleteEmptyDirectories.DeleteEmptyDirectories(logger, sourceDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LogToTrace(ILogger<Worker> logger, string sourceDirectory, string searchPattern, ReadOnlyCollection<string> directories) {
|
||||||
|
string text;
|
||||||
|
string[] lines;
|
||||||
|
string[] files;
|
||||||
|
string checkFile;
|
||||||
|
FileInfo fileInfo;
|
||||||
|
string directoryName;
|
||||||
|
const string extension = ".trc";
|
||||||
|
foreach (string directory in directories) {
|
||||||
|
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string file in files) {
|
||||||
|
fileInfo = new(file);
|
||||||
|
if (fileInfo.LastWriteTime > DateTime.Now.AddSeconds(-5)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
directoryName = Path.GetFileName(fileInfo.DirectoryName);
|
||||||
|
checkFile = Path.Combine(directoryName, $"{fileInfo.Name}{extension}");
|
||||||
|
if (File.Exists(checkFile)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines = File.ReadAllLines(fileInfo.FullName);
|
||||||
|
LogToTrace(logger, fileInfo, lines, checkFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LogToTrace(ILogger<Worker> logger, FileInfo fileInfo, string[] lines, string checkFile) {
|
||||||
|
string line;
|
||||||
|
Match match;
|
||||||
|
string body;
|
||||||
|
string[] segments;
|
||||||
|
string previousLine;
|
||||||
|
List<string> log = [];
|
||||||
|
for (int i = 1; i < lines.Length - 1; i++) {
|
||||||
|
line = lines[i];
|
||||||
|
if (!line.StartsWith('S')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match = StreamFunction().Match(line);
|
||||||
|
if (!match.Success) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
segments = lines[i - 1].Split(" ");
|
||||||
|
if (segments.Length < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!segments[0].Contains(' ')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
body = GetBody(lines, i, segments[0].Split(' '));
|
||||||
|
log.Add($"{segments[0]} {line} ~ {body}");
|
||||||
|
}
|
||||||
|
if (log.Count > 0) {
|
||||||
|
File.WriteAllText(checkFile, string.Join(Environment.NewLine, log));
|
||||||
|
File.SetLastWriteTime(checkFile, fileInfo.LastWriteTime);
|
||||||
|
logger.LogInformation("<{checkFile}> was written", checkFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetBody(string[] lines, int i, string[] segments) {
|
||||||
|
string result;
|
||||||
|
List<string> results = [];
|
||||||
|
for (int j = i + 1; j < lines.Length; j++) {
|
||||||
|
if (lines[j].StartsWith(segments[0]))
|
||||||
|
break;
|
||||||
|
results.Add(lines[j].Trim());
|
||||||
|
}
|
||||||
|
result = string.Join('_', results);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -177,6 +177,10 @@ internal static class HelperDay
|
|||||||
ADO2025.PI6.Helper20250701.ProcessDataStandardFormatTo(logger, args);
|
ADO2025.PI6.Helper20250701.ProcessDataStandardFormatTo(logger, args);
|
||||||
else if (args[1] == "Day-Helper-2025-07-05")
|
else if (args[1] == "Day-Helper-2025-07-05")
|
||||||
ADO2025.PI6.Helper20250705.ExportFaces(logger, args);
|
ADO2025.PI6.Helper20250705.ExportFaces(logger, args);
|
||||||
|
else if (args[1] == "Day-Helper-2025-07-09")
|
||||||
|
ADO2025.PI6.Helper20250709.JavaScriptObjectNotationToReactor(logger, args);
|
||||||
|
else if (args[1] == "Day-Helper-2025-07-10")
|
||||||
|
ADO2025.PI6.Helper20250710.StripLog(logger, args);
|
||||||
else
|
else
|
||||||
throw new Exception(appSettings.Company);
|
throw new Exception(appSettings.Company);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ internal static class Helper20231130
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex, ReadOnlyDictionary<string, string> systemStates)
|
private static ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex, ReadOnlyDictionary<string, string> systemStateToNames)
|
||||||
{
|
{
|
||||||
List<string> results = [];
|
List<string> results = [];
|
||||||
string[] values;
|
string[] values;
|
||||||
@ -79,7 +79,7 @@ internal static class Helper20231130
|
|||||||
keyColumnValue = values[keyColumnIndex];
|
keyColumnValue = values[keyColumnIndex];
|
||||||
if (string.IsNullOrEmpty(keyColumnValue))
|
if (string.IsNullOrEmpty(keyColumnValue))
|
||||||
continue;
|
continue;
|
||||||
if (!systemStates.TryGetValue(keyColumnValue, out systemState))
|
if (!systemStateToNames.TryGetValue(keyColumnValue, out systemState))
|
||||||
continue;
|
continue;
|
||||||
if (results.Contains(systemState))
|
if (results.Contains(systemState))
|
||||||
continue;
|
continue;
|
||||||
@ -106,7 +106,7 @@ internal static class Helper20231130
|
|||||||
string missingKeyDirectory = Path.Combine(sourceDirectory, "Missing-Key");
|
string missingKeyDirectory = Path.Combine(sourceDirectory, "Missing-Key");
|
||||||
if (!Directory.Exists(missingKeyDirectory))
|
if (!Directory.Exists(missingKeyDirectory))
|
||||||
_ = Directory.CreateDirectory(missingKeyDirectory);
|
_ = Directory.CreateDirectory(missingKeyDirectory);
|
||||||
ReadOnlyDictionary<string, string> systemStates = GetSystemStates();
|
ReadOnlyDictionary<string, string> systemStateToNames = GetSystemStates();
|
||||||
ReadOnlyCollection<Record> records = GetRecords(sourceDirectory, timestampFormat);
|
ReadOnlyCollection<Record> records = GetRecords(sourceDirectory, timestampFormat);
|
||||||
foreach (Record record in records)
|
foreach (Record record in records)
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ internal static class Helper20231130
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
logger.LogInformation("{timestamp} triggered", record.TimeStamp);
|
logger.LogInformation("{timestamp} triggered", record.TimeStamp);
|
||||||
systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value, systemStates);
|
systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value, systemStateToNames);
|
||||||
if (systemStateValues.Count == 0)
|
if (systemStateValues.Count == 0)
|
||||||
{
|
{
|
||||||
File.Move(record.File, Path.Combine(sourceDirectory, missingKeyDirectory, record.FileName));
|
File.Move(record.File, Path.Combine(sourceDirectory, missingKeyDirectory, record.FileName));
|
||||||
@ -142,7 +142,6 @@ internal static class Helper20231130
|
|||||||
systemState = string.Join('-', systemStateValues);
|
systemState = string.Join('-', systemStateValues);
|
||||||
checkFileName = Path.Combine(Path.GetDirectoryName(record.File) ?? throw new Exception(), $"{record.Equipment}-{record.TimeStamp}-{systemState}.pdsf");
|
checkFileName = Path.Combine(Path.GetDirectoryName(record.File) ?? throw new Exception(), $"{record.Equipment}-{record.TimeStamp}-{systemState}.pdsf");
|
||||||
File.WriteAllLines(checkFileName, lines);
|
File.WriteAllLines(checkFileName, lines);
|
||||||
File.Delete(record.File);
|
|
||||||
if (DateTime.TryParseExact(record.TimeStamp, timestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
if (DateTime.TryParseExact(record.TimeStamp, timestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||||
File.SetLastWriteTime(checkFileName, dateTime);
|
File.SetLastWriteTime(checkFileName, dateTime);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user