MET08RESIMAPCDE - v2.47.0- Zone
This commit is contained in:
@ -242,6 +242,65 @@ public class ProcessData : IProcessData
|
||||
return result;
|
||||
}
|
||||
|
||||
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 layer;
|
||||
if (segments.Length <= 2)
|
||||
{
|
||||
psn = defaultPSN;
|
||||
layer = defaultLayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public static Descriptor GetDescriptor(string text)
|
||||
{
|
||||
Descriptor result;
|
||||
@ -249,70 +308,56 @@ public class ProcessData : IProcessData
|
||||
string rds;
|
||||
string run;
|
||||
string zone;
|
||||
string title;
|
||||
string layer;
|
||||
string title;
|
||||
string reactor;
|
||||
string[] segments;
|
||||
const string defaultPSN = "0000";
|
||||
const string defaultRDS = "000000";
|
||||
const string defaultReactor = "00";
|
||||
if (text.Length is 2 or 3)
|
||||
string employee;
|
||||
string defaultPSN = string.Empty;
|
||||
string defaultRDS = string.Empty;
|
||||
string defaultZone = string.Empty;
|
||||
string defaultLayer = string.Empty;
|
||||
string defaultReactor = string.Empty;
|
||||
string defaultEmployee = string.Empty;
|
||||
if (string.IsNullOrEmpty(text) || (text.Length is 2 or 3 && Regex.IsMatch(text, "^[a-zA-z]{2,3}")))
|
||||
{
|
||||
run = text;
|
||||
title = text;
|
||||
employee = text;
|
||||
psn = defaultPSN;
|
||||
rds = defaultRDS;
|
||||
zone = defaultZone;
|
||||
layer = defaultLayer;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
else if (Regex.IsMatch(text, @"^[0-9]{2}[.][0-9]{1}[.]?[0-9]{0,1}"))
|
||||
{
|
||||
string[] segments = text.Split('.');
|
||||
run = text;
|
||||
title = text;
|
||||
psn = defaultPSN;
|
||||
rds = defaultRDS;
|
||||
zone = string.Empty;
|
||||
layer = string.Empty;
|
||||
reactor = defaultReactor;
|
||||
layer = segments[1];
|
||||
reactor = segments[0];
|
||||
employee = defaultEmployee;
|
||||
if (segments.Length <= 2)
|
||||
zone = defaultZone;
|
||||
else
|
||||
zone = segments[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove illegal characters \/:*?"<>| found in the run.
|
||||
title = Regex.Replace(text, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
if (title.StartsWith("1T") || title.StartsWith("1t"))
|
||||
if (title.Length > 2 && title[0] == '1' && (title[1] == 'T' || title[1] == 't'))
|
||||
title = title.Substring(2);
|
||||
run = title;
|
||||
segments = title.Split('-');
|
||||
if (segments.Length == 0)
|
||||
reactor = defaultReactor;
|
||||
else
|
||||
reactor = segments[0];
|
||||
if (segments.Length <= 1)
|
||||
rds = defaultRDS;
|
||||
else
|
||||
rds = segments[1];
|
||||
if (reactor.Length > 3)
|
||||
{
|
||||
rds = reactor;
|
||||
reactor = defaultReactor;
|
||||
}
|
||||
if (segments.Length <= 2)
|
||||
psn = defaultPSN;
|
||||
else
|
||||
psn = segments[2];
|
||||
if (segments.Length < 3)
|
||||
layer = string.Empty;
|
||||
else
|
||||
{
|
||||
string[] segmentsB = segments[2].Split('.');
|
||||
if (segmentsB.Length > 1)
|
||||
psn = segmentsB[0];
|
||||
if (segmentsB.Length <= 1)
|
||||
layer = string.Empty;
|
||||
else
|
||||
layer = segmentsB[1];
|
||||
}
|
||||
if (segments.Length <= 3)
|
||||
zone = string.Empty;
|
||||
else
|
||||
zone = segments[3];
|
||||
string[] segments = title.Split('-');
|
||||
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, title, segments);
|
||||
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments);
|
||||
zone = GetZone(segments);
|
||||
employee = defaultEmployee;
|
||||
}
|
||||
if (layer.Length > 1 && layer[0] == '0')
|
||||
layer = layer.Substring(1);
|
||||
if (zone.Length > 1 && zone[0] == '0')
|
||||
zone = zone.Substring(1);
|
||||
result = new(layer, psn, rds, reactor, run, title, zone);
|
||||
result = new(employee, layer, psn, rds, reactor, run, title, zone);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -359,6 +404,7 @@ public class ProcessData : IProcessData
|
||||
layer = descriptor.Layer;
|
||||
title = descriptor.Title;
|
||||
reactor = descriptor.Reactor;
|
||||
employee = descriptor.Employee;
|
||||
resistivitySpec = GetToEOL();
|
||||
ScanPast("EQUIP#:");
|
||||
equipId = GetBefore("Engineer:");
|
||||
@ -369,7 +415,10 @@ public class ProcessData : IProcessData
|
||||
lot = GetBefore("D.L.RATIO:");
|
||||
dlRatio = GetToEOL();
|
||||
ScanPast("OPERATOR:");
|
||||
employee = GetBefore("TEMP:");
|
||||
if (!string.IsNullOrEmpty(employee))
|
||||
_ = GetBefore("TEMP:");
|
||||
else
|
||||
employee = GetBefore("TEMP:");
|
||||
temp = GetToken();
|
||||
string dateTimeText = GetToEOL();
|
||||
DateTime dateTime = GetDateTime(logistics, dateTimeText);
|
||||
|
Reference in New Issue
Block a user