Removed all references to FabTime
This commit is contained in:
@ -4,8 +4,6 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
{
|
||||
public static class APIHelperFunctions
|
||||
{
|
||||
private readonly static string fabTimeServer = "http://messa004.infineon.com/fabtime717service/GetChartData.aspx?";
|
||||
|
||||
public static string GetBeginningOfWeekAsAPIString()
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
@ -43,57 +41,6 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
return dateString;
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> SetParameters(string startDate = "", string endDate = "", string chart = "", string periodLen = "",
|
||||
string areasLike = "", string toolsLike = "", string operationsLike = "", string capacityTypesLike = "")
|
||||
{
|
||||
Dictionary<string, string> parameters = new();
|
||||
|
||||
startDate = startDate == "" ? HttpUtility.UrlEncode(GetBeginningOfWeekAsAPIString()) : startDate;
|
||||
endDate = endDate == "" ? HttpUtility.UrlEncode(GetDateTimeAsAPIString(DateTime.Now.ToString(), true)) : endDate;
|
||||
|
||||
parameters.Add("chart", chart);
|
||||
parameters.Add("starttime", startDate);
|
||||
parameters.Add("endtime", endDate);
|
||||
parameters.Add("periodlen", periodLen);
|
||||
parameters.Add("areaslike", areasLike);
|
||||
parameters.Add("toolslike", toolsLike);
|
||||
parameters.Add("operationslike", operationsLike);
|
||||
parameters.Add("capacitytypeslike", capacityTypesLike);
|
||||
parameters.Add("login", "administrator");
|
||||
parameters.Add("password", "admin");
|
||||
parameters.Add("fabtimeauthentication", "1");
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public static string GenerateURL(Dictionary<string, string> parameters)
|
||||
{
|
||||
int count = 0;
|
||||
string url = fabTimeServer;
|
||||
|
||||
foreach (KeyValuePair<string, string> pair in parameters)
|
||||
{
|
||||
if (pair.Value != "")
|
||||
url = url + pair.Key + "=" + pair.Value;
|
||||
|
||||
if (count != parameters.Count - 1 && !string.IsNullOrEmpty(pair.Value))
|
||||
url += "&";
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
public static string GenerateURLWithParameters(string startDate = "", string endDate = "", string chart = "", string periodLen = "",
|
||||
string areasLike = "", string toolsLike = "", string operationsLike = "", string capacityTypesLike = "")
|
||||
{
|
||||
Dictionary<string, string> parameters = SetParameters(startDate, endDate, chart,
|
||||
periodLen, areasLike, toolsLike, operationsLike, capacityTypesLike);
|
||||
|
||||
return GenerateURL(parameters);
|
||||
}
|
||||
|
||||
public static List<T> ReverseList<T>(List<T> inputList)
|
||||
{
|
||||
List<T> temp = new();
|
||||
|
@ -10,17 +10,10 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
{
|
||||
T deserializedJson = default(T);
|
||||
|
||||
try
|
||||
using (HttpClient client = new())
|
||||
{
|
||||
using (HttpClient client = new())
|
||||
{
|
||||
string apiResponse = await client.GetStringAsync(url);
|
||||
deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
string apiResponse = await client.GetStringAsync(url);
|
||||
deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
|
||||
}
|
||||
|
||||
return deserializedJson;
|
||||
|
@ -9,8 +9,23 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
private static readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
|
||||
private static readonly string _SLLFilePath = "wwwroot/Assets/SLLTools.json";
|
||||
|
||||
public static DailyReport SetUpDailyReport(ILogger logger, string baseUrlFabtime, string baseUrlScrapeDb)
|
||||
public static DailyReport SetUpDailyReport(ILogger logger, string baseUrlScrapeDb)
|
||||
{
|
||||
DailyReport report = new();
|
||||
|
||||
try
|
||||
{
|
||||
report.SLLTools = JsonFileHandler.LoadJSONFile<List<SLLTool>>(_SLLFilePath);
|
||||
report.ManualReportEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Failed to load JsonFiles.");
|
||||
logger.LogInformation("SLL File Path: {path}", _SLLFilePath);
|
||||
logger.LogInformation("Manual Report Entries File Path: {path}", _dailyRptFilePath);
|
||||
}
|
||||
|
||||
List<string> cleanTools = new()
|
||||
{
|
||||
"AHPS",
|
||||
@ -38,16 +53,17 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
"SRP"
|
||||
};
|
||||
|
||||
List<Task<List<EquipmentStateByDay>>> tasksEQState = new();
|
||||
List<Task<List<ToolStateCurrent>>> tasksState = new();
|
||||
DailyReport report = new();
|
||||
|
||||
List<Reactor> reactors = ApiCaller.GetApi<List<Reactor>>(baseUrlScrapeDb + "Reactors").Result;
|
||||
|
||||
List<Task<List<ReactorEvent>>> toolEvents = new();
|
||||
List<Task<ToolEvent>> cleanEvents = new();
|
||||
List<Task<ToolEvent>> metrologyEvents = new();
|
||||
|
||||
Task<YieldInformation> task1 = null;
|
||||
Task<YieldInformation> task2 = null;
|
||||
Task<QuarterlyTargets> targets = null;
|
||||
Task<List<RDS>> rds = null;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (Reactor reactor in reactors)
|
||||
@ -65,80 +81,17 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
{
|
||||
metrologyEvents.Add(ApiCaller.GetApi<ToolEvent>(baseUrlScrapeDb + "ToolEvents?toolID=" + tool));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
report.SLLTools = JsonFileHandler.LoadJSONFile<List<SLLTool>>(_SLLFilePath);
|
||||
report.ManualReportEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Failed to load JsonFiles.");
|
||||
logger.LogInformation("SLL File Path: {path}", _SLLFilePath);
|
||||
logger.LogInformation("Manual Report Entries File Path: {path}", _dailyRptFilePath);
|
||||
}
|
||||
|
||||
Task<YieldInformation> task1 = null;
|
||||
Task<YieldInformation> task2 = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
task1 = ApiCaller.GetApi<YieldInformation>(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString());
|
||||
task2 = ApiCaller.GetApi<YieldInformation>(baseUrlScrapeDb + "ReactorOuts?startDate=" + report.StartDate.AddDays(-7).ToString() + "&endDate=" + report.StartDate.ToString());
|
||||
|
||||
tasksEQState.Add(ApiCaller.GetApi<List<EquipmentStateByDay>>(baseUrlFabtime + "ToolStateTrend?toolType=ASM"));
|
||||
tasksEQState.Add(ApiCaller.GetApi<List<EquipmentStateByDay>>(baseUrlFabtime + "ToolStateTrend?toolType=EPP"));
|
||||
tasksEQState.Add(ApiCaller.GetApi<List<EquipmentStateByDay>>(baseUrlFabtime + "ToolStateTrend?toolType=HTR"));
|
||||
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(baseUrlFabtime + "ToolState?toolType=ASM"));
|
||||
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(baseUrlFabtime + "ToolState?toolType=EPP"));
|
||||
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(baseUrlFabtime + "ToolState?toolType=HTR"));
|
||||
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(baseUrlFabtime + "ToolState?toolType=Metrology"));
|
||||
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(baseUrlFabtime + "ToolState?toolType=Cleans"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogCritical(ex, "Failed to send get requests to fabtime endpoints.");
|
||||
}
|
||||
|
||||
Task<QuarterlyTargets> targets = null;
|
||||
Task<List<RDS>> rds = null;
|
||||
|
||||
try
|
||||
{
|
||||
targets = ApiCaller.GetApi<QuarterlyTargets>(baseUrlScrapeDb + "Targets");
|
||||
rds = ApiCaller.GetApi<List<RDS>>(baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString());
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogCritical(ex, "Failed to send get requests to scrapedb endpoints.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
report.AddToolAvailibilityByType("ASM", tasksEQState[0].Result);
|
||||
report.AddToolAvailibilityByType("EPP", tasksEQState[1].Result);
|
||||
report.AddToolAvailibilityByType("HTR", tasksEQState[2].Result);
|
||||
|
||||
report.AddToolStateByType("ASM", tasksState[0].Result);
|
||||
report.AddToolStateByType("EPP", tasksState[1].Result);
|
||||
report.AddToolStateByType("HTR", tasksState[2].Result);
|
||||
report.AddToolStateByType("Metrology", tasksState[3].Result);
|
||||
report.AddToolStateByType("Cleans", tasksState[4].Result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogCritical(ex, "Failed to retrieve data back from Tool State and Tool State Trend FabTime endpoints.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
report.QuarterlyTargets = targets.Result;
|
||||
@ -165,20 +118,13 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
|
||||
report.CleanEvents = report.CleanEvents.Where(x => (x.TOOL_MODE != "PROD" || x.TOOL_MODE_DESC != "Production") && x.TOOL_MODE != "OUT").ToList();
|
||||
report.MetrologyEvents = report.MetrologyEvents.Where(x => (x.TOOL_MODE != "PROD" || x.TOOL_MODE_DESC != "Production") && x.TOOL_MODE != "OUT").ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogCritical(ex, "Failed to retrieve data back from Scrape DB endpoints.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
report.CurrentWeek.SetYieldInformation(task1.Result, report.QuarterlyTargets);
|
||||
report.PreviousWeek.SetYieldInformation(task2.Result, report.QuarterlyTargets);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogCritical(ex, "Failed to retreive data back from ReactorOuts and Scrap endpoints.");
|
||||
logger.LogCritical(ex, "Failed to retrieve data back from Scrape DB endpoints.");
|
||||
}
|
||||
|
||||
report.ReverseLists();
|
||||
@ -203,17 +149,11 @@ namespace ReportingServices.Shared.HelperClasses
|
||||
{
|
||||
List<int> reactors = new();
|
||||
|
||||
foreach (KeyValuePair<string, ToolStateByType> keyValuePairs in report.ToolStateByType)
|
||||
foreach (ToolEventView tool in report.ToolEvents)
|
||||
{
|
||||
if (keyValuePairs.Key != "Metrology" && keyValuePairs.Key != "Cleans")
|
||||
if (!tool.IsInProduction)
|
||||
{
|
||||
foreach (ToolStateCurrent tool in keyValuePairs.Value.ToolStateCurrents)
|
||||
{
|
||||
if (tool.BasicStateDescription != "Productive" && tool.ReactorStatus != "Out of Service")
|
||||
{
|
||||
reactors.Add(int.Parse(tool.Tool.Substring(1)));
|
||||
}
|
||||
}
|
||||
reactors.Add(int.Parse(tool.Reactor));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user