Cleaned up references to repositories in the UI that were overlooked

This commit is contained in:
Daniel Wathen
2023-01-04 14:32:13 -07:00
parent 1adb303d99
commit e3b4e68425
4 changed files with 6 additions and 355 deletions

View File

@ -6,16 +6,9 @@ namespace ReportingServices.Shared.HelperClasses
{
public static class DailyReportHelper
{
private static IFabTimeReportingRepository _fabTimeReportingRepository;
private static IScrapeDatabaseRepository _scrapeDatabaseRepository;
private static readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
private static readonly string _baseUrlFabtime = "https://localhost:7196/api/FabTime/";
public static void SetRepositories(IFabTimeReportingRepository fabTimeReportingRepository, IScrapeDatabaseRepository scrapeDatabaseRepository)
{
_fabTimeReportingRepository = fabTimeReportingRepository;
_scrapeDatabaseRepository = scrapeDatabaseRepository;
}
private static readonly string _baseUrlScrapeDb = "https://localhost:7196/api/ScrapeDB/";
public async static Task<DailyReport> SetUpDailyReport()
{
@ -35,15 +28,13 @@ namespace ReportingServices.Shared.HelperClasses
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(_baseUrlFabtime + "ToolState?toolType=Metrology"));
tasksState.Add(ApiCaller.GetApi<List<ToolStateCurrent>>(_baseUrlFabtime + "ToolState?toolType=Cleans"));
report.QuarterlyTargets = _scrapeDatabaseRepository.GetQuarterlyTargets();
report.QuarterlyTargets = await ApiCaller.GetApi<QuarterlyTargets>(_baseUrlScrapeDb + "Targets");
Dictionary<string, List<ManualReportEntries>> entries = JsonFileHandler.LoadJSONFile<Dictionary<string, List<ManualReportEntries>>>(_dailyRptFilePath);
report.CurrentEntries = entries["Current Week"];
report.PreviousEntries = entries["Previous Week"];
report.SetRDSInfo(_scrapeDatabaseRepository.GetRDSForLastDay());
report.AddToolAvailibilityByType("ASM", tasksEQState[0].Result);
report.AddToolAvailibilityByType("EPP", tasksEQState[1].Result);
report.AddToolAvailibilityByType("HTR", tasksEQState[2].Result);
@ -54,7 +45,8 @@ namespace ReportingServices.Shared.HelperClasses
report.AddToolStateByType("Metrology", tasksState[3].Result);
report.AddToolStateByType("Cleans", tasksState[4].Result);
report.SetReactorInfo(_scrapeDatabaseRepository.GetReactors(), GetUnscheduledReactors(report));
report.SetRDSInfo(await ApiCaller.GetApi<List<RDS>>(_baseUrlScrapeDb + "RDS"));
report.SetReactorInfo(await ApiCaller.GetApi<List<Reactor>>(_baseUrlScrapeDb + "Reactors"), GetUnscheduledReactors(report));
report.CurrentWeek.SetYieldInformation(task1.Result);
report.PreviousWeek.SetYieldInformation(task2.Result);

View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Repositories;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.HelperClasses;
@ -7,14 +6,8 @@ namespace ReportingServices.UI.Controllers
{
public class PlanningReportController : Controller
{
private readonly IScrapeDatabaseRepository _scrapeDatabaseRepository;
private readonly string _baseUrl = "https://localhost:7196/api/ScrapeDB/";
public PlanningReportController(IScrapeDatabaseRepository scrapeDatabaseRepository)
{
_scrapeDatabaseRepository = scrapeDatabaseRepository;
}
public IActionResult Index()
{
return View();

View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Repositories;
using ReportingServices.Shared.HelperClasses;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.ViewModels.ProductionReport;
@ -8,18 +7,13 @@ namespace ReportingServices.UI.Controllers
{
public class ProductionReportController : Controller
{
private readonly IScrapeDatabaseRepository _scrapeDatabaseRepository;
private readonly IFabTimeReportingRepository _fabTimeReportingRepository;
private readonly ILogger<ProductionReportController> _logger;
private readonly int _reportIndex = (int)DateTime.Now.DayOfWeek;
private readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
private readonly string _toolStateOwnerFilePath = "wwwroot/Assets/ToolStates.json";
public ProductionReportController(IScrapeDatabaseRepository scrapeDatabaseRepository,
IFabTimeReportingRepository fabTimeReportingRepository, ILogger<ProductionReportController> logger)
public ProductionReportController(ILogger<ProductionReportController> logger)
{
_scrapeDatabaseRepository = scrapeDatabaseRepository;
_fabTimeReportingRepository = fabTimeReportingRepository;
_logger = logger;
}
@ -33,7 +27,6 @@ namespace ReportingServices.UI.Controllers
{
try
{
DailyReportHelper.SetRepositories(_fabTimeReportingRepository, _scrapeDatabaseRepository);
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport().Result;
Dictionary<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);

File diff suppressed because one or more lines are too long