IDescription.GetDescriptions with body
SignalR
This commit is contained in:
@ -39,7 +39,7 @@ public class Job
|
||||
public DateTime DateTime { get; }
|
||||
public List<Item> Items { get; }
|
||||
|
||||
public Job(string lsl2SQLConnectionString, string metrologyFileShare, string mid)
|
||||
public Job(string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare, string mid)
|
||||
{
|
||||
const int zero = 0;
|
||||
Items = new List<Item>();
|
||||
@ -64,6 +64,8 @@ public class Job
|
||||
(layer, psn, rdsNumber, zone) = (string.Empty, string.Empty, null, string.Empty);
|
||||
else if (!string.IsNullOrEmpty(input.MID) && input.MID.Length is 2 or 3 && Regex.IsMatch(input.MID, "^[a-zA-z]{2,3}"))
|
||||
(layer, psn, rdsNumber, reactorNumber, zone) = Get(metrologyFileShare, input);
|
||||
else if (!string.IsNullOrEmpty(input.MID) && !string.IsNullOrEmpty(input.MesEntity) && input.MesEntity is "BIORAD2" or "BIORAD3" && Regex.IsMatch(input.MID, @"^[0-9]{2}[.][0-9]{1}[.]?[0-9]{0,1}"))
|
||||
(layer, psn, rdsNumber, reactorNumber, zone) = Get(input, barcodeHostFileShare);
|
||||
else
|
||||
(layer, psn, rdsNumber, reactorNumber, zone) = Get(input);
|
||||
if (IsValid(rdsNumber))
|
||||
@ -246,7 +248,7 @@ public class Job
|
||||
return new(layer, psn, rdsNumber, reactorNumber, zone);
|
||||
}
|
||||
|
||||
private static string[] GetDirectories(string metrologyFileShare)
|
||||
private static string[] GetDirectories(string fileShare)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
DateTime before = dateTime.AddHours(-1);
|
||||
@ -255,8 +257,8 @@ public class Job
|
||||
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"))
|
||||
Path.Combine(fileShare, weekOfYear, dateTime.ToString("yyyy-MM-dd_HH")),
|
||||
Path.Combine(fileShare, weekOfYearForBefore, before.ToString("yyyy-MM-dd_HH"))
|
||||
};
|
||||
}
|
||||
|
||||
@ -306,6 +308,37 @@ public class Job
|
||||
return new(layer, psn, rdsNumber, reactor, zone);
|
||||
}
|
||||
|
||||
private static (string, string, int?, int?, string) Get(Input input, string barcodeHostFileShare)
|
||||
{
|
||||
string text;
|
||||
int? rds = null;
|
||||
string psn = string.Empty;
|
||||
List<string> files = new();
|
||||
string[] segments = input.MID.Split('.');
|
||||
string layer = segments[1];
|
||||
string zone = segments.Length <= 2 ? string.Empty : segments[2];
|
||||
int? reactor = !int.TryParse(segments[0], out int reactorNumber) ? null : reactorNumber;
|
||||
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
|
||||
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
|
||||
if (!string.IsNullOrEmpty(input.MID))
|
||||
{
|
||||
string[] checkDirectories = GetDirectories(barcodeHostFileShare);
|
||||
foreach (string checkDirectory in checkDirectories)
|
||||
{
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
files.AddRange(Directory.GetFiles(checkDirectory, $"{input.MesEntity}.csv", SearchOption.TopDirectoryOnly));
|
||||
}
|
||||
}
|
||||
foreach (string file in files.OrderByDescending(l => new FileInfo(l).LastWriteTime))
|
||||
{
|
||||
text = File.ReadAllText(file);
|
||||
rds = !int.TryParse(segments[0], out int rdsNumber) ? null : rdsNumber;
|
||||
break;
|
||||
}
|
||||
return new(layer, psn, rds, reactor, zone);
|
||||
}
|
||||
|
||||
#nullable disable
|
||||
|
||||
private static string GetRunJson(string lsl2SQLConnectionString, int? rds, int? workOrderNumber, int? workOrderCassette, int? slot, int? reactor)
|
||||
|
@ -16,17 +16,19 @@ internal partial class Main
|
||||
private static object _IfxTransport;
|
||||
private static string _CellInstanceName;
|
||||
private static string _MetrologyFileShare;
|
||||
private static string _BarcodeHostFileShare;
|
||||
private static string _LSL2SQLConnectionString;
|
||||
private static string _TibcoParameterSubjectPrefix;
|
||||
private static FileConnectorConfiguration _FileConnectorConfiguration;
|
||||
|
||||
internal static void Initialize(ISMTP smtp, string cellInstanceName, FileConnectorConfiguration fileConnectorConfiguration, string lsl2SQLConnectionString, string metrologyFileShare)
|
||||
internal static void Initialize(ISMTP smtp, string cellInstanceName, FileConnectorConfiguration fileConnectorConfiguration, string lsl2SQLConnectionString, string metrologyFileShare, string barcodeHostFileShare)
|
||||
{
|
||||
_SMTP = smtp;
|
||||
_IfxTransport = null;
|
||||
_CellInstanceName = cellInstanceName;
|
||||
_MetrologyFileShare = metrologyFileShare;
|
||||
_TibcoParameterSubjectPrefix = string.Empty;
|
||||
_BarcodeHostFileShare = barcodeHostFileShare;
|
||||
_LSL2SQLConnectionString = lsl2SQLConnectionString;
|
||||
_FileConnectorConfiguration = fileConnectorConfiguration;
|
||||
}
|
||||
@ -184,7 +186,7 @@ internal partial class Main
|
||||
if (!subject.Contains(_TibcoParameterSubjectPrefix))
|
||||
throw new Exception("Invalid Subject");
|
||||
mid = GetJobsMID(envelopeDocument);
|
||||
Job job = new(_LSL2SQLConnectionString, _MetrologyFileShare, mid);
|
||||
Job job = new(_LSL2SQLConnectionString, _MetrologyFileShare, _BarcodeHostFileShare, mid);
|
||||
if (job.IsAreaSi)
|
||||
{
|
||||
IfxDoc sendReply = GetJobsReply(job);
|
||||
|
Reference in New Issue
Block a user