MET08DDUPSP1TBI - v2.47.0 - Job - Zone Rev C

This commit is contained in:
Mike Phares 2022-10-17 16:36:23 -07:00
parent 963082a769
commit 6f92f8fcfc
2 changed files with 115 additions and 35 deletions

View File

@ -47,6 +47,7 @@ public class Job
{
string psn;
string zone;
string layer;
int? rdsNumber;
string comment;
const string hyphen = "-";
@ -58,21 +59,20 @@ public class Job
int? reactorNumber = GetReactorNumber(input);
(int? workOrderNumber, int? _, int? workOrderCassette, int? slotNumber, bool isWorkOrder) = GetWorkOrder(input);
if (isWorkOrder || reactorNumber.HasValue)
(psn, rdsNumber) = (string.Empty, null);
else if (input.MID.Length is not 2 and not 3)
(psn, rdsNumber, reactorNumber) = Get(input);
(layer, psn, rdsNumber, zone) = (string.Empty, string.Empty, null, string.Empty);
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is not 2 and not 3)
(layer, psn, rdsNumber, reactorNumber, zone) = Get(input);
else
(psn, rdsNumber, reactorNumber) = Get(metrologyFileShare, input);
(layer, psn, rdsNumber, reactorNumber, zone) = Get(metrologyFileShare, input);
if (IsValid(rdsNumber))
(comment, rdsNumber, psn, reactorNumber, zone) = GetWithValidRDS(lsl2SQLConnectionString, psn, rdsNumber, reactorNumber);
(comment, layer, rdsNumber, psn, reactorNumber, zone) = GetWithValidRDS(lsl2SQLConnectionString, layer, psn, rdsNumber, reactorNumber, zone);
else if (isWorkOrder || reactorNumber.HasValue)
(comment, rdsNumber, psn, reactorNumber, zone) = Get(lsl2SQLConnectionString, reactorNumber, slotNumber, workOrderNumber, workOrderCassette);
(comment, layer, rdsNumber, psn, reactorNumber, zone) = Get(lsl2SQLConnectionString, layer, psn, reactorNumber, slotNumber, workOrderNumber, workOrderCassette, zone);
else
(comment, zone) = (hyphen, hyphen);
(comment, layer, zone) = (hyphen, hyphen, hyphen);
Qty = "1";
Status = hyphen; // INFO
CreationUser = hyphen; // ?
SpecName = hyphen; // LAYER
LotState = hyphen; // LAYER2
LastUpdateUser = hyphen; // ?
Equipment = input.MesEntity; // ?
@ -82,6 +82,7 @@ public class Job
IsAreaSi = input.Area == "Si"; // N/A
StateModel = input.EquipmentType; // ?
JobName = DateTime.Ticks.ToString(); // ?
SpecName = !string.IsNullOrEmpty(layer) ? layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(psn) ? psn : hyphen; // PRODUCT
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
ProcessSpecName = !string.IsNullOrEmpty(zone) ? zone : hyphen; // WAFER_POS
@ -116,7 +117,7 @@ public class Job
collection = Array.Empty<MatchCollection>();
else
{
string pattern = @"^([oiOI])([0-9]{6,7})\.([0-5]{1})\.([0-9]{1,2})$"; // o171308.1.51
string pattern = @"^([oiOI])?([0-9]{6,7})\.([0-5]{1})\.([0-9]{1,2})$"; // o171308.1.51
collection = (from l in input.MID.Split('-') select Regex.Matches(l, pattern)).ToArray();
}
foreach (MatchCollection matchCollection in collection)
@ -147,35 +148,102 @@ public class Job
private static bool IsInvalid(int? rdsNumber) => rdsNumber is null or < 100000 or > 100000000;
private static (string, int, int?) Get(Input input)
private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments)
{
string rds;
string reactor;
if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText))
reactor = defaultReactor;
else
reactor = segments[0];
if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99)
rds = defaultRDS;
else
rds = segments[1];
if (reactor.Length > 3)
{
rds = reactor;
reactor = defaultReactor;
}
return new(reactor, rds);
}
private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments)
{
string psn;
int rdsNumber;
int? reactorNumber;
const int zero = 0;
string[] segments;
if (string.IsNullOrEmpty(input.MID))
segments = Array.Empty<string>();
string layer;
if (segments.Length <= 2)
{
psn = defaultPSN;
layer = defaultLayer;
}
else
segments = Regex.Split(input.MID, "[^0-9']");
if (segments.Length < 3)
{
string[] segmentsB = segments[2].Split('.');
psn = segmentsB[0];
if (segmentsB.Length <= 1)
layer = defaultLayer;
else
{
layer = segmentsB[1];
if (layer.Length > 1 && layer[0] == '0')
layer = layer.Substring(1);
}
}
return (layer, psn);
}
private static string GetZone(string[] segments)
{
string result;
if (segments.Length <= 3)
result = string.Empty;
else
{
result = segments[3];
if (result.Length > 1 && result[0] == '0')
result = result.Substring(1);
}
return result;
}
private static (string, string, int, int?, string) Get(Input input)
{
string psn;
string rds;
string zone;
string layer;
int rdsNumber;
string reactor;
int? reactorNumber;
string defaultPSN = string.Empty;
string defaultRDS = string.Empty;
string defaultLayer = string.Empty;
string defaultReactor = string.Empty;
string[] segments = input.MID.Split(new char[] { '-' });
string formattedText = Regex.Replace(input.MID, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, input.MID, formattedText, segments);
if (string.IsNullOrEmpty(rds))
rdsNumber = 0;
else
_ = int.TryParse(segments[1], out rdsNumber);
if (IsInvalid(rdsNumber) || !int.TryParse(segments[zero], out int reactor))
if (IsInvalid(rdsNumber) || !int.TryParse(reactor, out int reactorCheck))
{
psn = string.Empty;
zone = string.Empty;
layer = string.Empty;
reactorNumber = null;
}
else
{
psn = segments[2];
reactorNumber = reactor;
reactorNumber = reactorCheck;
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments);
zone = GetZone(segments);
}
return new(psn, rdsNumber, reactorNumber);
return new(layer, psn, rdsNumber, reactorNumber, zone);
}
private static (string, int?, int?) Get(string metrologyFileShare, Input input)
private static (string, string, int?, int?, string) Get(string metrologyFileShare, Input input)
{
string[] files;
string[] lines;
@ -183,6 +251,8 @@ public class Job
int? reactor = null;
int? rdsNumber = null;
string psn = string.Empty;
string zone = string.Empty;
string layer = string.Empty;
string usedDirectory = Path.Combine(metrologyFileShare, "Used");
if (!Directory.Exists(metrologyFileShare))
throw new Exception($"Unable to access file-share <{metrologyFileShare}>");
@ -214,7 +284,7 @@ public class Job
break;
}
}
return new(psn, rdsNumber, reactor);
return new(layer, psn, rdsNumber, reactor, zone);
}
private static string GetRunJson(string lsl2SQLConnectionString, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
@ -311,10 +381,8 @@ public class Job
return result;
}
private static (string, int?, string, int?, string) Get(string lsl2SQLConnectionString, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette)
private static (string, string, int?, string, int?, string) Get(string lsl2SQLConnectionString, string layer, string psn, int? reactorNumber, int? slotNumber, int? workOrderNumber, int? workOrderCassette, string zone)
{
string psn;
string zone;
int? rdsNumber;
string comment;
const int zero = 0;
@ -343,9 +411,13 @@ public class Job
}
else
{
psn = runs[zero].PSN;
zone = runs[zero].Zone;
rdsNumber = runs[zero].RdsNo;
if (string.IsNullOrEmpty(psn))
psn = runs[zero].PSN;
if (string.IsNullOrEmpty(zone))
zone = runs[zero].Zone;
if (string.IsNullOrEmpty(layer))
layer = runs[zero].EpiLayer;
reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch
@ -357,12 +429,11 @@ public class Job
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
}
}
return new(comment, rdsNumber, psn, reactorNumber, zone);
return new(comment, layer, rdsNumber, psn, reactorNumber, zone);
}
private static (string, int?, string, int?, string) GetWithValidRDS(string lsl2SQLConnectionString, string psn, int? rdsNumber, int? reactorNumber)
private static (string, string, int?, string, int?, string) GetWithValidRDS(string lsl2SQLConnectionString, string layer, string psn, int? rdsNumber, int? reactorNumber, string zone)
{
string zone;
string comment;
const int zero = 0;
const string hyphen = "-";
@ -386,8 +457,12 @@ public class Job
}
else
{
psn = runs[zero].PSN;
zone = runs[zero].Zone;
if (string.IsNullOrEmpty(psn))
psn = runs[zero].PSN;
if (string.IsNullOrEmpty(zone))
zone = runs[zero].Zone;
if (string.IsNullOrEmpty(layer))
layer = runs[zero].EpiLayer;
reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch
@ -399,7 +474,7 @@ public class Job
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}";
}
}
return new(comment, rdsNumber, psn, reactorNumber, zone);
return new(comment, layer, rdsNumber, psn, reactorNumber, zone);
}
}

View File

@ -70,6 +70,11 @@ public class Job : LoggingUnitTesting, IDisposable
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-171308.1.51-0000\", \"Recipe\": \"Recipe\", \"Slot\": \"11\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}