load-lock-side from reactor and open-insight api

This commit is contained in:
2025-08-25 09:31:01 -07:00
parent 43024c6c30
commit 19b54a7cc8
6 changed files with 55 additions and 37 deletions

View File

@ -313,8 +313,13 @@ public class FileRead : Shared.FileRead, IFileRead
continue; continue;
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults)) if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
wsResults = null; wsResults = null;
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults); if (processDataStandardFormat.InputPDSF is null)
File.Delete(preWith.MatchingFile); File.Move(preWith.MatchingFile, preWith.CheckFile);
else
{
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
}
if (Directory.Exists(preWith.NoWaitDirectory)) if (Directory.Exists(preWith.NoWaitDirectory))
{ {
post = new(preWith.CheckFile, preWith.ErrFile); post = new(preWith.CheckFile, preWith.ErrFile);

View File

@ -7,15 +7,17 @@ public class Input
public string? Area { get; } public string? Area { get; }
public string? EquipmentType { get; } public string? EquipmentType { get; }
public string? MID { get; } public string? LoadLock { get; }
public string? Slot { get; }
public string? MesEntity { get; } public string? MesEntity { get; }
public string? MID { get; }
public string? Recipe { get; } public string? Recipe { get; }
public string? Sequence { get; } public string? Sequence { get; }
public string? Slot { get; }
[System.Text.Json.Serialization.JsonConstructor] [System.Text.Json.Serialization.JsonConstructor]
public Input(string? area, public Input(string? area,
string? equipmentType, string? equipmentType,
string? loadLock,
string? mid, string? mid,
string? slot, string? slot,
string? mesEntity, string? mesEntity,
@ -25,6 +27,7 @@ public class Input
Area = area; Area = area;
EquipmentType = equipmentType; EquipmentType = equipmentType;
LoadLock = loadLock;
MID = mid; MID = mid;
Slot = slot; Slot = slot;
MesEntity = mesEntity; MesEntity = mesEntity;
@ -36,6 +39,7 @@ public class Input
{ {
Area = input.Area; Area = input.Area;
EquipmentType = input.EquipmentType; EquipmentType = input.EquipmentType;
LoadLock = input.LoadLock;
MID = mid; MID = mid;
Slot = input.Slot; Slot = input.Slot;
MesEntity = input.MesEntity; MesEntity = input.MesEntity;

View File

@ -433,8 +433,10 @@ public partial class Job
string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID; string mid = string.IsNullOrEmpty(input.MID) ? string.Empty : input.MID;
JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true }; JsonSerializerOptions jsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber; int? reactor = mid.Length < 2 || !int.TryParse(mid.Substring(0, 2), out int reactorNumber) ? null : reactorNumber;
ReactorRoot? reactorRoot = reactor is null ? null : GetReactorRoot(httpClient, jsonSerializerOptions, reactor); char? loadLockSide = string.IsNullOrEmpty(input.LoadLock) || input.LoadLock[0] is not 'L' and not 'R' ? null : input.LoadLock[0];
if (reactorRoot?.Reactor is null || reactor != reactorRoot.Reactor.ReactorNo || reactorRoot.Reactor.LoadedRDS is null || reactorRoot.Reactor.LoadedRDS.Length < 1) ReactorRoot? reactorRoot = reactor is null || loadLockSide is null ? null : GetReactorRoot(httpClient, jsonSerializerOptions, reactor);
rds = loadLockSide is null ? null : loadLockSide == 'L' ? reactorRoot?.Reactor?.LoadLockLeftRDS : loadLockSide == 'R' ? reactorRoot?.Reactor?.LoadLockRightRDS : null;
if (reactorRoot?.Reactor is null || reactor != reactorRoot.Reactor.ReactorNo || rds is null)
{ {
rds = null; rds = null;
psn = null; psn = null;
@ -449,7 +451,6 @@ public partial class Job
} }
else else
{ {
rds = reactorRoot.Reactor.LoadedRDS[0];
RunDataSheetRoot? runDataSheetRoot = GetRunDataSheetRoot(httpClient, rds.Value); RunDataSheetRoot? runDataSheetRoot = GetRunDataSheetRoot(httpClient, rds.Value);
if (runDataSheetRoot?.RunDataSheet is null || reactor != runDataSheetRoot.RunDataSheet.Reactor) if (runDataSheetRoot?.RunDataSheet is null || reactor != runDataSheetRoot.RunDataSheet.Reactor)
{ {

View File

@ -6,13 +6,15 @@ public class Reactor
{ {
[JsonConstructor] [JsonConstructor]
public Reactor(int reactorNo, int[] loadedRDS) public Reactor(int reactorNo, int? loadLockLeftRDS, int? loadLockRightRDS)
{ {
LoadLockLeftRDS = loadLockLeftRDS;
LoadLockRightRDS = loadLockRightRDS;
ReactorNo = reactorNo; ReactorNo = reactorNo;
LoadedRDS = loadedRDS;
} }
[JsonPropertyName("reactorNo")] public int ReactorNo { get; } // { init; get; } [JsonPropertyName("reactorNo")] public int ReactorNo { get; } // { init; get; }
[JsonPropertyName("loadedRDS")] public int[] LoadedRDS { get; } // { init; get; } [JsonPropertyName("loadLockLeftRDS")] public int? LoadLockLeftRDS { get; } // { init; get; }
[JsonPropertyName("loadLockRightRDS")] public int? LoadLockRightRDS { get; } // { init; get; }
} }

View File

@ -383,17 +383,24 @@ public class FileRead : Properties.IFileRead
else else
{ {
string[] files; string[] files;
string logisticsSequence = _Logistics.Sequence.ToString(); string[] directories;
string[] directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly); string logisticsSequence;
foreach (string directory in directories) for (int i = 0; i < 10; i++)
{ {
files = Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly); logisticsSequence = (_Logistics.Sequence + -i).ToString();
if (files.Length == 0) directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
continue; foreach (string directory in directories)
results.Add(directory); {
files = Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly);
if (files.Length == 0)
continue;
results.Add(directory);
}
if (results.Count == 1)
break;
} }
} }
if ((results is null) || results.Count != 1) if (results.Count != 1)
throw new Exception("Didn't find directory by logistics sequence"); throw new Exception("Didn't find directory by logistics sequence");
return results.ToArray(); return results.ToArray();
} }

View File

@ -518,6 +518,8 @@ 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";
@ -555,25 +557,22 @@ internal class ProcessDataStandardFormat
} }
} }
results.Add("END_HEADER"); results.Add("END_HEADER");
if (processDataStandardFormat.InputPDSF is not null) results.Add(string.Empty);
{ List<char> hyphens = new();
results.Add(string.Empty); results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
List<char> hyphens = new(); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|")); results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
results.Add(string.Empty); for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|"); hyphens.Add('-');
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++) results.Add($"|{string.Join("|", hyphens)}|");
hyphens.Add('-'); results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add($"|{string.Join("|", hyphens)}|"); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|")); results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty); results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|")); results.Add("EOF");
results.Add(string.Empty); results.Add(string.Empty);
results.Add("EOF"); string json = GetJson(processDataStandardFormat);
results.Add(string.Empty); results.Add(json);
string json = GetJson(processDataStandardFormat);
results.Add(json);
}
File.WriteAllText(path, string.Join(Environment.NewLine, results)); File.WriteAllText(path, string.Join(Environment.NewLine, results));
} }