Removed hasRDS that was added for P2-LOW-RR

This commit is contained in:
Mike Phares 2023-03-22 17:10:13 -07:00
parent 4c77edbc40
commit d86d3d6294
2 changed files with 11 additions and 12 deletions

View File

@ -250,15 +250,15 @@ public class ProcessData : IProcessData
return result; return result;
} }
private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments, bool hasRDS) private static (string, string) GetReactorAndRDS(string defaultReactor, string defaultRDS, string text, string formattedText, string[] segments)
{ {
string rds; string rds;
string reactor; string reactor;
if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText) || (segments.Length > 1 && !hasRDS)) if (string.IsNullOrEmpty(text) || segments.Length == 0 || string.IsNullOrEmpty(formattedText))
reactor = defaultReactor; reactor = defaultReactor;
else else
reactor = segments[0]; reactor = segments[0];
if (segments.Length <= 1 || !int.TryParse(segments[1].Replace("QP", string.Empty), out int rdsValue) || rdsValue < 99) if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99)
rds = defaultRDS; rds = defaultRDS;
else else
rds = segments[1]; rds = segments[1];
@ -270,11 +270,11 @@ public class ProcessData : IProcessData
return new(reactor, rds); return new(reactor, rds);
} }
private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments, bool hasRDS) private static (string, string) GetLayerAndPSN(string defaultLayer, string defaultPSN, string[] segments)
{ {
string psn; string psn;
string layer; string layer;
if (segments.Length <= 2 || (segments.Length > 1 && !hasRDS)) if (segments.Length <= 2)
{ {
psn = defaultPSN; psn = defaultPSN;
layer = defaultLayer; layer = defaultLayer;
@ -356,9 +356,9 @@ public class ProcessData : IProcessData
if (lot.Length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't')) if (lot.Length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't'))
lot = lot.Substring(2); lot = lot.Substring(2);
string[] segments = lot.Split('-'); string[] segments = lot.Split('-');
bool hasRDS = Regex.IsMatch(lot, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?"); // bool hasRDS = Regex.IsMatch(lot, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?");
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments, hasRDS); (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments);
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS); (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments);
zone = GetZone(segments); zone = GetZone(segments);
employee = defaultEmployee; employee = defaultEmployee;
} }

View File

@ -129,18 +129,17 @@ public class PCL : LoggingUnitTesting, IDisposable
Assert.IsTrue(descriptor.Zone is "1"); Assert.IsTrue(descriptor.Zone is "1");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.pcl.ProcessData.GetDescriptor("P2-LOW-RR"); descriptor = FileHandlers.pcl.ProcessData.GetDescriptor("P2-LOW-RR");
Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.PSN)); Assert.IsTrue(descriptor.PSN is "RR");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(descriptor.Reactor is "P2");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));
descriptor = FileHandlers.pcl.ProcessData.GetDescriptor("75-QP1414-SPLIT4"); descriptor = FileHandlers.pcl.ProcessData.GetDescriptor("75-QP1414-SPLIT4");
Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot)); Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Lot));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer));
Assert.IsTrue(descriptor.PSN is "SPLIT4"); Assert.IsTrue(descriptor.PSN is "SPLIT4");
Assert.IsTrue(descriptor.RDS is "QP1414"); Assert.IsTrue(string.IsNullOrEmpty(descriptor.RDS));
Assert.IsTrue(descriptor.Reactor is "75"); Assert.IsTrue(descriptor.Reactor is "75");
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone));
Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee));