Added backend API project to segregate responsibilites - Data is now handled in API project and business is all handled in UI project.

This commit is contained in:
Daniel Wathen 2023-01-04 14:19:59 -07:00
parent 80696e5fe6
commit 1adb303d99
33 changed files with 762 additions and 95 deletions

View File

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Repositories;
namespace ReportingServices.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FabTimeController : ControllerBase
{
private readonly IFabTimeReportingRepository _fabTimeReportingRepository;
public FabTimeController(IFabTimeReportingRepository fabTimeReportingRepository)
{
_fabTimeReportingRepository = fabTimeReportingRepository;
}
[HttpGet("ReactorOuts")]
public async Task<List<ReactorOutsByRDS>> GetReactorOuts(string startDate, string endDate)
{
return await _fabTimeReportingRepository.GetMovesTrendData(startDate, endDate);
}
[HttpGet("ToolStateTrend")]
public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType)
{
return await _fabTimeReportingRepository.GetToolStateTrendData(toolType);
}
[HttpGet("ToolState")]
public async Task<List<ToolStateCurrent>> GetToolStateData(string toolType)
{
return await _fabTimeReportingRepository.GetToolStateData(toolType);
}
}
}

View File

@ -0,0 +1,58 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Repositories;
namespace ReportingServices.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ScrapeDBController : ControllerBase
{
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository)
{
_scrapeDBRepository = scrapeDBRepository;
}
[HttpGet("Scrap")]
public List<ScrapByDay> GetScrapByDay(List<ReactorOutsByRDS> outs)
{
return _scrapeDBRepository.GetScrapByDay(outs);
}
[HttpGet("PSNWO")]
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate)
{
var path = Environment.CurrentDirectory;
return _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
}
[HttpGet("PartChanges")]
public int GetNumberOfPartChanges(string startDate, string endDate)
{
return _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
}
[HttpGet("Targets")]
public QuarterlyTargets GetQuarterlyTargets()
{
return _scrapeDBRepository.GetQuarterlyTargets();
}
[HttpGet("Reactors")]
public List<Reactor> GetReactors()
{
return _scrapeDBRepository.GetReactors();
}
[HttpGet("RDS")]
public List<RDS> GetRDSForLastDay()
{
return _scrapeDBRepository.GetRDSForLastDay();
}
}
}

View File

@ -0,0 +1,29 @@
using ReportingServices.Shared.Repositories;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<IFabTimeReportingRepository, FabTimeReportingRepository>();
builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:43372",
"sslPort": 44364
}
},
"profiles": {
"ReportingServicesAPIs": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7196;http://localhost:5196",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>disable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReportingServices.Shared\ReportingServices.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -0,0 +1,22 @@
using ReportingServices.Shared.Models.ProductionReport;
using System.Net.Http.Json;
using System.Text.Json;
namespace ReportingServices.Shared.HelperClasses
{
public static class ApiCaller
{
public static async Task<T> GetApi<T>(string url)
{
T deserializedJson;
using (HttpClient client = new())
{
string apiResponse = await client.GetStringAsync(url);
deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
}
return deserializedJson;
}
}
}

View File

@ -9,6 +9,7 @@ namespace ReportingServices.Shared.HelperClasses
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)
{
@ -16,21 +17,23 @@ namespace ReportingServices.Shared.HelperClasses
_scrapeDatabaseRepository = scrapeDatabaseRepository;
}
public static DailyReport SetUpDailyReport()
public async static Task<DailyReport> SetUpDailyReport()
{
List<Task> tasks = new();
List<Task<List<EquipmentStateByDay>>> tasksEQState = new();
List<Task<List<ToolStateCurrent>>> tasksState = new();
DailyReport report = new();
Task<List<ReactorOutsByRDS>> task1 = _fabTimeReportingRepository.GetMovesTrendData();
Task<List<ReactorOutsByRDS>> task2 = _fabTimeReportingRepository.GetMovesTrendData(startDate: report.StartDate.AddDays(-7).ToString(), endDate: report.StartDate.ToString());
tasks.Add(_fabTimeReportingRepository.GetToolStateTrendData(report, "ASM"));
tasks.Add(_fabTimeReportingRepository.GetToolStateTrendData(report, "EPP"));
tasks.Add(_fabTimeReportingRepository.GetToolStateTrendData(report, "HTR"));
tasks.Add(_fabTimeReportingRepository.GetToolStateData(report, "ASM"));
tasks.Add(_fabTimeReportingRepository.GetToolStateData(report, "EPP"));
tasks.Add(_fabTimeReportingRepository.GetToolStateData(report, "HTR"));
tasks.Add(_fabTimeReportingRepository.GetToolStateData(report, "Metrology"));
tasks.Add(_fabTimeReportingRepository.GetToolStateData(report, "Cleans"));
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"));
report.QuarterlyTargets = _scrapeDatabaseRepository.GetQuarterlyTargets();
@ -41,15 +44,20 @@ namespace ReportingServices.Shared.HelperClasses
report.SetRDSInfo(_scrapeDatabaseRepository.GetRDSForLastDay());
Task.WaitAll(tasks.ToArray());
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);
report.SetReactorInfo(_scrapeDatabaseRepository.GetReactors(), GetUnscheduledReactors(report));
List<ScrapByDay> scrap = _scrapeDatabaseRepository.GetScrapByDay(task1.Result);
List<ScrapByDay> previousScrap = _scrapeDatabaseRepository.GetScrapByDay(task2.Result);
report.CurrentWeek.SetYieldInformation(task1.Result, scrap);
report.PreviousWeek.SetYieldInformation(task2.Result, previousScrap);
report.CurrentWeek.SetYieldInformation(task1.Result);
report.PreviousWeek.SetYieldInformation(task2.Result);
report.ReverseLists();

View File

@ -1,9 +1,14 @@
namespace ReportingServices.Shared.Models.PlanningReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.PlanningReport
{
public class ReactorPSNWORuns
{
[JsonPropertyName("REACTOR")]
public string REACTOR { get; set; }
[JsonPropertyName("PSN")]
public string PSN { get; set; }
[JsonPropertyName("WO_COUNT")]
public int WO_COUNT { get; set; }
}
}

View File

@ -1,8 +1,12 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class EquipmentStateByDay
{
[JsonPropertyName("StartTime")]
public string StartTime { get; set; }
[JsonPropertyName("AvailablePct")]
public string AvailablePct { get; set; }
}
}

View File

@ -1,10 +1,16 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class QuarterlyTargets
{
[JsonPropertyName("Reactor_Outs")]
public int Reactor_Outs { get; set; }
[JsonPropertyName("Yield_Outs")]
public int Yield_Outs { get; set; }
[JsonPropertyName("IFX_Scrap")]
public int IFX_Scrap { get; set; }
[JsonPropertyName("Yield")]
public float Yield { get; set; }
}
}

View File

@ -1,11 +1,18 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class RDS
{
[JsonPropertyName("Reactor")]
public int Reactor { get; set; }
[JsonPropertyName("ReactorType")]
public string ReactorType { get; set; }
[JsonPropertyName("DateOut")]
public DateTime DateOut { get; set; }
[JsonPropertyName("UnloadTemp")]
public int UnloadTemp { get; set; }
[JsonPropertyName("LayerType")]
public string LayerType { get; set; }
}
}

View File

@ -1,10 +1,16 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class Reactor
{
[JsonPropertyName("ReactorNumber")]
public int ReactorNumber { get; set; }
[JsonPropertyName("Type")]
public string Type { get; set; }
[JsonPropertyName("PocketSize")]
public string PocketSize { get; set; }
[JsonPropertyName("HasDisabledLoadLock")]
public bool HasDisabledLoadlock { get; set; }
}
}

View File

@ -1,9 +1,14 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class ReactorOutsByRDS
{
[JsonPropertyName("RDS_NO")]
public string RDS_NO { get; set; }
[JsonPropertyName("Units")]
public string Units { get; set; }
[JsonPropertyName("EndProcessTime")]
public string EndProcessTime { get; set; }
}
}

View File

@ -1,11 +1,18 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class ScrapByDay
{
[JsonPropertyName("StartDate")]
public string StartDate { get; set; }
[JsonPropertyName("TW_PROD")]
public int TW_PROD { get; set; }
[JsonPropertyName("TOT_REJ_CUST")]
public int TOT_REJ_CUST { get; set; }
[JsonPropertyName("TOT_REJ_MANU")]
public int TOT_REJ_MANU { get; set; }
[JsonPropertyName("TOT_REJ_WFRS")]
public int TOT_REJ_WFRS { get; set; }
}
}

View File

@ -1,14 +1,24 @@
namespace ReportingServices.Shared.Models.ProductionReport
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class ToolStateCurrent
{
[JsonPropertyName("Tool")]
public string Tool { get; set; }
[JsonPropertyName("TranTime")]
public string TranTime { get; set; }
[JsonPropertyName("GanttEndTime")]
public string GanttEndTime { get; set; }
[JsonPropertyName("GanttElapsedHours")]
public string GanttElapsedHours { get; set; }
[JsonPropertyName("BasicStateDescription")]
public string BasicStateDescription { get; set; }
[JsonPropertyName("SubState")]
public string SubState { get; set; }
[JsonPropertyName("ReactorStatus")]
public string ReactorStatus { get; set; }
[JsonPropertyName("Comment")]
public string Comment { get; set; }
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace ReportingServices.Shared.Models.ProductionReport
{
public class YieldInformation
{
[JsonPropertyName("Outs")]
public List<ReactorOutsByRDS> Outs { get; set; }
[JsonPropertyName("Scrap")]
public List<ScrapByDay> Scrap { get; set; }
}
}

View File

@ -17,16 +17,14 @@ namespace ReportingServices.Shared.Repositories
return await GetJsonData<List<ReactorOutsByRDS>>(url);
}
public async Task GetToolStateTrendData(DailyReport rpt, string toolType)
public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType)
{
string url = APIHelperFunctions.GenerateURLWithParameters(chart: "TOOLSTATE", periodLen: "24", capacityTypesLike: toolType, toolsLike: _toolFilter);
rpt.AddToolAvailibilityByType(toolType, await GetJsonData<List<EquipmentStateByDay>>(url));
return;
return await GetJsonData<List<EquipmentStateByDay>>(url);
}
public async Task GetToolStateData(DailyReport rpt, string toolType)
public async Task<List<ToolStateCurrent>> GetToolStateData(string toolType)
{
string capacityFilter = toolType == "ASM" ? toolType + "%2CASM%2B" : toolType;
string startDate = HttpUtility.UrlEncode(APIHelperFunctions.GetDateWithOffsetAsAPIString(DateTime.Now.ToString(), -12.5f));
@ -34,9 +32,7 @@ namespace ReportingServices.Shared.Repositories
string url = APIHelperFunctions.GenerateURLWithParameters(chart: "ToolStateGantt", periodLen: "24",
capacityTypesLike: capacityFilter, toolsLike: _toolFilter, startDate: startDate);
rpt.AddToolStateByType(toolType, await GetJsonData<List<ToolStateCurrent>>(url));
return;
return await GetJsonData<List<ToolStateCurrent>>(url);
}
public async Task<T> GetJsonData<T>(string url)

View File

@ -6,8 +6,8 @@ namespace ReportingServices.Shared.Repositories
public interface IFabTimeReportingRepository
{
public Task<List<ReactorOutsByRDS>> GetMovesTrendData(string startDate = "", string endDate = "");
public Task GetToolStateTrendData(DailyReport rpt, string toolType);
public Task GetToolStateData(DailyReport rpt, string toolType);
public Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType);
public Task<List<ToolStateCurrent>> GetToolStateData(string toolType);
public Task<T> GetJsonData<T>(string url);
}
}

View File

@ -15,10 +15,10 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
IsCurrentWeek = isCurrentWeek;
}
public void SetYieldInformation(List<ReactorOutsByRDS> outs, List<ScrapByDay> scrap)
public void SetYieldInformation(YieldInformation yieldInformation)
{
OutsByDay = GetReactorOutsByDay(outs);
ScrapByDay = scrap;
OutsByDay = GetReactorOutsByDay(yieldInformation.Outs);
ScrapByDay = yieldInformation.Scrap;
}
public static List<string> GetDistinctDatesFromReactorOuts(List<ReactorOutsByRDS> outs)

View File

@ -1,12 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Repositories;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.HelperClasses;
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)
{
@ -18,10 +20,13 @@ namespace ReportingServices.UI.Controllers
return View();
}
public IActionResult WeeklyPartChangesReport(DateTime startDate, DateTime endDate)
public async Task<IActionResult> WeeklyPartChangesReport(DateTime startDate, DateTime endDate)
{
int numberOfPartChanges = _scrapeDatabaseRepository.GetNumberOfPartChanges(startDate.ToString(), endDate.ToString());
List<ReactorPSNWORuns> reactorPSNWORuns = _scrapeDatabaseRepository.GetReactorPSNWORuns(startDate.ToString(), endDate.ToString());
string partChangeUrl = _baseUrl + "PartChanges?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString();
string psnwoRunsUrl = _baseUrl + "PSNWO?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString();
int numberOfPartChanges = await ApiCaller.GetApi<int>(partChangeUrl);
List<ReactorPSNWORuns> reactorPSNWORuns = await ApiCaller.GetApi<List<ReactorPSNWORuns>>(psnwoRunsUrl);
WeeklyPartChanges weeklyPartChanges = new()
{

View File

@ -34,7 +34,7 @@ namespace ReportingServices.UI.Controllers
try
{
DailyReportHelper.SetRepositories(_fabTimeReportingRepository, _scrapeDatabaseRepository);
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport();
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport().Result;
Dictionary<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);
dailyReport.ToolStatesByOwner = toolStateOwners;

View File

@ -18,8 +18,4 @@
<ProjectReference Include="..\ReportingServicesAPIs\ReportingServices.API.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="HelperClasses\" />
</ItemGroup>
</Project>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Repositories;
namespace ReportingServices.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FabTimeController : ControllerBase
{
private readonly IFabTimeReportingRepository _fabTimeReportingRepository;
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
public FabTimeController(IFabTimeReportingRepository fabTimeReportingRepository, IScrapeDatabaseRepository scrapeDBRepository)
{
_fabTimeReportingRepository = fabTimeReportingRepository;
_scrapeDBRepository = scrapeDBRepository;
}
[HttpGet("ReactorOuts")]
public async Task<YieldInformation> GetReactorOuts(string startDate, string endDate)
{
List<ReactorOutsByRDS> outs = await _fabTimeReportingRepository.GetMovesTrendData(startDate, endDate);
YieldInformation yieldInformation = new()
{
Outs = outs,
Scrap = _scrapeDBRepository.GetScrapByDay(outs)
};
return yieldInformation;
}
[HttpGet("ToolStateTrend")]
public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType)
{
return await _fabTimeReportingRepository.GetToolStateTrendData(toolType);
}
[HttpGet("ToolState")]
public async Task<List<ToolStateCurrent>> GetToolStateData(string toolType)
{
return await _fabTimeReportingRepository.GetToolStateData(toolType);
}
}
}

View File

@ -0,0 +1,50 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Repositories;
namespace ReportingServices.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ScrapeDBController : ControllerBase
{
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository)
{
_scrapeDBRepository = scrapeDBRepository;
}
[HttpGet("PSNWO")]
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate)
{
return _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
}
[HttpGet("PartChanges")]
public int GetNumberOfPartChanges(string startDate, string endDate)
{
return _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
}
[HttpGet("Targets")]
public QuarterlyTargets GetQuarterlyTargets()
{
return _scrapeDBRepository.GetQuarterlyTargets();
}
[HttpGet("Reactors")]
public List<Reactor> GetReactors()
{
return _scrapeDBRepository.GetReactors();
}
[HttpGet("RDS")]
public List<RDS> GetRDSForLastDay()
{
return _scrapeDBRepository.GetRDSForLastDay();
}
}
}

View File

@ -1,33 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace ReportingServicesAPIs.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

View File

@ -1,11 +1,14 @@
using ReportingServices.Shared.Repositories;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<IFabTimeReportingRepository, FabTimeReportingRepository>();
builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
var app = builder.Build();

View File

@ -10,4 +10,8 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReportingServices.Shared\ReportingServices.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -1,13 +0,0 @@
namespace ReportingServicesAPIs
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}