Updated appsettings.json file to change base api url based on environment. Also fixed bug in calculation of yield percentage.

This commit is contained in:
Daniel Wathen
2023-01-05 15:10:40 -07:00
parent 3922d28a8b
commit 6de41bc8da
7 changed files with 49 additions and 33 deletions

View File

@ -1,5 +1,4 @@
using ReportingServices.Shared.Repositories;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.ViewModels.ProductionReport;
namespace ReportingServices.Shared.HelperClasses
@ -8,10 +7,8 @@ namespace ReportingServices.Shared.HelperClasses
{
private static readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
private static readonly string _SLLFilePath = "wwwroot/Assets/SLLTools.json";
private static readonly string _baseUrlFabtime = "https://localhost:7196/api/FabTime/";
private static readonly string _baseUrlScrapeDb = "https://localhost:7196/api/ScrapeDB/";
public static DailyReport SetUpDailyReport()
public static DailyReport SetUpDailyReport(string baseUrlFabtime, string baseUrlScrapeDb)
{
List<Task<List<EquipmentStateByDay>>> tasksEQState = new();
List<Task<List<ToolStateCurrent>>> tasksState = new();
@ -21,21 +18,21 @@ namespace ReportingServices.Shared.HelperClasses
ManualReportEntries = JsonFileHandler.LoadJSONFile<ManualReportEntries>(_dailyRptFilePath)
};
Task<YieldInformation> task1 = ApiCaller.GetApi<YieldInformation>(_baseUrlFabtime + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString());
Task<YieldInformation> task2 = ApiCaller.GetApi<YieldInformation>(_baseUrlFabtime + "ReactorOuts?startDate=" + report.StartDate.AddDays(-7).ToString() + "&endDate=" + report.StartDate.ToString());
Task<YieldInformation> task1 = ApiCaller.GetApi<YieldInformation>(baseUrlFabtime + "ReactorOuts?startDate=" + report.StartDate.ToString() + "&endDate=" + DateTime.Now.ToString());
Task<YieldInformation> task2 = ApiCaller.GetApi<YieldInformation>(baseUrlFabtime + "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"));
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"));
Task<QuarterlyTargets> targets = ApiCaller.GetApi<QuarterlyTargets>(_baseUrlScrapeDb + "Targets");
Task<List<RDS>> rds = ApiCaller.GetApi<List<RDS>>(_baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString());
Task<List<Reactor>> reactors = ApiCaller.GetApi<List<Reactor>>(_baseUrlScrapeDb + "Reactors");
Task<QuarterlyTargets> targets = ApiCaller.GetApi<QuarterlyTargets>(baseUrlScrapeDb + "Targets");
Task<List<RDS>> rds = ApiCaller.GetApi<List<RDS>>(baseUrlScrapeDb + "RDS?date=" + report.StartDate.ToString());
Task<List<Reactor>> reactors = ApiCaller.GetApi<List<Reactor>>(baseUrlScrapeDb + "Reactors");
report.AddToolAvailibilityByType("ASM", tasksEQState[0].Result);
report.AddToolAvailibilityByType("EPP", tasksEQState[1].Result);