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 psn;
string zone; string zone;
string layer;
int? rdsNumber; int? rdsNumber;
string comment; string comment;
const string hyphen = "-"; const string hyphen = "-";
@ -58,21 +59,20 @@ public class Job
int? reactorNumber = GetReactorNumber(input); int? reactorNumber = GetReactorNumber(input);
(int? workOrderNumber, int? _, int? workOrderCassette, int? slotNumber, bool isWorkOrder) = GetWorkOrder(input); (int? workOrderNumber, int? _, int? workOrderCassette, int? slotNumber, bool isWorkOrder) = GetWorkOrder(input);
if (isWorkOrder || reactorNumber.HasValue) if (isWorkOrder || reactorNumber.HasValue)
(psn, rdsNumber) = (string.Empty, null); (layer, psn, rdsNumber, zone) = (string.Empty, string.Empty, null, string.Empty);
else if (input.MID.Length is not 2 and not 3) else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is not 2 and not 3)
(psn, rdsNumber, reactorNumber) = Get(input); (layer, psn, rdsNumber, reactorNumber, zone) = Get(input);
else else
(psn, rdsNumber, reactorNumber) = Get(metrologyFileShare, input); (layer, psn, rdsNumber, reactorNumber, zone) = Get(metrologyFileShare, input);
if (IsValid(rdsNumber)) 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) 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 else
(comment, zone) = (hyphen, hyphen); (comment, layer, zone) = (hyphen, hyphen, hyphen);
Qty = "1"; Qty = "1";
Status = hyphen; // INFO Status = hyphen; // INFO
CreationUser = hyphen; // ? CreationUser = hyphen; // ?
SpecName = hyphen; // LAYER
LotState = hyphen; // LAYER2 LotState = hyphen; // LAYER2
LastUpdateUser = hyphen; // ? LastUpdateUser = hyphen; // ?
Equipment = input.MesEntity; // ? Equipment = input.MesEntity; // ?
@ -82,6 +82,7 @@ public class Job
IsAreaSi = input.Area == "Si"; // N/A IsAreaSi = input.Area == "Si"; // N/A
StateModel = input.EquipmentType; // ? StateModel = input.EquipmentType; // ?
JobName = DateTime.Ticks.ToString(); // ? JobName = DateTime.Ticks.ToString(); // ?
SpecName = !string.IsNullOrEmpty(layer) ? layer : hyphen; // LAYER
ProductName = !string.IsNullOrEmpty(psn) ? psn : hyphen; // PRODUCT ProductName = !string.IsNullOrEmpty(psn) ? psn : hyphen; // PRODUCT
AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ? AutomationMode = string.Concat(DateTime.Ticks, ".", input.MesEntity); // ?
ProcessSpecName = !string.IsNullOrEmpty(zone) ? zone : hyphen; // WAFER_POS ProcessSpecName = !string.IsNullOrEmpty(zone) ? zone : hyphen; // WAFER_POS
@ -116,7 +117,7 @@ public class Job
collection = Array.Empty<MatchCollection>(); collection = Array.Empty<MatchCollection>();
else 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(); collection = (from l in input.MID.Split('-') select Regex.Matches(l, pattern)).ToArray();
} }
foreach (MatchCollection matchCollection in collection) 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 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; string psn;
int rdsNumber; string layer;
int? reactorNumber; if (segments.Length <= 2)
const int zero = 0; {
string[] segments; psn = defaultPSN;
if (string.IsNullOrEmpty(input.MID)) layer = defaultLayer;
segments = Array.Empty<string>(); }
else 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; rdsNumber = 0;
else else
_ = int.TryParse(segments[1], out rdsNumber); _ = 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; psn = string.Empty;
zone = string.Empty;
layer = string.Empty;
reactorNumber = null; reactorNumber = null;
} }
else else
{ {
psn = segments[2]; reactorNumber = reactorCheck;
reactorNumber = reactor; (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[] files;
string[] lines; string[] lines;
@ -183,6 +251,8 @@ public class Job
int? reactor = null; int? reactor = null;
int? rdsNumber = null; int? rdsNumber = null;
string psn = string.Empty; string psn = string.Empty;
string zone = string.Empty;
string layer = string.Empty;
string usedDirectory = Path.Combine(metrologyFileShare, "Used"); string usedDirectory = Path.Combine(metrologyFileShare, "Used");
if (!Directory.Exists(metrologyFileShare)) if (!Directory.Exists(metrologyFileShare))
throw new Exception($"Unable to access file-share <{metrologyFileShare}>"); throw new Exception($"Unable to access file-share <{metrologyFileShare}>");
@ -214,7 +284,7 @@ public class Job
break; 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) 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; 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; int? rdsNumber;
string comment; string comment;
const int zero = 0; const int zero = 0;
@ -343,9 +411,13 @@ public class Job
} }
else else
{ {
psn = runs[zero].PSN;
zone = runs[zero].Zone;
rdsNumber = runs[zero].RdsNo; 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; reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide; string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch string loadLockSideFull = loadLockSide switch
@ -357,12 +429,11 @@ public class Job
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}"; 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; string comment;
const int zero = 0; const int zero = 0;
const string hyphen = "-"; const string hyphen = "-";
@ -386,8 +457,12 @@ public class Job
} }
else else
{ {
psn = runs[zero].PSN; if (string.IsNullOrEmpty(psn))
zone = runs[zero].Zone; psn = runs[zero].PSN;
if (string.IsNullOrEmpty(zone))
zone = runs[zero].Zone;
if (string.IsNullOrEmpty(layer))
layer = runs[zero].EpiLayer;
reactorNumber = runs[zero].Reactor; reactorNumber = runs[zero].Reactor;
string loadLockSide = runs[zero].LoadLockSide; string loadLockSide = runs[zero].LoadLockSide;
string loadLockSideFull = loadLockSide switch string loadLockSideFull = loadLockSide switch
@ -399,7 +474,7 @@ public class Job
comment = $"{loadLockSideFull} - {runs[zero].ReactorType}"; 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.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445"); Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); 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"));
} }
} }