IDescription.GetDescriptions with body

SignalR
This commit is contained in:
Mike Phares 2023-06-20 12:08:50 -07:00
parent 05b7f32605
commit cc4473ffa8
13 changed files with 563 additions and 23 deletions

View File

@ -1,19 +1,31 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.FileHandlers.TIBCO.SignalR;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using Microsoft.AspNetCore.SignalR.Client;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace Adaptation.FileHandlers.TIBCO;
public class FileRead : Shared.FileRead, IFileRead
public class FileRead : Shared.FileRead, IFileRead, IAsyncDisposable
{
#nullable enable
private long? _TickOffset;
private readonly Timer _Timer;
private readonly string _BarcodeHostFileShare;
private readonly HubConnection? _HubConnectionBioRad2;
private readonly HubConnection? _HubConnectionBioRad3;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
@ -27,7 +39,9 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
string metrologyFileShare = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Metrology.FileShare");
_BarcodeHostFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\BarcodeHost\API"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "BarcodeHost.FileShare");
string lsl2SQLConnectionString = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ConnectionString.LSL2SQL");
ModelObjectParameterDefinition[] tibcoParameters = GetProperties(cellInstanceConnectionName, modelObjectParameters, "TIBCO.");
string tibcoParameterChannel = GetPropertyValue(cellInstanceConnectionName, tibcoParameters, "TIBCO.IFX_CHANNEL");
@ -35,15 +49,38 @@ public class FileRead : Shared.FileRead, IFileRead
string tibcoParameterSubjectPrefix = GetPropertyValue(cellInstanceConnectionName, tibcoParameters, "TIBCO.IFX_SUBJECT_PREFIX");
string tibcoParameterConfigurationLocation = GetPropertyValue(cellInstanceConnectionName, tibcoParameters, "TIBCO.IFX_CONFIGURATION_LOCATION");
string tibcoParameterConfigurationLocationCopy = GetPropertyValue(cellInstanceConnectionName, tibcoParameters, "TIBCO.IFX_CONFIGURATION_LOCATION_LOCAL_COPY");
string hostDomainBioRad2 = "unity4"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "CellInstance.BIORAD2.StaticFileServer");
string hostDomainBioRad3 = "unity5"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "CellInstance.BIORAD3.StaticFileServer");
if (!Directory.Exists(metrologyFileShare))
throw new Exception($"Unable to access file-share <{metrologyFileShare}>");
if (!Directory.Exists(_BarcodeHostFileShare))
throw new Exception($"Unable to access file-share <{_BarcodeHostFileShare}>");
if (_IsEAFHosted)
{
Transport.Main.Initialize(smtp, cellInstanceName, fileConnectorConfiguration, lsl2SQLConnectionString, metrologyFileShare);
Transport.Main.Initialize(smtp, cellInstanceName, fileConnectorConfiguration, lsl2SQLConnectionString, metrologyFileShare, _BarcodeHostFileShare);
if (!string.IsNullOrEmpty(fileConnectorConfiguration.SourceFileLocation))
_ = Transport.Main.Setup(useSleep: true, setIfxTransport: true, tibcoParameterChannel, tibcoParameterSubjectPrefix, tibcoParameterConfigurationLocation, tibcoParameterConfigurationLocationCopy, tibcoParameterSubject);
else
_ = Transport.Main.Setup(useSleep: false, setIfxTransport: false, tibcoParameterChannel, tibcoParameterSubjectPrefix, tibcoParameterConfigurationLocation, tibcoParameterConfigurationLocationCopy, tibcoParameterSubject);
_HubConnectionBioRad2 = new HubConnectionBuilder()
.WithUrl(new Uri($"https://{hostDomainBioRad2}/NotificationHub"))
.WithAutomaticReconnect()
.Build();
_HubConnectionBioRad2.Closed += Closed;
_ = _HubConnectionBioRad2.On<Notification>("NotifyAll", OnNotifyAllBioRad2);
_HubConnectionBioRad3 = new HubConnectionBuilder()
.WithUrl(new Uri($"https://{hostDomainBioRad3}/NotificationHub"))
.WithAutomaticReconnect()
.Build();
_HubConnectionBioRad3.Closed += Closed;
_ = _HubConnectionBioRad3.On<Notification>("NotifyAll", OnNotifyAllBioRad3);
}
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process || _FileConnectorConfiguration.FileScanningIntervalInSeconds is null)
Callback(null);
else
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
}
@ -106,7 +143,7 @@ public class FileRead : Shared.FileRead, IFileRead
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), Array.Empty<JsonElement>(), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
@ -124,11 +161,73 @@ public class FileRead : Shared.FileRead, IFileRead
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, Array.Empty<Test>(), Array.Empty<JsonElement>(), new List<FileInfo>());
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
return results;
}
private Task Closed(Exception? exception) =>
throw new NotImplementedException();
private void Write(string cellInstanceConnectionName, Notification notification)
{
DateTime dateTime = DateTime.Now;
string weekOfYear = $"{dateTime:yyyy}_Week_{_Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
string directory = Path.Combine(_BarcodeHostFileShare, weekOfYear, dateTime.ToString("yyyy-MM-dd_HH"));
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
File.WriteAllText(Path.Combine(directory, $"{cellInstanceConnectionName}.csv"), notification.LastScanServiceResultValue);
}
private void OnNotifyAllBioRad2(Notification notification) =>
Write("BIORAD2", notification);
private void OnNotifyAllBioRad3(Notification notification) =>
Write("BIORAD3", notification);
public async ValueTask DisposeAsync()
{
if (_HubConnectionBioRad2 is not null)
await _HubConnectionBioRad2.DisposeAsync();
if (_HubConnectionBioRad3 is not null)
await _HubConnectionBioRad3.DisposeAsync();
}
private void Callback(object? state)
{
try
{
int modulus = DateTime.Now.Second % 2;
if (modulus == 0 && _HubConnectionBioRad2?.State == HubConnectionState.Disconnected)
_HubConnectionBioRad2.StartAsync().Wait();
if (modulus == 1 && _HubConnectionBioRad3?.State == HubConnectionState.Disconnected)
_HubConnectionBioRad3.StartAsync().Wait();
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
try
{
if (_FileConnectorConfiguration.FileScanningIntervalInSeconds is null)
throw new NullReferenceException(nameof(_FileConnectorConfiguration.FileScanningIntervalInSeconds));
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
}
}

View File

@ -0,0 +1,277 @@
namespace Adaptation.FileHandlers.TIBCO.SignalR;
/// <summary>
/// Mapping for this can be found here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
/// </summary>
public enum EventCode
{
Reserved = 0,
Esc = 1,
Num1 = 2,
Num2 = 3,
Num3 = 4,
Num4 = 5,
Num5 = 6,
Num6 = 7,
Num7 = 8,
Num8 = 9,
Num9 = 10,
Num0 = 11,
Minus = 12,
Equal = 13,
Backspace = 14,
Tab = 15,
Q = 16,
W = 17,
E = 18,
R = 19,
T = 20,
Y = 21,
U = 22,
I = 23,
O = 24,
P = 25,
LeftBrace = 26,
RightBrace = 27,
Enter = 28,
LeftCtrl = 29,
A = 30,
S = 31,
D = 32,
F = 33,
G = 34,
H = 35,
J = 36,
K = 37,
L = 38,
Semicolon = 39,
Apostrophe = 40,
Grave = 41,
LeftShift = 42,
Backslash = 43,
Z = 44,
X = 45,
C = 46,
V = 47,
B = 48,
N = 49,
M = 50,
Comma = 51,
Dot = 52,
Slash = 53,
RightShift = 54,
KpAsterisk = 55,
LeftAlt = 56,
Space = 57,
Capslock = 58,
F1 = 59,
Pf2 = 60,
F3 = 61,
F4 = 62,
F5 = 63,
F6 = 64,
F7 = 65,
F8 = 66,
Pf9 = 67,
F10 = 68,
Numlock = 69,
ScrollLock = 70,
Kp7 = 71,
Kp8 = 72,
Kp9 = 73,
PkpMinus = 74,
Kp4 = 75,
Kp5 = 76,
Kp6 = 77,
KpPlus = 78,
Kp1 = 79,
Kp2 = 80,
Kp3 = 81,
Kp0 = 82,
KpDot = 83,
Zenkakuhankaku = 85,
//102ND = 86,
F11 = 87,
F12 = 88,
Ro = 89,
Katakana = 90,
Hiragana = 91,
Henkan = 92,
Katakanahiragana = 93,
Muhenkan = 94,
KpJpComma = 95,
KpEnter = 96,
RightCtrl = 97,
KpSlash = 98,
SysRq = 99,
RightAlt = 100,
LineFeed = 101,
Home = 102,
Up = 103,
Pageup = 104,
Left = 105,
Right = 106,
End = 107,
Down = 108,
Pagedown = 109,
Insert = 110,
Delete = 111,
Macro = 112,
Mute = 113,
VolumeDown = 114,
VolumeUp = 115,
Power = 116, // SC System Power Down
KpEqual = 117,
KpPlusMinus = 118,
Pause = 119,
Scale = 120, // AL Compiz Scale (Expose)
KpComma = 121,
Hangeul = 122,
Hanja = 123,
Yen = 124,
LeftMeta = 125,
RightMeta = 126,
Compose = 127,
Stop = 128, // AC Stop
Again = 129,
Props = 130, // AC Properties
Undo = 131, // AC Undo
Front = 132,
Copy = 133, // AC Copy
Open = 134, // AC Open
Paste = 135, // AC Paste
Find = 136, // AC Search
Cut = 137, // AC Cut
Help = 138, // AL Integrated Help Center
Menu = 139, // Menu (show menu)
Calc = 140, // AL Calculator
Setup = 141,
Sleep = 142, // SC System Sleep
Wakeup = 143, // System Wake Up
File = 144, // AL Local Machine Browser
Sendfile = 145,
DeleteFile = 146,
Xfer = 147,
Prog1 = 148,
Prog2 = 149,
Www = 150, // AL Internet Browser
MsDos = 151,
Coffee = 152, // AL Terminal Lock/Screensaver
RotateDisplay = 153, // Display orientation for e.g. tablets
CycleWindows = 154,
Mail = 155,
Bookmarks = 156, // AC Bookmarks
Computer = 157,
Back = 158, // AC Back
Forward = 159, // AC Forward
CloseCd = 160,
EjectCd = 161,
EjectCloseCd = 162,
NextSong = 163,
PlayPause = 164,
PreviousSong = 165,
StopCd = 166,
Record = 167,
Rewind = 168,
Phone = 169, // Media Select Telephone
Iso = 170,
Config = 171, // AL Consumer Control Configuration
Homepage = 172, // AC Home
Refresh = 173, // AC Refresh
Exit = 174, // AC Exit
Move = 175,
Edit = 176,
ScrollUp = 177,
ScrollDown = 178,
KpLeftParen = 179,
KpRightParen = 180,
New = 181, // AC New
Redo = 182, // AC Redo/Repeat
F13 = 183,
F14 = 184,
F15 = 185,
F16 = 186,
F17 = 187,
F18 = 188,
F19 = 189,
F20 = 190,
F21 = 191,
F22 = 192,
F23 = 193,
F24 = 194,
PlayCd = 200,
PauseCd = 201,
Prog3 = 202,
Prog4 = 203,
Dashboard = 204, // AL Dashboard
Suspend = 205,
Close = 206, // AC Close
Play = 207,
FastForward = 208,
BassBoost = 209,
Print = 210, // AC Print
Hp = 211,
Camera = 212,
Sound = 213,
Question = 214,
Email = 215,
Chat = 216,
Search = 217,
Connect = 218,
Finance = 219, // AL Checkbook/Finance
Sport = 220,
Shop = 221,
AltErase = 222,
Cancel = 223, // AC Cancel
BrightnessDown = 224,
BrightnessUp = 225,
Media = 226,
SwitchVideoMode = 227, // Cycle between available video outputs (Monitor/LCD/TV-out/etc)
KbdIllumToggle = 228,
KbdIllumDown = 229,
KbdIllumUp = 230,
Send = 231, // AC Send
Reply = 232, // AC Reply
ForwardMail = 233, // AC Forward Msg
Save = 234, // AC Save
Documents = 235,
Battery = 236,
Bluetooth = 237,
Wlan = 238,
Uwb = 239,
Unknown = 240,
VideoNext = 241, // drive next video source
VideoPrev = 242, // drive previous video source
BrightnessCycle = 243, // brightness up, after max is min
BrightnessAuto = 244, // Set Auto Brightness: manual brightness control is off, rely on ambient
DisplayOff = 245, // display device to off state
Wwan = 246, // Wireless WAN (LTE, UMTS, GSM, etc.)
RfKill = 247, // Key that controls all radios
MicMute = 248, // Mute / unmute the microphone
LeftMouse = 272,
RightMouse = 273,
MiddleMouse = 274,
MouseBack = 275,
MouseForward = 276,
ToolFinger = 325,
ToolQuintTap = 328,
Touch = 330,
ToolDoubleTap = 333,
ToolTripleTap = 334,
ToolQuadTap = 335,
Mic = 582
}

View File

@ -0,0 +1,20 @@
using System;
namespace Adaptation.FileHandlers.TIBCO.SignalR;
public readonly struct KeyPressEvent
{
public DateTime DateTime { get; }
public EventCode EventCode { get; }
public KeyState KeyState { get; }
public TimeSpan TimeSpan { get; }
public KeyPressEvent(DateTime dateTime, EventCode eventCode, KeyState keyState, TimeSpan timeSpan)
{
DateTime = dateTime;
EventCode = eventCode;
KeyState = keyState;
TimeSpan = timeSpan;
}
}

View File

@ -0,0 +1,8 @@
namespace Adaptation.FileHandlers.TIBCO.SignalR;
public enum KeyState
{
KeyUp,
KeyDown,
KeyHold
}

View File

@ -0,0 +1,14 @@
namespace Adaptation.FileHandlers.TIBCO.SignalR;
public readonly struct Notification
{
public KeyPressEvent KeyPressEvent { get; }
public string LastScanServiceResultValue { get; }
public Notification(KeyPressEvent keyPressEvent, string lastScanServiceResultValue)
{
KeyPressEvent = keyPressEvent;
LastScanServiceResultValue = lastScanServiceResultValue;
}
}

View File

@ -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)

View File

@ -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);

View File

@ -33,7 +33,7 @@
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="FFMpegCore" Version="5.1.0" />
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
@ -43,6 +43,7 @@
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
@ -53,10 +54,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="7.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="RoboSharp" Version="1.2.8" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
@ -67,8 +68,8 @@
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference>

View File

@ -110,6 +110,42 @@ public class Description : IDescription, Properties.IDescription
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{
List<IDescription> results = new();
if (iProcessData is null || !iProcessData.Details.Any())
results.Add(GetDefault(fileRead, logistics));
else
{
string nullData;
Description description;
object configDataNullData = fileRead.NullData;
if (configDataNullData is null)
nullData = string.Empty;
else
nullData = configDataNullData.ToString();
for (int i = 0; i < iProcessData.Details.Count; i++)
{
if (iProcessData.Details[i] is null)
continue;
description = new Description
{
Test = (int)tests[i],
Count = tests.Count,
Index = i,
//
EventName = fileRead.EventName,
NullData = nullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = logistics.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = DateTime.Now.ToString(GetDateFormat()),
RDS = string.Empty,
};
results.Add(description);
}
}
return results;
}

View File

@ -177,4 +177,15 @@ public class MET08DDUPSP1TBI : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[Ignore]
[TestMethod]
public void Staging__v2_49_2__MET08DDUPSP1TBI__TIBCO()
{
string check = "*.idc";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -1,6 +1,7 @@
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
@ -22,6 +23,13 @@ public class MET08DDUPSP1TBI
_MET08DDUPSP1TBI = CreateSelfDescription.Staging.v2_49_2.MET08DDUPSP1TBI.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
@ -113,4 +121,26 @@ public class MET08DDUPSP1TBI
[TestMethod]
public void Staging__v2_49_2__MET08DDUPSP1TBI__Dummy() => _MET08DDUPSP1TBI.Staging__v2_49_2__MET08DDUPSP1TBI__Dummy();
#if true
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_2__MET08DDUPSP1TBI__TIBCO() => _MET08DDUPSP1TBI.Staging__v2_49_2__MET08DDUPSP1TBI__TIBCO();
#if true
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_2__MET08DDUPSP1TBI__TIBCO638217888620242702__Normal()
{
string check = "*.idc";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08DDUPSP1TBI.Staging__v2_49_2__MET08DDUPSP1TBI__TIBCO();
string[] variables = _MET08DDUPSP1TBI.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
_ = _MET08DDUPSP1TBI.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
for (int i = 0; i < int.MaxValue; i++)
System.Threading.Thread.Sleep(500);
NonThrowTryCatch();
}
}

View File

@ -49,31 +49,32 @@ public class Job : LoggingUnitTesting, IDisposable
{
FileHandlers.TIBCO.Transport.Job job;
MethodBase methodBase = new StackFrame().GetMethod();
string barcodeHostFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\BarcodeHost\API";
string metrologyFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\WorkMaterialOut\API";
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string lsl2SQLConnectionString = "Data Source=10.95.128.28\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;";
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"12-123456-1234\", \"Recipe\": \"Recipe\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"12-123456-1234\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "21");
Assert.IsTrue(job.LotName == "123456");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4609");
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"-544481-\", \"Recipe\": \"Recipe\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"-544481-\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.IsTrue(job.LotName == "544481");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158");
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-544481-0000\", \"Recipe\": \"Recipe\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-544481-0000\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.IsTrue(job.LotName == "544481");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158");
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"37\", \"Recipe\": \"Recipe\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"37\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(job.ProcessType == "37");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "549918");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5101");
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-o171308.1.51-0000\", \"Recipe\": \"Recipe\", \"Slot\": \"11\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-o171308.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"));
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE5\", \"Sequence\": \"638163023363575829\", \"MID\": \"B48\", \"Recipe\": \"lsl_6in \"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE5\", \"Sequence\": \"638163023363575829\", \"MID\": \"B48\", \"Recipe\": \"lsl_6in \"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
@ -87,10 +88,11 @@ public class Job : LoggingUnitTesting, IDisposable
{
MethodBase methodBase = new StackFrame().GetMethod();
FileHandlers.TIBCO.Transport.Job job;
string barcodeHostFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\BarcodeHost\API";
string metrologyFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\WorkMaterialOut\API";
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string lsl2SQLConnectionString = "Data Source=10.95.128.28\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;";
job = new(lsl2SQLConnectionString, metrologyFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"P1234\", \"Recipe\": \"Recipe\"}");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"P1234\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType));
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName));
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName));

View File

@ -112,6 +112,10 @@
<Compile Include="Adaptation\FileHandlers\Processed\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\SPaCe\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\FileRead.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\SignalR\EventCode.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\SignalR\KeyPressEvent.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\SignalR\KeyState.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\SignalR\Notification.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\Transport\Input.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\Transport\Item.cs" />
<Compile Include="Adaptation\FileHandlers\TIBCO\Transport\Job.cs" />
@ -174,6 +178,9 @@
<PackageReference Include="Infineon.EAF.Runtime">
<Version>2.49.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client">
<Version>7.0.5</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>6.0.3</Version>
</PackageReference>