Ran formatting through code

This commit is contained in:
Daniel Wathen 2023-01-12 13:19:05 -07:00
parent ba6d7b19e7
commit 8d65b82af6
37 changed files with 2006 additions and 1823 deletions

View File

@ -0,0 +1,268 @@
[*.cs]
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false:silent
csharp_prefer_qualified_reference = true:error
csharp_prefer_simple_default_expression = true:warning
csharp_prefer_simple_using_statement = true:warning
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
csharp_style_conditional_delegate_call = true
csharp_style_deconstructed_variable_declaration = false
csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:warning
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:warning
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = false
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_switch_expression = true:warning
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_using_directive_placement = outside_namespace:silent
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.private_of_internal_field.required_prefix = _
dotnet_naming_style.private_of_internal_field.required_suffix =
dotnet_naming_style.private_of_internal_field.word_separator =
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.delegate.applicable_kinds = delegate
dotnet_naming_symbols.delegate.required_modifiers =
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enum.applicable_kinds = enum
dotnet_naming_symbols.enum.required_modifiers =
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.event.applicable_kinds = event
dotnet_naming_symbols.event.required_modifiers =
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_accessibilities = public
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.struct.applicable_kinds = struct
dotnet_naming_symbols.struct.required_modifiers =
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.required_modifiers =
dotnet_remove_unnecessary_suppression_exclusions = 0
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members
end_of_line = crlf
file_header_template = unset
indent_size = 4
indent_style = space
insert_final_newline = false
root = true
tab_width = 4
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_local_over_anonymous_function = true:suggestion
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
# https://github.com/dotnet/project-system/blob/main/.editorconfig
[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion

View File

@ -2,20 +2,16 @@
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.Repositories;
using ReportingServices.Shared.ViewModels.ProductionReport;
namespace ReportingServices.API.Controllers
{
namespace ReportingServices.API.Controllers;
[Route("api/[controller]")]
[ApiController]
public class ScrapeDBController : ControllerBase
{
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository)
{
_scrapeDBRepository = scrapeDBRepository;
}
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository) => _scrapeDBRepository = scrapeDBRepository;
[HttpGet("ReactorOuts")]
public YieldInformation GetReactorOuts(string startDate, string endDate)
@ -31,63 +27,32 @@ namespace ReportingServices.API.Controllers
}
[HttpGet("PSNWO")]
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate)
{
return _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
}
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate) => _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
[HttpGet("PartChanges")]
public int GetNumberOfPartChanges(string startDate, string endDate)
{
return _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
}
public int GetNumberOfPartChanges(string startDate, string endDate) => _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
[HttpGet("Targets")]
public QuarterlyTargets GetQuarterlyTargets()
{
return _scrapeDBRepository.GetQuarterlyTargets();
}
public QuarterlyTargets GetQuarterlyTargets() => _scrapeDBRepository.GetQuarterlyTargets();
[HttpGet("Reactors")]
public List<Reactor> GetReactors()
{
return _scrapeDBRepository.GetReactors();
}
public List<Reactor> GetReactors() => _scrapeDBRepository.GetReactors();
[HttpGet("RDS")]
public List<RDS> GetRDSForLastDay(string date)
{
return _scrapeDBRepository.GetRDSForLastDay(date);
}
public List<RDS> GetRDSForLastDay(string date) => _scrapeDBRepository.GetRDSForLastDay(date);
[HttpGet("ReactorEvents")]
public List<ReactorEvent> GetReactorEvents(string startDate, string endDate, string reactorNumber)
{
return _scrapeDBRepository.GetReactorEvents(startDate, endDate, reactorNumber);
}
public List<ReactorEvent> GetReactorEvents(string startDate, string endDate, string reactorNumber) => _scrapeDBRepository.GetReactorEvents(startDate, endDate, reactorNumber);
[HttpGet("GetLastUpTransaction")]
public int GetLastUpTransaction(string reactorNumber)
{
return _scrapeDBRepository.GetLastUpTransaction(reactorNumber);
}
public int GetLastUpTransaction(string reactorNumber) => _scrapeDBRepository.GetLastUpTransaction(reactorNumber);
[HttpGet("ToolEvents")]
public ToolEvent GetLatestToolEvent(string toolID)
{
return _scrapeDBRepository.GetLatestToolEvent(toolID);
}
public ToolEvent GetLatestToolEvent(string toolID) => _scrapeDBRepository.GetLatestToolEvent(toolID);
[HttpGet("GetOutsAndScrapTotals")]
public OutsAndScrapTotal GetOutsAndScrapTotal(string startDate, string endDate)
{
return _scrapeDBRepository.GetOutsAndScrapTotals(startDate, endDate);
}
public OutsAndScrapTotal GetOutsAndScrapTotal(string startDate, string endDate) => _scrapeDBRepository.GetOutsAndScrapTotals(startDate, endDate);
[HttpGet("GetQuarterStartDate")]
public DateTime GetQuarterStartDate()
{
return _scrapeDBRepository.GetQuarterStartDate();
}
}
public DateTime GetQuarterStartDate() => _scrapeDBRepository.GetQuarterStartDate();
}

View File

@ -1,35 +1,39 @@
using ReportingServices.Shared.Repositories;
using Serilog;
internal class Program
{
private static void Main(string[] args)
{
LoggerConfiguration loggerConfiguration = new();
var builder = WebApplication.CreateBuilder(args);
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
Environment.SetEnvironmentVariable("workingDirectory", "D:\\tmp\\logging\\MesaReportingServices\\API");
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, builder.Configuration);
_ = SerilogHostBuilderExtensions.UseSerilog(builder.Host);
_ = loggerConfiguration.ReadFrom.Configuration(builder.Configuration);
_ = builder.Host.UseSerilog();
Log.Logger = loggerConfiguration.CreateLogger();
Serilog.ILogger log = Log.ForContext<Program>();
// Add services to the container.
builder.Services.AddControllers();
_ = builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
_ = builder.Services.AddEndpointsApiExplorer();
_ = builder.Services.AddSwaggerGen();
_ = builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
var app = builder.Build();
WebApplication app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
_ = app.UseSwagger();
_ = app.UseSwaggerUI();
}
app.UseHttpsRedirection();
_ = app.UseHttpsRedirection();
app.UseAuthorization();
_ = app.UseAuthorization();
app.MapControllers();
_ = app.MapControllers();
_ = app.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
log.Information("Starting Web APIs");
@ -45,3 +49,5 @@ finally
{
Log.CloseAndFlush();
}
}
}

View File

@ -1,7 +1,5 @@
using System.Web;
namespace ReportingServices.Shared.HelperClasses;
namespace ReportingServices.Shared.HelperClasses
{
public static class APIHelperFunctions
{
public static string GetBeginningOfWeekAsAPIString()
@ -53,4 +51,3 @@ namespace ReportingServices.Shared.HelperClasses
return temp;
}
}
}

View File

@ -1,14 +1,12 @@
using ReportingServices.Shared.Models.ProductionReport;
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json;
namespace ReportingServices.Shared.HelperClasses;
namespace ReportingServices.Shared.HelperClasses
{
public static class ApiCaller
{
public static async Task<T> GetApi<T>(string url)
{
T deserializedJson = default(T);
T deserializedJson = default;
using (HttpClient client = new())
{
@ -19,4 +17,3 @@ namespace ReportingServices.Shared.HelperClasses
return deserializedJson;
}
}
}

View File

@ -2,8 +2,8 @@
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.ViewModels.ProductionReport;
namespace ReportingServices.Shared.HelperClasses
{
namespace ReportingServices.Shared.HelperClasses;
public static class DailyReportHelper
{
private static readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
@ -108,7 +108,7 @@ namespace ReportingServices.Shared.HelperClasses
report.SetRDSInfo(rds.Result);
report.SetReactorInfo(reactors, GetUnscheduledReactors(report));
foreach (var task in toolEvents)
foreach (Task<List<ReactorEvent>> task in toolEvents)
{
ToolEventView toolEvent = new(task.Result,
report.StartDate.ToString(), DateTime.Now.ToString(), task.Result[0].REACT_NO,
@ -120,7 +120,7 @@ namespace ReportingServices.Shared.HelperClasses
}
report.ToolEvents = report.ToolEvents
.Where(x => x.Reactor != "100" && x.Reactor != "101" && x.Reactor != "47")
.Where(x => x.Reactor is not "100" and not "101" and not "47")
.OrderBy(x => x.Reactor)
.ToList();
@ -179,4 +179,3 @@ namespace ReportingServices.Shared.HelperClasses
return reactors;
}
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json;
namespace ReportingServices.Shared.HelperClasses
{
namespace ReportingServices.Shared.HelperClasses;
public static class JsonFileHandler
{
public static T LoadJSONFile<T>(string file)
@ -16,4 +16,3 @@ namespace ReportingServices.Shared.HelperClasses
File.WriteAllText(file, json);
}
}
}

View File

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

View File

@ -1,5 +1,5 @@
namespace ReportingServices.Shared.Models.PlanningReport
{
namespace ReportingServices.Shared.Models.PlanningReport;
public class WeeklyPartChanges
{
public int TotalPartChanges { get; set; }
@ -7,4 +7,3 @@
public string EndDate { get; set; }
public List<ReactorPSNWORuns> ReactorPSNWORuns { get; set; }
}
}

View File

@ -1,5 +1,5 @@
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ManualReportEntries
{
public int OperatorHeadcountDays { get; set; }
@ -18,4 +18,3 @@
public string DailyPartChanges { get; set; }
public string WeeklyPartChanges { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class OutsAndScrapTotal
{
[JsonPropertyName("Outs")]
@ -13,4 +13,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("ProductionScrap")]
public int ProductionScrap { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class QuarterlyTargets
{
[JsonPropertyName("Reactor_Outs")]
@ -15,4 +15,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("PlanWorkingDays")]
public int PlanWorkingDays { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class RDS
{
[JsonPropertyName("Reactor")]
@ -15,4 +15,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("LayerType")]
public string LayerType { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class Reactor
{
[JsonPropertyName("ReactorNumber")]
@ -13,4 +13,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("HasDisabledLoadLock")]
public bool HasDisabledLoadlock { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ReactorEvent
{
[JsonPropertyName("REACT_NO")]
@ -13,4 +13,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("REACT_MODE")]
public string REACT_MODE { get; set; }
}
}

View File

@ -1,8 +1,7 @@
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ReactorOutsByDay
{
public string StartDate { get; set; }
public int TotalWafers { get; set; }
}
}

View File

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

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ScrapByDay
{
[JsonPropertyName("StartDate")]
@ -15,4 +15,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("TOT_REJ_WFRS")]
public int TOT_REJ_WFRS { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ToolEvent
{
[JsonPropertyName("TOOL_ID")]
@ -13,4 +13,3 @@ namespace ReportingServices.Shared.Models.ProductionReport
[JsonPropertyName("TOOL_MODE_DESC")]
public string TOOL_MODE_DESC { get; set; }
}
}

View File

@ -1,8 +1,7 @@
namespace ReportingServices.Shared.Models.ProductionReport
{
namespace ReportingServices.Shared.Models.ProductionReport;
public class ToolUptimeData
{
public string Date { get; set; }
public double UptimePercentage { get; set; }
}
}

View File

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

View File

@ -1,25 +1,20 @@
using Microsoft.Data.SqlClient;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport;
using System.Collections.Generic;
using System.Data;
namespace ReportingServices.Shared.Repositories
{
namespace ReportingServices.Shared.Repositories;
public class ScrapeDatabaseRepository : IScrapeDatabaseRepository
{
private SqlConnection _connection;
private readonly string _connectionString;
public ScrapeDatabaseRepository()
{
_connectionString = "Server=MESSV01EC.EC.LOCAL\\PROD1,53959;Database=LSL2SQL;User Id=srpadmin;Password=0okm9ijn;TrustServerCertificate=true";
}
public ScrapeDatabaseRepository() => _connectionString = "Server=MESSV01EC.EC.LOCAL\\PROD1,53959;Database=LSL2SQL;User Id=srpadmin;Password=0okm9ijn;TrustServerCertificate=true";
public void OpenConnection()
{
if (_connection == null)
_connection = new SqlConnection(_connectionString);
_connection ??= new SqlConnection(_connectionString);
if (_connection.State != ConnectionState.Open)
_connection.Open();
@ -45,12 +40,12 @@ namespace ReportingServices.Shared.Repositories
"GROUP BY REACTOR) AS l WHERE PCHANGE > 0";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@startDate", startDate);
cmd.Parameters.AddWithValue("@endDate", endDate);
_ = cmd.Parameters.AddWithValue("@startDate", startDate);
_ = cmd.Parameters.AddWithValue("@endDate", endDate);
using (SqlDataReader reader = cmd.ExecuteReader())
{
reader.Read();
_ = reader.Read();
result = int.Parse(reader[0].ToString());
}
@ -70,7 +65,7 @@ namespace ReportingServices.Shared.Repositories
foreach (ReactorOutsByRDS rout in outs)
rdsNumbers = rdsNumbers + "'" + rout.RDS_NO + "', ";
rdsNumbers = rdsNumbers.Substring(0, rdsNumbers.Length - 2);
rdsNumbers = rdsNumbers[..^2];
OpenConnection();
@ -123,8 +118,8 @@ namespace ReportingServices.Shared.Repositories
"ORDER BY 1";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@startDate", startDate);
cmd.Parameters.AddWithValue("@endDate", endDate);
_ = cmd.Parameters.AddWithValue("@startDate", startDate);
_ = cmd.Parameters.AddWithValue("@endDate", endDate);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -249,7 +244,7 @@ namespace ReportingServices.Shared.Repositories
"WHERE DATE_OUT >= @date";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@date", date);
_ = cmd.Parameters.AddWithValue("@date", date);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -286,8 +281,8 @@ namespace ReportingServices.Shared.Repositories
"ORDER BY DATE_OUT ASC";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@startDate", startDate);
cmd.Parameters.AddWithValue("@endDate", endDate);
_ = cmd.Parameters.AddWithValue("@startDate", startDate);
_ = cmd.Parameters.AddWithValue("@endDate", endDate);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -337,9 +332,9 @@ namespace ReportingServices.Shared.Repositories
"ORDER BY EVENT_DTM ASC";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@startDate", startDate);
cmd.Parameters.AddWithValue("@endDate", endDate);
cmd.Parameters.AddWithValue("@reactorNumber", reactorNumber);
_ = cmd.Parameters.AddWithValue("@startDate", startDate);
_ = cmd.Parameters.AddWithValue("@endDate", endDate);
_ = cmd.Parameters.AddWithValue("@reactorNumber", reactorNumber);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -378,7 +373,7 @@ namespace ReportingServices.Shared.Repositories
"ORDER BY START_DTM DESC";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@toolID", toolID);
_ = cmd.Parameters.AddWithValue("@toolID", toolID);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -414,7 +409,7 @@ namespace ReportingServices.Shared.Repositories
"ORDER BY START_DTM DESC";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@reactorNumber", reactorNumber);
_ = cmd.Parameters.AddWithValue("@reactorNumber", reactorNumber);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -446,8 +441,8 @@ namespace ReportingServices.Shared.Repositories
" AND DATE_OUT <= @endDate";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@startDate", startDate);
cmd.Parameters.AddWithValue("@endDate", endDate);
_ = cmd.Parameters.AddWithValue("@startDate", startDate);
_ = cmd.Parameters.AddWithValue("@endDate", endDate);
using (SqlDataReader reader = cmd.ExecuteReader())
{
@ -496,4 +491,3 @@ namespace ReportingServices.Shared.Repositories
return date;
}
}
}

View File

@ -1,8 +1,8 @@
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Shared.Repositories
{
namespace ReportingServices.Shared.Repositories;
public interface IScrapeDatabaseRepository
{
public void OpenConnection();
@ -20,4 +20,3 @@ namespace ReportingServices.Shared.Repositories
public OutsAndScrapTotal GetOutsAndScrapTotals(string startDate, string endDate);
public DateTime GetQuarterStartDate();
}
}

View File

@ -1,8 +1,8 @@
using ReportingServices.Shared.HelperClasses;
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class DailyReport
{
public DateTime StartDate { get; set; }
@ -109,9 +109,9 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
private void SetUnloadTempsLessThan700(List<RDS> rdsList)
{
var rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut);
IEnumerable<IGrouping<DateTime, RDS>> rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut);
foreach (var group in rdsWithTempsLessThan700)
foreach (IGrouping<DateTime, RDS> group in rdsWithTempsLessThan700)
{
UnloadTempsByDay.Add(new UnloadTempsByDay
{
@ -128,4 +128,3 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
PreviousWeek.ScrapByDay = APIHelperFunctions.ReverseList(PreviousWeek.ScrapByDay);
}
}
}

View File

@ -1,9 +1,8 @@
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class SLLTool
{
public DateTime Date { get; set; }
public int ASM { get; set; }
public int HTR { get; set; }
}
}

View File

@ -1,8 +1,7 @@
using ReportingServices.Shared.Models.ProductionReport;
using System.Data;
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class ToolEventView
{
public string Reactor { get; set; }
@ -22,7 +21,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
EndDate = endDate;
Reactor = reactor;
Type = type;
MostRecentEvent = events[events.Count - 1];
MostRecentEvent = events[^1];
IsInProduction = EventIsProduction(MostRecentEvent.REACT_MODE);
Uptime = DetermineToolUptimeData();
}
@ -105,7 +104,7 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
if (i == Events.Count - 1)
{
if ((DateTime.Parse(EndDate).Date != compareDate))
if (DateTime.Parse(EndDate).Date != compareDate)
{
while (DateTime.Parse(EndDate).Date != compareDate)
{
@ -170,4 +169,3 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
}
}
}

View File

@ -1,9 +1,8 @@
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class UnloadTempsByDay
{
public DateTime Date { get; set; }
public int ASMUnloadsBelow700 { get; set; }
public int HTRUnloadsBelow700 { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Shared.ViewModels.ProductionReport
{
namespace ReportingServices.Shared.ViewModels.ProductionReport;
public class YieldStatistics
{
public DateTime StartDate { get; set; }
@ -59,4 +59,3 @@ namespace ReportingServices.Shared.ViewModels.ProductionReport
return outsByDay;
}
}
}

View File

@ -1,7 +1,7 @@
using ReportingServices.Shared.HelperClasses;
namespace ReportingServices.Test
{
namespace ReportingServices.Test;
[TestClass]
public class APIHelperTester
{
@ -82,7 +82,7 @@ namespace ReportingServices.Test
if (date.DayOfWeek == DayOfWeek.Sunday)
date = date.AddDays(-6);
return date.Year + "-" + date.Month + "-" + date.Day + " 0:0:0"; ;
}
return date.Year + "-" + date.Month + "-" + date.Day + " 0:0:0";
;
}
}

View File

@ -1,7 +1,5 @@
using ReportingServices.Shared.ViewModels.ProductionReport;
namespace ReportingServices.Test;
namespace ReportingServices.Test
{
[TestClass]
public class DailyReportTester
{
@ -64,4 +62,3 @@ namespace ReportingServices.Test
*/
}
}
}

View File

@ -1,7 +1,7 @@
using ReportingServices.Shared.Models.ProductionReport;
namespace ReportingServices.Test
{
namespace ReportingServices.Test;
internal static class TestingClass
{
public static readonly List<RDS> RDSList = new()
@ -183,4 +183,3 @@ namespace ReportingServices.Test
new ManualReportEntries(),
};
}
}

View File

@ -2,16 +2,13 @@
using ReportingServices.UI.Models;
using System.Diagnostics;
namespace ReportingServices.UI.Controllers
{
namespace ReportingServices.UI.Controllers;
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public HomeController(ILogger<HomeController> logger) => _logger = logger;
public IActionResult Index()
{
@ -20,9 +17,5 @@ namespace ReportingServices.UI.Controllers
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
public IActionResult Error() => View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using ReportingServices.Shared.Models.PlanningReport;
using ReportingServices.Shared.HelperClasses;
using ReportingServices.Shared.Models.PlanningReport;
namespace ReportingServices.UI.Controllers;
namespace ReportingServices.UI.Controllers
{
public class PlanningReportController : Controller
{
private readonly ILogger<PlanningReportController> _logger;
@ -17,10 +17,7 @@ namespace ReportingServices.UI.Controllers
_logger.LogInformation("Base API Address: {baseUrl}", _baseUrl);
}
public IActionResult Index()
{
return View();
}
public IActionResult Index() => View();
public async Task<IActionResult> WeeklyPartChangesReport(DateTime startDate, DateTime endDate)
{
@ -45,11 +42,9 @@ namespace ReportingServices.UI.Controllers
catch (Exception ex)
{
_logger.LogCritical(ex, "Failed to get a response from API calls.");
RedirectToAction("Error");
_ = RedirectToAction("Error");
}
return View(weeklyPartChanges);
}
}
}

View File

@ -3,8 +3,8 @@ using ReportingServices.Shared.HelperClasses;
using ReportingServices.Shared.Models.ProductionReport;
using ReportingServices.Shared.ViewModels.ProductionReport;
namespace ReportingServices.UI.Controllers
{
namespace ReportingServices.UI.Controllers;
public class ProductionReportController : Controller
{
private readonly ILogger<ProductionReportController> _logger;
@ -20,11 +20,7 @@ namespace ReportingServices.UI.Controllers
_logger.LogInformation("Base Database Address: {baseUrl}", _baseDBUrl);
}
public IActionResult Index()
{
return View();
}
public IActionResult Index() => View();
public IActionResult DailyReport()
{
@ -61,4 +57,3 @@ namespace ReportingServices.UI.Controllers
return RedirectToAction("DailyReport");
}
}
}

View File

@ -1,9 +1,8 @@
namespace ReportingServices.UI.Models
{
namespace ReportingServices.UI.Models;
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

View File

@ -1,37 +1,39 @@
using ReportingServices.Shared.Repositories;
using Serilog;
internal class Program
{
private static void Main(string[] args)
{
LoggerConfiguration loggerConfiguration = new();
var builder = WebApplication.CreateBuilder(args);
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
Environment.SetEnvironmentVariable("workingDirectory", "D:\\tmp\\logging\\MesaReportingServices\\UI");
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, builder.Configuration);
_ = SerilogHostBuilderExtensions.UseSerilog(builder.Host);
_ = loggerConfiguration.ReadFrom.Configuration(builder.Configuration);
_ = builder.Host.UseSerilog();
Log.Logger = loggerConfiguration.CreateLogger();
Serilog.ILogger log = Log.ForContext<Program>();
// Add services to the container.
builder.Services.AddControllersWithViews();
_ = builder.Services.AddControllersWithViews();
var app = builder.Build();
WebApplication app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
_ = app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
_ = app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
_ = app.UseHttpsRedirection();
_ = app.UseStaticFiles();
app.UseRouting();
_ = app.UseRouting();
app.UseAuthorization();
_ = app.UseAuthorization();
app.MapControllerRoute(
_ = app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
_ = app.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
@ -48,3 +50,5 @@ finally
{
Log.CloseAndFlush();
}
}
}

View File

@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportingServices.Shared",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E5DEBD84-0237-49D3-B6D7-6F5736174EF6}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
.config\dotnet-tools.json = .config\dotnet-tools.json
EndProjectSection
EndProject