Infineon.EAF.Runtime 2.49.0
net6.0 to net7.0 Removed hasRDS that was added for P2-LOW-RR
This commit is contained in:
@ -36,9 +36,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_LastLines = string.Empty;
|
||||
_OpenInsightApiIFXDirectory = @"\\messdv002.na.infineon.com\Candela\Archive\API";
|
||||
_OpenInsightApiECDirectory = @"\\messv02ecc1.ec.local\EC_Metrology_Si\Archive\API";
|
||||
_IqsConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.ConnectionString");
|
||||
_OpenInsightApiECDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.EC.Directory");
|
||||
_OpenInsightApiIFXDirectory = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "API.IFX.Directory");
|
||||
_OpenInsightFilePattern = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.FilePattern");
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -61,7 +62,7 @@ public class Job
|
||||
(int? workOrderNumber, int? _, int? workOrderCassette, int? slotNumber, bool isWorkOrder) = GetWorkOrder(input);
|
||||
if (isWorkOrder || reactorNumber.HasValue)
|
||||
(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)
|
||||
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is not 2 and not 3 and not 5)
|
||||
(layer, psn, rdsNumber, reactorNumber, zone) = Get(input);
|
||||
else
|
||||
(layer, psn, rdsNumber, reactorNumber, zone) = Get(metrologyFileShare, input);
|
||||
@ -157,7 +158,7 @@ public class Job
|
||||
reactor = defaultReactor;
|
||||
else
|
||||
reactor = segments[0];
|
||||
if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99)
|
||||
if (segments.Length <= 1 || !int.TryParse(segments[1].Replace("QP", string.Empty), out int rdsValue) || rdsValue < 99)
|
||||
rds = defaultRDS;
|
||||
else
|
||||
rds = segments[1];
|
||||
@ -222,7 +223,7 @@ public class Job
|
||||
string defaultLayer = string.Empty;
|
||||
string defaultReactor = string.Empty;
|
||||
string[] segments = input.MID.Split(new char[] { '-' });
|
||||
bool hasRDS = Regex.IsMatch(input.MID, "[-]?[0-9]{5,}[-]?");
|
||||
bool hasRDS = Regex.IsMatch(input.MID, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?");
|
||||
string formattedText = Regex.Replace(input.MID, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
|
||||
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, input.MID, formattedText, segments, hasRDS);
|
||||
if (string.IsNullOrEmpty(rds))
|
||||
@ -245,50 +246,66 @@ public class Job
|
||||
return new(layer, psn, rdsNumber, reactorNumber, zone);
|
||||
}
|
||||
|
||||
private static string[] GetDirectories(string metrologyFileShare)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
DateTime before = dateTime.AddHours(-1);
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
||||
string weekOfYearForBefore = $"{before:yyyy}_Week_{calendar.GetWeekOfYear(before, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
||||
return new string[]
|
||||
{
|
||||
Path.Combine(metrologyFileShare, weekOfYear, dateTime.ToString("yyyy-MM-dd_HH")),
|
||||
Path.Combine(metrologyFileShare, weekOfYearForBefore, before.ToString("yyyy-MM-dd_HH"))
|
||||
};
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
||||
private static (string, string, int?, int?, string) Get(string metrologyFileShare, Input input)
|
||||
{
|
||||
string[] files;
|
||||
string[] lines;
|
||||
string moveFile;
|
||||
string lines;
|
||||
int? reactor = null;
|
||||
int? rdsNumber = null;
|
||||
string psn = string.Empty;
|
||||
List<string> files = new();
|
||||
string zone = string.Empty;
|
||||
string layer = string.Empty;
|
||||
string usedDirectory = Path.Combine(metrologyFileShare, "Used");
|
||||
WorkMaterialOut? workMaterialOut;
|
||||
if (!Directory.Exists(metrologyFileShare))
|
||||
throw new Exception($"Unable to access file-share <{metrologyFileShare}>");
|
||||
if (!Directory.Exists(usedDirectory))
|
||||
_ = Directory.CreateDirectory(usedDirectory);
|
||||
if (string.IsNullOrEmpty(input.MID))
|
||||
files = Array.Empty<string>();
|
||||
else
|
||||
files = Directory.GetFiles(metrologyFileShare, $"*-{input.MID}.rsv", SearchOption.TopDirectoryOnly);
|
||||
if (!string.IsNullOrEmpty(input.MID))
|
||||
{
|
||||
string[] checkDirectories = GetDirectories(metrologyFileShare);
|
||||
foreach (string checkDirectory in checkDirectories)
|
||||
{
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
files.AddRange(Directory.GetFiles(checkDirectory, $"WMO-{input.MID}.json", SearchOption.TopDirectoryOnly));
|
||||
}
|
||||
}
|
||||
foreach (string file in files.OrderByDescending(l => new FileInfo(l).LastWriteTime))
|
||||
{
|
||||
lines = File.ReadAllLines(file);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
if (!int.TryParse(line, out int rds) || IsInvalid(rds))
|
||||
continue;
|
||||
lines = File.ReadAllText(file);
|
||||
workMaterialOut = JsonSerializer.Deserialize<WorkMaterialOut>(lines, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
if (workMaterialOut is null)
|
||||
continue;
|
||||
if (!string.IsNullOrEmpty(workMaterialOut.Layer))
|
||||
layer = workMaterialOut.Layer;
|
||||
if (!string.IsNullOrEmpty(workMaterialOut.PSN))
|
||||
psn = workMaterialOut.PSN;
|
||||
if (!string.IsNullOrEmpty(workMaterialOut.RunDataSheet) && int.TryParse(workMaterialOut.RunDataSheet, out int rds))
|
||||
rdsNumber = rds;
|
||||
break;
|
||||
}
|
||||
if (rdsNumber is not null)
|
||||
{
|
||||
moveFile = Path.Combine(usedDirectory, Path.GetFileName(file));
|
||||
if (File.Exists(moveFile))
|
||||
File.Delete(file);
|
||||
else
|
||||
File.Move(file, moveFile);
|
||||
break;
|
||||
}
|
||||
reactor = workMaterialOut.Reactor;
|
||||
if (!string.IsNullOrEmpty(workMaterialOut.Zone))
|
||||
zone = workMaterialOut.Zone;
|
||||
break;
|
||||
}
|
||||
return new(layer, psn, rdsNumber, reactor, zone);
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
|
18
Adaptation/FileHandlers/TIBCO/Transport/WorkMaterialOut.cs
Normal file
18
Adaptation/FileHandlers/TIBCO/Transport/WorkMaterialOut.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace Adaptation.FileHandlers.TIBCO.Transport;
|
||||
|
||||
#nullable enable
|
||||
|
||||
public class WorkMaterialOut
|
||||
{
|
||||
|
||||
public string? Layer { get; set; }
|
||||
public string? PSN { get; set; }
|
||||
public string? Pocket { get; set; }
|
||||
public int? Reactor { get; set; }
|
||||
public string? RunDataSheet { get; set; }
|
||||
public string? Scan { get; set; }
|
||||
public int? SlotNumber { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Zone { get; set; }
|
||||
|
||||
}
|
@ -457,11 +457,11 @@ public class ProcessData : IProcessData
|
||||
}
|
||||
}
|
||||
|
||||
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 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;
|
||||
else
|
||||
reactor = segments[0];
|
||||
@ -477,11 +477,11 @@ public class ProcessData : IProcessData
|
||||
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 layer;
|
||||
if (segments.Length <= 2 || (segments.Length > 1 && !hasRDS))
|
||||
if (segments.Length <= 2)
|
||||
{
|
||||
psn = defaultPSN;
|
||||
layer = defaultLayer;
|
||||
@ -532,7 +532,17 @@ public class ProcessData : IProcessData
|
||||
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}")))
|
||||
if (Regex.IsMatch(text, @"^[a-zA-z][0-9]{4}$"))
|
||||
{
|
||||
lot = text.ToUpper();
|
||||
psn = defaultPSN;
|
||||
rds = defaultRDS;
|
||||
zone = defaultZone;
|
||||
layer = defaultLayer;
|
||||
reactor = defaultReactor;
|
||||
employee = defaultEmployee;
|
||||
}
|
||||
else if (string.IsNullOrEmpty(text) || (text.Length is 2 or 3 && Regex.IsMatch(text, "^[a-zA-z]{2,3}")))
|
||||
{
|
||||
lot = text;
|
||||
employee = text;
|
||||
@ -563,9 +573,9 @@ public class ProcessData : IProcessData
|
||||
if (lot.Length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't'))
|
||||
lot = lot.Substring(2);
|
||||
string[] segments = lot.Split('-');
|
||||
bool hasRDS = Regex.IsMatch(lot, "[-]?[0-9]{5,}[-]?");
|
||||
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments, hasRDS);
|
||||
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS);
|
||||
// bool hasRDS = Regex.IsMatch(lot, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?");
|
||||
(reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments);
|
||||
(layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments);
|
||||
zone = GetZone(segments);
|
||||
employee = defaultEmployee;
|
||||
}
|
||||
|
Reference in New Issue
Block a user