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;
if (!_StaticRuns.TryGetValue(_Logistics.Sequence, out List<Shared.Metrology.WS.Results>? wsResults))
wsResults = null;
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
if (processDataStandardFormat.InputPDSF is null)
File.Move(preWith.MatchingFile, preWith.CheckFile);
else
{
ProcessDataStandardFormat.Write(preWith.CheckFile, processDataStandardFormat, wsResults);
File.Delete(preWith.MatchingFile);
}
if (Directory.Exists(preWith.NoWaitDirectory))
{
post = new(preWith.CheckFile, preWith.ErrFile);

View File

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

View File

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

View File

@ -6,13 +6,15 @@ public class Reactor
{
[JsonConstructor]
public Reactor(int reactorNo, int[] loadedRDS)
public Reactor(int reactorNo, int? loadLockLeftRDS, int? loadLockRightRDS)
{
LoadLockLeftRDS = loadLockLeftRDS;
LoadLockRightRDS = loadLockRightRDS;
ReactorNo = reactorNo;
LoadedRDS = loadedRDS;
}
[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
{
string[] files;
string logisticsSequence = _Logistics.Sequence.ToString();
string[] directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
foreach (string directory in directories)
string[] directories;
string logisticsSequence;
for (int i = 0; i < 10; i++)
{
files = Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly);
if (files.Length == 0)
continue;
results.Add(directory);
logisticsSequence = (_Logistics.Sequence + -i).ToString();
directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
foreach (string directory in directories)
{
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");
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)
{
List<string> results = new();
if (processDataStandardFormat.InputPDSF is null)
throw new NullReferenceException(nameof(processDataStandardFormat.InputPDSF));
if (processDataStandardFormat.Sequence is null)
throw new NullReferenceException(nameof(processDataStandardFormat.Sequence));
string endOffset = "E#######T";
@ -555,25 +557,22 @@ internal class ProcessDataStandardFormat
}
}
results.Add("END_HEADER");
if (processDataStandardFormat.InputPDSF is not null)
{
results.Add(string.Empty);
List<char> hyphens = new();
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
hyphens.Add('-');
results.Add($"|{string.Join("|", hyphens)}|");
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.Add("EOF");
results.Add(string.Empty);
string json = GetJson(processDataStandardFormat);
results.Add(json);
}
results.Add(string.Empty);
List<char> hyphens = new();
results.AddRange(processDataStandardFormat.InputPDSF.Header.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.Add($"|{string.Join("|", processDataStandardFormat.InputPDSF.Columns)}|");
for (int i = 0; i < processDataStandardFormat.InputPDSF.Columns.Count; i++)
hyphens.Add('-');
results.Add($"|{string.Join("|", hyphens)}|");
results.AddRange(processDataStandardFormat.InputPDSF.Body.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.AddRange(processDataStandardFormat.InputPDSF.Footer.Select(l => $"|{l.Replace('\t', '|')}|"));
results.Add(string.Empty);
results.Add("EOF");
results.Add(string.Empty);
string json = GetJson(processDataStandardFormat);
results.Add(json);
File.WriteAllText(path, string.Join(Environment.NewLine, results));
}