Updated daily report to show correct information when two work weeks split quarters.

Also current changes to project with Blazor implementation is implemented here as well.
This commit is contained in:
Daniel Wathen
2023-04-03 09:58:28 -07:00
parent f77d723576
commit 72e7a55ab4
305 changed files with 148901 additions and 4 deletions

View File

@ -0,0 +1,43 @@
using ReportingServices.Shared.Blazor.Models.PlanningReport;
using ReportingServices.Shared.Blazor.Models.ProductionReport;
using System.Text.Json;
namespace ReportingServices.Blazor.Services;
public class ScrapeDBService
{
private readonly string APIUrl = "https://localhost:7196/api/ScrapeDB/";
public async Task<List<NCR>> GetNCRsAsync() => await GetApi<List<NCR>>(APIUrl + "GetCurrentNCRs");
public async Task<List<HoldLot>> GetHoldLotsAsync() => await GetApi<List<HoldLot>>(APIUrl + "GetCurrentHoldLots");
public async Task<int> GetPartChangesAsync(DateTime startDate, DateTime endDate) =>
await GetApi<int>(APIUrl + "PartChanges?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString());
public async Task<List<ReactorPSNWORuns>> GetReactorRunsAsync(DateTime startDate, DateTime endDate) =>
await GetApi<List<ReactorPSNWORuns>>(APIUrl + "PSNWO?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString());
public async Task<YieldInformation> GetReactorAndScrapOutsAsync(DateTime startDate, DateTime endDate) =>
await GetApi<YieldInformation>(APIUrl + "ReactorOuts?startDate=" + startDate + "&endDate=" + endDate);
public async Task<QuarterlyTargets> GetTargetsAsync() => await GetApi<QuarterlyTargets>(APIUrl + "Targets");
public async Task<DateTime> GetQuarterStartDate() => await GetApi<DateTime>(APIUrl + "GetQuarterStartDate");
public async Task<OutsAndScrapTotal> GetOutsAndScrapAsync(DateTime startDate, DateTime endDate) =>
await GetApi<OutsAndScrapTotal>(APIUrl + "GetOutsAndScrapTotals?startDate=" + startDate + "&endDate=" + endDate);
private async Task<T> GetApi<T>(string url)
{
T deserializedJson = default;
using (HttpClient client = new())
{
string apiResponse = await client.GetStringAsync(url);
deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
}
return deserializedJson;
}
}