diff --git a/.gitignore b/.gitignore index 3e759b7..7c7ee90 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,12 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/Adaptation/.editorconfig b/Adaptation/.editorconfig new file mode 100644 index 0000000..a3ebdb2 --- /dev/null +++ b/Adaptation/.editorconfig @@ -0,0 +1,336 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories +root = true + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = space +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = false + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false +file_header_template = unset + +# this. and Me. preferences +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 + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true +dotnet_style_predefined_type_for_member_access = true + +# Parentheses preferences +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 + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members + +# Expression-level preferences +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_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 + +# Field preferences +dotnet_style_readonly_field = true:warning + +# Parameter preferences +dotnet_code_quality_unused_parameters = all + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = 0 + +# New line preferences +dotnet_style_allow_multiple_blank_lines_experimental = false:warning +dotnet_style_allow_statement_immediately_after_block_experimental = true + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = false:warning +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_when_type_is_apparent = false:warning + +# Expression-bodied members +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 + +# Pattern matching preferences +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_not_pattern = true:warning +csharp_style_prefer_pattern_matching = true:warning +csharp_style_prefer_switch_expression = true:warning + +# Null-checking preferences +csharp_style_conditional_delegate_call = true + +# Modifier preferences +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 + +# Code-block preferences +csharp_prefer_braces = false +csharp_prefer_simple_using_statement = true:warning +csharp_style_namespace_declarations = file_scoped:warning + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:warning +csharp_style_deconstructed_variable_declaration = false +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +csharp_style_inlined_variable_declaration = false +csharp_style_pattern_local_over_anonymous_function = true:warning +csharp_style_prefer_index_operator = false:warning +csharp_style_prefer_null_check_over_type_check = true +csharp_style_prefer_range_operator = false:warning +csharp_style_throw_expression = true +csharp_style_unused_value_assignment_preference = discard_variable:warning +csharp_style_unused_value_expression_statement_preference = discard_variable:warning + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace + +# New line preferences +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 + +#### C# Formatting Rules #### + +# New line preferences +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 + +# Indentation preferences +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 + +# Space preferences +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 + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = warning +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +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.symbols = private_or_internal_field +dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field + +dotnet_naming_rule.enum_should_be_pascal_case.severity = warning +dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum +dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case + +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.symbols = public_or_protected_field +dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field + +dotnet_naming_rule.class_should_be_pascal_case.severity = warning +dotnet_naming_rule.class_should_be_pascal_case.symbols = class +dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.method_should_be_pascal_case.severity = warning +dotnet_naming_rule.method_should_be_pascal_case.symbols = method +dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case + +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.symbols = private_or_internal_static_field +dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_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_field_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.property_should_be_pascal_case.severity = warning +dotnet_naming_rule.property_should_be_pascal_case.symbols = property +dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method +dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method +dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method +dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.event_should_be_pascal_case.severity = warning +dotnet_naming_rule.event_should_be_pascal_case.symbols = event +dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning +dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate +dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.struct_should_be_pascal_case.severity = warning +dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct +dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.class.applicable_kinds = class +dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.class.required_modifiers = + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.struct.applicable_kinds = struct +dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.struct.required_modifiers = + +dotnet_naming_symbols.enum.applicable_kinds = enum +dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enum.required_modifiers = + +dotnet_naming_symbols.delegate.applicable_kinds = delegate +dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.delegate.required_modifiers = + +dotnet_naming_symbols.event.applicable_kinds = event +dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.event.required_modifiers = + +dotnet_naming_symbols.method.applicable_kinds = method +dotnet_naming_symbols.method.applicable_accessibilities = public +dotnet_naming_symbols.method.required_modifiers = + +dotnet_naming_symbols.private_method.applicable_kinds = method +dotnet_naming_symbols.private_method.applicable_accessibilities = private +dotnet_naming_symbols.private_method.required_modifiers = + +dotnet_naming_symbols.abstract_method.applicable_kinds = method +dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.abstract_method.required_modifiers = abstract + +dotnet_naming_symbols.static_method.applicable_kinds = method +dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_method.required_modifiers = static + +dotnet_naming_symbols.property.applicable_kinds = property +dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.property.required_modifiers = + +dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field +dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected +dotnet_naming_symbols.public_or_protected_field.required_modifiers = + +dotnet_naming_symbols.static_field.applicable_kinds = field +dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_field.required_modifiers = static + +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_field.required_modifiers = + +dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.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.begins_with_i.capitalization = pascal_case + +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_style.private_of_internal_field.capitalization = pascal_case diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs new file mode 100644 index 0000000..4b83dcf --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class BackboneComponent + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs new file mode 100644 index 0000000..5da2cda --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class BackboneStatusCache + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs new file mode 100644 index 0000000..ba939e7 --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public interface ILoggingSetupManager + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs new file mode 100644 index 0000000..4dc8f3b --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class StatusItem + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Backbone.cs b/Adaptation/Eaf/Core/Backbone.cs new file mode 100644 index 0000000..d4b6f03 --- /dev/null +++ b/Adaptation/Eaf/Core/Backbone.cs @@ -0,0 +1,48 @@ +using Adaptation.PeerGroup.GCL.Annotations; +using System; +using System.Collections.Generic; + +namespace Adaptation.Eaf.Core +{ + public class Backbone + { + public const string STATE_ERROR = "Error"; + public const string STATE_OFFLINE = "Offline"; + public const string STATE_RUNNING = "Running"; + public const string STATE_SHUTDOWN = "Shutting Down"; + public const string STATE_STARTING = "Starting"; + + protected Backbone() { } + + [NotNull] + public static Backbone Instance { get; } + [NotNull] + public ILoggingSetupManager LoggingConfigurationManager { get; set; } + public BackboneStatusCache Status { get; } + public bool IsAutomatedRestartActive { get; } + public bool IsReadyForRestart { get; } + public string StartTime { get; } + public string State { get; } + public string Name { get; } + public string ConfigurationServiceAddress { get; } + public string CellName { get; } + protected bool IsInitialized { get; set; } + protected Dictionary BackboneComponents { get; } + + public void AddBackboneComponent(BackboneComponent backboneComponent) { } + public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); } + [Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")] + public List GetAllStatuses() { throw new NotImplementedException(); } + public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); } + public List GetBackboneComponentsOfType() { throw new NotImplementedException(); } + public List GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); } + public void RegisterSubprocess(int pid) { } + [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] + public void SetStatus(string statusName, string statusValue) { } + [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] + public void SetStatus(BackboneComponent source, string statusName, string statusValue) { } + protected void CloseConnectionOfComponents(List components) { } + protected virtual void StopAllComponents() { } + protected void StopComponents(List components) { } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/EmailMessage.cs b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs new file mode 100644 index 0000000..f0c2baf --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs @@ -0,0 +1,24 @@ +using System; + +namespace Adaptation.Eaf.Core.Smtp +{ + + public class EmailMessage + { + public EmailMessage() { } + public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { } + + public string Body { get; } + public MailPriority Priority { get; } + public string Subject { get; } + + public EmailMessage PriorityHigh() { throw new NotImplementedException(); } + public EmailMessage PriorityLow() { throw new NotImplementedException(); } + public EmailMessage PriorityNormal() { throw new NotImplementedException(); } + public EmailMessage SetBody(string body) { throw new NotImplementedException(); } + public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); } + public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); } + + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/ISmtp.cs b/Adaptation/Eaf/Core/Smtp/ISmtp.cs new file mode 100644 index 0000000..3a12278 --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/ISmtp.cs @@ -0,0 +1,9 @@ +namespace Adaptation.Eaf.Core.Smtp +{ + + public interface ISmtp + { + void Send(EmailMessage message); + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/MailPriority.cs b/Adaptation/Eaf/Core/Smtp/MailPriority.cs new file mode 100644 index 0000000..18ee1af --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/MailPriority.cs @@ -0,0 +1,11 @@ +namespace Adaptation.Eaf.Core.Smtp +{ + + public enum MailPriority + { + Low = 0, + Normal = 1, + High = 2 + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs new file mode 100644 index 0000000..096cfd8 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class ChangeDataCollectionHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs new file mode 100644 index 0000000..f085c14 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class DataCollectionRequest + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs new file mode 100644 index 0000000..fd97bcb --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentEvent + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs new file mode 100644 index 0000000..1a3babd --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentException + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs new file mode 100644 index 0000000..3697004 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentSelfDescription + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs new file mode 100644 index 0000000..bc26e0f --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class GetParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs new file mode 100644 index 0000000..a9e800c --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IConnectionControl + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs new file mode 100644 index 0000000..3b98f85 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IDataTracingHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs new file mode 100644 index 0000000..2a54add --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentCommandService + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs new file mode 100644 index 0000000..a119d2b --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs @@ -0,0 +1,16 @@ +using Adaptation.PeerGroup.GCL.Annotations; + +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentControl : IPackageSource + { + [NotNull] + IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; } + [NotNull] + IEquipmentDataCollection DataCollection { get; } + [NotNull] + IEquipmentCommandService Commands { get; } + [NotNull] + IConnectionControl Connection { get; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs new file mode 100644 index 0000000..b583e8c --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentSelfDescriptionBuilder + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs new file mode 100644 index 0000000..67ef808 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IPackage + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs new file mode 100644 index 0000000..57b3215 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface ISelfDescriptionLookup + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs new file mode 100644 index 0000000..64e4621 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IVirtualParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs new file mode 100644 index 0000000..200fb13 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class SetParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs new file mode 100644 index 0000000..84511e9 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class TraceRequest + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs new file mode 100644 index 0000000..7a704b5 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs @@ -0,0 +1,39 @@ +using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; +using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; +using System; +using System.Collections.Generic; + +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentDataCollection + { + IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; } + ISelfDescriptionLookup SelfDescriptionLookup { get; } + EquipmentSelfDescription SelfDescription { get; } + IEnumerable ActiveRequests { get; } + IDataTracingHandler DataTracingHandler { get; } + + ParameterValue CreateParameterValue(EquipmentParameter parameter, object value); + void NotifyDataTracingAvailable(bool isAvailable); + void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler); + void RegisterDataTracingHandler(IDataTracingHandler handler); + void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler); + void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler); + void TriggerDeactivate(DataCollectionRequest deactivateRequest); + void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters); + void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters); + void TriggerPerformanceRestored(); + void TriggerPerformanceWarning(); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, IPackage sourcePackage); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, DateTime equipmentTimeStamp); + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs new file mode 100644 index 0000000..2c0371e --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IPackageSource + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs new file mode 100644 index 0000000..9f0b794 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs @@ -0,0 +1,20 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Adaptation.PeerGroup.GCL.Annotations; +using System; + +namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting +{ + public class ParameterValue + { + public ParameterValue(EquipmentParameter definition, object value) { } + public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { } + + public virtual object Value { get; protected internal set; } + [NotNull] + public EquipmentParameter Definition { get; } + public DateTime Timestamp { get; protected set; } + + public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); } + public override string ToString() { return base.ToString(); } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs new file mode 100644 index 0000000..852fb8d --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs @@ -0,0 +1,24 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; + +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription +{ + public class EquipmentParameter + { + public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { } + public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } + public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } + + public string Name { get; } + public string Id { get; } + public string Description { get; } + public string SourcePath { get; } + public string SourceEquipment { get; } + public ParameterTypeDefinition TypeDefinition { get; } + public bool IsTransient { get; } + public bool IsReadOnly { get; } + + public override string ToString() { return base.ToString(); } + public string ToStringWithDetails() { return base.ToString(); } + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs new file mode 100644 index 0000000..a83b45f --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs @@ -0,0 +1,12 @@ +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public class Field + { + public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { } + + public string Name { get; } + public string Description { get; } + public ParameterTypeDefinition TypeDefinition { get; } + public bool CanBeNull { get; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs new file mode 100644 index 0000000..65ad7dd --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs @@ -0,0 +1,12 @@ +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public abstract class ParameterTypeDefinition + { + public ParameterTypeDefinition(string name, string description) { } + + public string Name { get; } + public string Description { get; } + + public override string ToString() { return base.ToString(); } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs new file mode 100644 index 0000000..24c5856 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public class StructuredType : ParameterTypeDefinition + { + + public StructuredType(string name, string description, IList fields) : base(name, description) { } + + public IList Fields { get; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs new file mode 100644 index 0000000..597ace3 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +{ + public interface IConfigurationObject + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs new file mode 100644 index 0000000..0b772a2 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs @@ -0,0 +1,26 @@ +using System; + +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +{ + [System.Runtime.Serialization.DataContractAttribute(IsReference = true)] + public class ModelObjectParameterDefinition : IConfigurationObject + { + public ModelObjectParameterDefinition() { } + public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { } + public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { } + + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long Id { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string Name { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string Value { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual ModelObjectParameterType ValueType { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string EnumType { get; set; } + + public virtual ModelObjectParameterDefinition Clone() { return null; } + public virtual bool IsValidValue(string value) { return false; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs new file mode 100644 index 0000000..6f779af --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs @@ -0,0 +1,17 @@ +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +{ + public enum ModelObjectParameterType + { + String = 0, + Bool = 1, + Byte = 2, + SignedByte = 3, + Integer = 4, + UnsignedInteger = 5, + LongInteger = 6, + UnsignedLongInteger = 7, + Double = 8, + Float = 9, + Enum = 10 + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs new file mode 100644 index 0000000..91493b0 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs @@ -0,0 +1,44 @@ +using Adaptation.PeerGroup.GCL.SecsDriver; +using System; + +namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances +{ + [System.Runtime.Serialization.DataContractAttribute] + public class SecsConnectionConfiguration + { + public SecsConnectionConfiguration() { } + + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T6HsmsControlMessage { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T5ConnectionSeperation { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T4InterBlock { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T3MessageReply { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T2Protocol { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T1InterCharacter { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual SerialBaudRate? BaudRate { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual SecsTransportType? PortType { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? Port { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan LinkTestTimer { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string Host { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? DeviceId { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual HsmsSessionMode? SessionMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual HsmsConnectionMode? ConnectionMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T7ConnectionIdle { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual TimeSpan T8NetworkIntercharacter { get; set; } + } +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/FileRead.cs b/Adaptation/FileHandlers/FileRead.cs new file mode 100644 index 0000000..0e74689 --- /dev/null +++ b/Adaptation/FileHandlers/FileRead.cs @@ -0,0 +1,293 @@ +using Adaptation.Helpers; +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using log4net; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Text.RegularExpressions; + +namespace Adaptation.FileHandlers +{ + + public partial class FileRead : ILogic + { + + private string _LastLines; + private ConfigData _ConfigData; + + + public FileRead() + { + _LastLines = string.Empty; + Logistics = new Logistics(); + _Log = LogManager.GetLogger(typeof(FileRead)); + } + + public ILogic ShallowCopy() + { + return (ILogic)MemberwiseClone(); + } + + public void WaitForThread() + { + WaitForThread(thread: null, threadExceptions: null); + } + + public Tuple GetOpenInsightTuple() + { + Tuple restuls = new Tuple(_ConfigData.OpenInsightSiViewer, _ConfigData); + return restuls; + } + + public Tuple> GetExtractResult(string reportFullPath, string eventName) + { + Tuple> results; + _FileParameter.Clear(); + DateTime dateTime = DateTime.Now; + if (_ConfigData.IsEvent && _ConfigData.Duplicator is null) + results = GetExtractResult(reportFullPath); + else if (_ConfigData.Duplicator.HasValue) + results = GetDuplicatorExtractResult(reportFullPath, dateTime); + else + throw new Exception(); + if (results.Item2 is null) + results = new Tuple>(results.Item1, JsonSerializer.Deserialize("[]"), results.Item3); + int count = results.Item2.Value.GetArrayLength(); + if (count > 0 && _ConfigData.EafHosted) + WritePDSF(results.Item2.Value); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + private Tuple> GetExtractResult(string reportFullPath) + { + Tuple> results = new Tuple>(string.Empty, null, new List()); + FileInfo fileInfo = new FileInfo(reportFullPath); + Logistics = new Logistics(ConfigData.NullData, _ConfigData.CellNames, _ConfigData.MesEntities, fileInfo, useSplitForMID: false); + SetFileParameterLotID(Logistics.MID); + if (_Configuration.SourceFileFilter == "*") + _Log.Debug("Share transfer"); + else if (fileInfo.Length < ConfigData.MinFileLength) + results.Item3.Add(fileInfo); + else + { + ProcessData processData = new ProcessData(this, _ConfigData, results.Item3); + if (!(processData.Header is null)) + { + string mid = string.Concat(processData.Header.Reactor, "-", processData.Header.RDS, "-", processData.Header.PSN); + mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + Logistics.MID = mid; + SetFileParameterLotID(mid); + Logistics.ProcessJobID = processData.Header.Reactor; + } + if (processData.Header is null || !processData.Details.Any()) + throw new Exception(); + results = processData.GetResults(this, _ConfigData, results.Item3); + } + return results; + } + + private Tuple> GetDuplicatorExtractResult(string reportFullPath, DateTime dateTime) + { + Tuple> results; + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + JsonElement pdsdBodyValues = ProcessDataStandardFormat.GetArray(pdsf); + results = new Tuple>(pdsf.Item1, pdsdBodyValues, new List()); + List processDataDescriptions = _ConfigData.GetProcessDataDescriptions(pdsdBodyValues); + Dictionary> keyValuePairs = ProcessData.GetKeyValuePairs(_ConfigData, pdsdBodyValues, processDataDescriptions, extra: false); + bool isNotUsedInsightMetrologyViewerAttachments = (!(_Configuration.FileScanningIntervalInSeconds > 0) && _ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments); + bool isDummyRun = (ConfigData.DummyRuns.Any() && ConfigData.DummyRuns.ContainsKey(Logistics.JobID) && ConfigData.DummyRuns[Logistics.JobID].Any() && (from l in ConfigData.DummyRuns[Logistics.JobID] where l == Logistics.Sequence select 1).Any()); + if (isDummyRun) + { + try + { File.SetLastWriteTime(reportFullPath, dateTime); } + catch (Exception) { } + } + string duplicateDirectory; + string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_'); + if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsight) + duplicateDirectory = string.Concat(_Configuration.TargetFileLocation, @"\", segments[0]); + else + duplicateDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_Configuration.TargetFileLocation)), @"\Data"); + if (segments.Length > 2) + duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]); + if (!Directory.Exists(duplicateDirectory)) + Directory.CreateDirectory(duplicateDirectory); + if (!Directory.Exists(duplicateDirectory)) + Directory.CreateDirectory(duplicateDirectory); + if ((isDummyRun || isNotUsedInsightMetrologyViewerAttachments || _Configuration.FileScanningIntervalInSeconds > 0) && _ConfigData.Duplicator.Value != ConfigData.Level.IsXToArchive && _ConfigData.Duplicator.Value != ConfigData.Level.IsArchive) + { + string successDirectory; + if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToAPC) + successDirectory = string.Empty; + else + { + successDirectory = string.Concat(Path.GetDirectoryName(_Configuration.TargetFileLocation), @"\ViewerPath"); + if (!Directory.Exists(successDirectory)) + Directory.CreateDirectory(successDirectory); + } + CultureInfo cultureInfo = new CultureInfo("en-US"); + Calendar calendar = cultureInfo.Calendar; + List> tuples = new List>(); + string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath)); + string weekOfYear = calendar.GetWeekOfYear(Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string weekDirectory = string.Concat(Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); + string logisticsSequenceMemoryDirectory = string.Concat(_ConfigData.MemoryPath, @"\", _ConfigData.GetEquipmentType(), @"\Source\", weekDirectory, @"\", Logistics.Sequence); + if (!Directory.Exists(logisticsSequenceMemoryDirectory)) + Directory.CreateDirectory(logisticsSequenceMemoryDirectory); + if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToAPC) + { + if (!isDummyRun && _ConfigData.EafHosted) + File.Copy(reportFullPath, duplicateFile, overwrite: true); + } + else + { + if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewer) + { + List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); + ProcessData.WSRequest wsRequest = new ProcessData.WSRequest(this, fileReadDescriptions); + if (!isDummyRun && _ConfigData.EafHosted) + { + Tuple wsResults = WS.SendData(_ConfigData.OpenInsightMetrologyViewerAPI, wsRequest); + if (!wsResults.Item2.Success) + throw new Exception(wsResults.ToString()); + _Log.Debug(wsResults.Item2.HeaderID); + File.WriteAllText(string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"), wsResults.Item1); + } + } + else + { + Test test; + string check; + IScopeInfo scopeInfo; + Tuple tuple; + foreach (KeyValuePair> keyValuePair in keyValuePairs) + { + test = keyValuePair.Key; + //scopeInfo = new ScopeInfo(this, _ConfigData, test); + if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsight) + scopeInfo = new ScopeInfo(this, _ConfigData, test, _ConfigData.IqsFile, _ConfigData.IqsQueryFilter); + else + scopeInfo = new ScopeInfo(this, _ConfigData, test, _ConfigData.OpenInsightFilePattern, _ConfigData.IqsQueryFilter); + //lines = ProcessDataStandardFormat.GetLines(Logistics, scopeInfo, names, values, dateFormat: "M/d/yyyy hh:mm:ss tt", timeFormat: string.Empty, pairedColumns: ExtractResultPairedColumns); + List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); + tuple = ProcessData.GetLines(this, fileReadDescriptions); + check = tuple.Item1.Replace(tuple.Item2, "$Date$"); + if (string.IsNullOrEmpty(_LastLines) || check != _LastLines) + tuples.Add(new Tuple(scopeInfo, tuple.Item1)); + _LastLines = check; + } + } + if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) + { + string[] matchDirectories = Shared1567(reportFullPath, tuples); + if (!isDummyRun && _ConfigData.EafHosted && !isNotUsedInsightMetrologyViewerAttachments) + { + List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); + ProcessData.PostOpenInsightMetrologyViewerAttachments(_Log, _ConfigData, Logistics, dateTime, logisticsSequenceMemoryDirectory, fileReadDescriptions, matchDirectories[0]); + } + } + } + if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsightMetrologyViewer && _ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) + Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile); + } + if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) + { + string destinationDirectory; + //string destinationDirectory = WriteScopeInfo(_ConfigData.ProgressPath, Logistics, dateTime, duplicateDirectory, tuples); + FileInfo fileInfo = new FileInfo(reportFullPath); + string logisticsSequence = Logistics.Sequence.ToString(); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); + string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_ConfigData.FileConnectorConfiguration.TargetFileLocation)), @"\", Logistics.JobID); + if (!Directory.Exists(jobIdDirectory)) + Directory.CreateDirectory(jobIdDirectory); + string[] matchDirectories; + if (!_ConfigData.EafHosted) + matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) }; + else + matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly); + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + destinationDirectory = matchDirectories[0]; + if (isDummyRun) + Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory); + else + { + List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); + ProcessData.WSRequest wsRequest = new ProcessData.WSRequest(this, fileReadDescriptions); + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; + string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions); + if (_ConfigData.EafHosted) + Shared1277(reportFullPath, destinationDirectory, logisticsSequence, jobIdDirectory, json); + else + { + string jsonFileName = Path.ChangeExtension(reportFullPath, ".json"); + string historicalText = File.ReadAllText(jsonFileName); + if (json != historicalText) + throw new Exception("File doesn't match historical!"); + } + } + } + return results; + } + + private void MoveArchive() + { + CultureInfo cultureInfo = new CultureInfo("en-US"); + Calendar calendar = cultureInfo.Calendar; + string logisticsSequence = Logistics.Sequence.ToString(); + string weekOfYear = calendar.GetWeekOfYear(Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string weekDirectory = string.Concat(Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); + string jobIdDirectory = string.Concat(_ConfigData.FileConnectorConfiguration.TargetFileLocation, @"\", Logistics.JobID); + if (!Directory.Exists(jobIdDirectory)) + Directory.CreateDirectory(jobIdDirectory); + //string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory); + string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_ConfigData.FileConnectorConfiguration.TargetFileLocation), @"\Archive\", Logistics.JobID, @"\", weekDirectory); + if (!Directory.Exists(destinationArchiveDirectory)) + Directory.CreateDirectory(destinationArchiveDirectory); + string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() }; + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]); + destinationArchiveDirectory = string.Concat(destinationArchiveDirectory, @"\", Path.GetFileName(sourceDirectory)); + Directory.Move(sourceDirectory, destinationArchiveDirectory); + } + + public void Move(string reportFullPath, Tuple> extractResults, Exception exception = null) + { + Shared1872(reportFullPath, exception); + bool isErrorFile = !(exception is null); + if (!isErrorFile && _ConfigData.Duplicator.HasValue) + { + if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToArchive) + Shared0192(reportFullPath); + else if (_ConfigData.EafHosted && _ConfigData.Duplicator.Value == ConfigData.Level.IsArchive) + MoveArchive(); + if (_ConfigData.EafHosted && !string.IsNullOrEmpty(_ConfigData.ProgressPath)) + CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, (int?)_ConfigData.Duplicator, exceptionLines: null); + } + if (!isErrorFile && _ConfigData.Duplicator is null) + WriteIO(reportFullPath); + if (!_ConfigData.EafHosted) + { + object @object = GetFilePathGeneratorInfo(reportFullPath, isErrorFile: false); + if (!(@object is null) && @object is string to) + { + if (to.Contains("%")) + _Log.Debug("Can't debug without EAF Hosting"); + else + Shared1124(reportFullPath, extractResults, to, _Configuration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null); + } + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/FileReadShared.cs b/Adaptation/FileHandlers/FileReadShared.cs new file mode 100644 index 0000000..1be34c7 --- /dev/null +++ b/Adaptation/FileHandlers/FileReadShared.cs @@ -0,0 +1,1041 @@ +using Adaptation.Eaf.Core; +using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Helpers; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using log4net; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; + +namespace Adaptation.FileHandlers +{ + + public partial class FileRead + { + + public Logistics Logistics { get; protected set; } + + private bool _TargetFileLocationOkay; + private bool _ErrorTargetFileLocationOkay; + + private string _OriginalSourceFileLocation; + private string _OriginalTargetFileLocation; + private string _OriginalTarget2FileLocation; + private string _OriginalErrorTargetFileLocation; + +#pragma warning disable CS0169 + private readonly ILog _Log; + private Description _Description; +#pragma warning restore CS0169 + + private Type _ConfigurationType; + private MethodInfo _SetPlaceHolderMethodInfo; + private PropertyInfo _Target2FileLocationPropertyInfo; + private MethodInfo _ResolveSourcePlaceHoldersMethodInfo; + private MethodInfo _ResolveTargetPlaceHoldersMethodInfo; + private MethodInfo _ResolveTarget2PlaceHoldersMethodInfo; + private MethodInfo _ResolveErrorTargetPlaceHoldersMethodInfo; + + private string _LastReportFullPath; + private long _BreakAfterSeconds = 0; + private long _LastTicksDuration = 0; + private Dictionary _FileParameter; + private FileConnectorConfiguration _Configuration; + + public ConfigDataBase GetConfigDataBase(MethodBase methodBase, string cellInstanceName, string equipmentElementName, FileConnectorConfiguration fileConnectorConfiguration, IList modelObjectParameterDefinitions, bool eafHosted) + { + ConfigData result; + _Configuration = fileConnectorConfiguration; + Type type = methodBase.DeclaringType; + string equipmentTypeName = string.Empty; + result = new ConfigData(this, cellInstanceName, equipmentElementName, fileConnectorConfiguration, equipmentTypeName, modelObjectParameterDefinitions, type.FullName, isEAFHosted: true); + _ConfigData = result; + return result; + } + + public string GetTarget2FileLocation() + { + string result; + if (_Target2FileLocationPropertyInfo is null) + _Target2FileLocationPropertyInfo = _ConfigurationType.GetProperty("Target2FileLocation", BindingFlags.Instance | BindingFlags.Public); + if (_Target2FileLocationPropertyInfo is null) + result = string.Empty; + else + { + object @object = _Target2FileLocationPropertyInfo.GetValue(_Configuration); + if (@object is null) + result = string.Empty; + else + result = @object.ToString(); + } + return result; + } + + public void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums) + { + throw new NotImplementedException("Use V2"); + } + + public ConfigDataBase ReflectionCreateSelfDescriptionV2(string json) + { + ConfigData result; + string cellInstanceName; + string equipmentTypeName; + string cellInstanceConnectionName; + string parameterizedModelObjectDefinitionType; + if (!json.Contains(nameof(cellInstanceName))) + throw new Exception(); + if (!json.Contains(nameof(equipmentTypeName))) + throw new Exception(); + if (!json.Contains(nameof(cellInstanceConnectionName))) + throw new Exception(); + if (!json.Contains(nameof(FileConnectorConfiguration))) + throw new Exception(); + if (!json.Contains(nameof(IList))) + throw new Exception(); + if (!json.Contains(nameof(parameterizedModelObjectDefinitionType))) + throw new Exception(); + MethodBase methodBase = new StackFrame().GetMethod(); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString(); + equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString(); + cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString(); + JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration)); + parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString(); + if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions); + _Configuration = fileConnectorConfiguration; + JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList)); + if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + IList modelObjectParameterDefinitions = JsonSerializer.Deserialize>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions); +#if (false) + FileConnectorConfiguration fileConnectorConfigurationOld = GetFileConnectorConfiguration(strings, booleans, numbers, enums); + jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; + string @new = JsonSerializer.Serialize(fileConnectorConfiguration, fileConnectorConfiguration.GetType(), jsonSerializerOptions); + string old = JsonSerializer.Serialize(fileConnectorConfigurationOld, fileConnectorConfiguration.GetType(), jsonSerializerOptions); + if (@new != old) + throw new Exception(); +#endif + if (!(Backbone.Instance is null)) + { + Type type = Backbone.Instance.GetType(); + PropertyInfo propertyInfo = type.GetProperty(nameof(Backbone.Instance.CellName)); + if (!(propertyInfo is null)) + { + MethodInfo methodInfo = propertyInfo.GetSetMethod(nonPublic: true); + if (!(methodInfo is null)) + methodInfo.Invoke(Backbone.Instance, new object[] { cellInstanceName }); + } + } + _Configuration = fileConnectorConfiguration; + result = new ConfigData(this, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, modelObjectParameterDefinitions, parameterizedModelObjectDefinitionType, isEAFHosted: false); + _ConfigData = result; + _Description = new Description(this, result, equipmentControl: null); + Shared0749(); + _FileParameter = new Dictionary(); + Shared1301(_FileParameter, fileConnectorConfiguration); + return result; + } + + public object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) + { + string result; + if (!_Configuration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString())) + result = _Configuration.TargetFileLocation; + else + result = Path.GetDirectoryName(_Configuration.TargetFileLocation); + foreach (KeyValuePair keyValuePair in _FileParameter) + result = result.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value); + return result; + } + + private void TriggerEvents(string reportFullPath, Tuple> extractResults) + { + List parameters; + int count = extractResults.Item2.Value.GetArrayLength(); + for (int i = 0; i < count; i++) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); + parameters = _Description.GetParameterValues(this, null, extractResults.Item2.Value, i); +#if (false) + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); +#endif + if (_ConfigData.UseCyclicalForDescription) + break; + } + if (_ConfigData.IsDatabaseExportToIPDSF && count > 0) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); + parameters = _Description.GetParameterValues(this, null, extractResults.Item2.Value, null); +#if (false) + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); +#endif + } + } + + public Tuple> ReExtract(string searchDirectory, string sourceFileFilter) + { + Tuple> results; + if (!Directory.Exists(searchDirectory)) + results = null; + else + { + string[] segments; + string[] matches = null; + foreach (string subSourceFileFilter in sourceFileFilter.Split('|')) + { + segments = subSourceFileFilter.Split('\\'); + if (_Configuration.IncludeSubDirectories.Value) + matches = Directory.GetFiles(searchDirectory, segments.Last(), SearchOption.AllDirectories); + else + matches = Directory.GetFiles(searchDirectory, segments.Last(), SearchOption.TopDirectoryOnly); + if (matches.Any()) + break; + } + if (matches is null || !matches.Any()) + results = null; + else + { + string reportFullPath = matches[0]; + results = GetExtractResult(reportFullPath, Description.FileFound); + if (!_ConfigData.EafHosted) + TriggerEvents(Logistics.ReportFullPath, results); + } + } + return results; + } + + public void SetTarget2FileLocation(string value) + { + if (_Target2FileLocationPropertyInfo is null) + _Target2FileLocationPropertyInfo = _ConfigurationType.GetProperty("Target2FileLocation", BindingFlags.Instance | BindingFlags.Public); + if (!(_Target2FileLocationPropertyInfo is null)) + _Target2FileLocationPropertyInfo.SetValue(_Configuration, value); + } + + public void ConfigurationRestore() + { + _Configuration.SourceFileLocation = _OriginalSourceFileLocation; + _Configuration.TargetFileLocation = _OriginalTargetFileLocation; + SetTarget2FileLocation(_OriginalTarget2FileLocation); + _Configuration.ErrorTargetFileLocation = _OriginalErrorTargetFileLocation; + } + + public string GetConfigurationSourceFileLocation() + { + return _Configuration.SourceFileLocation; + } + + public string GetConfigurationTargetFileLocation() + { + return _Configuration.TargetFileLocation; + } + + public string GetConfigurationTargetFileName() + { + return _Configuration.TargetFileName; + } + + public string GetConfigurationTarget2FileLocation() + { + return GetTarget2FileLocation(); + } + + public string GetConfigurationErrorTargetFileLocation() + { + return _Configuration.ErrorTargetFileLocation; + } + + public void SetPlaceHolder(string reportFullPath, string key, string value) + { + if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) + _LastReportFullPath = reportFullPath; + if (_SetPlaceHolderMethodInfo is null) + _SetPlaceHolderMethodInfo = _ConfigurationType.GetMethod(nameof(this.SetPlaceHolder)); + object @object = _SetPlaceHolderMethodInfo.Invoke(_Configuration, new object[] { key, value }); + if (!_FileParameter.ContainsKey(key)) + _FileParameter[key] = string.Empty; + _FileParameter[key] = value; + } + + public string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true) + { + string result; + if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) + _LastReportFullPath = reportFullPath; + _FileParameter.Clear(); + if (_ResolveSourcePlaceHoldersMethodInfo is null) + _ResolveSourcePlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveSourcePlaceHolders)); + if (_ResolveSourcePlaceHoldersMethodInfo is null) + result = string.Empty; + else + { + object @object = _ResolveSourcePlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory }); + if (@object is null) + result = string.Empty; + else + result = @object.ToString(); + } + return result; + } + + public string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") + { + string result; + if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) + _LastReportFullPath = reportFullPath; + if (!string.IsNullOrEmpty(reportFullPath) || !string.IsNullOrEmpty(_LastReportFullPath)) + { + //bool isErrorFile = false; + //Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator filePathGenerator; + //if (!string.IsNullOrEmpty(reportFullPath)) + // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, reportFullPath, isErrorFile, _FileParameter); + //else if (!string.IsNullOrEmpty(_LastReportFullPath)) + // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, _LastReportFullPath, isErrorFile, _FileParameter); + //else + // throw new Exception(); + //result = filePathGenerator.GetTargetFolder(); + } + _FileParameter.Clear(); + if (_ResolveTargetPlaceHoldersMethodInfo is null) + _ResolveTargetPlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveTargetPlaceHolders)); + if (_ResolveTargetPlaceHoldersMethodInfo is null) + result = string.Empty; + else + { + object @object = _ResolveTargetPlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); + if (@object is null) + result = string.Empty; + else + result = @object.ToString(); + } + return result; + } + + public string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") + { + string result; + if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) + _LastReportFullPath = reportFullPath; + _FileParameter.Clear(); + if (_ResolveTarget2PlaceHoldersMethodInfo is null) + _ResolveTarget2PlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveTarget2PlaceHolders)); + if (_ResolveTarget2PlaceHoldersMethodInfo is null) + result = string.Empty; + else + { + object @object = _ResolveTarget2PlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); + if (@object is null) + result = string.Empty; + else + result = @object.ToString(); + } + return result; + } + + public string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") + { + string result; + if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) + _LastReportFullPath = reportFullPath; + if (!string.IsNullOrEmpty(reportFullPath) || !string.IsNullOrEmpty(_LastReportFullPath)) + { + //bool isErrorFile = true; + //Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator filePathGenerator; + //if (!string.IsNullOrEmpty(reportFullPath)) + // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, reportFullPath, isErrorFile, _FileParameter); + //else if (!string.IsNullOrEmpty(_LastReportFullPath)) + // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, _LastReportFullPath, isErrorFile, _FileParameter); + //else + // throw new Exception(); + //result = filePathGenerator.GetTargetFolder(); + } + _FileParameter.Clear(); + if (_ResolveErrorTargetPlaceHoldersMethodInfo is null) + _ResolveErrorTargetPlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveErrorTargetPlaceHolders)); + if (_ResolveErrorTargetPlaceHoldersMethodInfo is null) + result = string.Empty; + else + { + object @object = _ResolveErrorTargetPlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); + if (@object is null) + result = string.Empty; + else + result = @object.ToString(); + } + return result; + } + + public string GetReportFullPath(Dictionary keyValuePairs) + { + string result; + if (keyValuePairs is null || !keyValuePairs.Any()) + result = string.Empty; + else + { + string key; + key = "Param1"; + Dictionary eventDataList; + if (!keyValuePairs.ContainsKey(key)) + eventDataList = keyValuePairs; + else + eventDataList = (Dictionary)keyValuePairs[key]; + key = "InputFileName"; + if (!eventDataList.ContainsKey(key)) + result = string.Empty; + else + result = eventDataList[key].ToString(); + } + return result; + } + + public void SetFileParameter(string key, string value) + { + if (_Configuration is null || _Configuration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _Configuration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _Configuration.TargetFileName.Contains(string.Concat("%", key, "%")) || _Configuration.ErrorTargetFileName.Contains(string.Concat("%", key, "%"))) + { + if (_FileParameter.ContainsKey(key)) + _FileParameter[key] = value; + else + _FileParameter.Add(key, value); + } + } + + public void SetFileParameterLotID(string value, bool includeLogisticsSequence = true) + { + string key; + if (!includeLogisticsSequence) + key = "LotID"; + else + { + key = "LotIDWithLogisticsSequence"; + value = string.Concat(value, "_", Logistics.Sequence, "_", DateTime.Now.Ticks - Logistics.Sequence); + } + SetFileParameter(key, value); + } + + public void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true) + { + string key; + if (!includeLogisticsSequence) + key = "LotID"; + else + key = "LotIDWithLogisticsSequence"; + string value = string.Concat(Logistics.MID, "_", Logistics.Sequence, "_", DateTime.Now.Ticks - Logistics.Sequence); + SetFileParameter(key, value); + } + + public void SetFileParameterSystemDateTimeToLogisticsSequence() + { + string key = "SystemDateTime"; + string value = string.Concat(DateTime.Now.ToString("hh;mm;ss_tt_"), Logistics.Sequence); + SetFileParameter(key, value); + } + + private void UpdateLastTicksDuration(long ticksDuration) + { + if (ticksDuration < 50000000) + ticksDuration = 50000000; + _LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); + } + + private string GetTupleFile(Logistics logistics, IScopeInfo scopeInfo, string duplicateDirectory) + { + string result; + string rds; + string dateValue; + string datePlaceholder; + string[] segments = logistics.MID.Split('-'); + if (segments.Length < 2) + rds = "%RDS%"; + else + rds = segments[1]; + segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries); + if (segments.Length == 0) + result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace("%RDS%", rds)); + else + { + datePlaceholder = "%DateTime%"; + segments = segments[1].Split('%'); + dateValue = logistics.DateTimeFromSequence.ToString(segments[0]); + foreach (string segment in scopeInfo.FileName.Split('%')) + { + if (!segment.Contains(segments[0])) + continue; + datePlaceholder = string.Concat('%', segment, '%'); + } + result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace("%RDS%", rds).Replace(datePlaceholder, dateValue)); + } + if (result.Contains('%')) + throw new Exception("Placeholder exists!"); + return result; + } + + private void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List> tuples) + { + bool check; + long preWait; + string tupleFile; + List consumedFileIndices = new List(); + List duplicateFiles = new List(); + bool moreThanAnHour = (_BreakAfterSeconds > 3600); + StringBuilder stringBuilder = new StringBuilder(); + long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; + if (moreThanAnHour) + preWait = dateTime.AddSeconds(30).Ticks; + else + preWait = dateTime.AddTicks(_LastTicksDuration).Ticks; + if (!tuples.Any()) + duplicateFiles.Add(duplicateFile); + string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); + string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath)); + foreach (Tuple tuple in tuples) + { + if (tuple.Item1.FileName.StartsWith(@"\")) + tupleFile = tuple.Item1.FileName; + else if (!tuple.Item1.FileName.Contains('%')) + tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + else + tupleFile = GetTupleFile(logistics, tuple.Item1, duplicateDirectory); + duplicateFiles.Add(tupleFile); + File.WriteAllText(tupleFile, tuple.Item2); + } + for (short i = 0; i < short.MaxValue; i++) + { + if (DateTime.Now.Ticks > preWait) + break; + Thread.Sleep(500); + } + if (!moreThanAnHour) + { + for (short z = 0; z < short.MaxValue; z++) + { + try + { + check = (string.IsNullOrEmpty(successDirectory) || File.Exists(successFile)); + if (check) + { + consumedFileIndices.Clear(); + for (int i = 0; i < duplicateFiles.Count; i++) + { + if (!File.Exists(duplicateFiles[i])) + consumedFileIndices.Add(i); + } + if (consumedFileIndices.Count == duplicateFiles.Count) + break; + } + } + catch (Exception) { } + if (DateTime.Now.Ticks > breakAfter) + { + for (int i = 0; i < duplicateFiles.Count; i++) + { + if (File.Exists(duplicateFiles[i])) + { + try + { File.Delete(duplicateFiles[i]); } + catch (Exception) { } + stringBuilder.Append("<").Append(duplicateFiles[i]).Append("> "); + } + } + throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder)); + } + Thread.Sleep(500); + } + } + } + + private IEnumerable GetDirectoriesRecursively(string path, string directoryNameSegment = null) + { + Queue queue = new Queue(); + queue.Enqueue(path); + while (queue.Count > 0) + { + path = queue.Dequeue(); + foreach (string subDirectory in Directory.GetDirectories(path)) + { + queue.Enqueue(subDirectory); + if (string.IsNullOrEmpty(directoryNameSegment) || Path.GetFileName(subDirectory).Contains(directoryNameSegment)) + yield return subDirectory; + } + } + } + + private string GetProcessedDirectory(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory) + { + string result = duplicateDirectory; + string logisticsSequence = logistics.Sequence.ToString(); + string[] matchDirectories; + if (!_ConfigData.EafHosted) + matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(logistics.ReportFullPath)) }; + else + matchDirectories = new string[] { GetDirectoriesRecursively(Path.GetDirectoryName(progressPath), logisticsSequence).FirstOrDefault() }; + if (matchDirectories.Length == 0 || string.IsNullOrEmpty(matchDirectories[0])) + matchDirectories = Directory.GetDirectories(duplicateDirectory, string.Concat('*', logisticsSequence, '*'), SearchOption.AllDirectories); + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + if (!matchDirectories[0].Contains("_processed")) + { + result = string.Concat(matchDirectories[0].Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), dateTime.Ticks - logistics.Sequence, "_processed"); + Directory.Move(matchDirectories[0], result); + result = string.Concat(result, @"\", logistics.Sequence); + if (!Directory.Exists(result)) + Directory.CreateDirectory(result); + } + return result; + } + + private string WriteScopeInfo(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory, List> tuples) + { + string result = GetProcessedDirectory(progressPath, logistics, dateTime, duplicateDirectory); + string tupleFile; + string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); + string duplicateFile = string.Concat(result, @"\", fileName, ".pdsf"); + foreach (Tuple tuple in tuples) + { + if (tuple.Item1.FileName.StartsWith(@"\")) + tupleFile = tuple.Item1.FileName; + else + tupleFile = string.Concat(result, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + File.WriteAllText(tupleFile, tuple.Item2); + } + File.Copy(logistics.ReportFullPath, duplicateFile, overwrite: true); + return result; + } + + private void CreateProgressDirectory(string progressPath, Logistics logistics, int? duplicator, string[] exceptionLines) + { + string progressDirectory; + StringBuilder stringBuilder = new StringBuilder(); + if (duplicator is null || duplicator.Value == 0) + progressDirectory = string.Concat(progressPath, @"\", ProcessDataStandardFormat.EquipmentIntegration()); + else + { + stringBuilder.Clear(); + for (int i = 0; i < duplicator.Value; i++) + { + if (i > 0 && (i % 2) == 0) + stringBuilder.Append(' '); + stringBuilder.Append('-'); + } + progressDirectory = string.Concat(progressPath, @"\", (duplicator.Value + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim(); + } + DateTime dateTime = DateTime.Now; + CultureInfo cultureInfo = new CultureInfo("en-US"); + Calendar calendar = cultureInfo.Calendar; + string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", logistics.MID, "_", logistics.Sequence, "_", DateTime.Now.Ticks - logistics.Sequence); + if (!Directory.Exists(progressDirectory)) + Directory.CreateDirectory(progressDirectory); + if (!(exceptionLines is null)) + { + string fileName = string.Concat(progressDirectory, @"\readme.txt"); + try + { File.WriteAllLines(fileName, exceptionLines); } + catch (Exception) { } + } + } + + private void Shared0192(string reportFullPath) + { + if (!string.IsNullOrEmpty(reportFullPath)) + { + FileInfo fileInfo = new FileInfo(reportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); + } + } + + public void Shared0231(List directories) + { + if (_Configuration.PostProcessingMode != FileConnectorConfiguration.PostProcessingModeEnum.Copy) + { + foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct()) + { + if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any()) + Directory.Delete(directory); + } + } + } + + private void WriteIO(string reportFullPath) + { + if (!_ConfigData.IsSourceTimer && !_ConfigData.IsDatabaseExportToIPDSF) + { + string fileName = string.Concat(reportFullPath, ".IO"); + if (!(_Configuration is null) && _Configuration.PostProcessingMode == FileConnectorConfiguration.PostProcessingModeEnum.Copy) + File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString() }); + } + } + + private void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List> tuples, string duplicateFile) + { + if (!isDummyRun && _ConfigData.EafHosted) + WaitForFileConsumption(_Configuration.SourceDirectoryCloaking, Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples); + else + { + long breakAfter = DateTime.Now.AddSeconds(_Configuration.ConnectionRetryInterval.Value).Ticks; + for (short i = 0; i < short.MaxValue; i++) + { + if (!_ConfigData.EafHosted || DateTime.Now.Ticks > breakAfter) + break; + Thread.Sleep(500); + } + } + } + + public void Shared0449(string to, string[] exceptionLines) + { + if (_ConfigData.Duplicator.HasValue) + CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, (int?)_ConfigData.Duplicator, exceptionLines); + else + { + string fileName = string.Concat(to, @"\readme.txt"); + try + { + if (!Directory.Exists(to)) + Directory.CreateDirectory(to); + File.WriteAllLines(fileName, exceptionLines); + } + catch (Exception ex) { _Log.Error(ex.Message); } + } + } + + private static void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory) + { + if (destinationDirectory == duplicateDirectory) + throw new Exception("Check Target File Folder for %LotIDWithLogisticsSequence%_in process on CI (not Duplicator)"); + if (destinationDirectory.EndsWith(logisticsSequence)) + destinationDirectory = Path.GetDirectoryName(destinationDirectory); + string[] deleteFiles = Directory.GetFiles(destinationDirectory, "*", SearchOption.AllDirectories); + if (deleteFiles.Length > 250) + throw new Exception("Safety net!"); + foreach (string file in deleteFiles) + File.Delete(file); + Directory.Delete(destinationDirectory, recursive: true); + File.Delete(reportFullPath); + } + + public void Shared0749() + { + long breakAfterSeconds; + if (_Configuration is null) + breakAfterSeconds = 360; + else + { + if (_Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased) + breakAfterSeconds = 360; + else + breakAfterSeconds = Math.Abs(_Configuration.FileScanningIntervalInSeconds.Value); + } + _BreakAfterSeconds = breakAfterSeconds; + UpdateLastTicksDuration(breakAfterSeconds * 10000000); + if (_ConfigData.Duplicator.HasValue) + { + if (string.IsNullOrEmpty(_Configuration.TargetFileLocation) || string.IsNullOrEmpty(_Configuration.ErrorTargetFileLocation)) + throw new Exception("_Configuration is empty?"); + if (_Configuration.TargetFileLocation.Contains('%') || _Configuration.ErrorTargetFileLocation.Contains('%')) + throw new Exception("_Configuration is incorrect for a duplicator!"); + if (!(_Configuration is null)) + { + if (string.IsNullOrEmpty(_Configuration.SourceDirectoryCloaking)) + throw new Exception("SourceDirectoryCloaking is empty?"); + if (!_Configuration.SourceDirectoryCloaking.StartsWith("~")) + throw new Exception("SourceDirectoryCloaking is incorrect for a duplicator!"); + } + } + } + + public string[] Shared1124(string reportFullPath, Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception = null) + { + string[] results; + bool isErrorFile = !(exception is null); + if (!to.EndsWith(@"\")) + string.Concat(to, @"\"); + if (!isErrorFile) + results = new string[] { }; + else + { + results = new string[] { Logistics.Sequence.ToString(), reportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace }; + Shared0449(to, results); + } + if (!(extractResults is null) && !(extractResults.Item3 is null) && extractResults.Item3.Any()) + { + string itemFile; + List directories = new List(); + foreach (FileInfo sourceFile in extractResults.Item3) + { + if (sourceFile.FullName != reportFullPath) + { + itemFile = sourceFile.FullName.Replace(from, to); + Shared1880(reportFullPath, itemFile, directories, sourceFile, isErrorFile); + } + else if (!isErrorFile && !(Logistics is null)) + Shared1811(to, sourceFile); + } + Shared0231(directories); + } + return results; + } + + private void WritePDSF(JsonElement jsonElement) + { + string directory; + string eventName = _ConfigData.GetEventName(); + string equipmentType = _ConfigData.GetEquipmentType(); + if (_ConfigData.EquipmentConnection is null || _ConfigData.EquipmentConnection.Value == _ConfigData.EquipmentType) + directory = Path.Combine(_ConfigData.TracePath, equipmentType, "Source", _ConfigData.CellName, _ConfigData.EquipmentElementName); + else + directory = Path.Combine(_ConfigData.VillachPath, equipmentType, "Target"); + if (!Directory.Exists(directory)) + Directory.CreateDirectory(directory); + string file = Path.Combine(directory, string.Concat(Logistics.MesEntity, "_", Logistics.Sequence, ".ipdsf")); + string lines = ProcessDataStandardFormat.GetPDSFText(this, eventName, equipmentType, jsonElement, logisticsText: string.Empty); + File.WriteAllText(file, lines); + if (Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) + { + try + { File.SetLastWriteTime(file, Logistics.DateTimeFromSequence); } + catch (Exception) { } + } + } + + private void Shared1277(string reportFullPath, string destinationDirectory, string logisticsSequence, string jobIdDirectory, string json) + { + string ecCharacterizationSi = Path.GetDirectoryName(Path.GetDirectoryName(jobIdDirectory)); + string destinationJobIdDirectory = string.Concat(ecCharacterizationSi, @"\Processed\", Logistics.JobID); + if (!Directory.Exists(destinationJobIdDirectory)) + Directory.CreateDirectory(destinationJobIdDirectory); + destinationJobIdDirectory = string.Concat(destinationJobIdDirectory, @"\", Path.GetFileName(destinationDirectory).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), DateTime.Now.Ticks - Logistics.Sequence); + string sequenceDirectory = string.Concat(destinationJobIdDirectory, @"\", logisticsSequence); + string jsonFileName = string.Concat(sequenceDirectory, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".json"); + Directory.Move(destinationDirectory, destinationJobIdDirectory); + if (!Directory.Exists(sequenceDirectory)) + Directory.CreateDirectory(sequenceDirectory); + File.Copy(reportFullPath, string.Concat(sequenceDirectory, @"\", Path.GetFileName(reportFullPath)), overwrite: true); + File.WriteAllText(jsonFileName, json); + } + + public void Shared1301(Dictionary fileParameter, FileConnectorConfiguration configuration) + { + if (fileParameter is null) + throw new Exception("File Parameter is null?"); + _FileParameter = fileParameter; + _LastReportFullPath = string.Empty; + _TargetFileLocationOkay = true; + _ErrorTargetFileLocationOkay = true; + _ConfigurationType = configuration.GetType(); + _OriginalSourceFileLocation = configuration.SourceFileLocation; + _OriginalTargetFileLocation = configuration.TargetFileLocation; + _OriginalTarget2FileLocation = GetTarget2FileLocation(); + _OriginalErrorTargetFileLocation = configuration.ErrorTargetFileLocation; + if (_TargetFileLocationOkay) + { } + if (_ErrorTargetFileLocationOkay) + { } + } + + private string[] Shared1567(string reportFullPath, List> tuples) + { + string[] results; + string historicalText; + string logisticsSequence = Logistics.Sequence.ToString(); + string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_Configuration.TargetFileLocation)), @"\", Logistics.JobID); + if (!Directory.Exists(jobIdDirectory)) + Directory.CreateDirectory(jobIdDirectory); + string[] matchDirectories; + if (!_ConfigData.EafHosted) + matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) }; + else + matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly); + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + string fileName = Path.GetFileNameWithoutExtension(reportFullPath); + string sequenceDirectory = string.Concat(matchDirectories[0], @"\", logisticsSequence); + if (!Directory.Exists(sequenceDirectory)) + Directory.CreateDirectory(sequenceDirectory); + foreach (Tuple tuple in tuples) + { + fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + if (_ConfigData.EafHosted) + File.WriteAllText(fileName, tuple.Item2); + else + { + historicalText = File.ReadAllText(fileName); + if (tuple.Item2 != historicalText) + throw new Exception("File doesn't match historical!"); + } + } + results = matchDirectories; + return results; + } + + public void Shared1811(string to, FileInfo sourceFile) + { + if (_ConfigData.Duplicator is null && _Configuration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < ConfigData.MinFileLength) + { + string directoryName = Path.GetFileName(to); + string jobIdDirectory = Path.GetDirectoryName(to); + CultureInfo cultureInfo = new CultureInfo("en-US"); + Calendar calendar = cultureInfo.Calendar; + DateTime dateTime = DateTime.Now.AddMinutes(-15); + string weekOfYear = calendar.GetWeekOfYear(Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string weekDirectory = string.Concat(Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); + string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); + if (!Directory.Exists(destinationDirectory)) + Directory.CreateDirectory(destinationDirectory); + File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); + try + { + string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly); + foreach (string checkDirectory in checkDirectories) + { + if (!checkDirectory.Contains("_")) + continue; + if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) + continue; + if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) + continue; + if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any()) + continue; + if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any()) + continue; + if (new DirectoryInfo(checkDirectory).CreationTime > dateTime) + continue; + Directory.Delete(checkDirectory, recursive: false); + } + } + catch (Exception) { throw; } + } + } + + private void Shared1872(string reportFullPath, Exception exception) + { + if (!string.IsNullOrEmpty(reportFullPath) && !(exception is null)) + { + if (!(_Configuration is null) && _ConfigData.Duplicator.HasValue) + try + { File.WriteAllLines(string.Concat(_Configuration.ErrorTargetFileLocation, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".err"), new string[] { Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } + catch (Exception) { } + if (!_ConfigData.IsSourceTimer && !_ConfigData.IsDatabaseExportToIPDSF) + { + string fileName = string.Concat(reportFullPath, ".IO"); + if (!(_Configuration is null) && _Configuration.PostProcessingMode == FileConnectorConfiguration.PostProcessingModeEnum.Copy) + try + { File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } + catch (Exception) { } + } + if (_ConfigData.EquipmentConnection.HasValue && _ConfigData.EquipmentConnection.Value != _ConfigData.EquipmentType) + { + if (!reportFullPath.EndsWith(".pdsf") && !reportFullPath.EndsWith(".ipdsf")) + { + string fileName = string.Concat(reportFullPath, ".IO"); + try + { File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } + catch (Exception) { } + } + else + { + List debug = new List { "//Exception:" }; + if (!(Logistics is null) && !(Logistics.Tags is null)) + debug.AddRange(Logistics.Tags); + debug.Add(exception.Message); + debug.Add(exception.StackTrace); + try + { File.AppendAllLines(reportFullPath, debug); } + catch (Exception) { } + if (!(Logistics is null) && Logistics.DateTimeFromSequence != DateTime.MinValue && Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) + { + try + { File.SetLastWriteTime(reportFullPath, Logistics.DateTimeFromSequence); } + catch (Exception) { } + } + } + } + } + } + + public void Shared1880(string reportFullPath, string itemFile, List directories, FileInfo sourceFile, bool isErrorFile) + { + string itemDirectory; + directories.Add(Path.GetDirectoryName(sourceFile.FullName)); + itemDirectory = Path.GetDirectoryName(itemFile); + FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum; + if (!isErrorFile) + processingModeEnum = _Configuration.PostProcessingMode.Value; + else + processingModeEnum = _Configuration.ErrorPostProcessingMode.Value; + if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory)) + { + Directory.CreateDirectory(itemDirectory); + FileInfo fileInfo = new FileInfo(reportFullPath); + Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime); + } + if (_ConfigData.EafHosted) + { + switch (processingModeEnum) + { + case FileConnectorConfiguration.PostProcessingModeEnum.Move: + File.Move(sourceFile.FullName, itemFile); + break; + case FileConnectorConfiguration.PostProcessingModeEnum.Copy: + File.Copy(sourceFile.FullName, itemFile); + break; + case FileConnectorConfiguration.PostProcessingModeEnum.Delete: + File.Delete(sourceFile.FullName); + break; + default: + throw new Exception(); + } + } + } + + public void WaitForThread(Thread thread, List threadExceptions) + { + if (!(thread is null)) + { + System.Threading.ThreadState threadState; + for (short i = 0; i < short.MaxValue; i++) + { + if (thread is null) + break; + else + { + threadState = thread.ThreadState; + if (threadState != System.Threading.ThreadState.Running && threadState != System.Threading.ThreadState.WaitSleepJoin) + break; + } + Thread.Sleep(500); + } + lock (threadExceptions) + { + if (threadExceptions.Any()) + { + foreach (Exception item in threadExceptions) + _Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace)); + Exception exception = threadExceptions[0]; + threadExceptions.Clear(); + throw exception; + } + } + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ConfigData.Level.cs b/Adaptation/Helpers/ConfigData.Level.cs new file mode 100644 index 0000000..3c0e814 --- /dev/null +++ b/Adaptation/Helpers/ConfigData.Level.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace Adaptation.Helpers +{ + + public partial class ConfigData + { + public enum Level + { + IsXToOpenInsightMetrologyViewer, //MetrologyWS.SendData(logic, string.Concat("http://", serverName, "/api/inbound/TencorSP1"), headerAttachments, detailAttachments); + IsXToIQSSi, //bool WriteFileSPC(Dictionary + IsXToOpenInsight, //bool WriteFileOpenInsight(Dictionary + IsXToOpenInsightMetrologyViewerAttachments, //Site-Two + IsXToAPC, + IsXToSPaCe, + IsXToArchive, + IsArchive, + IsDummy, + IsNaEDA + } + + public static List> LevelTuples + { + get + { + return new List> + { + new Tuple(0, Level.IsNaEDA, @"\EC_EDA\Staging\Traces\~\Source"), + new Tuple(15, Level.IsXToOpenInsightMetrologyViewer, @"\EC_EAFLog\TracesMES\~\Source"), + new Tuple(36, Level.IsXToIQSSi, @"\EC_SPC_Si\Traces\~\PollPath"), + new Tuple(36, Level.IsXToOpenInsight, @"\\messa01ec.ec.local\APPS\Metrology\~\Source"), + new Tuple(36, Level.IsXToOpenInsightMetrologyViewerAttachments, @"\EC_Characterization_Si\In Process\~\Source"), + new Tuple(360, Level.IsXToAPC, @"\EC_APC\Staging\Traces\~\PollPath"), + new Tuple(-36, Level.IsXToSPaCe, @"\EC_SPC_Si\Traces\~\Source"), + new Tuple(180, Level.IsXToArchive, @"\EC_EAFLog\TracesArchive\~\Source"), + new Tuple(36, Level.IsArchive, @"\EC_Characterization_Si\Processed") + //new Tuple("IsDummy" + }; + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ConfigData.cs b/Adaptation/Helpers/ConfigData.cs new file mode 100644 index 0000000..7802f1f --- /dev/null +++ b/Adaptation/Helpers/ConfigData.cs @@ -0,0 +1,520 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using Infineon.Monitoring.MonA; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Reflection; +using System.Text.Json; +using System.Threading; + +namespace Adaptation.Helpers +{ + + public partial class ConfigData : ConfigDataBase + { + + internal const object NullData = null; + internal const int MinFileLength = 100; + + public string IqsFile { get; private set; } + public string TracePath { get; private set; } + public Level? Duplicator { get; private set; } + public string MemoryPath { get; private set; } + public string VillachPath { get; private set; } + public string ProgressPath { get; private set; } + public string IqsQueryFilter { get; private set; } + public string GhostPCLFileName { get; private set; } + public string OpenInsightSiViewer { get; private set; } + public string OpenInsightFilePattern { get; private set; } + public string OpenInsightMetrogyViewerAPI { get; private set; } + public static Dictionary> DummyRuns { get; private set; } + + private Timer _Timer; + private int _LastDummyRunIndex; + private readonly Calendar _Calendar; + private readonly string _ReportFullPath; + + public ConfigData(ILogic logic, string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, IList modelObjectParameterDefinitions, string parameterizedModelObjectDefinitionType, bool isEAFHosted) : + base(cellName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, isEAFHosted) + { + _LastDummyRunIndex = -1; + UseCyclicalForDescription = false; + CultureInfo cultureInfo = new CultureInfo("en-US"); + _Calendar = cultureInfo.Calendar; + string firstSourceFileFilter = fileConnectorConfiguration.SourceFileFilter.Split('|')[0]; + if (DummyRuns is null) + DummyRuns = new Dictionary>(); + bool isDuplicator = cellInstanceConnectionName.StartsWith(cellName); + int level = (cellInstanceConnectionName.Length - cellInstanceConnectionName.Replace("-", string.Empty).Length); + if (!isDuplicator) + Duplicator = null; + else + { + CellNames.Add(cellName, cellName); + MesEntities.Add(cellName, cellName); + Duplicator = (Level)level; + } + if (isDuplicator) + ProcessDataDescription = new Duplicator.Description(); + else + ProcessDataDescription = new ProcessData.FileRead.Description(); + if (!isDuplicator) + { + //Verify(fileConnectorConfiguration, cellInstanceConnectionName); + if (!EafHosted) + VerifyProcessDataDescription(logic); + else + WriteExportAliases(logic, cellName, cellInstanceConnectionName); + } + GhostPCLFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\gpcl6win64.exe"); + if (EafHosted && Duplicator.HasValue && Duplicator.Value == Level.IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(GhostPCLFileName)) + throw new Exception("Ghost PCL FileName doesn't Exist!"); + //LincPDFCFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\LincPDFC.exe"); + if (!modelObjectParameterDefinitions.Any()) + { + CellNames.Add(cellName, "****"); + MesEntities.Add(cellName, "****"); + } + else + { + int index; + string key; + string variable = string.Empty; + Dictionary iqsSection = new Dictionary(); + Dictionary pathSection = new Dictionary(); + Dictionary commonSection = new Dictionary(); + Dictionary openInsightSection = new Dictionary(); + foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in modelObjectParameterDefinitions) + { + if (!modelObjectParameterDefinition.Name.Contains('.')) + continue; + else if (modelObjectParameterDefinition.Name.StartsWith("Description.") && (modelObjectParameterDefinition.Name.EndsWith(".EventName") || modelObjectParameterDefinition.Name.EndsWith(".EquipmentType"))) + continue; + index = modelObjectParameterDefinition.Name.IndexOf("."); + if (index <= -1) + continue; + key = modelObjectParameterDefinition.Name.Substring(0, index); + variable = modelObjectParameterDefinition.Name.Substring(index + 1); + if (key == "COMMON") + commonSection.Add(variable, modelObjectParameterDefinition.Value); + //else if (key == "CONNECTION STRINGS") + // connectionStringsSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "IQS") + iqsSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "OpenInsight") + openInsightSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "PATH") + pathSection.Add(variable, modelObjectParameterDefinition.Value); + //else if (key == "REACTOR") + // reactorTuples.Add(new Tuple(variable, modelObjectParameterDefinition.Value)); + //else if (key == "TIBCO") + // tibcoSection.Add(variable, modelObjectParameterDefinition.Value); + else + throw new Exception(cellInstanceConnectionName); + } + if (!iqsSection.Any()) + throw new Exception("IQS section is missing from configuration"); + else + { + key = "FILE"; + if (iqsSection.ContainsKey(key)) + IqsFile = iqsSection[key]; + else + throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); + if (string.IsNullOrEmpty(IqsFile)) + throw new Exception(string.Format("IQS key {0} is empty", key)); + key = "QUERY"; + if (iqsSection.ContainsKey(key)) + IqsQueryFilter = iqsSection[key]; + else + throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); + if (string.IsNullOrEmpty(IqsQueryFilter)) + throw new Exception(string.Format("IQS key {0} is empty", key)); + } + if (!pathSection.Any()) + throw new Exception("Path section is missing from configuration"); + else + { + key = "TRACE"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + TracePath = pathSection[key]; + if (!string.IsNullOrEmpty(TracePath) && !Directory.Exists(TracePath)) + Directory.CreateDirectory(TracePath); + key = "VILLACH"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + VillachPath = pathSection[key]; + if (!string.IsNullOrEmpty(VillachPath) && !Directory.Exists(VillachPath)) + Directory.CreateDirectory(VillachPath); + key = "Progress"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + ProgressPath = pathSection[key]; + if (!string.IsNullOrEmpty(ProgressPath) && Directory.Exists(Path.GetPathRoot(ProgressPath)) && !Directory.Exists(ProgressPath)) + Directory.CreateDirectory(ProgressPath); + key = "Memory"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + MemoryPath = pathSection[key]; + if (!string.IsNullOrEmpty(MemoryPath) && !Directory.Exists(MemoryPath)) + Directory.CreateDirectory(MemoryPath); + } + if (!commonSection.Any()) + throw new Exception("Common section is missing from configuration"); + else + { + key = "CELL_NAMES"; + if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) + throw new Exception(cellInstanceConnectionName); + else + { + string[] segments; + string[] cellNames = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + foreach (string item in cellNames) + { + segments = item.Split(':'); + CellNames.Add(segments[0].Trim(), segments[1].Trim()); + } + } + if (!string.IsNullOrEmpty(cellName) && !CellNames.ContainsKey(cellName)) + throw new Exception(cellInstanceConnectionName); + key = "MES_ENTITIES"; + if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) + throw new Exception(cellInstanceConnectionName); + else + { + string[] segments; + string[] mesEntity = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + foreach (string item in mesEntity) + { + segments = item.Split(':'); + MesEntities.Add(segments[0].Trim(), segments[1].Trim()); + } + } + if (!string.IsNullOrEmpty(cellName) && !MesEntities.ContainsKey(cellName)) + throw new Exception(cellInstanceConnectionName); + } + if (!MesEntities.Any()) + throw new Exception(cellInstanceConnectionName); + if (!openInsightSection.Any()) + throw new Exception("OpenInsight section is missing from configuration"); + else + { + key = "MetrologyViewerAPI"; + if (openInsightSection.ContainsKey(key)) + OpenInsightMetrogyViewerAPI = openInsightSection[key]; + if (string.IsNullOrEmpty(OpenInsightMetrogyViewerAPI)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + if (!OpenInsightMetrogyViewerAPI.Contains(":") || !OpenInsightMetrogyViewerAPI.Contains(".")) + throw new Exception(string.Format("OpenInsight key {0} is invalid", key)); + key = "SiViewer"; + if (openInsightSection.ContainsKey(key)) + OpenInsightSiViewer = openInsightSection[key]; + if (string.IsNullOrEmpty(OpenInsightSiViewer)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + if (!OpenInsightSiViewer.Contains(":") || !OpenInsightSiViewer.Contains(".")) + throw new Exception(string.Format("OpenInsight key {0} is invalid", key)); + key = "FilePattern"; + if (openInsightSection.ContainsKey(key)) + OpenInsightFilePattern = openInsightSection[key]; + else + throw new Exception(string.Concat("Missing OpenInsight Configuration entry for ", key)); + if (string.IsNullOrEmpty(OpenInsightFilePattern)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + } + if (IsSourceTimer || IsDatabaseExportToIPDSF || (Duplicator.HasValue && Duplicator.Value == Level.IsDummy)) + { + if (!Directory.Exists(fileConnectorConfiguration.SourceFileLocation)) + Directory.CreateDirectory(fileConnectorConfiguration.SourceFileLocation); + _ReportFullPath = string.Concat(fileConnectorConfiguration.SourceFileLocation, firstSourceFileFilter.Replace("*", @"\")); + if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process) + Callback(null); + else + { + int milliSeconds; + milliSeconds = (int)((fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000) / 2); + _Timer = new Timer(Callback, null, milliSeconds, Timeout.Infinite); + milliSeconds += 2000; + } + } + } + } + + public void CheckProcessDataDescription(Dictionary> results, bool extra) + { + foreach (Test test in results.Keys) + { + if (test == Test.SP1) + { + if (!(ProcessDataDescription is ProcessData.FileRead.Description)) + ProcessDataDescription = new ProcessData.FileRead.Description(); + } + else + throw new Exception(); + } + } + + private void CallbackIsDummy(string traceDummyFile, List> tuples, bool fileConnectorConfigurationIncludeSubDirectories, bool includeSubDirectoriesExtra) + { + int fileCount; + string[] files; + string monARessource; + string checkDirectory; + string sourceArchiveFile; + string inProcessDirectory; + const string site = "sjc"; + const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; + MonIn monIn = MonIn.GetInstance(monInURL); + string stateName = string.Concat("Dummy_", _EventName); + foreach (Tuple item in tuples) + { + monARessource = item.Item1; + sourceArchiveFile = item.Item2; + inProcessDirectory = item.Item3; + checkDirectory = item.Item4; + fileCount = item.Item5; + try + { + if (fileCount > 0 || string.IsNullOrEmpty(checkDirectory)) + { + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() }); + monIn.SendStatus(site, monARessource, stateName, State.Warning); + for (int i = 1; i < 12; i++) + Thread.Sleep(500); + } + else if (inProcessDirectory == checkDirectory) + continue; + if (!EafHosted) + continue; + if (!File.Exists(sourceArchiveFile)) + continue; + if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) + continue; + ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory); + if (fileConnectorConfigurationIncludeSubDirectories && includeSubDirectoriesExtra) + { + if (_EventName == EventName.FileRead) + checkDirectory = string.Concat(checkDirectory, @"\", sequence); + else if (_EventName == EventName.FileReadDaily) + checkDirectory = string.Concat(checkDirectory, @"\Source\", sequence); + else + throw new Exception(); + } + if (fileConnectorConfigurationIncludeSubDirectories) + files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories); + else + files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly); + if (files.Length > 250) + throw new Exception("Safety net!"); + foreach (string file in files) + File.SetLastWriteTime(file, new DateTime(sequence)); + if (!fileConnectorConfigurationIncludeSubDirectories) + { + foreach (string file in files) + File.Move(file, string.Concat(checkDirectory, @"\", Path.GetFileName(file))); + } + else + { + string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories); + foreach (string directory in directories) + Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length))); + foreach (string file in files) + File.Move(file, string.Concat(checkDirectory, file.Substring(inProcessDirectory.Length))); + } + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() }); + monIn.SendStatus(site, monARessource, stateName, State.Ok); + } + catch (Exception exception) + { + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace }); + monIn.SendStatus(site, monARessource, stateName, State.Critical); + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + } + + private void CallbackIsDummy() + { + DateTime dateTime = DateTime.Now; + bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday); + if (check) + { + int fileCount; + string[] files; + string monARessource; + string checkDirectory; + string sourceArchiveFile; + string sourceFileLocation; + string targetFileLocation; + string inProcessDirectory; + string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string traceDummyDirectory = string.Concat(Path.GetPathRoot(TracePath), @"\TracesDummy\", CellName, @"\Source\", dateTime.ToString("yyyy"), "___Week_", weekOfYear); + if (!Directory.Exists(traceDummyDirectory)) + Directory.CreateDirectory(traceDummyDirectory); + string traceDummyFile = string.Concat(traceDummyDirectory, @"\", dateTime.Ticks, " - ", CellName, ".txt"); + File.AppendAllText(traceDummyFile, string.Empty); + List> tuples = new List>(); + foreach (var keyValuePair in CellNames) + { + monARessource = keyValuePair.Key; + if (!keyValuePair.Value.Contains(@"\")) + continue; + foreach (string sourceFileFilter in FileConnectorConfiguration.SourceFileFilter.Split('|')) + { + if (sourceFileFilter.ToLower().StartsWith(keyValuePair.Value.Replace(@"\", string.Empty))) + sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); + else if (FileConnectorConfiguration.SourceFileLocation.ToLower().EndsWith(keyValuePair.Value)) + sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); + else + sourceFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\", keyValuePair.Value)); + sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, @"\", sourceFileFilter)); + targetFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.TargetFileLocation, @"\", keyValuePair.Value)); + if (!File.Exists(sourceArchiveFile)) + continue; + if (!DummyRuns.ContainsKey(monARessource)) + DummyRuns.Add(monARessource, new List()); + tuples.Add(new Tuple(monARessource, sourceFileLocation, targetFileLocation, sourceArchiveFile, 0)); + } + } + File.AppendAllLines(traceDummyFile, from l in tuples select l.Item4); + if (tuples.Any()) + { + _LastDummyRunIndex += 1; + if (_LastDummyRunIndex >= tuples.Count) + _LastDummyRunIndex = 0; + monARessource = tuples[_LastDummyRunIndex].Item1; + sourceFileLocation = tuples[_LastDummyRunIndex].Item2; + targetFileLocation = tuples[_LastDummyRunIndex].Item3; + sourceArchiveFile = tuples[_LastDummyRunIndex].Item4; + //fileCount = tuples[_LastDummyRunIndex].Item5; + tuples.Clear(); + if (long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) + { + if (!DummyRuns[monARessource].Contains(sequence)) + DummyRuns[monARessource].Add(sequence); + inProcessDirectory = string.Concat(ProgressPath, @"\", monARessource, @"\Dummy_in process\", sequence); + checkDirectory = inProcessDirectory; + if (!Directory.Exists(checkDirectory)) + Directory.CreateDirectory(checkDirectory); + files = Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories); + fileCount = files.Length; + if (files.Any()) + { + if (files.Length > 250) + throw new Exception("Safety net!"); + try + { + foreach (string file in files) + File.Delete(file); + } + catch (Exception) { } + } + tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); + checkDirectory = targetFileLocation; + files = Directory.GetFiles(checkDirectory, string.Concat("*", sequence, "*"), SearchOption.TopDirectoryOnly); + fileCount = files.Length; + tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); + } + } + if (tuples.Any()) + CallbackIsDummy(traceDummyFile, tuples, FileConnectorConfiguration.IncludeSubDirectories.Value, includeSubDirectoriesExtra: false); + } + } + + private void Callback(object state) + { + try + { + if (Duplicator is null) + { + if (File.Exists(_ReportFullPath)) + File.Delete(_ReportFullPath); + File.WriteAllText(_ReportFullPath, string.Empty); + } + else if (Duplicator.Value == Level.IsDummy) + CallbackIsDummy(); + else + throw new Exception(); + } + catch (Exception exception) + { + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + try + { + TimeSpan timeSpan; + if (IsDatabaseExportToIPDSF) + timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks); + else if (IsSourceTimer) + timeSpan = new TimeSpan(DateTime.Now.AddMinutes(15).Ticks - DateTime.Now.Ticks); + else if (Duplicator.HasValue && Duplicator.Value == Level.IsDummy) + timeSpan = new TimeSpan(DateTime.Now.AddSeconds(FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks); + else if (Duplicator.HasValue) + timeSpan = new TimeSpan(DateTime.Now.AddSeconds(30).Ticks - DateTime.Now.Ticks); + else + timeSpan = new TimeSpan(DateTime.Now.AddDays(.5).Ticks - DateTime.Now.Ticks); + if (!(_Timer is null)) + _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite); + else + _Timer = new Timer(Callback, null, (long)timeSpan.TotalMilliseconds, Timeout.Infinite); + } + catch (Exception exception) + { + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + + public Tuple> IsManualOIEntry(string reportFullPath) + { + Tuple> results; + string monARessource; + const string site = "sjc"; + string equipment = string.Empty; + string description = string.Empty; + string stateName = "MANUAL_OI_ENTRY"; + string json = File.ReadAllText(reportFullPath); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + results = new Tuple>(string.Empty, jsonElement, new List()); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + { + if (jsonProperty.Name == "Equipment") + equipment = jsonProperty.Value.ToString(); + else if (jsonProperty.Name == "Description") + description = jsonProperty.Value.ToString(); + } + if (string.IsNullOrEmpty(equipment)) + monARessource = CellName; + else + monARessource = equipment; + const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; + MonIn monIn = MonIn.GetInstance(monInURL); + if (EafHosted) + monIn.SendStatus(site, monARessource, stateName, State.Warning, description); + return results; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.DataFile.cs b/Adaptation/Helpers/ProcessData.DataFile.cs new file mode 100644 index 0000000..ae82a4d --- /dev/null +++ b/Adaptation/Helpers/ProcessData.DataFile.cs @@ -0,0 +1,86 @@ +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + public class DataFile + { + + public string Grade { get; set; } + public string HeaderUniqueID { get; set; } + public string Side { get; set; } + public string SrcDest { get; set; } + public string UniqueID { get; set; } + public string WaferID { get; set; } + public string Data { get; set; } + public string DcnAll { get; set; } + public string DcnArea { get; set; } + public string DcnAreaCount { get; set; } + public string DcnBin1 { get; set; } + public string DcnBin2 { get; set; } + public string DcnBin3 { get; set; } + public string DcnBin4 { get; set; } + public string DcnBin5 { get; set; } + public string DcnBin6 { get; set; } + public string DcnBin7 { get; set; } + public string DcnBin8 { get; set; } + public string DcnHazeAvg { get; set; } + public string DcnHazeMedian { get; set; } + public string DcnHazeStdDev { get; set; } + public string DcnLpd { get; set; } + public string DcnLpdES { get; set; } + public string DcnLpdN { get; set; } + public string DcnMicroScr { get; set; } + public string DcnScr { get; set; } + public string DcnSlip { get; set; } + public string DnnAll { get; set; } + public string DnnArea { get; set; } + public string DnnAreaCount { get; set; } + public string DnnBin1 { get; set; } + public string DnnBin2 { get; set; } + public string DnnBin3 { get; set; } + public string DnnBin4 { get; set; } + public string DnnBin5 { get; set; } + public string DnnBin6 { get; set; } + public string DnnBin7 { get; set; } + public string DnnBin8 { get; set; } + public string DnnHazeAvg { get; set; } + public string DnnHazeMedian { get; set; } + public string DnnHazeStdDev { get; set; } + public string DnnLpd { get; set; } + public string DnnLpdES { get; set; } + public string DnnLpdN { get; set; } + public string DnnMicroScr { get; set; } + public string DnnScr { get; set; } + public string DnnSlip { get; set; } + public string DwnAll { get; set; } + public string DwnArea { get; set; } + public string DwnAreaCount { get; set; } + public string DwnBin1 { get; set; } + public string DwnBin2 { get; set; } + public string DwnBin3 { get; set; } + public string DwnBin4 { get; set; } + public string DwnBin5 { get; set; } + public string DwnBin6 { get; set; } + public string DwnBin7 { get; set; } + public string DwnBin8 { get; set; } + public string DwnHazeAvg { get; set; } + public string DwnHazeMedian { get; set; } + public string DwnHazeStdDev { get; set; } + public string DwnLpd { get; set; } + public string DwnLpdES { get; set; } + public string DwnLpdN { get; set; } + public string DwnMicroScr { get; set; } + public string DwnScr { get; set; } + public string DwnSlip { get; set; } + + public DataFile() + { + Data = "*Data*"; + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.FileRead.Description.cs b/Adaptation/Helpers/ProcessData.FileRead.Description.cs new file mode 100644 index 0000000..cce0fab --- /dev/null +++ b/Adaptation/Helpers/ProcessData.FileRead.Description.cs @@ -0,0 +1,1418 @@ +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + + public class FileRead + { + + public class Description : IProcessDataDescription + { + + public int Test { get; set; } + public int Count { get; set; } + public int Index { get; set; } + // + public string EventName { get; set; } + public string NullData { get; set; } + public string JobID { get; set; } + public string Sequence { get; set; } + public string MesEntity { get; set; } + public string ReportFullPath { get; set; } + public string ProcessJobID { get; set; } + public string MID { get; set; } + // + public string Date { get; set; } + public string Employee { get; set; } + public string Lot { get; set; } + public string PSN { get; set; } + public string Reactor { get; set; } + public string Recipe { get; set; } + // + public string Grade { get; set; } + public string HeaderUniqueId { get; set; } + public string RDS { get; set; } + public string Session { get; set; } + public string Side { get; set; } + public string SrcDest { get; set; } + public string UniqueId { get; set; } + public string WaferID { get; set; } + // + public string DcnAllMax { get; set; } + public string DcnAllMean { get; set; } + public string DcnAllMin { get; set; } + public string DcnAllStdDev { get; set; } + public string DcnAreaCountMax { get; set; } + public string DcnAreaCountMean { get; set; } + public string DcnAreaCountMin { get; set; } + public string DcnAreaCountStdDev { get; set; } + public string DcnAreaMax { get; set; } + public string DcnAreaMean { get; set; } + public string DcnAreaMin { get; set; } + public string DcnAreaStdDev { get; set; } + public string DcnBin1Max { get; set; } + public string DcnBin1Mean { get; set; } + public string DcnBin1Min { get; set; } + public string DcnBin1StdDev { get; set; } + public string DcnBin2Max { get; set; } + public string DcnBin2Mean { get; set; } + public string DcnBin2Min { get; set; } + public string DcnBin2StdDev { get; set; } + public string DcnBin3Max { get; set; } + public string DcnBin3Mean { get; set; } + public string DcnBin3Min { get; set; } + public string DcnBin3StdDev { get; set; } + public string DcnBin4Max { get; set; } + public string DcnBin4Mean { get; set; } + public string DcnBin4Min { get; set; } + public string DcnBin4StdDev { get; set; } + public string DcnBin5Max { get; set; } + public string DcnBin5Mean { get; set; } + public string DcnBin5Min { get; set; } + public string DcnBin5StdDev { get; set; } + public string DcnBin6Max { get; set; } + public string DcnBin6Mean { get; set; } + public string DcnBin6Min { get; set; } + public string DcnBin6StdDev { get; set; } + public string DcnBin7Max { get; set; } + public string DcnBin7Mean { get; set; } + public string DcnBin7Min { get; set; } + public string DcnBin7StdDev { get; set; } + public string DcnBin8Max { get; set; } + public string DcnBin8Mean { get; set; } + public string DcnBin8Min { get; set; } + public string DcnBin8StdDev { get; set; } + public string DcnHazeAvgMax { get; set; } + public string DcnHazeAvgMean { get; set; } + public string DcnHazeAvgMin { get; set; } + public string DcnHazeAvgStdDev { get; set; } + public string DcnHazeMedianMax { get; set; } + public string DcnHazeMedianMean { get; set; } + public string DcnHazeMedianMin { get; set; } + public string DcnHazeMedianStdDev { get; set; } + public string DcnHazeStdDevMax { get; set; } + public string DcnHazeStdDevMean { get; set; } + public string DcnHazeStdDevMin { get; set; } + public string DcnHazeStdDevStdDev { get; set; } + public string DcnLpdESMax { get; set; } + public string DcnLpdESMean { get; set; } + public string DcnLpdESMin { get; set; } + public string DcnLpdESStdDev { get; set; } + public string DcnLpdMax { get; set; } + public string DcnLpdMean { get; set; } + public string DcnLpdMin { get; set; } + public string DcnLpdNMax { get; set; } + public string DcnLpdNMean { get; set; } + public string DcnLpdNMin { get; set; } + public string DcnLpdNStdDev { get; set; } + public string DcnLpdStdDev { get; set; } + public string DcnMicroScrMax { get; set; } + public string DcnMicroScrMean { get; set; } + public string DcnMicroScrMin { get; set; } + public string DcnMicroScrStdDev { get; set; } + public string DcnScrMax { get; set; } + public string DcnScrMean { get; set; } + public string DcnScrMin { get; set; } + public string DcnScrStdDev { get; set; } + public string DcnSlipMax { get; set; } + public string DcnSlipMean { get; set; } + public string DcnSlipMin { get; set; } + public string DcnSlipStdDev { get; set; } + public string DnnAllMax { get; set; } + public string DnnAllMean { get; set; } + public string DnnAllMin { get; set; } + public string DnnAllStdDev { get; set; } + public string DnnAreaCountMax { get; set; } + public string DnnAreaCountMean { get; set; } + public string DnnAreaCountMin { get; set; } + public string DnnAreaCountStdDev { get; set; } + public string DnnAreaMax { get; set; } + public string DnnAreaMean { get; set; } + public string DnnAreaMin { get; set; } + public string DnnAreaStdDev { get; set; } + public string DnnBin1Max { get; set; } + public string DnnBin1Mean { get; set; } + public string DnnBin1Min { get; set; } + public string DnnBin1StdDev { get; set; } + public string DnnBin2Max { get; set; } + public string DnnBin2Mean { get; set; } + public string DnnBin2Min { get; set; } + public string DnnBin2StdDev { get; set; } + public string DnnBin3Max { get; set; } + public string DnnBin3Mean { get; set; } + public string DnnBin3Min { get; set; } + public string DnnBin3StdDev { get; set; } + public string DnnBin4Max { get; set; } + public string DnnBin4Mean { get; set; } + public string DnnBin4Min { get; set; } + public string DnnBin4StdDev { get; set; } + public string DnnBin5Max { get; set; } + public string DnnBin5Mean { get; set; } + public string DnnBin5Min { get; set; } + public string DnnBin5StdDev { get; set; } + public string DnnBin6Max { get; set; } + public string DnnBin6Mean { get; set; } + public string DnnBin6Min { get; set; } + public string DnnBin6StdDev { get; set; } + public string DnnBin7Max { get; set; } + public string DnnBin7Mean { get; set; } + public string DnnBin7Min { get; set; } + public string DnnBin7StdDev { get; set; } + public string DnnBin8Max { get; set; } + public string DnnBin8Mean { get; set; } + public string DnnBin8Min { get; set; } + public string DnnBin8StdDev { get; set; } + public string DnnHazeAvgMax { get; set; } + public string DnnHazeAvgMean { get; set; } + public string DnnHazeAvgMin { get; set; } + public string DnnHazeAvgStdDev { get; set; } + public string DnnHazeMedianMax { get; set; } + public string DnnHazeMedianMean { get; set; } + public string DnnHazeMedianMin { get; set; } + public string DnnHazeMedianStdDev { get; set; } + public string DnnHazeStdDevMax { get; set; } + public string DnnHazeStdDevMean { get; set; } + public string DnnHazeStdDevMin { get; set; } + public string DnnHazeStdDevStdDev { get; set; } + public string DnnLpdESMax { get; set; } + public string DnnLpdESMean { get; set; } + public string DnnLpdESMin { get; set; } + public string DnnLpdESStdDev { get; set; } + public string DnnLpdMax { get; set; } + public string DnnLpdMean { get; set; } + public string DnnLpdMin { get; set; } + public string DnnLpdNMax { get; set; } + public string DnnLpdNMean { get; set; } + public string DnnLpdNMin { get; set; } + public string DnnLpdNStdDev { get; set; } + public string DnnLpdStdDev { get; set; } + public string DnnMicroScrMax { get; set; } + public string DnnMicroScrMean { get; set; } + public string DnnMicroScrMin { get; set; } + public string DnnMicroScrStdDev { get; set; } + public string DnnScrMax { get; set; } + public string DnnScrMean { get; set; } + public string DnnScrMin { get; set; } + public string DnnScrStdDev { get; set; } + public string DnnSlipMax { get; set; } + public string DnnSlipMean { get; set; } + public string DnnSlipMin { get; set; } + public string DnnSlipStdDev { get; set; } + public string DwnAllMax { get; set; } + public string DwnAllMean { get; set; } + public string DwnAllMin { get; set; } + public string DwnAllStdDev { get; set; } + public string DwnAreaCountMax { get; set; } + public string DwnAreaCountMean { get; set; } + public string DwnAreaCountMin { get; set; } + public string DwnAreaCountStdDev { get; set; } + public string DwnAreaMax { get; set; } + public string DwnAreaMean { get; set; } + public string DwnAreaMin { get; set; } + public string DwnAreaStdDev { get; set; } + public string DwnBin1Max { get; set; } + public string DwnBin1Mean { get; set; } + public string DwnBin1Min { get; set; } + public string DwnBin1StdDev { get; set; } + public string DwnBin2Max { get; set; } + public string DwnBin2Mean { get; set; } + public string DwnBin2Min { get; set; } + public string DwnBin2StdDev { get; set; } + public string DwnBin3Max { get; set; } + public string DwnBin3Mean { get; set; } + public string DwnBin3Min { get; set; } + public string DwnBin3StdDev { get; set; } + public string DwnBin4Max { get; set; } + public string DwnBin4Mean { get; set; } + public string DwnBin4Min { get; set; } + public string DwnBin4StdDev { get; set; } + public string DwnBin5Max { get; set; } + public string DwnBin5Mean { get; set; } + public string DwnBin5Min { get; set; } + public string DwnBin5StdDev { get; set; } + public string DwnBin6Max { get; set; } + public string DwnBin6Mean { get; set; } + public string DwnBin6Min { get; set; } + public string DwnBin6StdDev { get; set; } + public string DwnBin7Max { get; set; } + public string DwnBin7Mean { get; set; } + public string DwnBin7Min { get; set; } + public string DwnBin7StdDev { get; set; } + public string DwnBin8Max { get; set; } + public string DwnBin8Mean { get; set; } + public string DwnBin8Min { get; set; } + public string DwnBin8StdDev { get; set; } + public string DwnHazeAvgMax { get; set; } + public string DwnHazeAvgMean { get; set; } + public string DwnHazeAvgMin { get; set; } + public string DwnHazeAvgStdDev { get; set; } + public string DwnHazeMedianMax { get; set; } + public string DwnHazeMedianMean { get; set; } + public string DwnHazeMedianMin { get; set; } + public string DwnHazeMedianStdDev { get; set; } + public string DwnHazeStdDevMax { get; set; } + public string DwnHazeStdDevMean { get; set; } + public string DwnHazeStdDevMin { get; set; } + public string DwnHazeStdDevStdDev { get; set; } + public string DwnLpdESMax { get; set; } + public string DwnLpdESMean { get; set; } + public string DwnLpdESMin { get; set; } + public string DwnLpdESStdDev { get; set; } + public string DwnLpdMax { get; set; } + public string DwnLpdMean { get; set; } + public string DwnLpdMin { get; set; } + public string DwnLpdNMax { get; set; } + public string DwnLpdNMean { get; set; } + public string DwnLpdNMin { get; set; } + public string DwnLpdNStdDev { get; set; } + public string DwnLpdStdDev { get; set; } + public string DwnMicroScrMax { get; set; } + public string DwnMicroScrMean { get; set; } + public string DwnMicroScrMin { get; set; } + public string DwnMicroScrStdDev { get; set; } + public string DwnScrMax { get; set; } + public string DwnScrMean { get; set; } + public string DwnScrMin { get; set; } + public string DwnScrStdDev { get; set; } + public string DwnSlipMax { get; set; } + public string DwnSlipMean { get; set; } + public string DwnSlipMin { get; set; } + public string DwnSlipStdDev { get; set; } + public string DcnAll { get; set; } + public string DcnArea { get; set; } + public string DcnAreaCount { get; set; } + public string DcnBin1 { get; set; } + public string DcnBin2 { get; set; } + public string DcnBin3 { get; set; } + public string DcnBin4 { get; set; } + public string DcnBin5 { get; set; } + public string DcnBin6 { get; set; } + public string DcnBin7 { get; set; } + public string DcnBin8 { get; set; } + public string DcnHazeAvg { get; set; } + public string DcnHazeMedian { get; set; } + public string DcnHazeStdDev { get; set; } + public string DcnLpd { get; set; } + public string DcnLpdES { get; set; } + public string DcnLpdN { get; set; } + public string DcnMicroScr { get; set; } + public string DcnScr { get; set; } + public string DcnSlip { get; set; } + public string DnnAll { get; set; } + public string DnnArea { get; set; } + public string DnnAreaCount { get; set; } + public string DnnBin1 { get; set; } + public string DnnBin2 { get; set; } + public string DnnBin3 { get; set; } + public string DnnBin4 { get; set; } + public string DnnBin5 { get; set; } + public string DnnBin6 { get; set; } + public string DnnBin7 { get; set; } + public string DnnBin8 { get; set; } + public string DnnHazeAvg { get; set; } + public string DnnHazeMedian { get; set; } + public string DnnHazeStdDev { get; set; } + public string DnnLpd { get; set; } + public string DnnLpdES { get; set; } + public string DnnLpdN { get; set; } + public string DnnMicroScr { get; set; } + public string DnnScr { get; set; } + public string DnnSlip { get; set; } + public string DwnAll { get; set; } + public string DwnArea { get; set; } + public string DwnAreaCount { get; set; } + public string DwnBin1 { get; set; } + public string DwnBin2 { get; set; } + public string DwnBin3 { get; set; } + public string DwnBin4 { get; set; } + public string DwnBin5 { get; set; } + public string DwnBin6 { get; set; } + public string DwnBin7 { get; set; } + public string DwnBin8 { get; set; } + public string DwnHazeAvg { get; set; } + public string DwnHazeMedian { get; set; } + public string DwnHazeStdDev { get; set; } + public string DwnLpd { get; set; } + public string DwnLpdES { get; set; } + public string DwnLpdN { get; set; } + public string DwnMicroScr { get; set; } + public string DwnScr { get; set; } + public string DwnSlip { get; set; } + + public string GetEventDescription() { return "File Has been read and parsed"; } + + public List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(Date), + nameof(Employee), + nameof(Lot), + nameof(PSN), + nameof(Reactor), + nameof(Recipe) + }; + return results; + } + + public List GetDetailNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(Grade), + nameof(HeaderUniqueId), + nameof(RDS), + nameof(Session), + nameof(Side), + nameof(SrcDest), + nameof(UniqueId), + nameof(WaferID) + }; + return results; + } + + public List GetParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(DcnAllMax), + nameof(DcnAllMean), + nameof(DcnAllMin), + nameof(DcnAllStdDev), + nameof(DcnAreaCountMax), + nameof(DcnAreaCountMean), + nameof(DcnAreaCountMin), + nameof(DcnAreaCountStdDev), + nameof(DcnAreaMax), + nameof(DcnAreaMean), + nameof(DcnAreaMin), + nameof(DcnAreaStdDev), + nameof(DcnBin1Max), + nameof(DcnBin1Mean), + nameof(DcnBin1Min), + nameof(DcnBin1StdDev), + nameof(DcnBin2Max), + nameof(DcnBin2Mean), + nameof(DcnBin2Min), + nameof(DcnBin2StdDev), + nameof(DcnBin3Max), + nameof(DcnBin3Mean), + nameof(DcnBin3Min), + nameof(DcnBin3StdDev), + nameof(DcnBin4Max), + nameof(DcnBin4Mean), + nameof(DcnBin4Min), + nameof(DcnBin4StdDev), + nameof(DcnBin5Max), + nameof(DcnBin5Mean), + nameof(DcnBin5Min), + nameof(DcnBin5StdDev), + nameof(DcnBin6Max), + nameof(DcnBin6Mean), + nameof(DcnBin6Min), + nameof(DcnBin6StdDev), + nameof(DcnBin7Max), + nameof(DcnBin7Mean), + nameof(DcnBin7Min), + nameof(DcnBin7StdDev), + nameof(DcnBin8Max), + nameof(DcnBin8Mean), + nameof(DcnBin8Min), + nameof(DcnBin8StdDev), + nameof(DcnHazeAvgMax), + nameof(DcnHazeAvgMean), + nameof(DcnHazeAvgMin), + nameof(DcnHazeAvgStdDev), + nameof(DcnHazeMedianMax), + nameof(DcnHazeMedianMean), + nameof(DcnHazeMedianMin), + nameof(DcnHazeMedianStdDev), + nameof(DcnHazeStdDevMax), + nameof(DcnHazeStdDevMean), + nameof(DcnHazeStdDevMin), + nameof(DcnHazeStdDevStdDev), + nameof(DcnLpdESMax), + nameof(DcnLpdESMean), + nameof(DcnLpdESMin), + nameof(DcnLpdESStdDev), + nameof(DcnLpdMax), + nameof(DcnLpdMean), + nameof(DcnLpdMin), + nameof(DcnLpdNMax), + nameof(DcnLpdNMean), + nameof(DcnLpdNMin), + nameof(DcnLpdNStdDev), + nameof(DcnLpdStdDev), + nameof(DcnMicroScrMax), + nameof(DcnMicroScrMean), + nameof(DcnMicroScrMin), + nameof(DcnMicroScrStdDev), + nameof(DcnScrMax), + nameof(DcnScrMean), + nameof(DcnScrMin), + nameof(DcnScrStdDev), + nameof(DcnSlipMax), + nameof(DcnSlipMean), + nameof(DcnSlipMin), + nameof(DcnSlipStdDev), + nameof(DnnAllMax), + nameof(DnnAllMean), + nameof(DnnAllMin), + nameof(DnnAllStdDev), + nameof(DnnAreaCountMax), + nameof(DnnAreaCountMean), + nameof(DnnAreaCountMin), + nameof(DnnAreaCountStdDev), + nameof(DnnAreaMax), + nameof(DnnAreaMean), + nameof(DnnAreaMin), + nameof(DnnAreaStdDev), + nameof(DnnBin1Max), + nameof(DnnBin1Mean), + nameof(DnnBin1Min), + nameof(DnnBin1StdDev), + nameof(DnnBin2Max), + nameof(DnnBin2Mean), + nameof(DnnBin2Min), + nameof(DnnBin2StdDev), + nameof(DnnBin3Max), + nameof(DnnBin3Mean), + nameof(DnnBin3Min), + nameof(DnnBin3StdDev), + nameof(DnnBin4Max), + nameof(DnnBin4Mean), + nameof(DnnBin4Min), + nameof(DnnBin4StdDev), + nameof(DnnBin5Max), + nameof(DnnBin5Mean), + nameof(DnnBin5Min), + nameof(DnnBin5StdDev), + nameof(DnnBin6Max), + nameof(DnnBin6Mean), + nameof(DnnBin6Min), + nameof(DnnBin6StdDev), + nameof(DnnBin7Max), + nameof(DnnBin7Mean), + nameof(DnnBin7Min), + nameof(DnnBin7StdDev), + nameof(DnnBin8Max), + nameof(DnnBin8Mean), + nameof(DnnBin8Min), + nameof(DnnBin8StdDev), + nameof(DnnHazeAvgMax), + nameof(DnnHazeAvgMean), + nameof(DnnHazeAvgMin), + nameof(DnnHazeAvgStdDev), + nameof(DnnHazeMedianMax), + nameof(DnnHazeMedianMean), + nameof(DnnHazeMedianMin), + nameof(DnnHazeMedianStdDev), + nameof(DnnHazeStdDevMax), + nameof(DnnHazeStdDevMean), + nameof(DnnHazeStdDevMin), + nameof(DnnHazeStdDevStdDev), + nameof(DnnLpdESMax), + nameof(DnnLpdESMean), + nameof(DnnLpdESMin), + nameof(DnnLpdESStdDev), + nameof(DnnLpdMax), + nameof(DnnLpdMean), + nameof(DnnLpdMin), + nameof(DnnLpdNMax), + nameof(DnnLpdNMean), + nameof(DnnLpdNMin), + nameof(DnnLpdNStdDev), + nameof(DnnLpdStdDev), + nameof(DnnMicroScrMax), + nameof(DnnMicroScrMean), + nameof(DnnMicroScrMin), + nameof(DnnMicroScrStdDev), + nameof(DnnScrMax), + nameof(DnnScrMean), + nameof(DnnScrMin), + nameof(DnnScrStdDev), + nameof(DnnSlipMax), + nameof(DnnSlipMean), + nameof(DnnSlipMin), + nameof(DnnSlipStdDev), + nameof(DwnAllMax), + nameof(DwnAllMean), + nameof(DwnAllMin), + nameof(DwnAllStdDev), + nameof(DwnAreaCountMax), + nameof(DwnAreaCountMean), + nameof(DwnAreaCountMin), + nameof(DwnAreaCountStdDev), + nameof(DwnAreaMax), + nameof(DwnAreaMean), + nameof(DwnAreaMin), + nameof(DwnAreaStdDev), + nameof(DwnBin1Max), + nameof(DwnBin1Mean), + nameof(DwnBin1Min), + nameof(DwnBin1StdDev), + nameof(DwnBin2Max), + nameof(DwnBin2Mean), + nameof(DwnBin2Min), + nameof(DwnBin2StdDev), + nameof(DwnBin3Max), + nameof(DwnBin3Mean), + nameof(DwnBin3Min), + nameof(DwnBin3StdDev), + nameof(DwnBin4Max), + nameof(DwnBin4Mean), + nameof(DwnBin4Min), + nameof(DwnBin4StdDev), + nameof(DwnBin5Max), + nameof(DwnBin5Mean), + nameof(DwnBin5Min), + nameof(DwnBin5StdDev), + nameof(DwnBin6Max), + nameof(DwnBin6Mean), + nameof(DwnBin6Min), + nameof(DwnBin6StdDev), + nameof(DwnBin7Max), + nameof(DwnBin7Mean), + nameof(DwnBin7Min), + nameof(DwnBin7StdDev), + nameof(DwnBin8Max), + nameof(DwnBin8Mean), + nameof(DwnBin8Min), + nameof(DwnBin8StdDev), + nameof(DwnHazeAvgMax), + nameof(DwnHazeAvgMean), + nameof(DwnHazeAvgMin), + nameof(DwnHazeAvgStdDev), + nameof(DwnHazeMedianMax), + nameof(DwnHazeMedianMean), + nameof(DwnHazeMedianMin), + nameof(DwnHazeMedianStdDev), + nameof(DwnHazeStdDevMax), + nameof(DwnHazeStdDevMean), + nameof(DwnHazeStdDevMin), + nameof(DwnHazeStdDevStdDev), + nameof(DwnLpdESMax), + nameof(DwnLpdESMean), + nameof(DwnLpdESMin), + nameof(DwnLpdESStdDev), + nameof(DwnLpdMax), + nameof(DwnLpdMean), + nameof(DwnLpdMin), + nameof(DwnLpdNMax), + nameof(DwnLpdNMean), + nameof(DwnLpdNMin), + nameof(DwnLpdNStdDev), + nameof(DwnLpdStdDev), + nameof(DwnMicroScrMax), + nameof(DwnMicroScrMean), + nameof(DwnMicroScrMin), + nameof(DwnMicroScrStdDev), + nameof(DwnScrMax), + nameof(DwnScrMean), + nameof(DwnScrMin), + nameof(DwnScrStdDev), + nameof(DwnSlipMax), + nameof(DwnSlipMean), + nameof(DwnSlipMin), + nameof(DwnSlipStdDev), + nameof(DcnAll), + nameof(DcnArea), + nameof(DcnAreaCount), + nameof(DcnBin1), + nameof(DcnBin2), + nameof(DcnBin3), + nameof(DcnBin4), + nameof(DcnBin5), + nameof(DcnBin6), + nameof(DcnBin7), + nameof(DcnBin8), + nameof(DcnHazeAvg), + nameof(DcnHazeMedian), + nameof(DcnHazeStdDev), + nameof(DcnLpd), + nameof(DcnLpdES), + nameof(DcnLpdN), + nameof(DcnMicroScr), + nameof(DcnScr), + nameof(DcnSlip), + nameof(DnnAll), + nameof(DnnArea), + nameof(DnnAreaCount), + nameof(DnnBin1), + nameof(DnnBin2), + nameof(DnnBin3), + nameof(DnnBin4), + nameof(DnnBin5), + nameof(DnnBin6), + nameof(DnnBin7), + nameof(DnnBin8), + nameof(DnnHazeAvg), + nameof(DnnHazeMedian), + nameof(DnnHazeStdDev), + nameof(DnnLpd), + nameof(DnnLpdES), + nameof(DnnLpdN), + nameof(DnnMicroScr), + nameof(DnnScr), + nameof(DnnSlip), + nameof(DwnAll), + nameof(DwnArea), + nameof(DwnAreaCount), + nameof(DwnBin1), + nameof(DwnBin2), + nameof(DwnBin3), + nameof(DwnBin4), + nameof(DwnBin5), + nameof(DwnBin6), + nameof(DwnBin7), + nameof(DwnBin8), + nameof(DwnHazeAvg), + nameof(DwnHazeMedian), + nameof(DwnHazeStdDev), + nameof(DwnLpd), + nameof(DwnLpdES), + nameof(DwnLpdN), + nameof(DwnMicroScr), + nameof(DwnScr), + nameof(DwnSlip) + }; + return results; + } + + public List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test) + { + List results = new List(); + return results; + } + + public List GetNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + results.Add(jsonProperty.Name); + return results; + } + + public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description(); + return result; + } + + public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description + { + Test = -1, + Count = 0, + Index = -1, + // + EventName = configDataBase.GetEventName(), + NullData = string.Empty, + JobID = logic.Logistics.JobID, + Sequence = logic.Logistics.Sequence.ToString(), + MesEntity = logic.Logistics.MesEntity, + ReportFullPath = logic.Logistics.ReportFullPath, + ProcessJobID = logic.Logistics.ProcessJobID, + MID = logic.Logistics.MID, + // + Date = nameof(Date), + Employee = nameof(Employee), + Lot = nameof(Lot), + PSN = nameof(PSN), + Reactor = nameof(Reactor), + Recipe = nameof(Recipe), + // + Grade = nameof(Grade), + HeaderUniqueId = nameof(HeaderUniqueId), + RDS = nameof(RDS), + Session = nameof(Session), + Side = nameof(Side), + SrcDest = nameof(SrcDest), + UniqueId = nameof(UniqueId), + WaferID = nameof(WaferID), + // + DcnAllMax = nameof(DcnAllMax), + DcnAllMean = nameof(DcnAllMean), + DcnAllMin = nameof(DcnAllMin), + DcnAllStdDev = nameof(DcnAllStdDev), + DcnAreaCountMax = nameof(DcnAreaCountMax), + DcnAreaCountMean = nameof(DcnAreaCountMean), + DcnAreaCountMin = nameof(DcnAreaCountMin), + DcnAreaCountStdDev = nameof(DcnAreaCountStdDev), + DcnAreaMax = nameof(DcnAreaMax), + DcnAreaMean = nameof(DcnAreaMean), + DcnAreaMin = nameof(DcnAreaMin), + DcnAreaStdDev = nameof(DcnAreaStdDev), + DcnBin1Max = nameof(DcnBin1Max), + DcnBin1Mean = nameof(DcnBin1Mean), + DcnBin1Min = nameof(DcnBin1Min), + DcnBin1StdDev = nameof(DcnBin1StdDev), + DcnBin2Max = nameof(DcnBin2Max), + DcnBin2Mean = nameof(DcnBin2Mean), + DcnBin2Min = nameof(DcnBin2Min), + DcnBin2StdDev = nameof(DcnBin2StdDev), + DcnBin3Max = nameof(DcnBin3Max), + DcnBin3Mean = nameof(DcnBin3Mean), + DcnBin3Min = nameof(DcnBin3Min), + DcnBin3StdDev = nameof(DcnBin3StdDev), + DcnBin4Max = nameof(DcnBin4Max), + DcnBin4Mean = nameof(DcnBin4Mean), + DcnBin4Min = nameof(DcnBin4Min), + DcnBin4StdDev = nameof(DcnBin4StdDev), + DcnBin5Max = nameof(DcnBin5Max), + DcnBin5Mean = nameof(DcnBin5Mean), + DcnBin5Min = nameof(DcnBin5Min), + DcnBin5StdDev = nameof(DcnBin5StdDev), + DcnBin6Max = nameof(DcnBin6Max), + DcnBin6Mean = nameof(DcnBin6Mean), + DcnBin6Min = nameof(DcnBin6Min), + DcnBin6StdDev = nameof(DcnBin6StdDev), + DcnBin7Max = nameof(DcnBin7Max), + DcnBin7Mean = nameof(DcnBin7Mean), + DcnBin7Min = nameof(DcnBin7Min), + DcnBin7StdDev = nameof(DcnBin7StdDev), + DcnBin8Max = nameof(DcnBin8Max), + DcnBin8Mean = nameof(DcnBin8Mean), + DcnBin8Min = nameof(DcnBin8Min), + DcnBin8StdDev = nameof(DcnBin8StdDev), + DcnHazeAvgMax = nameof(DcnHazeAvgMax), + DcnHazeAvgMean = nameof(DcnHazeAvgMean), + DcnHazeAvgMin = nameof(DcnHazeAvgMin), + DcnHazeAvgStdDev = nameof(DcnHazeAvgStdDev), + DcnHazeMedianMax = nameof(DcnHazeMedianMax), + DcnHazeMedianMean = nameof(DcnHazeMedianMean), + DcnHazeMedianMin = nameof(DcnHazeMedianMin), + DcnHazeMedianStdDev = nameof(DcnHazeMedianStdDev), + DcnHazeStdDevMax = nameof(DcnHazeStdDevMax), + DcnHazeStdDevMean = nameof(DcnHazeStdDevMean), + DcnHazeStdDevMin = nameof(DcnHazeStdDevMin), + DcnHazeStdDevStdDev = nameof(DcnHazeStdDevStdDev), + DcnLpdESMax = nameof(DcnLpdESMax), + DcnLpdESMean = nameof(DcnLpdESMean), + DcnLpdESMin = nameof(DcnLpdESMin), + DcnLpdESStdDev = nameof(DcnLpdESStdDev), + DcnLpdMax = nameof(DcnLpdMax), + DcnLpdMean = nameof(DcnLpdMean), + DcnLpdMin = nameof(DcnLpdMin), + DcnLpdNMax = nameof(DcnLpdNMax), + DcnLpdNMean = nameof(DcnLpdNMean), + DcnLpdNMin = nameof(DcnLpdNMin), + DcnLpdNStdDev = nameof(DcnLpdNStdDev), + DcnLpdStdDev = nameof(DcnLpdStdDev), + DcnMicroScrMax = nameof(DcnMicroScrMax), + DcnMicroScrMean = nameof(DcnMicroScrMean), + DcnMicroScrMin = nameof(DcnMicroScrMin), + DcnMicroScrStdDev = nameof(DcnMicroScrStdDev), + DcnScrMax = nameof(DcnScrMax), + DcnScrMean = nameof(DcnScrMean), + DcnScrMin = nameof(DcnScrMin), + DcnScrStdDev = nameof(DcnScrStdDev), + DcnSlipMax = nameof(DcnSlipMax), + DcnSlipMean = nameof(DcnSlipMean), + DcnSlipMin = nameof(DcnSlipMin), + DcnSlipStdDev = nameof(DcnSlipStdDev), + DnnAllMax = nameof(DnnAllMax), + DnnAllMean = nameof(DnnAllMean), + DnnAllMin = nameof(DnnAllMin), + DnnAllStdDev = nameof(DnnAllStdDev), + DnnAreaCountMax = nameof(DnnAreaCountMax), + DnnAreaCountMean = nameof(DnnAreaCountMean), + DnnAreaCountMin = nameof(DnnAreaCountMin), + DnnAreaCountStdDev = nameof(DnnAreaCountStdDev), + DnnAreaMax = nameof(DnnAreaMax), + DnnAreaMean = nameof(DnnAreaMean), + DnnAreaMin = nameof(DnnAreaMin), + DnnAreaStdDev = nameof(DnnAreaStdDev), + DnnBin1Max = nameof(DnnBin1Max), + DnnBin1Mean = nameof(DnnBin1Mean), + DnnBin1Min = nameof(DnnBin1Min), + DnnBin1StdDev = nameof(DnnBin1StdDev), + DnnBin2Max = nameof(DnnBin2Max), + DnnBin2Mean = nameof(DnnBin2Mean), + DnnBin2Min = nameof(DnnBin2Min), + DnnBin2StdDev = nameof(DnnBin2StdDev), + DnnBin3Max = nameof(DnnBin3Max), + DnnBin3Mean = nameof(DnnBin3Mean), + DnnBin3Min = nameof(DnnBin3Min), + DnnBin3StdDev = nameof(DnnBin3StdDev), + DnnBin4Max = nameof(DnnBin4Max), + DnnBin4Mean = nameof(DnnBin4Mean), + DnnBin4Min = nameof(DnnBin4Min), + DnnBin4StdDev = nameof(DnnBin4StdDev), + DnnBin5Max = nameof(DnnBin5Max), + DnnBin5Mean = nameof(DnnBin5Mean), + DnnBin5Min = nameof(DnnBin5Min), + DnnBin5StdDev = nameof(DnnBin5StdDev), + DnnBin6Max = nameof(DnnBin6Max), + DnnBin6Mean = nameof(DnnBin6Mean), + DnnBin6Min = nameof(DnnBin6Min), + DnnBin6StdDev = nameof(DnnBin6StdDev), + DnnBin7Max = nameof(DnnBin7Max), + DnnBin7Mean = nameof(DnnBin7Mean), + DnnBin7Min = nameof(DnnBin7Min), + DnnBin7StdDev = nameof(DnnBin7StdDev), + DnnBin8Max = nameof(DnnBin8Max), + DnnBin8Mean = nameof(DnnBin8Mean), + DnnBin8Min = nameof(DnnBin8Min), + DnnBin8StdDev = nameof(DnnBin8StdDev), + DnnHazeAvgMax = nameof(DnnHazeAvgMax), + DnnHazeAvgMean = nameof(DnnHazeAvgMean), + DnnHazeAvgMin = nameof(DnnHazeAvgMin), + DnnHazeAvgStdDev = nameof(DnnHazeAvgStdDev), + DnnHazeMedianMax = nameof(DnnHazeMedianMax), + DnnHazeMedianMean = nameof(DnnHazeMedianMean), + DnnHazeMedianMin = nameof(DnnHazeMedianMin), + DnnHazeMedianStdDev = nameof(DnnHazeMedianStdDev), + DnnHazeStdDevMax = nameof(DnnHazeStdDevMax), + DnnHazeStdDevMean = nameof(DnnHazeStdDevMean), + DnnHazeStdDevMin = nameof(DnnHazeStdDevMin), + DnnHazeStdDevStdDev = nameof(DnnHazeStdDevStdDev), + DnnLpdESMax = nameof(DnnLpdESMax), + DnnLpdESMean = nameof(DnnLpdESMean), + DnnLpdESMin = nameof(DnnLpdESMin), + DnnLpdESStdDev = nameof(DnnLpdESStdDev), + DnnLpdMax = nameof(DnnLpdMax), + DnnLpdMean = nameof(DnnLpdMean), + DnnLpdMin = nameof(DnnLpdMin), + DnnLpdNMax = nameof(DnnLpdNMax), + DnnLpdNMean = nameof(DnnLpdNMean), + DnnLpdNMin = nameof(DnnLpdNMin), + DnnLpdNStdDev = nameof(DnnLpdNStdDev), + DnnLpdStdDev = nameof(DnnLpdStdDev), + DnnMicroScrMax = nameof(DnnMicroScrMax), + DnnMicroScrMean = nameof(DnnMicroScrMean), + DnnMicroScrMin = nameof(DnnMicroScrMin), + DnnMicroScrStdDev = nameof(DnnMicroScrStdDev), + DnnScrMax = nameof(DnnScrMax), + DnnScrMean = nameof(DnnScrMean), + DnnScrMin = nameof(DnnScrMin), + DnnScrStdDev = nameof(DnnScrStdDev), + DnnSlipMax = nameof(DnnSlipMax), + DnnSlipMean = nameof(DnnSlipMean), + DnnSlipMin = nameof(DnnSlipMin), + DnnSlipStdDev = nameof(DnnSlipStdDev), + DwnAllMax = nameof(DwnAllMax), + DwnAllMean = nameof(DwnAllMean), + DwnAllMin = nameof(DwnAllMin), + DwnAllStdDev = nameof(DwnAllStdDev), + DwnAreaCountMax = nameof(DwnAreaCountMax), + DwnAreaCountMean = nameof(DwnAreaCountMean), + DwnAreaCountMin = nameof(DwnAreaCountMin), + DwnAreaCountStdDev = nameof(DwnAreaCountStdDev), + DwnAreaMax = nameof(DwnAreaMax), + DwnAreaMean = nameof(DwnAreaMean), + DwnAreaMin = nameof(DwnAreaMin), + DwnAreaStdDev = nameof(DwnAreaStdDev), + DwnBin1Max = nameof(DwnBin1Max), + DwnBin1Mean = nameof(DwnBin1Mean), + DwnBin1Min = nameof(DwnBin1Min), + DwnBin1StdDev = nameof(DwnBin1StdDev), + DwnBin2Max = nameof(DwnBin2Max), + DwnBin2Mean = nameof(DwnBin2Mean), + DwnBin2Min = nameof(DwnBin2Min), + DwnBin2StdDev = nameof(DwnBin2StdDev), + DwnBin3Max = nameof(DwnBin3Max), + DwnBin3Mean = nameof(DwnBin3Mean), + DwnBin3Min = nameof(DwnBin3Min), + DwnBin3StdDev = nameof(DwnBin3StdDev), + DwnBin4Max = nameof(DwnBin4Max), + DwnBin4Mean = nameof(DwnBin4Mean), + DwnBin4Min = nameof(DwnBin4Min), + DwnBin4StdDev = nameof(DwnBin4StdDev), + DwnBin5Max = nameof(DwnBin5Max), + DwnBin5Mean = nameof(DwnBin5Mean), + DwnBin5Min = nameof(DwnBin5Min), + DwnBin5StdDev = nameof(DwnBin5StdDev), + DwnBin6Max = nameof(DwnBin6Max), + DwnBin6Mean = nameof(DwnBin6Mean), + DwnBin6Min = nameof(DwnBin6Min), + DwnBin6StdDev = nameof(DwnBin6StdDev), + DwnBin7Max = nameof(DwnBin7Max), + DwnBin7Mean = nameof(DwnBin7Mean), + DwnBin7Min = nameof(DwnBin7Min), + DwnBin7StdDev = nameof(DwnBin7StdDev), + DwnBin8Max = nameof(DwnBin8Max), + DwnBin8Mean = nameof(DwnBin8Mean), + DwnBin8Min = nameof(DwnBin8Min), + DwnBin8StdDev = nameof(DwnBin8StdDev), + DwnHazeAvgMax = nameof(DwnHazeAvgMax), + DwnHazeAvgMean = nameof(DwnHazeAvgMean), + DwnHazeAvgMin = nameof(DwnHazeAvgMin), + DwnHazeAvgStdDev = nameof(DwnHazeAvgStdDev), + DwnHazeMedianMax = nameof(DwnHazeMedianMax), + DwnHazeMedianMean = nameof(DwnHazeMedianMean), + DwnHazeMedianMin = nameof(DwnHazeMedianMin), + DwnHazeMedianStdDev = nameof(DwnHazeMedianStdDev), + DwnHazeStdDevMax = nameof(DwnHazeStdDevMax), + DwnHazeStdDevMean = nameof(DwnHazeStdDevMean), + DwnHazeStdDevMin = nameof(DwnHazeStdDevMin), + DwnHazeStdDevStdDev = nameof(DwnHazeStdDevStdDev), + DwnLpdESMax = nameof(DwnLpdESMax), + DwnLpdESMean = nameof(DwnLpdESMean), + DwnLpdESMin = nameof(DwnLpdESMin), + DwnLpdESStdDev = nameof(DwnLpdESStdDev), + DwnLpdMax = nameof(DwnLpdMax), + DwnLpdMean = nameof(DwnLpdMean), + DwnLpdMin = nameof(DwnLpdMin), + DwnLpdNMax = nameof(DwnLpdNMax), + DwnLpdNMean = nameof(DwnLpdNMean), + DwnLpdNMin = nameof(DwnLpdNMin), + DwnLpdNStdDev = nameof(DwnLpdNStdDev), + DwnLpdStdDev = nameof(DwnLpdStdDev), + DwnMicroScrMax = nameof(DwnMicroScrMax), + DwnMicroScrMean = nameof(DwnMicroScrMean), + DwnMicroScrMin = nameof(DwnMicroScrMin), + DwnMicroScrStdDev = nameof(DwnMicroScrStdDev), + DwnScrMax = nameof(DwnScrMax), + DwnScrMean = nameof(DwnScrMean), + DwnScrMin = nameof(DwnScrMin), + DwnScrStdDev = nameof(DwnScrStdDev), + DwnSlipMax = nameof(DwnSlipMax), + DwnSlipMean = nameof(DwnSlipMean), + DwnSlipMin = nameof(DwnSlipMin), + DwnSlipStdDev = nameof(DwnSlipStdDev), + DcnAll = nameof(DcnAll), + DcnArea = nameof(DcnArea), + DcnAreaCount = nameof(DcnAreaCount), + DcnBin1 = nameof(DcnBin1), + DcnBin2 = nameof(DcnBin2), + DcnBin3 = nameof(DcnBin3), + DcnBin4 = nameof(DcnBin4), + DcnBin5 = nameof(DcnBin5), + DcnBin6 = nameof(DcnBin6), + DcnBin7 = nameof(DcnBin7), + DcnBin8 = nameof(DcnBin8), + DcnHazeAvg = nameof(DcnHazeAvg), + DcnHazeMedian = nameof(DcnHazeMedian), + DcnHazeStdDev = nameof(DcnHazeStdDev), + DcnLpd = nameof(DcnLpd), + DcnLpdES = nameof(DcnLpdES), + DcnLpdN = nameof(DcnLpdN), + DcnMicroScr = nameof(DcnMicroScr), + DcnScr = nameof(DcnScr), + DcnSlip = nameof(DcnSlip), + DnnAll = nameof(DnnAll), + DnnArea = nameof(DnnArea), + DnnAreaCount = nameof(DnnAreaCount), + DnnBin1 = nameof(DnnBin1), + DnnBin2 = nameof(DnnBin2), + DnnBin3 = nameof(DnnBin3), + DnnBin4 = nameof(DnnBin4), + DnnBin5 = nameof(DnnBin5), + DnnBin6 = nameof(DnnBin6), + DnnBin7 = nameof(DnnBin7), + DnnBin8 = nameof(DnnBin8), + DnnHazeAvg = nameof(DnnHazeAvg), + DnnHazeMedian = nameof(DnnHazeMedian), + DnnHazeStdDev = nameof(DnnHazeStdDev), + DnnLpd = nameof(DnnLpd), + DnnLpdES = nameof(DnnLpdES), + DnnLpdN = nameof(DnnLpdN), + DnnMicroScr = nameof(DnnMicroScr), + DnnScr = nameof(DnnScr), + DnnSlip = nameof(DnnSlip), + DwnAll = nameof(DwnAll), + DwnArea = nameof(DwnArea), + DwnAreaCount = nameof(DwnAreaCount), + DwnBin1 = nameof(DwnBin1), + DwnBin2 = nameof(DwnBin2), + DwnBin3 = nameof(DwnBin3), + DwnBin4 = nameof(DwnBin4), + DwnBin5 = nameof(DwnBin5), + DwnBin6 = nameof(DwnBin6), + DwnBin7 = nameof(DwnBin7), + DwnBin8 = nameof(DwnBin8), + DwnHazeAvg = nameof(DwnHazeAvg), + DwnHazeMedian = nameof(DwnHazeMedian), + DwnHazeStdDev = nameof(DwnHazeStdDev), + DwnLpd = nameof(DwnLpd), + DwnLpdES = nameof(DwnLpdES), + DwnLpdN = nameof(DwnLpdN), + DwnMicroScr = nameof(DwnMicroScr), + DwnScr = nameof(DwnScr), + DwnSlip = nameof(DwnSlip), + }; + return result; + } + + public List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData) + { + List results = new List(); + if (iProcessData is null || !(iProcessData is ProcessData processData) || processData.Header is null || !processData.Details.Any()) + results.Add(GetDefault(logic, configDataBase)); + else + { + string nullData; + Description description; + object configDataNullData = ConfigData.NullData; + if (configDataNullData is null) + nullData = string.Empty; + else + nullData = configDataNullData.ToString(); + for (int i = 0; i < processData.Details.Count; i++) + { + description = new Description + { + Test = (int)tests[i], + Count = tests.Count, + Index = i, + // + EventName = configDataBase.GetEventName(), + NullData = nullData, + JobID = logic.Logistics.JobID, + Sequence = logic.Logistics.Sequence.ToString(), + MesEntity = logic.Logistics.MesEntity, + ReportFullPath = logic.Logistics.ReportFullPath, + ProcessJobID = logic.Logistics.ProcessJobID, + MID = logic.Logistics.MID, + // + Date = processData.Header.Date, + Employee = processData.Header.Operator, + Lot = processData.Header.Lot, + PSN = processData.Header.PSN, + Reactor = processData.Header.Reactor, + Recipe = processData.Header.Recipe, + // + Grade = processData.Details[i].Grade, + HeaderUniqueId = processData.Details[i].HeaderUniqueID, + RDS = processData.Header.RDS, + Session = processData.Header.Session, + Side = processData.Details[i].Side, + SrcDest = processData.Details[i].SrcDest, + UniqueId = processData.Details[i].UniqueID, + WaferID = processData.Details[i].WaferID, + // + DcnAllMax = processData.Header.DcnAllMax, + DcnAllMean = processData.Header.DcnAllMean, + DcnAllMin = processData.Header.DcnAllMin, + DcnAllStdDev = processData.Header.DcnAllStdDev, + DcnAreaCountMax = processData.Header.DcnAreaCountMax, + DcnAreaCountMean = processData.Header.DcnAreaCountMean, + DcnAreaCountMin = processData.Header.DcnAreaCountMin, + DcnAreaCountStdDev = processData.Header.DcnAreaCountStdDev, + DcnAreaMax = processData.Header.DcnAreaMax, + DcnAreaMean = processData.Header.DcnAreaMean, + DcnAreaMin = processData.Header.DcnAreaMin, + DcnAreaStdDev = processData.Header.DcnAreaStdDev, + DcnBin1Max = processData.Header.DcnBin1Max, + DcnBin1Mean = processData.Header.DcnBin1Mean, + DcnBin1Min = processData.Header.DcnBin1Min, + DcnBin1StdDev = processData.Header.DcnBin1StdDev, + DcnBin2Max = processData.Header.DcnBin2Max, + DcnBin2Mean = processData.Header.DcnBin2Mean, + DcnBin2Min = processData.Header.DcnBin2Min, + DcnBin2StdDev = processData.Header.DcnBin2StdDev, + DcnBin3Max = processData.Header.DcnBin3Max, + DcnBin3Mean = processData.Header.DcnBin3Mean, + DcnBin3Min = processData.Header.DcnBin3Min, + DcnBin3StdDev = processData.Header.DcnBin3StdDev, + DcnBin4Max = processData.Header.DcnBin4Max, + DcnBin4Mean = processData.Header.DcnBin4Mean, + DcnBin4Min = processData.Header.DcnBin4Min, + DcnBin4StdDev = processData.Header.DcnBin4StdDev, + DcnBin5Max = processData.Header.DcnBin5Max, + DcnBin5Mean = processData.Header.DcnBin5Mean, + DcnBin5Min = processData.Header.DcnBin5Min, + DcnBin5StdDev = processData.Header.DcnBin5StdDev, + DcnBin6Max = processData.Header.DcnBin6Max, + DcnBin6Mean = processData.Header.DcnBin6Mean, + DcnBin6Min = processData.Header.DcnBin6Min, + DcnBin6StdDev = processData.Header.DcnBin6StdDev, + DcnBin7Max = processData.Header.DcnBin7Max, + DcnBin7Mean = processData.Header.DcnBin7Mean, + DcnBin7Min = processData.Header.DcnBin7Min, + DcnBin7StdDev = processData.Header.DcnBin7StdDev, + DcnBin8Max = processData.Header.DcnBin8Max, + DcnBin8Mean = processData.Header.DcnBin8Mean, + DcnBin8Min = processData.Header.DcnBin8Min, + DcnBin8StdDev = processData.Header.DcnBin8StdDev, + DcnHazeAvgMax = processData.Header.DcnHazeAvgMax, + DcnHazeAvgMean = processData.Header.DcnHazeAvgMean, + DcnHazeAvgMin = processData.Header.DcnHazeAvgMin, + DcnHazeAvgStdDev = processData.Header.DcnHazeAvgStdDev, + DcnHazeMedianMax = processData.Header.DcnHazeMedianMax, + DcnHazeMedianMean = processData.Header.DcnHazeMedianMean, + DcnHazeMedianMin = processData.Header.DcnHazeMedianMin, + DcnHazeMedianStdDev = processData.Header.DcnHazeMedianStdDev, + DcnHazeStdDevMax = processData.Header.DcnHazeStdDevMax, + DcnHazeStdDevMean = processData.Header.DcnHazeStdDevMean, + DcnHazeStdDevMin = processData.Header.DcnHazeStdDevMin, + DcnHazeStdDevStdDev = processData.Header.DcnHazeStdDevStdDev, + DcnLpdESMax = processData.Header.DcnLpdESMax, + DcnLpdESMean = processData.Header.DcnLpdESMean, + DcnLpdESMin = processData.Header.DcnLpdESMin, + DcnLpdESStdDev = processData.Header.DcnLpdESStdDev, + DcnLpdMax = processData.Header.DcnLpdMax, + DcnLpdMean = processData.Header.DcnLpdMean, + DcnLpdMin = processData.Header.DcnLpdMin, + DcnLpdNMax = processData.Header.DcnLpdNMax, + DcnLpdNMean = processData.Header.DcnLpdNMean, + DcnLpdNMin = processData.Header.DcnLpdNMin, + DcnLpdNStdDev = processData.Header.DcnLpdNStdDev, + DcnLpdStdDev = processData.Header.DcnLpdStdDev, + DcnMicroScrMax = processData.Header.DcnMicroScrMax, + DcnMicroScrMean = processData.Header.DcnMicroScrMean, + DcnMicroScrMin = processData.Header.DcnMicroScrMin, + DcnMicroScrStdDev = processData.Header.DcnMicroScrStdDev, + DcnScrMax = processData.Header.DcnScrMax, + DcnScrMean = processData.Header.DcnScrMean, + DcnScrMin = processData.Header.DcnScrMin, + DcnScrStdDev = processData.Header.DcnScrStdDev, + DcnSlipMax = processData.Header.DcnSlipMax, + DcnSlipMean = processData.Header.DcnSlipMean, + DcnSlipMin = processData.Header.DcnSlipMin, + DcnSlipStdDev = processData.Header.DcnSlipStdDev, + DnnAllMax = processData.Header.DnnAllMax, + DnnAllMean = processData.Header.DnnAllMean, + DnnAllMin = processData.Header.DnnAllMin, + DnnAllStdDev = processData.Header.DnnAllStdDev, + DnnAreaCountMax = processData.Header.DnnAreaCountMax, + DnnAreaCountMean = processData.Header.DnnAreaCountMean, + DnnAreaCountMin = processData.Header.DnnAreaCountMin, + DnnAreaCountStdDev = processData.Header.DnnAreaCountStdDev, + DnnAreaMax = processData.Header.DnnAreaMax, + DnnAreaMean = processData.Header.DnnAreaMean, + DnnAreaMin = processData.Header.DnnAreaMin, + DnnAreaStdDev = processData.Header.DnnAreaStdDev, + DnnBin1Max = processData.Header.DnnBin1Max, + DnnBin1Mean = processData.Header.DnnBin1Mean, + DnnBin1Min = processData.Header.DnnBin1Min, + DnnBin1StdDev = processData.Header.DnnBin1StdDev, + DnnBin2Max = processData.Header.DnnBin2Max, + DnnBin2Mean = processData.Header.DnnBin2Mean, + DnnBin2Min = processData.Header.DnnBin2Min, + DnnBin2StdDev = processData.Header.DnnBin2StdDev, + DnnBin3Max = processData.Header.DnnBin3Max, + DnnBin3Mean = processData.Header.DnnBin3Mean, + DnnBin3Min = processData.Header.DnnBin3Min, + DnnBin3StdDev = processData.Header.DnnBin3StdDev, + DnnBin4Max = processData.Header.DnnBin4Max, + DnnBin4Mean = processData.Header.DnnBin4Mean, + DnnBin4Min = processData.Header.DnnBin4Min, + DnnBin4StdDev = processData.Header.DnnBin4StdDev, + DnnBin5Max = processData.Header.DnnBin5Max, + DnnBin5Mean = processData.Header.DnnBin5Mean, + DnnBin5Min = processData.Header.DnnBin5Min, + DnnBin5StdDev = processData.Header.DnnBin5StdDev, + DnnBin6Max = processData.Header.DnnBin6Max, + DnnBin6Mean = processData.Header.DnnBin6Mean, + DnnBin6Min = processData.Header.DnnBin6Min, + DnnBin6StdDev = processData.Header.DnnBin6StdDev, + DnnBin7Max = processData.Header.DnnBin7Max, + DnnBin7Mean = processData.Header.DnnBin7Mean, + DnnBin7Min = processData.Header.DnnBin7Min, + DnnBin7StdDev = processData.Header.DnnBin7StdDev, + DnnBin8Max = processData.Header.DnnBin8Max, + DnnBin8Mean = processData.Header.DnnBin8Mean, + DnnBin8Min = processData.Header.DnnBin8Min, + DnnBin8StdDev = processData.Header.DnnBin8StdDev, + DnnHazeAvgMax = processData.Header.DnnHazeAvgMax, + DnnHazeAvgMean = processData.Header.DnnHazeAvgMean, + DnnHazeAvgMin = processData.Header.DnnHazeAvgMin, + DnnHazeAvgStdDev = processData.Header.DnnHazeAvgStdDev, + DnnHazeMedianMax = processData.Header.DnnHazeMedianMax, + DnnHazeMedianMean = processData.Header.DnnHazeMedianMean, + DnnHazeMedianMin = processData.Header.DnnHazeMedianMin, + DnnHazeMedianStdDev = processData.Header.DnnHazeMedianStdDev, + DnnHazeStdDevMax = processData.Header.DnnHazeStdDevMax, + DnnHazeStdDevMean = processData.Header.DnnHazeStdDevMean, + DnnHazeStdDevMin = processData.Header.DnnHazeStdDevMin, + DnnHazeStdDevStdDev = processData.Header.DnnHazeStdDevStdDev, + DnnLpdESMax = processData.Header.DnnLpdESMax, + DnnLpdESMean = processData.Header.DnnLpdESMean, + DnnLpdESMin = processData.Header.DnnLpdESMin, + DnnLpdESStdDev = processData.Header.DnnLpdESStdDev, + DnnLpdMax = processData.Header.DnnLpdMax, + DnnLpdMean = processData.Header.DnnLpdMean, + DnnLpdMin = processData.Header.DnnLpdMin, + DnnLpdNMax = processData.Header.DnnLpdNMax, + DnnLpdNMean = processData.Header.DnnLpdNMean, + DnnLpdNMin = processData.Header.DnnLpdNMin, + DnnLpdNStdDev = processData.Header.DnnLpdNStdDev, + DnnLpdStdDev = processData.Header.DnnLpdStdDev, + DnnMicroScrMax = processData.Header.DnnMicroScrMax, + DnnMicroScrMean = processData.Header.DnnMicroScrMean, + DnnMicroScrMin = processData.Header.DnnMicroScrMin, + DnnMicroScrStdDev = processData.Header.DnnMicroScrStdDev, + DnnScrMax = processData.Header.DnnScrMax, + DnnScrMean = processData.Header.DnnScrMean, + DnnScrMin = processData.Header.DnnScrMin, + DnnScrStdDev = processData.Header.DnnScrStdDev, + DnnSlipMax = processData.Header.DnnSlipMax, + DnnSlipMean = processData.Header.DnnSlipMean, + DnnSlipMin = processData.Header.DnnSlipMin, + DnnSlipStdDev = processData.Header.DnnSlipStdDev, + DwnAllMax = processData.Header.DwnAllMax, + DwnAllMean = processData.Header.DwnAllMean, + DwnAllMin = processData.Header.DwnAllMin, + DwnAllStdDev = processData.Header.DwnAllStdDev, + DwnAreaCountMax = processData.Header.DwnAreaCountMax, + DwnAreaCountMean = processData.Header.DwnAreaCountMean, + DwnAreaCountMin = processData.Header.DwnAreaCountMin, + DwnAreaCountStdDev = processData.Header.DwnAreaCountStdDev, + DwnAreaMax = processData.Header.DwnAreaMax, + DwnAreaMean = processData.Header.DwnAreaMean, + DwnAreaMin = processData.Header.DwnAreaMin, + DwnAreaStdDev = processData.Header.DwnAreaStdDev, + DwnBin1Max = processData.Header.DwnBin1Max, + DwnBin1Mean = processData.Header.DwnBin1Mean, + DwnBin1Min = processData.Header.DwnBin1Min, + DwnBin1StdDev = processData.Header.DwnBin1StdDev, + DwnBin2Max = processData.Header.DwnBin2Max, + DwnBin2Mean = processData.Header.DwnBin2Mean, + DwnBin2Min = processData.Header.DwnBin2Min, + DwnBin2StdDev = processData.Header.DwnBin2StdDev, + DwnBin3Max = processData.Header.DwnBin3Max, + DwnBin3Mean = processData.Header.DwnBin3Mean, + DwnBin3Min = processData.Header.DwnBin3Min, + DwnBin3StdDev = processData.Header.DwnBin3StdDev, + DwnBin4Max = processData.Header.DwnBin4Max, + DwnBin4Mean = processData.Header.DwnBin4Mean, + DwnBin4Min = processData.Header.DwnBin4Min, + DwnBin4StdDev = processData.Header.DwnBin4StdDev, + DwnBin5Max = processData.Header.DwnBin5Max, + DwnBin5Mean = processData.Header.DwnBin5Mean, + DwnBin5Min = processData.Header.DwnBin5Min, + DwnBin5StdDev = processData.Header.DwnBin5StdDev, + DwnBin6Max = processData.Header.DwnBin6Max, + DwnBin6Mean = processData.Header.DwnBin6Mean, + DwnBin6Min = processData.Header.DwnBin6Min, + DwnBin6StdDev = processData.Header.DwnBin6StdDev, + DwnBin7Max = processData.Header.DwnBin7Max, + DwnBin7Mean = processData.Header.DwnBin7Mean, + DwnBin7Min = processData.Header.DwnBin7Min, + DwnBin7StdDev = processData.Header.DwnBin7StdDev, + DwnBin8Max = processData.Header.DwnBin8Max, + DwnBin8Mean = processData.Header.DwnBin8Mean, + DwnBin8Min = processData.Header.DwnBin8Min, + DwnBin8StdDev = processData.Header.DwnBin8StdDev, + DwnHazeAvgMax = processData.Header.DwnHazeAvgMax, + DwnHazeAvgMean = processData.Header.DwnHazeAvgMean, + DwnHazeAvgMin = processData.Header.DwnHazeAvgMin, + DwnHazeAvgStdDev = processData.Header.DwnHazeAvgStdDev, + DwnHazeMedianMax = processData.Header.DwnHazeMedianMax, + DwnHazeMedianMean = processData.Header.DwnHazeMedianMean, + DwnHazeMedianMin = processData.Header.DwnHazeMedianMin, + DwnHazeMedianStdDev = processData.Header.DwnHazeMedianStdDev, + DwnHazeStdDevMax = processData.Header.DwnHazeStdDevMax, + DwnHazeStdDevMean = processData.Header.DwnHazeStdDevMean, + DwnHazeStdDevMin = processData.Header.DwnHazeStdDevMin, + DwnHazeStdDevStdDev = processData.Header.DwnHazeStdDevStdDev, + DwnLpdESMax = processData.Header.DwnLpdESMax, + DwnLpdESMean = processData.Header.DwnLpdESMean, + DwnLpdESMin = processData.Header.DwnLpdESMin, + DwnLpdESStdDev = processData.Header.DwnLpdESStdDev, + DwnLpdMax = processData.Header.DwnLpdMax, + DwnLpdMean = processData.Header.DwnLpdMean, + DwnLpdMin = processData.Header.DwnLpdMin, + DwnLpdNMax = processData.Header.DwnLpdNMax, + DwnLpdNMean = processData.Header.DwnLpdNMean, + DwnLpdNMin = processData.Header.DwnLpdNMin, + DwnLpdNStdDev = processData.Header.DwnLpdNStdDev, + DwnLpdStdDev = processData.Header.DwnLpdStdDev, + DwnMicroScrMax = processData.Header.DwnMicroScrMax, + DwnMicroScrMean = processData.Header.DwnMicroScrMean, + DwnMicroScrMin = processData.Header.DwnMicroScrMin, + DwnMicroScrStdDev = processData.Header.DwnMicroScrStdDev, + DwnScrMax = processData.Header.DwnScrMax, + DwnScrMean = processData.Header.DwnScrMean, + DwnScrMin = processData.Header.DwnScrMin, + DwnScrStdDev = processData.Header.DwnScrStdDev, + DwnSlipMax = processData.Header.DwnSlipMax, + DwnSlipMean = processData.Header.DwnSlipMean, + DwnSlipMin = processData.Header.DwnSlipMin, + DwnSlipStdDev = processData.Header.DwnSlipStdDev, + DcnAll = processData.Details[i].DcnAll, + DcnArea = processData.Details[i].DcnArea, + DcnAreaCount = processData.Details[i].DcnAreaCount, + DcnBin1 = processData.Details[i].DcnBin1, + DcnBin2 = processData.Details[i].DcnBin2, + DcnBin3 = processData.Details[i].DcnBin3, + DcnBin4 = processData.Details[i].DcnBin4, + DcnBin5 = processData.Details[i].DcnBin5, + DcnBin6 = processData.Details[i].DcnBin6, + DcnBin7 = processData.Details[i].DcnBin7, + DcnBin8 = processData.Details[i].DcnBin8, + DcnHazeAvg = processData.Details[i].DcnHazeAvg, + DcnHazeMedian = processData.Details[i].DcnHazeMedian, + DcnHazeStdDev = processData.Details[i].DcnHazeStdDev, + DcnLpd = processData.Details[i].DcnLpd, + DcnLpdES = processData.Details[i].DcnLpdES, + DcnLpdN = processData.Details[i].DcnLpdN, + DcnMicroScr = processData.Details[i].DcnMicroScr, + DcnScr = processData.Details[i].DcnScr, + DcnSlip = processData.Details[i].DcnSlip, + DnnAll = processData.Details[i].DnnAll, + DnnArea = processData.Details[i].DnnArea, + DnnAreaCount = processData.Details[i].DnnAreaCount, + DnnBin1 = processData.Details[i].DnnBin1, + DnnBin2 = processData.Details[i].DnnBin2, + DnnBin3 = processData.Details[i].DnnBin3, + DnnBin4 = processData.Details[i].DnnBin4, + DnnBin5 = processData.Details[i].DnnBin5, + DnnBin6 = processData.Details[i].DnnBin6, + DnnBin7 = processData.Details[i].DnnBin7, + DnnBin8 = processData.Details[i].DnnBin8, + DnnHazeAvg = processData.Details[i].DnnHazeAvg, + DnnHazeMedian = processData.Details[i].DnnHazeMedian, + DnnHazeStdDev = processData.Details[i].DnnHazeStdDev, + DnnLpd = processData.Details[i].DnnLpd, + DnnLpdES = processData.Details[i].DnnLpdES, + DnnLpdN = processData.Details[i].DnnLpdN, + DnnMicroScr = processData.Details[i].DnnMicroScr, + DnnScr = processData.Details[i].DnnScr, + DnnSlip = processData.Details[i].DnnSlip, + DwnAll = processData.Details[i].DwnAll, + DwnArea = processData.Details[i].DwnArea, + DwnAreaCount = processData.Details[i].DwnAreaCount, + DwnBin1 = processData.Details[i].DwnBin1, + DwnBin2 = processData.Details[i].DwnBin2, + DwnBin3 = processData.Details[i].DwnBin3, + DwnBin4 = processData.Details[i].DwnBin4, + DwnBin5 = processData.Details[i].DwnBin5, + DwnBin6 = processData.Details[i].DwnBin6, + DwnBin7 = processData.Details[i].DwnBin7, + DwnBin8 = processData.Details[i].DwnBin8, + DwnHazeAvg = processData.Details[i].DwnHazeAvg, + DwnHazeMedian = processData.Details[i].DwnHazeMedian, + DwnHazeStdDev = processData.Details[i].DwnHazeStdDev, + DwnLpd = processData.Details[i].DwnLpd, + DwnLpdES = processData.Details[i].DwnLpdES, + DwnLpdN = processData.Details[i].DwnLpdN, + DwnMicroScr = processData.Details[i].DwnMicroScr, + DwnScr = processData.Details[i].DwnScr, + DwnSlip = processData.Details[i].DwnSlip + }; + results.Add(description); + } + } + return results; + } + + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.HeaderFile.cs b/Adaptation/Helpers/ProcessData.HeaderFile.cs new file mode 100644 index 0000000..9ed6bfa --- /dev/null +++ b/Adaptation/Helpers/ProcessData.HeaderFile.cs @@ -0,0 +1,267 @@ +using System.Collections.Generic; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + public class HeaderFile + { + + public string JobID { get; set; } + public string MesEntity { get; set; } + public string Date { get; set; } + public string Lot { get; set; } + public string Operator { get; set; } + public string PSN { get; set; } + public string RDS { get; set; } + public string Reactor { get; set; } + public string Recipe { get; set; } + public string Session { get; set; } + public string UniqueID { get; set; } + public string DcnAllMax { get; set; } + public string DcnAllMean { get; set; } + public string DcnAllMin { get; set; } + public string DcnAllStdDev { get; set; } + public string DcnAreaCountMax { get; set; } + public string DcnAreaCountMean { get; set; } + public string DcnAreaCountMin { get; set; } + public string DcnAreaCountStdDev { get; set; } + public string DcnAreaMax { get; set; } + public string DcnAreaMean { get; set; } + public string DcnAreaMin { get; set; } + public string DcnAreaStdDev { get; set; } + public string DcnBin1Max { get; set; } + public string DcnBin1Mean { get; set; } + public string DcnBin1Min { get; set; } + public string DcnBin1StdDev { get; set; } + public string DcnBin2Max { get; set; } + public string DcnBin2Mean { get; set; } + public string DcnBin2Min { get; set; } + public string DcnBin2StdDev { get; set; } + public string DcnBin3Max { get; set; } + public string DcnBin3Mean { get; set; } + public string DcnBin3Min { get; set; } + public string DcnBin3StdDev { get; set; } + public string DcnBin4Max { get; set; } + public string DcnBin4Mean { get; set; } + public string DcnBin4Min { get; set; } + public string DcnBin4StdDev { get; set; } + public string DcnBin5Max { get; set; } + public string DcnBin5Mean { get; set; } + public string DcnBin5Min { get; set; } + public string DcnBin5StdDev { get; set; } + public string DcnBin6Max { get; set; } + public string DcnBin6Mean { get; set; } + public string DcnBin6Min { get; set; } + public string DcnBin6StdDev { get; set; } + public string DcnBin7Max { get; set; } + public string DcnBin7Mean { get; set; } + public string DcnBin7Min { get; set; } + public string DcnBin7StdDev { get; set; } + public string DcnBin8Max { get; set; } + public string DcnBin8Mean { get; set; } + public string DcnBin8Min { get; set; } + public string DcnBin8StdDev { get; set; } + public string DcnHazeAvgMax { get; set; } + public string DcnHazeAvgMean { get; set; } + public string DcnHazeAvgMin { get; set; } + public string DcnHazeAvgStdDev { get; set; } + public string DcnHazeMedianMax { get; set; } + public string DcnHazeMedianMean { get; set; } + public string DcnHazeMedianMin { get; set; } + public string DcnHazeMedianStdDev { get; set; } + public string DcnHazeStdDevMax { get; set; } + public string DcnHazeStdDevMean { get; set; } + public string DcnHazeStdDevMin { get; set; } + public string DcnHazeStdDevStdDev { get; set; } + public string DcnLpdESMax { get; set; } + public string DcnLpdESMean { get; set; } + public string DcnLpdESMin { get; set; } + public string DcnLpdESStdDev { get; set; } + public string DcnLpdMax { get; set; } + public string DcnLpdMean { get; set; } + public string DcnLpdMin { get; set; } + public string DcnLpdNMax { get; set; } + public string DcnLpdNMean { get; set; } + public string DcnLpdNMin { get; set; } + public string DcnLpdNStdDev { get; set; } + public string DcnLpdStdDev { get; set; } + public string DcnMicroScrMax { get; set; } + public string DcnMicroScrMean { get; set; } + public string DcnMicroScrMin { get; set; } + public string DcnMicroScrStdDev { get; set; } + public string DcnScrMax { get; set; } + public string DcnScrMean { get; set; } + public string DcnScrMin { get; set; } + public string DcnScrStdDev { get; set; } + public string DcnSlipMax { get; set; } + public string DcnSlipMean { get; set; } + public string DcnSlipMin { get; set; } + public string DcnSlipStdDev { get; set; } + public string DnnAllMax { get; set; } + public string DnnAllMean { get; set; } + public string DnnAllMin { get; set; } + public string DnnAllStdDev { get; set; } + public string DnnAreaCountMax { get; set; } + public string DnnAreaCountMean { get; set; } + public string DnnAreaCountMin { get; set; } + public string DnnAreaCountStdDev { get; set; } + public string DnnAreaMax { get; set; } + public string DnnAreaMean { get; set; } + public string DnnAreaMin { get; set; } + public string DnnAreaStdDev { get; set; } + public string DnnBin1Max { get; set; } + public string DnnBin1Mean { get; set; } + public string DnnBin1Min { get; set; } + public string DnnBin1StdDev { get; set; } + public string DnnBin2Max { get; set; } + public string DnnBin2Mean { get; set; } + public string DnnBin2Min { get; set; } + public string DnnBin2StdDev { get; set; } + public string DnnBin3Max { get; set; } + public string DnnBin3Mean { get; set; } + public string DnnBin3Min { get; set; } + public string DnnBin3StdDev { get; set; } + public string DnnBin4Max { get; set; } + public string DnnBin4Mean { get; set; } + public string DnnBin4Min { get; set; } + public string DnnBin4StdDev { get; set; } + public string DnnBin5Max { get; set; } + public string DnnBin5Mean { get; set; } + public string DnnBin5Min { get; set; } + public string DnnBin5StdDev { get; set; } + public string DnnBin6Max { get; set; } + public string DnnBin6Mean { get; set; } + public string DnnBin6Min { get; set; } + public string DnnBin6StdDev { get; set; } + public string DnnBin7Max { get; set; } + public string DnnBin7Mean { get; set; } + public string DnnBin7Min { get; set; } + public string DnnBin7StdDev { get; set; } + public string DnnBin8Max { get; set; } + public string DnnBin8Mean { get; set; } + public string DnnBin8Min { get; set; } + public string DnnBin8StdDev { get; set; } + public string DnnHazeAvgMax { get; set; } + public string DnnHazeAvgMean { get; set; } + public string DnnHazeAvgMin { get; set; } + public string DnnHazeAvgStdDev { get; set; } + public string DnnHazeMedianMax { get; set; } + public string DnnHazeMedianMean { get; set; } + public string DnnHazeMedianMin { get; set; } + public string DnnHazeMedianStdDev { get; set; } + public string DnnHazeStdDevMax { get; set; } + public string DnnHazeStdDevMean { get; set; } + public string DnnHazeStdDevMin { get; set; } + public string DnnHazeStdDevStdDev { get; set; } + public string DnnLpdESMax { get; set; } + public string DnnLpdESMean { get; set; } + public string DnnLpdESMin { get; set; } + public string DnnLpdESStdDev { get; set; } + public string DnnLpdMax { get; set; } + public string DnnLpdMean { get; set; } + public string DnnLpdMin { get; set; } + public string DnnLpdNMax { get; set; } + public string DnnLpdNMean { get; set; } + public string DnnLpdNMin { get; set; } + public string DnnLpdNStdDev { get; set; } + public string DnnLpdStdDev { get; set; } + public string DnnMicroScrMax { get; set; } + public string DnnMicroScrMean { get; set; } + public string DnnMicroScrMin { get; set; } + public string DnnMicroScrStdDev { get; set; } + public string DnnScrMax { get; set; } + public string DnnScrMean { get; set; } + public string DnnScrMin { get; set; } + public string DnnScrStdDev { get; set; } + public string DnnSlipMax { get; set; } + public string DnnSlipMean { get; set; } + public string DnnSlipMin { get; set; } + public string DnnSlipStdDev { get; set; } + public string DwnAllMax { get; set; } + public string DwnAllMean { get; set; } + public string DwnAllMin { get; set; } + public string DwnAllStdDev { get; set; } + public string DwnAreaCountMax { get; set; } + public string DwnAreaCountMean { get; set; } + public string DwnAreaCountMin { get; set; } + public string DwnAreaCountStdDev { get; set; } + public string DwnAreaMax { get; set; } + public string DwnAreaMean { get; set; } + public string DwnAreaMin { get; set; } + public string DwnAreaStdDev { get; set; } + public string DwnBin1Max { get; set; } + public string DwnBin1Mean { get; set; } + public string DwnBin1Min { get; set; } + public string DwnBin1StdDev { get; set; } + public string DwnBin2Max { get; set; } + public string DwnBin2Mean { get; set; } + public string DwnBin2Min { get; set; } + public string DwnBin2StdDev { get; set; } + public string DwnBin3Max { get; set; } + public string DwnBin3Mean { get; set; } + public string DwnBin3Min { get; set; } + public string DwnBin3StdDev { get; set; } + public string DwnBin4Max { get; set; } + public string DwnBin4Mean { get; set; } + public string DwnBin4Min { get; set; } + public string DwnBin4StdDev { get; set; } + public string DwnBin5Max { get; set; } + public string DwnBin5Mean { get; set; } + public string DwnBin5Min { get; set; } + public string DwnBin5StdDev { get; set; } + public string DwnBin6Max { get; set; } + public string DwnBin6Mean { get; set; } + public string DwnBin6Min { get; set; } + public string DwnBin6StdDev { get; set; } + public string DwnBin7Max { get; set; } + public string DwnBin7Mean { get; set; } + public string DwnBin7Min { get; set; } + public string DwnBin7StdDev { get; set; } + public string DwnBin8Max { get; set; } + public string DwnBin8Mean { get; set; } + public string DwnBin8Min { get; set; } + public string DwnBin8StdDev { get; set; } + public string DwnHazeAvgMax { get; set; } + public string DwnHazeAvgMean { get; set; } + public string DwnHazeAvgMin { get; set; } + public string DwnHazeAvgStdDev { get; set; } + public string DwnHazeMedianMax { get; set; } + public string DwnHazeMedianMean { get; set; } + public string DwnHazeMedianMin { get; set; } + public string DwnHazeMedianStdDev { get; set; } + public string DwnHazeStdDevMax { get; set; } + public string DwnHazeStdDevMean { get; set; } + public string DwnHazeStdDevMin { get; set; } + public string DwnHazeStdDevStdDev { get; set; } + public string DwnLpdESMax { get; set; } + public string DwnLpdESMean { get; set; } + public string DwnLpdESMin { get; set; } + public string DwnLpdESStdDev { get; set; } + public string DwnLpdMax { get; set; } + public string DwnLpdMean { get; set; } + public string DwnLpdMin { get; set; } + public string DwnLpdNMax { get; set; } + public string DwnLpdNMean { get; set; } + public string DwnLpdNMin { get; set; } + public string DwnLpdNStdDev { get; set; } + public string DwnLpdStdDev { get; set; } + public string DwnMicroScrMax { get; set; } + public string DwnMicroScrMean { get; set; } + public string DwnMicroScrMin { get; set; } + public string DwnMicroScrStdDev { get; set; } + public string DwnScrMax { get; set; } + public string DwnScrMean { get; set; } + public string DwnScrMin { get; set; } + public string DwnScrStdDev { get; set; } + public string DwnSlipMax { get; set; } + public string DwnSlipMean { get; set; } + public string DwnSlipMin { get; set; } + public string DwnSlipStdDev { get; set; } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.WSRequest.cs b/Adaptation/Helpers/ProcessData.WSRequest.cs new file mode 100644 index 0000000..2723b28 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.WSRequest.cs @@ -0,0 +1,612 @@ +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + public class WSRequest + { + public bool SentToMetrology { get; set; } + public bool SentToSPC { get; set; } + // + + public string CellName { get; set; } + public string Date { get; set; } + public string LotID { get; set; } + public string Operator { get; set; } + public string PSN { get; set; } + public string RDS { get; set; } + public string Reactor { get; set; } + public string Recipe { get; set; } + public string Session { get; set; } + public string UniqueID { get; set; } + public string DcnAllMax { get; set; } + public string DcnAllMean { get; set; } + public string DcnAllMin { get; set; } + public string DcnAllStDev { get; set; } + public string DcnAreaCntMax { get; set; } + public string DcnAreaCntMean { get; set; } + public string DcnAreaCntMin { get; set; } + public string DcnAreaCntStDev { get; set; } + public string DcnAreaMax { get; set; } + public string DcnAreaMean { get; set; } + public string DcnAreaMin { get; set; } + public string DcnAreaStDev { get; set; } + public string DcnBin1Max { get; set; } + public string DcnBin1Mean { get; set; } + public string DcnBin1Min { get; set; } + public string DcnBin1StDev { get; set; } + public string DcnBin2Max { get; set; } + public string DcnBin2Mean { get; set; } + public string DcnBin2Min { get; set; } + public string DcnBin2StDev { get; set; } + public string DcnBin3Max { get; set; } + public string DcnBin3Mean { get; set; } + public string DcnBin3Min { get; set; } + public string DcnBin3StDev { get; set; } + public string DcnBin4Max { get; set; } + public string DcnBin4Mean { get; set; } + public string DcnBin4Min { get; set; } + public string DcnBin4StDev { get; set; } + public string DcnBin5Max { get; set; } + public string DcnBin5Mean { get; set; } + public string DcnBin5Min { get; set; } + public string DcnBin5StDev { get; set; } + public string DcnBin6Max { get; set; } + public string DcnBin6Mean { get; set; } + public string DcnBin6Min { get; set; } + public string DcnBin6StDev { get; set; } + public string DcnBin7Max { get; set; } + public string DcnBin7Mean { get; set; } + public string DcnBin7Min { get; set; } + public string DcnBin7StDev { get; set; } + public string DcnBin8Max { get; set; } + public string DcnBin8Mean { get; set; } + public string DcnBin8Min { get; set; } + public string DcnBin8StDev { get; set; } + public string DcnHazeAvgMax { get; set; } + public string DcnHazeAvgMean { get; set; } + public string DcnHazeAvgMin { get; set; } + public string DcnHazeAvgStDev { get; set; } + public string DcnHazeMedMax { get; set; } + public string DcnHazeMedMean { get; set; } + public string DcnHazeMedMin { get; set; } + public string DcnHazeMedStDev { get; set; } + public string DcnHazeStDevMax { get; set; } + public string DcnHazeStDevMean { get; set; } + public string DcnHazeStDevMin { get; set; } + public string DcnHazeStDevStDev { get; set; } + public string DcnLpdESMax { get; set; } + public string DcnLpdESMean { get; set; } + public string DcnLpdESMin { get; set; } + public string DcnLpdESStDev { get; set; } + public string DcnLpdMax { get; set; } + public string DcnLpdMean { get; set; } + public string DcnLpdMin { get; set; } + public string DcnLpdNMax { get; set; } + public string DcnLpdNMean { get; set; } + public string DcnLpdNMin { get; set; } + public string DcnLpdNStDev { get; set; } + public string DcnLpdStDev { get; set; } + public string DcnMicroScrMax { get; set; } + public string DcnMicroScrMean { get; set; } + public string DcnMicroScrMin { get; set; } + public string DcnMicroScrStDev { get; set; } + public string DcnScrMax { get; set; } + public string DcnScrMean { get; set; } + public string DcnScrMin { get; set; } + public string DcnScrStDev { get; set; } + public string DcnSlipMax { get; set; } + public string DcnSlipMean { get; set; } + public string DcnSlipMin { get; set; } + public string DcnSlipStDev { get; set; } + public string DnnAllMax { get; set; } + public string DnnAllMean { get; set; } + public string DnnAllMin { get; set; } + public string DnnAllStDev { get; set; } + public string DnnAreaCntMax { get; set; } + public string DnnAreaCntMean { get; set; } + public string DnnAreaCntMin { get; set; } + public string DnnAreaCntStDev { get; set; } + public string DnnAreaMax { get; set; } + public string DnnAreaMean { get; set; } + public string DnnAreaMin { get; set; } + public string DnnAreaStDev { get; set; } + public string DnnBin1Max { get; set; } + public string DnnBin1Mean { get; set; } + public string DnnBin1Min { get; set; } + public string DnnBin1StDev { get; set; } + public string DnnBin2Max { get; set; } + public string DnnBin2Mean { get; set; } + public string DnnBin2Min { get; set; } + public string DnnBin2StDev { get; set; } + public string DnnBin3Max { get; set; } + public string DnnBin3Mean { get; set; } + public string DnnBin3Min { get; set; } + public string DnnBin3StDev { get; set; } + public string DnnBin4Max { get; set; } + public string DnnBin4Mean { get; set; } + public string DnnBin4Min { get; set; } + public string DnnBin4StDev { get; set; } + public string DnnBin5Max { get; set; } + public string DnnBin5Mean { get; set; } + public string DnnBin5Min { get; set; } + public string DnnBin5StDev { get; set; } + public string DnnBin6Max { get; set; } + public string DnnBin6Mean { get; set; } + public string DnnBin6Min { get; set; } + public string DnnBin6StDev { get; set; } + public string DnnBin7Max { get; set; } + public string DnnBin7Mean { get; set; } + public string DnnBin7Min { get; set; } + public string DnnBin7StDev { get; set; } + public string DnnBin8Max { get; set; } + public string DnnBin8Mean { get; set; } + public string DnnBin8Min { get; set; } + public string DnnBin8StDev { get; set; } + public string DnnHazeAvgMax { get; set; } + public string DnnHazeAvgMean { get; set; } + public string DnnHazeAvgMin { get; set; } + public string DnnHazeAvgStDev { get; set; } + public string DnnHazeMedMax { get; set; } + public string DnnHazeMedMean { get; set; } + public string DnnHazeMedMin { get; set; } + public string DnnHazeMedStDev { get; set; } + public string DnnHazeStDevMax { get; set; } + public string DnnHazeStDevMean { get; set; } + public string DnnHazeStDevMin { get; set; } + public string DnnHazeStDevStDev { get; set; } + public string DnnLpdESMax { get; set; } + public string DnnLpdESMean { get; set; } + public string DnnLpdESMin { get; set; } + public string DnnLpdESStDev { get; set; } + public string DnnLpdMax { get; set; } + public string DnnLpdMean { get; set; } + public string DnnLpdMin { get; set; } + public string DnnLpdNMax { get; set; } + public string DnnLpdNMean { get; set; } + public string DnnLpdNMin { get; set; } + public string DnnLpdNStDev { get; set; } + public string DnnLpdStDev { get; set; } + public string DnnMicroScrMax { get; set; } + public string DnnMicroScrMean { get; set; } + public string DnnMicroScrMin { get; set; } + public string DnnMicroScrStDev { get; set; } + public string DnnScrMax { get; set; } + public string DnnScrMean { get; set; } + public string DnnScrMin { get; set; } + public string DnnScrStDev { get; set; } + public string DnnSlipMax { get; set; } + public string DnnSlipMean { get; set; } + public string DnnSlipMin { get; set; } + public string DnnSlipStDev { get; set; } + public string DwnAllMax { get; set; } + public string DwnAllMean { get; set; } + public string DwnAllMin { get; set; } + public string DwnAllStDev { get; set; } + public string DwnAreaCntMax { get; set; } + public string DwnAreaCntMean { get; set; } + public string DwnAreaCntMin { get; set; } + public string DwnAreaCntStDev { get; set; } + public string DwnAreaMax { get; set; } + public string DwnAreaMean { get; set; } + public string DwnAreaMin { get; set; } + public string DwnAreaStDev { get; set; } + public string DwnBin1Max { get; set; } + public string DwnBin1Mean { get; set; } + public string DwnBin1Min { get; set; } + public string DwnBin1StDev { get; set; } + public string DwnBin2Max { get; set; } + public string DwnBin2Mean { get; set; } + public string DwnBin2Min { get; set; } + public string DwnBin2StDev { get; set; } + public string DwnBin3Max { get; set; } + public string DwnBin3Mean { get; set; } + public string DwnBin3Min { get; set; } + public string DwnBin3StDev { get; set; } + public string DwnBin4Max { get; set; } + public string DwnBin4Mean { get; set; } + public string DwnBin4Min { get; set; } + public string DwnBin4StDev { get; set; } + public string DwnBin5Max { get; set; } + public string DwnBin5Mean { get; set; } + public string DwnBin5Min { get; set; } + public string DwnBin5StDev { get; set; } + public string DwnBin6Max { get; set; } + public string DwnBin6Mean { get; set; } + public string DwnBin6Min { get; set; } + public string DwnBin6StDev { get; set; } + public string DwnBin7Max { get; set; } + public string DwnBin7Mean { get; set; } + public string DwnBin7Min { get; set; } + public string DwnBin7StDev { get; set; } + public string DwnBin8Max { get; set; } + public string DwnBin8Mean { get; set; } + public string DwnBin8Min { get; set; } + public string DwnBin8StDev { get; set; } + public string DwnHazeAvgMax { get; set; } + public string DwnHazeAvgMean { get; set; } + public string DwnHazeAvgMin { get; set; } + public string DwnHazeAvgStDev { get; set; } + public string DwnHazeMedMax { get; set; } + public string DwnHazeMedMean { get; set; } + public string DwnHazeMedMin { get; set; } + public string DwnHazeMedStDev { get; set; } + public string DwnHazeStDevMax { get; set; } + public string DwnHazeStDevMean { get; set; } + public string DwnHazeStDevMin { get; set; } + public string DwnHazeStDevStDev { get; set; } + public string DwnLpdESMax { get; set; } + public string DwnLpdESMean { get; set; } + public string DwnLpdESMin { get; set; } + public string DwnLpdESStDev { get; set; } + public string DwnLpdMax { get; set; } + public string DwnLpdMean { get; set; } + public string DwnLpdMin { get; set; } + public string DwnLpdNMax { get; set; } + public string DwnLpdNMean { get; set; } + public string DwnLpdNMin { get; set; } + public string DwnLpdNStDev { get; set; } + public string DwnLpdStDev { get; set; } + public string DwnMicroScrMax { get; set; } + public string DwnMicroScrMean { get; set; } + public string DwnMicroScrMin { get; set; } + public string DwnMicroScrStDev { get; set; } + public string DwnScrMax { get; set; } + public string DwnScrMean { get; set; } + public string DwnScrMin { get; set; } + public string DwnScrStDev { get; set; } + public string DwnSlipMax { get; set; } + public string DwnSlipMean { get; set; } + public string DwnSlipMin { get; set; } + public string DwnSlipStDev { get; set; } + public List Details { get; protected set; } + + [Obsolete("For json")] public WSRequest() { } + + internal WSRequest(ILogic logic, List descriptions) + { + Details = new List(); + CellName = logic.Logistics.MesEntity; + FileRead.Description x = descriptions[0]; + //Header + { + UniqueID = x.UniqueId; + Date = x.Date; + Reactor = x.Reactor; + LotID = x.Lot; + Session = x.Session; + DcnAllMin = x.DcnAllMin; + DcnAllMax = x.DcnAllMax; + DcnAllMean = x.DcnAllMean; + DcnAllStDev = x.DcnAllStdDev; + DcnLpdMin = x.DcnLpdMin; + DcnLpdMax = x.DcnLpdMax; + DcnLpdMean = x.DcnLpdMean; + DcnLpdStDev = x.DcnLpdStdDev; + DcnLpdNMin = x.DcnLpdNMin; + DcnLpdNMax = x.DcnLpdNMax; + DcnLpdNMean = x.DcnLpdNMean; + DcnLpdNStDev = x.DcnLpdNStdDev; + DcnLpdESMin = x.DcnLpdESMin; + DcnLpdESMax = x.DcnLpdESMax; + DcnLpdESMean = x.DcnLpdESMean; + DcnLpdESStDev = x.DcnLpdESStdDev; + DcnMicroScrMin = x.DcnMicroScrMin; + DcnMicroScrMax = x.DcnMicroScrMax; + DcnMicroScrMean = x.DcnMicroScrMean; + DcnMicroScrStDev = x.DcnMicroScrStdDev; + DcnScrMin = x.DcnScrMin; + DcnScrMax = x.DcnScrMax; + DcnScrMean = x.DcnScrMean; + DcnScrStDev = x.DcnScrStdDev; + DcnSlipMin = x.DcnSlipMin; + DcnSlipMax = x.DcnSlipMax; + DcnSlipMean = x.DcnSlipMean; + DcnSlipStDev = x.DcnSlipStdDev; + DcnAreaCntMin = x.DcnAreaCountMin; + DcnAreaCntMax = x.DcnAreaCountMax; + DcnAreaCntMean = x.DcnAreaCountMean; + DcnAreaCntStDev = x.DcnAreaCountStdDev; + DcnAreaMin = x.DcnAreaMin; + DcnAreaMax = x.DcnAreaMax; + DcnAreaMean = x.DcnAreaMean; + DcnAreaStDev = x.DcnAreaStdDev; + DcnHazeAvgMin = x.DcnHazeAvgMin; + DcnHazeAvgMax = x.DcnHazeAvgMax; + DcnHazeAvgMean = x.DcnHazeAvgMean; + DcnHazeAvgStDev = x.DcnHazeAvgStdDev; + DcnHazeMedMin = x.DcnHazeMedianMin; + DcnHazeMedMax = x.DcnHazeMedianMax; + DcnHazeMedMean = x.DcnHazeMedianMean; + DcnHazeMedStDev = x.DcnHazeMedianStdDev; + DcnHazeStDevMin = x.DcnHazeStdDevMin; + DcnHazeStDevMax = x.DcnHazeStdDevMax; + DcnHazeStDevMean = x.DcnHazeStdDevMean; + DcnHazeStDevStDev = x.DcnHazeStdDevStdDev; + DcnBin1Min = x.DcnBin1Min; + DcnBin1Max = x.DcnBin1Max; + DcnBin1Mean = x.DcnBin1Mean; + DcnBin1StDev = x.DcnBin1StdDev; + DcnBin2Min = x.DcnBin2Min; + DcnBin2Max = x.DcnBin2Max; + DcnBin2Mean = x.DcnBin2Mean; + DcnBin2StDev = x.DcnBin2StdDev; + DcnBin3Min = x.DcnBin3Min; + DcnBin3Max = x.DcnBin3Max; + DcnBin3Mean = x.DcnBin3Mean; + DcnBin3StDev = x.DcnBin3StdDev; + DcnBin4Min = x.DcnBin4Min; + DcnBin4Max = x.DcnBin4Max; + DcnBin4Mean = x.DcnBin4Mean; + DcnBin4StDev = x.DcnBin4StdDev; + DcnBin5Min = x.DcnBin5Min; + DcnBin5Max = x.DcnBin5Max; + DcnBin5Mean = x.DcnBin5Mean; + DcnBin5StDev = x.DcnBin5StdDev; + DcnBin6Min = x.DcnBin6Min; + DcnBin6Max = x.DcnBin6Max; + DcnBin6Mean = x.DcnBin6Mean; + DcnBin6StDev = x.DcnBin6StdDev; + DcnBin7Min = x.DcnBin7Min; + DcnBin7Max = x.DcnBin7Max; + DcnBin7Mean = x.DcnBin7Mean; + DcnBin7StDev = x.DcnBin7StdDev; + DcnBin8Min = x.DcnBin8Min; + DcnBin8Max = x.DcnBin8Max; + DcnBin8Mean = x.DcnBin8Mean; + DcnBin8StDev = x.DcnBin8StdDev; + DwnAllMin = x.DwnAllMin; + DwnAllMax = x.DwnAllMax; + DwnAllMean = x.DwnAllMean; + DwnAllStDev = x.DwnAllStdDev; + DwnLpdMin = x.DwnLpdMin; + DwnLpdMax = x.DwnLpdMax; + DwnLpdMean = x.DwnLpdMean; + DwnLpdStDev = x.DwnLpdStdDev; + DwnLpdNMin = x.DwnLpdNMin; + DwnLpdNMax = x.DwnLpdNMax; + DwnLpdNMean = x.DwnLpdNMean; + DwnLpdNStDev = x.DwnLpdNStdDev; + DwnLpdESMin = x.DwnLpdESMin; + DwnLpdESMax = x.DwnLpdESMax; + DwnLpdESMean = x.DwnLpdESMean; + DwnLpdESStDev = x.DwnLpdESStdDev; + DwnMicroScrMin = x.DwnMicroScrMin; + DwnMicroScrMax = x.DwnMicroScrMax; + DwnMicroScrMean = x.DwnMicroScrMean; + DwnMicroScrStDev = x.DwnMicroScrStdDev; + DwnScrMin = x.DwnScrMin; + DwnScrMax = x.DwnScrMax; + DwnScrMean = x.DwnScrMean; + DwnScrStDev = x.DwnScrStdDev; + DwnSlipMin = x.DwnSlipMin; + DwnSlipMax = x.DwnSlipMax; + DwnSlipMean = x.DwnSlipMean; + DwnSlipStDev = x.DwnSlipStdDev; + DwnAreaCntMin = x.DwnAreaCountMin; + DwnAreaCntMax = x.DwnAreaCountMax; + DwnAreaCntMean = x.DwnAreaCountMean; + DwnAreaCntStDev = x.DwnAreaCountStdDev; + DwnAreaMin = x.DwnAreaMin; + DwnAreaMax = x.DwnAreaMax; + DwnAreaMean = x.DwnAreaMean; + DwnAreaStDev = x.DwnAreaStdDev; + DwnHazeAvgMin = x.DwnHazeAvgMin; + DwnHazeAvgMax = x.DwnHazeAvgMax; + DwnHazeAvgMean = x.DwnHazeAvgMean; + DwnHazeAvgStDev = x.DwnHazeAvgStdDev; + DwnHazeMedMin = x.DwnHazeMedianMin; + DwnHazeMedMax = x.DwnHazeMedianMax; + DwnHazeMedMean = x.DwnHazeMedianMean; + DwnHazeMedStDev = x.DwnHazeMedianStdDev; + DwnHazeStDevMin = x.DwnHazeStdDevMin; + DwnHazeStDevMax = x.DwnHazeStdDevMax; + DwnHazeStDevMean = x.DwnHazeStdDevMean; + DwnHazeStDevStDev = x.DwnHazeStdDevStdDev; + DwnBin1Min = x.DwnBin1Min; + DwnBin1Max = x.DwnBin1Max; + DwnBin1Mean = x.DwnBin1Mean; + DwnBin1StDev = x.DwnBin1StdDev; + DwnBin2Min = x.DwnBin2Min; + DwnBin2Max = x.DwnBin2Max; + DwnBin2Mean = x.DwnBin2Mean; + DwnBin2StDev = x.DwnBin2StdDev; + DwnBin3Min = x.DwnBin3Min; + DwnBin3Max = x.DwnBin3Max; + DwnBin3Mean = x.DwnBin3Mean; + DwnBin3StDev = x.DwnBin3StdDev; + DwnBin4Min = x.DwnBin4Min; + DwnBin4Max = x.DwnBin4Max; + DwnBin4Mean = x.DwnBin4Mean; + DwnBin4StDev = x.DwnBin4StdDev; + DwnBin5Min = x.DwnBin5Min; + DwnBin5Max = x.DwnBin5Max; + DwnBin5Mean = x.DwnBin5Mean; + DwnBin5StDev = x.DwnBin5StdDev; + DwnBin6Min = x.DwnBin6Min; + DwnBin6Max = x.DwnBin6Max; + DwnBin6Mean = x.DwnBin6Mean; + DwnBin6StDev = x.DwnBin6StdDev; + DwnBin7Min = x.DwnBin7Min; + DwnBin7Max = x.DwnBin7Max; + DwnBin7Mean = x.DwnBin7Mean; + DwnBin7StDev = x.DwnBin7StdDev; + DwnBin8Min = x.DwnBin8Min; + DwnBin8Max = x.DwnBin8Max; + DwnBin8Mean = x.DwnBin8Mean; + DwnBin8StDev = x.DwnBin8StdDev; + DnnAllMin = x.DnnAllMin; + DnnAllMax = x.DnnAllMax; + DnnAllMean = x.DnnAllMean; + DnnAllStDev = x.DnnAllStdDev; + DnnLpdMin = x.DnnLpdMin; + DnnLpdMax = x.DnnLpdMax; + DnnLpdMean = x.DnnLpdMean; + DnnLpdStDev = x.DnnLpdStdDev; + DnnLpdNMin = x.DnnLpdNMin; + DnnLpdNMax = x.DnnLpdNMax; + DnnLpdNMean = x.DnnLpdNMean; + DnnLpdNStDev = x.DnnLpdNStdDev; + DnnLpdESMin = x.DnnLpdESMin; + DnnLpdESMax = x.DnnLpdESMax; + DnnLpdESMean = x.DnnLpdESMean; + DnnLpdESStDev = x.DnnLpdESStdDev; + DnnMicroScrMin = x.DnnMicroScrMin; + DnnMicroScrMax = x.DnnMicroScrMax; + DnnMicroScrMean = x.DnnMicroScrMean; + DnnMicroScrStDev = x.DnnMicroScrStdDev; + DnnScrMin = x.DnnScrMin; + DnnScrMax = x.DnnScrMax; + DnnScrMean = x.DnnScrMean; + DnnScrStDev = x.DnnScrStdDev; + DnnSlipMin = x.DnnSlipMin; + DnnSlipMax = x.DnnSlipMax; + DnnSlipMean = x.DnnSlipMean; + DnnSlipStDev = x.DnnSlipStdDev; + DnnAreaCntMin = x.DnnAreaCountMin; + DnnAreaCntMax = x.DnnAreaCountMax; + DnnAreaCntMean = x.DnnAreaCountMean; + DnnAreaCntStDev = x.DnnAreaCountStdDev; + DnnAreaMin = x.DnnAreaMin; + DnnAreaMax = x.DnnAreaMax; + DnnAreaMean = x.DnnAreaMean; + DnnAreaStDev = x.DnnAreaStdDev; + DnnHazeAvgMin = x.DnnHazeAvgMin; + DnnHazeAvgMax = x.DnnHazeAvgMax; + DnnHazeAvgMean = x.DnnHazeAvgMean; + DnnHazeAvgStDev = x.DnnHazeAvgStdDev; + DnnHazeMedMin = x.DnnHazeMedianMin; + DnnHazeMedMax = x.DnnHazeMedianMax; + DnnHazeMedMean = x.DnnHazeMedianMean; + DnnHazeMedStDev = x.DnnHazeMedianStdDev; + DnnHazeStDevMin = x.DnnHazeStdDevMin; + DnnHazeStDevMax = x.DnnHazeStdDevMax; + DnnHazeStDevMean = x.DnnHazeStdDevMean; + DnnHazeStDevStDev = x.DnnHazeStdDevStdDev; + DnnBin1Min = x.DnnBin1Min; + DnnBin1Max = x.DnnBin1Max; + DnnBin1Mean = x.DnnBin1Mean; + DnnBin1StDev = x.DnnBin1StdDev; + DnnBin2Min = x.DnnBin2Min; + DnnBin2Max = x.DnnBin2Max; + DnnBin2Mean = x.DnnBin2Mean; + DnnBin2StDev = x.DnnBin2StdDev; + DnnBin3Min = x.DnnBin3Min; + DnnBin3Max = x.DnnBin3Max; + DnnBin3Mean = x.DnnBin3Mean; + DnnBin3StDev = x.DnnBin3StdDev; + DnnBin4Min = x.DnnBin4Min; + DnnBin4Max = x.DnnBin4Max; + DnnBin4Mean = x.DnnBin4Mean; + DnnBin4StDev = x.DnnBin4StdDev; + DnnBin5Min = x.DnnBin5Min; + DnnBin5Max = x.DnnBin5Max; + DnnBin5Mean = x.DnnBin5Mean; + DnnBin5StDev = x.DnnBin5StdDev; + DnnBin6Min = x.DnnBin6Min; + DnnBin6Max = x.DnnBin6Max; + DnnBin6Mean = x.DnnBin6Mean; + DnnBin6StDev = x.DnnBin6StdDev; + DnnBin7Min = x.DnnBin7Min; + DnnBin7Max = x.DnnBin7Max; + DnnBin7Mean = x.DnnBin7Mean; + DnnBin7StDev = x.DnnBin7StdDev; + DnnBin8Min = x.DnnBin8Min; + DnnBin8Max = x.DnnBin8Max; + DnnBin8Mean = x.DnnBin8Mean; + DnnBin8StDev = x.DnnBin8StdDev; + RDS = x.RDS; + PSN = x.PSN; + Recipe = x.Recipe; + Operator = x.Employee; + } + DataFile dataFile; + foreach (FileRead.Description description in descriptions) + { + dataFile = new DataFile + { + Grade = description.Grade, + HeaderUniqueID = description.HeaderUniqueId, + Side = description.Side, + SrcDest = description.SrcDest, + UniqueID = description.UniqueId, + WaferID = description.WaferID, + Data = "*Data*", + DcnAll = description.DcnAll, + DcnArea = description.DcnArea, + DcnAreaCount = description.DcnAreaCount, + DcnBin1 = description.DcnBin1, + DcnBin2 = description.DcnBin2, + DcnBin3 = description.DcnBin3, + DcnBin4 = description.DcnBin4, + DcnBin5 = description.DcnBin5, + DcnBin6 = description.DcnBin6, + DcnBin7 = description.DcnBin7, + DcnBin8 = description.DcnBin8, + DcnHazeAvg = description.DcnHazeAvg, + DcnHazeMedian = description.DcnHazeMedian, + DcnHazeStdDev = description.DcnHazeStdDev, + DcnLpd = description.DcnLpd, + DcnLpdES = description.DcnLpdES, + DcnLpdN = description.DcnLpdN, + DcnMicroScr = description.DcnMicroScr, + DcnScr = description.DcnScr, + DcnSlip = description.DcnSlip, + DnnAll = description.DnnAll, + DnnArea = description.DnnArea, + DnnAreaCount = description.DnnAreaCount, + DnnBin1 = description.DnnBin1, + DnnBin2 = description.DnnBin2, + DnnBin3 = description.DnnBin3, + DnnBin4 = description.DnnBin4, + DnnBin5 = description.DnnBin5, + DnnBin6 = description.DnnBin6, + DnnBin7 = description.DnnBin7, + DnnBin8 = description.DnnBin8, + DnnHazeAvg = description.DnnHazeAvg, + DnnHazeMedian = description.DnnHazeMedian, + DnnHazeStdDev = description.DnnHazeStdDev, + DnnLpd = description.DnnLpd, + DnnLpdES = description.DnnLpdES, + DnnLpdN = description.DnnLpdN, + DnnMicroScr = description.DnnMicroScr, + DnnScr = description.DnnScr, + DnnSlip = description.DnnSlip, + DwnAll = description.DwnAll, + DwnArea = description.DwnArea, + DwnAreaCount = description.DwnAreaCount, + DwnBin1 = description.DwnBin1, + DwnBin2 = description.DwnBin2, + DwnBin3 = description.DwnBin3, + DwnBin4 = description.DwnBin4, + DwnBin5 = description.DwnBin5, + DwnBin6 = description.DwnBin6, + DwnBin7 = description.DwnBin7, + DwnBin8 = description.DwnBin8, + DwnHazeAvg = description.DwnHazeAvg, + DwnHazeMedian = description.DwnHazeMedian, + DwnHazeStdDev = description.DwnHazeStdDev, + DwnLpd = description.DwnLpd, + DwnLpdES = description.DwnLpdES, + DwnLpdN = description.DwnLpdN, + DwnMicroScr = description.DwnMicroScr, + DwnScr = description.DwnScr, + DwnSlip = description.DwnSlip + }; + Details.Add(dataFile); + } + Date = logic.Logistics.DateTimeFromSequence.ToString(); + if (UniqueID is null && Details.Any()) + UniqueID = Details[0].HeaderUniqueID; + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.WaferSummaryInfo.cs b/Adaptation/Helpers/ProcessData.WaferSummaryInfo.cs new file mode 100644 index 0000000..6c7fb12 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.WaferSummaryInfo.cs @@ -0,0 +1,38 @@ +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + public class WaferSummaryInfo + { + + public string All { get; set; } + public string Area { get; set; } + public string AreaNum { get; set; } + public string Bin1 { get; set; } + public string Bin2 { get; set; } + public string Bin3 { get; set; } + public string Bin4 { get; set; } + public string Bin5 { get; set; } + public string Bin6 { get; set; } + public string Bin7 { get; set; } + public string Bin8 { get; set; } + public string Grade { get; set; } + public string HazeAvg { get; set; } + public string HazeMedian { get; set; } + public string HazeStdDev { get; set; } + public string Lpd { get; set; } + public string LpdES { get; set; } + public string LpdN { get; set; } + public string MicroScr { get; set; } + public string Scr { get; set; } + public string Side { get; set; } + public string Slip { get; set; } + public string SrcDest { get; set; } + public string WaferID { get; set; } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.cs b/Adaptation/Helpers/ProcessData.cs new file mode 100644 index 0000000..cff2453 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.cs @@ -0,0 +1,819 @@ +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using log4net; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData : IProcessData + { + + public HeaderFile Header { get; private set; } + public List Details { get; private set; } + + private int _I; + private readonly ILog _Log; + private string _Data; + + public ProcessData(ILogic logic, ConfigData configData, List fileInfoCollection) + { + Header = null; + fileInfoCollection.Clear(); + _I = 0; + _Data = string.Empty; + _Log = LogManager.GetLogger(typeof(ProcessData)); + Details = new List(); + Tuple> tuple = Parse(logic, fileInfoCollection); + Details.AddRange(tuple.Item2); + Header = tuple.Item1; + } + + public Tuple> GetResults(ILogic logic, ConfigDataBase configDataBase, List fileInfoCollection) + { + Tuple> results; + if (!(configDataBase is ConfigData configData)) + throw new Exception(); + List tests = new List(); + List descriptions; + EventName eventName = configData.GetEventNameValue(); + if (eventName == EventName.FileRead && Details.Any()) + { + foreach (var item in Details) + tests.Add(Test.SP1); + descriptions = configData.GetDescription(logic, tests, this); + } + else + throw new Exception(); + if (!configData.EafHosted) + { + new FileRead.Description().GetDescription(logic, configData, tests, this); + } + if (tests.Count != descriptions.Count) + throw new Exception(); + for (int i = 0; i < tests.Count; i++) + { + if (descriptions[i].Test != (int)tests[i]) + throw new Exception(); + } + string json; + if (descriptions[0] is Duplicator.Description) + { + List duplicatorDescriptions = (from l in descriptions select (Duplicator.Description)l).ToList(); + json = JsonSerializer.Serialize(duplicatorDescriptions, duplicatorDescriptions.GetType()); + } + else if (descriptions[0] is FileRead.Description) + { + List fileReadDescriptions = (from l in descriptions select (FileRead.Description)l).ToList(); + json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType()); + } + else + throw new Exception(); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + results = new Tuple>(logic.Logistics.Logistics1[0], jsonElement, fileInfoCollection); + return results; + } + + public static Dictionary> GetKeyValuePairs(ConfigData configData, JsonElement jsonElement, List processDataDescriptions, bool extra = false) + { + Dictionary> results = configData.GetKeyValuePairs(processDataDescriptions); + configData.CheckProcessDataDescription(results, extra); + return results; + } + + public static List GetProcessDataFileReadDescriptions(ConfigData configData, JsonElement jsonElement) + { + List results = new List(); + List processDataDescriptions = configData.GetIProcessDataDescriptions(jsonElement); + foreach (IProcessDataDescription processDataDescription in processDataDescriptions) + { + if (!(processDataDescription is FileRead.Description description)) + continue; + results.Add(description); + } + return results; + } + + public static Tuple GetLines(ILogic logic, List descriptions) + { + char del = '\t'; + StringBuilder result = new StringBuilder(); + FileRead.Description x = descriptions[0]; + result.Append(x.DcnLpdMin).Append(del). // 001 - + Append(x.DcnLpdMax).Append(del). // 002 - + Append(x.DcnLpdMean).Append(del). // 003 - DCN LPD + Append(x.DcnAreaCountMin).Append(del). // 004 - + Append(x.DcnAreaCountMax).Append(del). // 005 - + Append(x.DcnAreaCountMean).Append(del).// 006 - DCN Area + Append(x.DcnAreaMin).Append(del). // 007 - + Append(x.DcnAreaMax).Append(del). // 008 - + Append(x.Date).Append(del). // 009 - + Append(x.DcnHazeAvgMean).Append(del). // 010 - Haze Average + Append(string.Empty).Append(del). // 011 - + Append(string.Empty).Append(del). // 012 - + Append(string.Empty).Append(del). // 013 - + Append(string.Empty).Append(del). // 014 - + Append(string.Empty).Append(del). // 015 - + Append(string.Empty).Append(del). // 016 - + Append(string.Empty).Append(del). // 017 - + Append(string.Empty).Append(del). // 018 - + Append(string.Empty).Append(del). // 019 - + Append(string.Empty).Append(del). // 020 - + Append(string.Empty).Append(del). // 021 - + Append(string.Empty).Append(del). // 022 - + Append(string.Empty).Append(del). // 023 - + Append(string.Empty).Append(del). // 024 - + Append(string.Empty).Append(del). // 025 - + Append(string.Empty).Append(del). // 026 - + Append(string.Empty).Append(del). // 027 - + Append(x.RDS).Append(del). // 028 - Lot + Append(x.Reactor).Append(del). // 029 - Process + Append(x.Recipe).Append(del). // 030 - Part + Append(x.DcnScrMean).Append(del). // 031 - Scratch Count + Append(string.Empty).Append(del). // 032 - + Append(string.Empty).Append(del). // 033 - + Append(string.Empty).Append(del). // 034 - + Append(x.DcnMicroScrMean).Append(del). // 035 - Scratch Length + Append(string.Empty).Append(del). // 036 - + Append(string.Empty).Append(del). // 037 - + Append(string.Empty).Append(del). // 038 - + Append(x.DcnAllMean).Append(del). // 039 - Average Sum of Defects + Append(x.DcnAllMax).Append(del). // 040 - Max Sum of defects + Append(x.DcnAllMin).Append(del). // 041 - Min Sum of Defects + Append(string.Empty).Append(del). // 042 - + Append(logic.Logistics.MesEntity).Append(del). // 043 - + Append(x.DcnAreaMean).Append(del). // 044 - DCN MM2 + AppendLine(); + return new Tuple(result.ToString(), x.Date); + } + + internal static void PostOpenInsightMetrologyViewerAttachments(ILog log, ConfigData configData, Logistics logistics, DateTime dateTime, string logisticsSequenceMemoryDirectory, List descriptions, string matchDirectory) + { + string[] summaryFiles = Directory.GetFiles(matchDirectory, "*.txt", SearchOption.TopDirectoryOnly); + if (summaryFiles.Length != 1) + throw new Exception("Invalid summary file count!"); + string wsResultsMemoryFile = string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"); + if (!File.Exists(wsResultsMemoryFile)) + throw new Exception(string.Concat("Memory file <", wsResultsMemoryFile, "> doesn't exist!")); + string json = File.ReadAllText(wsResultsMemoryFile); + WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json); + long wsResultsHeaderID = metrologyWSRequest.HeaderID; + string[] prnFiles = Directory.GetFiles(matchDirectory, "WaferMap*.prn", SearchOption.TopDirectoryOnly); + if (prnFiles.Length == 0 || prnFiles.Length != descriptions.Count) + log.Debug("Invalid WaferMap*.prn file count!"); + List pdfFiles = new List(); + foreach (string prnFile in prnFiles.OrderBy(l => l)) + pdfFiles.Add(ConvertSourceFileToPdf(configData, prnFile)); + if (pdfFiles.Count == 0 || pdfFiles.Count != descriptions.Count) + log.Debug("Invalid *.pdf file count!"); + List dataAttachments = new List(); + List headerAttachments = new List { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.txt", summaryFiles[0]) }; + int count; + if (pdfFiles.Count < descriptions.Count) + count = pdfFiles.Count; + else + count = descriptions.Count; + for (int i = 0; i < count; i++) + { + if (!string.IsNullOrEmpty(pdfFiles[i])) + dataAttachments.Add(new WS.Attachment(descriptions[i].UniqueId, "Image.pdf", pdfFiles[i])); + } + if (dataAttachments.Count == 0 || dataAttachments.Count != descriptions.Count) + log.Debug("Invalid attachment count!"); + WS.AttachFiles(configData.OpenInsightMetrogyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments); + } + + private void ScanPast(string text) + { + int num = _Data.IndexOf(text, _I); + if (num > -1) + _I = num + text.Length; + else + _I = _Data.Length; + } + + private string GetBefore(string text) + { + int num = _Data.IndexOf(text, _I); + if (num > -1) + { + string str = _Data.Substring(_I, num - _I); + _I = num + text.Length; + return str.Trim(); + } + string str1 = _Data.Substring(_I); + _I = _Data.Length; + return str1.Trim(); + } + + private string GetBefore(string text, bool trim) + { + if (trim) + return GetBefore(text); + int num = _Data.IndexOf(text, _I); + if (num > -1) + { + string str = _Data.Substring(_I, num - _I); + _I = num + text.Length; + return str; + } + string str1 = _Data.Substring(_I); + _I = _Data.Length; + return str1; + } + + private bool IsNullOrWhiteSpace(string text) + { + for (int index = 0; index < text.Length; ++index) + { + if (!char.IsWhiteSpace(text[index])) + return false; + } + return true; + } + + private bool IsBlankLine() + { + int num = _Data.IndexOf("\n", _I); + return IsNullOrWhiteSpace(num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)); + } + + private string GetToEOL() + { + return GetBefore("\n"); + } + + private string GetToEOL(bool trim) + { + if (trim) + return GetToEOL(); + return GetBefore("\n", false); + } + + private string GetToText(string text) + { + return _Data.Substring(_I, _Data.IndexOf(text, _I) - _I).Trim(); + } + + private string GetToken() + { + while (_I < _Data.Length && IsNullOrWhiteSpace(_Data.Substring(_I, 1))) + ++_I; + int j = _I; + while (j < _Data.Length && !IsNullOrWhiteSpace(_Data.Substring(j, 1))) + ++j; + string str = _Data.Substring(_I, j - _I); + _I = j; + return str.Trim(); + } + + private string PeekNextLine() + { + int j = _I; + string toEol = GetToEOL(); + _I = j; + return toEol; + } + + private void GetWaferSummaryInfo(List waferSummaryInfos, string whichInfo) + { + ScanPast(whichInfo); + GetToEOL(); + GetToEOL(); + GetToEOL(); + GetToEOL(); + string[] segments; + WaferSummaryInfo waferSummaryInfo; + const string grade = "F Grade"; + const string rejct = "F Reject"; + const string overLoad = "F OverLoad"; + for (string line = PeekNextLine(); line[0] != '-'; line = PeekNextLine()) + { + line = GetToEOL(); + waferSummaryInfo = new WaferSummaryInfo(); + if (line.StartsWith(grade)) + line = line.Replace(grade, string.Concat("F -1", grade.Substring(4))); + else if (line.StartsWith(rejct)) + line = line.Replace(rejct, string.Concat("F -1", rejct.Substring(4))); + else if (line.StartsWith(overLoad)) + line = line.Replace(overLoad, string.Concat("F -1", overLoad.Substring(4))); + segments = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + waferSummaryInfo.Side = segments[0]; + waferSummaryInfo.WaferID = segments[1]; + waferSummaryInfo.Grade = segments[2]; + waferSummaryInfo.SrcDest = segments[3]; + if (segments.Length > 4) + { + waferSummaryInfo.Lpd = segments[5]; + waferSummaryInfo.LpdN = segments[6]; + waferSummaryInfo.LpdES = segments[7]; + waferSummaryInfo.MicroScr = segments[8]; + waferSummaryInfo.Scr = segments[9]; + waferSummaryInfo.Slip = segments[10]; + waferSummaryInfo.AreaNum = segments[11]; + waferSummaryInfo.Area = segments[12]; + waferSummaryInfo.HazeAvg = segments[13]; + waferSummaryInfo.HazeMedian = segments[14]; + waferSummaryInfo.HazeStdDev = segments[15]; + waferSummaryInfo.Bin1 = segments[16]; + waferSummaryInfo.Bin2 = segments[17]; + waferSummaryInfo.Bin3 = segments[18]; + waferSummaryInfo.Bin4 = segments[19]; + waferSummaryInfo.Bin5 = segments[20]; + waferSummaryInfo.Bin6 = segments[21]; + waferSummaryInfo.Bin7 = segments[22]; + waferSummaryInfo.Bin8 = segments[23]; + } + if (waferSummaryInfo.WaferID == "-1") + { + segments = waferSummaryInfo.SrcDest.Split('-')[0].Split('/'); + waferSummaryInfo.WaferID = segments[segments.Length - 1]; + } + waferSummaryInfos.Add(waferSummaryInfo); + } + } + + private HeaderFile ParseHeader(ILogic logic, List dcnTotals, List dwnTotals, List dnnTotals) + { + HeaderFile result = new HeaderFile { JobID = logic.Logistics.JobID, MesEntity = logic.Logistics.MesEntity, Date = DateTime.Now.ToString() }; + _I = 0; + _Data = string.Empty; + string h = string.Empty; + string summaryReportText = File.ReadAllText(logic.Logistics.ReportFullPath); + if (!string.IsNullOrEmpty(summaryReportText)) + { + _Log.Debug("HeaderFile() - Beginning"); + _I = 0; + _Data = summaryReportText; + ScanPast("Long Wafer Summary"); + GetToEOL(); + ScanPast("Session:"); + string toEOL = GetToEOL(true); + string str = toEOL; + result.Recipe = toEOL; + result.Session = str; + ScanPast("Lot ID:"); + result.Lot = GetToEOL(true); + // Remove illegal characters \/:*?"<>| found in the Lot. + result.Lot = Regex.Replace(result.Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + string[] segments = result.Lot.Split(new char[] { '-' }); + _Log.Debug("HeaderFile() - Debug A"); + if (segments.Length > 1) + { + result.Reactor = segments[0]; + result.RDS = segments[1]; + if (segments.Length > 2) + { + result.PSN = segments[2]; + if (segments.Length > 3) + result.Operator = segments[3]; + } + } + _Log.Debug("HeaderFile() - Debug B"); + _I = 0; + _Data = summaryReportText; + GetWaferSummaryInfo(dcnTotals, "DCN Totals"); + ScanPast("Min"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DcnAllMin = segments[0]; + result.DcnLpdMin = segments[1]; + result.DcnLpdNMin = segments[2]; + result.DcnLpdESMin = segments[3]; + result.DcnMicroScrMin = segments[4]; + result.DcnScrMin = segments[5]; + result.DcnSlipMin = segments[6]; + result.DcnAreaCountMin = segments[7]; + result.DcnAreaMin = segments[8]; + result.DcnHazeAvgMin = segments[9]; + result.DcnHazeMedianMin = segments[10]; + result.DcnHazeStdDevMin = segments[11]; + result.DcnBin1Min = segments[12]; + result.DcnBin2Min = segments[13]; + result.DcnBin3Min = segments[14]; + result.DcnBin4Min = segments[15]; + result.DcnBin5Min = segments[16]; + result.DcnBin6Min = segments[17]; + result.DcnBin7Min = segments[18]; + result.DcnBin8Min = segments[19]; + ScanPast("Max"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DcnAllMax = segments[0]; + result.DcnLpdMax = segments[1]; + result.DcnLpdNMax = segments[2]; + result.DcnLpdESMax = segments[3]; + result.DcnMicroScrMax = segments[4]; + result.DcnScrMax = segments[5]; + result.DcnSlipMax = segments[6]; + result.DcnAreaCountMax = segments[7]; + result.DcnAreaMax = segments[8]; + result.DcnHazeAvgMax = segments[9]; + result.DcnHazeMedianMax = segments[10]; + result.DcnHazeStdDevMax = segments[11]; + result.DcnBin1Max = segments[12]; + result.DcnBin2Max = segments[13]; + result.DcnBin3Max = segments[14]; + result.DcnBin4Max = segments[15]; + result.DcnBin5Max = segments[16]; + result.DcnBin6Max = segments[17]; + result.DcnBin7Max = segments[18]; + result.DcnBin8Max = segments[19]; + ScanPast("Mean"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DcnAllMean = segments[0]; + result.DcnLpdMean = segments[1]; + result.DcnLpdNMean = segments[2]; + result.DcnLpdESMean = segments[3]; + result.DcnMicroScrMean = segments[4]; + result.DcnScrMean = segments[5]; + result.DcnSlipMean = segments[6]; + result.DcnAreaCountMean = segments[7]; + result.DcnAreaMean = segments[8]; + result.DcnHazeAvgMean = segments[9]; + result.DcnHazeMedianMean = segments[10]; + result.DcnHazeStdDevMean = segments[11]; + result.DcnBin1Mean = segments[12]; + result.DcnBin2Mean = segments[13]; + result.DcnBin3Mean = segments[14]; + result.DcnBin4Mean = segments[15]; + result.DcnBin5Mean = segments[16]; + result.DcnBin6Mean = segments[17]; + result.DcnBin7Mean = segments[18]; + result.DcnBin8Mean = segments[19]; + ScanPast("Std. Dev."); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DcnAllStdDev = segments[0]; + result.DcnLpdStdDev = segments[1]; + result.DcnLpdNStdDev = segments[2]; + result.DcnLpdESStdDev = segments[3]; + result.DcnMicroScrStdDev = segments[4]; + result.DcnScrStdDev = segments[5]; + result.DcnSlipStdDev = segments[6]; + result.DcnAreaCountStdDev = segments[7]; + result.DcnAreaStdDev = segments[8]; + result.DcnHazeAvgStdDev = segments[9]; + result.DcnHazeMedianStdDev = segments[10]; + result.DcnHazeStdDevStdDev = segments[11]; + result.DcnBin1StdDev = segments[12]; + result.DcnBin2StdDev = segments[13]; + result.DcnBin3StdDev = segments[14]; + result.DcnBin4StdDev = segments[15]; + result.DcnBin5StdDev = segments[16]; + result.DcnBin6StdDev = segments[17]; + result.DcnBin7StdDev = segments[18]; + result.DcnBin8StdDev = segments[19]; + _I = 0; + _Data = summaryReportText; + _Log.Debug("HeaderFile() - Debug C"); + if (!_Data.Contains("DWN Totals")) + { + foreach (WaferSummaryInfo dcnTotal in dcnTotals) + dwnTotals.Add(new WaferSummaryInfo()); + } + else + { + GetWaferSummaryInfo(dwnTotals, "DWN Totals"); + ScanPast("Min"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DwnAllMin = segments[0]; + result.DwnLpdMin = segments[1]; + result.DwnLpdNMin = segments[2]; + result.DwnLpdESMin = segments[3]; + result.DwnMicroScrMin = segments[4]; + result.DwnScrMin = segments[5]; + result.DwnSlipMin = segments[6]; + result.DwnAreaCountMin = segments[7]; + result.DwnAreaMin = segments[8]; + result.DwnHazeAvgMin = segments[9]; + result.DwnHazeMedianMin = segments[10]; + result.DwnHazeStdDevMin = segments[11]; + result.DwnBin1Min = segments[12]; + result.DwnBin2Min = segments[13]; + result.DwnBin3Min = segments[14]; + result.DwnBin4Min = segments[15]; + result.DwnBin5Min = segments[16]; + result.DwnBin6Min = segments[17]; + result.DwnBin7Min = segments[18]; + result.DwnBin8Min = segments[19]; + ScanPast("Max"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DwnAllMax = segments[0]; + result.DwnLpdMax = segments[1]; + result.DwnLpdNMax = segments[2]; + result.DwnLpdESMax = segments[3]; + result.DwnMicroScrMax = segments[4]; + result.DwnScrMax = segments[5]; + result.DwnSlipMax = segments[6]; + result.DwnAreaCountMax = segments[7]; + result.DwnAreaMax = segments[8]; + result.DwnHazeAvgMax = segments[9]; + result.DwnHazeMedianMax = segments[10]; + result.DwnHazeStdDevMax = segments[11]; + result.DwnBin1Max = segments[12]; + result.DwnBin2Max = segments[13]; + result.DwnBin3Max = segments[14]; + result.DwnBin4Max = segments[15]; + result.DwnBin5Max = segments[16]; + result.DwnBin6Max = segments[17]; + result.DwnBin7Max = segments[18]; + result.DwnBin8Max = segments[19]; + ScanPast("Mean"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DwnAllMean = segments[0]; + result.DwnLpdMean = segments[1]; + result.DwnLpdNMean = segments[2]; + result.DwnLpdESMean = segments[3]; + result.DwnMicroScrMean = segments[4]; + result.DwnScrMean = segments[5]; + result.DwnSlipMean = segments[6]; + result.DwnAreaCountMean = segments[7]; + result.DwnAreaMean = segments[8]; + result.DwnHazeAvgMean = segments[9]; + result.DwnHazeMedianMean = segments[10]; + result.DwnHazeStdDevMean = segments[11]; + result.DwnBin1Mean = segments[12]; + result.DwnBin2Mean = segments[13]; + result.DwnBin3Mean = segments[14]; + result.DwnBin4Mean = segments[15]; + result.DwnBin5Mean = segments[16]; + result.DwnBin6Mean = segments[17]; + result.DwnBin7Mean = segments[18]; + result.DwnBin8Mean = segments[19]; + ScanPast("Std. Dev."); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DwnAllStdDev = segments[0]; + result.DwnLpdStdDev = segments[1]; + result.DwnLpdNStdDev = segments[2]; + result.DwnLpdESStdDev = segments[3]; + result.DwnMicroScrStdDev = segments[4]; + result.DwnScrStdDev = segments[5]; + result.DwnSlipStdDev = segments[6]; + result.DwnAreaCountStdDev = segments[7]; + result.DwnAreaStdDev = segments[8]; + result.DwnHazeAvgStdDev = segments[9]; + result.DwnHazeMedianStdDev = segments[10]; + result.DwnHazeStdDevStdDev = segments[11]; + result.DwnBin1StdDev = segments[12]; + result.DwnBin2StdDev = segments[13]; + result.DwnBin3StdDev = segments[14]; + result.DwnBin4StdDev = segments[15]; + result.DwnBin5StdDev = segments[16]; + result.DwnBin6StdDev = segments[17]; + result.DwnBin7StdDev = segments[18]; + result.DwnBin8StdDev = segments[19]; + } + _I = 0; + _Data = summaryReportText; + _Log.Debug("HeaderFile() - Debug D"); + if (!_Data.Contains("DNN Totals")) + { + foreach (WaferSummaryInfo waferSummaryInfo in dcnTotals) + dnnTotals.Add(new WaferSummaryInfo()); + } + else + { + GetWaferSummaryInfo(dnnTotals, "DNN Totals"); + ScanPast("Min"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DnnAllMin = segments[0]; + result.DnnLpdMin = segments[1]; + result.DnnLpdNMin = segments[2]; + result.DnnLpdESMin = segments[3]; + result.DnnMicroScrMin = segments[4]; + result.DnnScrMin = segments[5]; + result.DnnSlipMin = segments[6]; + result.DnnAreaCountMin = segments[7]; + result.DnnAreaMin = segments[8]; + result.DnnHazeAvgMin = segments[9]; + result.DnnHazeMedianMin = segments[10]; + result.DnnHazeStdDevMin = segments[11]; + result.DnnBin1Min = segments[12]; + result.DnnBin2Min = segments[13]; + result.DnnBin3Min = segments[14]; + result.DnnBin4Min = segments[15]; + result.DnnBin5Min = segments[16]; + result.DnnBin6Min = segments[17]; + result.DnnBin7Min = segments[18]; + result.DnnBin8Min = segments[19]; + ScanPast("Max"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DnnAllMax = segments[0]; + result.DnnLpdMax = segments[1]; + result.DnnLpdNMax = segments[2]; + result.DnnLpdESMax = segments[3]; + result.DnnMicroScrMax = segments[4]; + result.DnnScrMax = segments[5]; + result.DnnSlipMax = segments[6]; + result.DnnAreaCountMax = segments[7]; + result.DnnAreaMax = segments[8]; + result.DnnHazeAvgMax = segments[9]; + result.DnnHazeMedianMax = segments[10]; + result.DnnHazeStdDevMax = segments[11]; + result.DnnBin1Max = segments[12]; + result.DnnBin2Max = segments[13]; + result.DnnBin3Max = segments[14]; + result.DnnBin4Max = segments[15]; + result.DnnBin5Max = segments[16]; + result.DnnBin6Max = segments[17]; + result.DnnBin7Max = segments[18]; + result.DnnBin8Max = segments[19]; + ScanPast("Mean"); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DnnAllMean = segments[0]; + result.DnnLpdMean = segments[1]; + result.DnnLpdNMean = segments[2]; + result.DnnLpdESMean = segments[3]; + result.DnnMicroScrMean = segments[4]; + result.DnnScrMean = segments[5]; + result.DnnSlipMean = segments[6]; + result.DnnAreaCountMean = segments[7]; + result.DnnAreaMean = segments[8]; + result.DnnHazeAvgMean = segments[9]; + result.DnnHazeMedianMean = segments[10]; + result.DnnHazeStdDevMean = segments[11]; + result.DnnBin1Mean = segments[12]; + result.DnnBin2Mean = segments[13]; + result.DnnBin3Mean = segments[14]; + result.DnnBin4Mean = segments[15]; + result.DnnBin5Mean = segments[16]; + result.DnnBin6Mean = segments[17]; + result.DnnBin7Mean = segments[18]; + result.DnnBin8Mean = segments[19]; + ScanPast("Std. Dev."); + segments = GetToEOL().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + result.DnnAllStdDev = segments[0]; + result.DnnLpdStdDev = segments[1]; + result.DnnLpdNStdDev = segments[2]; + result.DnnLpdESStdDev = segments[3]; + result.DnnMicroScrStdDev = segments[4]; + result.DnnScrStdDev = segments[5]; + result.DnnSlipStdDev = segments[6]; + result.DnnAreaCountStdDev = segments[7]; + result.DnnAreaStdDev = segments[8]; + result.DnnHazeAvgStdDev = segments[9]; + result.DnnHazeMedianStdDev = segments[10]; + result.DnnHazeStdDevStdDev = segments[11]; + result.DnnBin1StdDev = segments[12]; + result.DnnBin2StdDev = segments[13]; + result.DnnBin3StdDev = segments[14]; + result.DnnBin4StdDev = segments[15]; + result.DnnBin5StdDev = segments[16]; + result.DnnBin6StdDev = segments[17]; + result.DnnBin7StdDev = segments[18]; + result.DnnBin8StdDev = segments[19]; + } + } + //result.UniqueID = string.Format("{0}_{1}_Summary_{2}", logic.Logistics.JobID, result.Lot, result.Date); + result.UniqueID = string.Format("{0}_{1}_{2}", logic.Logistics.JobID, result.Lot, Path.GetFileNameWithoutExtension(logic.Logistics.ReportFullPath)); + return result; + } + + /// + /// Parse the wafer summary data + /// + /// wafer data + /// wafer index + /// + private DataFile ParseWaferSummary(HeaderFile headerFile, int i, List dcnTotals, List dwnTotals, List dnnTotals) + { + DataFile result = new DataFile() + { + // NOTE: get the UniqueID during DataCalculation in order to retrieve the SPCToolID from the cell component Tag field. + // id + //runData.UniqueID = string.Format("{0}_{1}", sp1Header.UniqueId, i + 1); + //runData.HeaderUniqueID = sp1Header.UniqueId; + + // General Wafer Info + Side = dcnTotals[i].Side, + WaferID = dcnTotals[i].WaferID, + Grade = dcnTotals[i].Grade, + SrcDest = dcnTotals[i].SrcDest, + + // Dcn Info + DcnAll = dcnTotals[i].All ?? string.Empty, + DcnLpd = dcnTotals[i].Lpd ?? string.Empty, + DcnLpdN = dcnTotals[i].LpdN ?? string.Empty, + DcnLpdES = dcnTotals[i].LpdES ?? string.Empty, + DcnMicroScr = dcnTotals[i].MicroScr ?? string.Empty, + DcnScr = dcnTotals[i].Scr ?? string.Empty, + DcnSlip = dcnTotals[i].Slip ?? string.Empty, + DcnAreaCount = dcnTotals[i].AreaNum ?? string.Empty, + DcnArea = dcnTotals[i].Area ?? string.Empty, + DcnHazeAvg = dcnTotals[i].HazeAvg ?? string.Empty, + DcnHazeMedian = dcnTotals[i].HazeMedian ?? string.Empty, + DcnHazeStdDev = dcnTotals[i].HazeStdDev ?? string.Empty, + DcnBin1 = dcnTotals[i].Bin1 ?? string.Empty, + DcnBin2 = dcnTotals[i].Bin2 ?? string.Empty, + DcnBin3 = dcnTotals[i].Bin3 ?? string.Empty, + DcnBin4 = dcnTotals[i].Bin4 ?? string.Empty, + DcnBin5 = dcnTotals[i].Bin5 ?? string.Empty, + DcnBin6 = dcnTotals[i].Bin6 ?? string.Empty, + DcnBin7 = dcnTotals[i].Bin7 ?? string.Empty, + DcnBin8 = dcnTotals[i].Bin8 ?? string.Empty, + + // Dwn Info + DwnAll = dwnTotals[i].All ?? string.Empty, + DwnLpd = dwnTotals[i].Lpd ?? string.Empty, + DwnLpdN = dwnTotals[i].LpdN ?? string.Empty, + DwnLpdES = dwnTotals[i].LpdES ?? string.Empty, + DwnMicroScr = dwnTotals[i].MicroScr ?? string.Empty, + DwnScr = dwnTotals[i].Scr ?? string.Empty, + DwnSlip = dwnTotals[i].Slip ?? string.Empty, + DwnAreaCount = dwnTotals[i].AreaNum ?? string.Empty, + DwnArea = dwnTotals[i].Area ?? string.Empty, + DwnHazeAvg = dwnTotals[i].HazeAvg ?? string.Empty, + DwnHazeMedian = dwnTotals[i].HazeMedian ?? string.Empty, + DwnHazeStdDev = dwnTotals[i].HazeStdDev ?? string.Empty, + DwnBin1 = dwnTotals[i].Bin1 ?? string.Empty, + DwnBin2 = dwnTotals[i].Bin2 ?? string.Empty, + DwnBin3 = dwnTotals[i].Bin3 ?? string.Empty, + DwnBin4 = dwnTotals[i].Bin4 ?? string.Empty, + DwnBin5 = dwnTotals[i].Bin5 ?? string.Empty, + DwnBin6 = dwnTotals[i].Bin6 ?? string.Empty, + DwnBin7 = dwnTotals[i].Bin7 ?? string.Empty, + DwnBin8 = dwnTotals[i].Bin8 ?? string.Empty, + + // Dnn Info + DnnAll = dnnTotals[i].All ?? string.Empty, + DnnLpd = dnnTotals[i].Lpd ?? string.Empty, + DnnLpdN = dnnTotals[i].LpdN ?? string.Empty, + DnnLpdES = dnnTotals[i].LpdES ?? string.Empty, + DnnMicroScr = dnnTotals[i].MicroScr ?? string.Empty, + DnnScr = dnnTotals[i].Scr ?? string.Empty, + DnnSlip = dnnTotals[i].Slip ?? string.Empty, + DnnAreaCount = dnnTotals[i].AreaNum ?? string.Empty, + DnnArea = dnnTotals[i].Area ?? string.Empty, + DnnHazeAvg = dnnTotals[i].HazeAvg ?? string.Empty, + DnnHazeMedian = dnnTotals[i].HazeMedian ?? string.Empty, + DnnHazeStdDev = dnnTotals[i].HazeStdDev ?? string.Empty, + DnnBin1 = dnnTotals[i].Bin1 ?? string.Empty, + DnnBin2 = dnnTotals[i].Bin2 ?? string.Empty, + DnnBin3 = dnnTotals[i].Bin3 ?? string.Empty, + DnnBin4 = dnnTotals[i].Bin4 ?? string.Empty, + DnnBin5 = dnnTotals[i].Bin5 ?? string.Empty, + DnnBin6 = dnnTotals[i].Bin6 ?? string.Empty, + DnnBin7 = dnnTotals[i].Bin7 ?? string.Empty, + DnnBin8 = dnnTotals[i].Bin8 ?? string.Empty + }; + //result.HeaderUniqueID = string.Concat(headerFile.MesEntity, "_", headerFile.Lot, "_Summary_", headerFile.Date); + result.HeaderUniqueID = headerFile.UniqueID; + result.UniqueID = string.Concat(result.HeaderUniqueID, "_", result.WaferID.PadLeft(2, '0')); + return result; + } + + /// + /// Convert the raw data file to parsable file format - in this case from PRN to PDF + /// + /// source file to be converted to PDF + /// + private static string ConvertSourceFileToPdf(ConfigData configData, string sourceFile) + { + string result = Path.ChangeExtension(sourceFile, ".pdf"); + if (!File.Exists(result)) + { + //string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\""); + string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", sourceFile, "\""); + //Process process = Process.Start(configData.LincPDFCFileName, arguments); + Process process = Process.Start(configData.GhostPCLFileName, arguments); + process.WaitForExit(30000); + if (!File.Exists(result)) + throw new Exception("PDF file wasn't created"); + } + return result; + } + + private Tuple> Parse(ILogic logic, List fileInfoCollection) + { + Tuple> result; + DataFile dataFile; + HeaderFile headerFile; + foreach (string file in Directory.GetFiles(Path.GetDirectoryName(logic.Logistics.ReportFullPath), "WaferMap*.prn", SearchOption.TopDirectoryOnly)) + fileInfoCollection.Add(new FileInfo(file)); + List dcnTotals = new List(); + List dwnTotals = new List(); + List dnnTotals = new List(); + headerFile = ParseHeader(logic, dcnTotals, dwnTotals, dnnTotals); + List details = new List(); + _Log.Debug($"Number of wafers: {dcnTotals.Count}"); + for (int i = 0; i < dcnTotals.Count; i++) + { + _Log.Debug($"****ParseData - Parsing wafer summary: {i}"); + dataFile = ParseWaferSummary(headerFile, i, dcnTotals, dwnTotals, dnnTotals); + details.Add(dataFile); + } + fileInfoCollection.Add(new FileInfo(logic.Logistics.ReportFullPath)); + result = new Tuple>(headerFile, details); + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs new file mode 100644 index 0000000..b6cb4b8 --- /dev/null +++ b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs @@ -0,0 +1,13 @@ +namespace Adaptation.Ifx.Eaf.Common.Configuration +{ + [System.Runtime.Serialization.DataContractAttribute] + public class ConnectionSetting + { + public ConnectionSetting(string name, string value) { } + + [System.Runtime.Serialization.DataMemberAttribute] + public string Name { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs new file mode 100644 index 0000000..4726692 --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +{ + public class File + { + public File(string filePath) { throw new NotImplementedException(); } + public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); } + + public string Path { get; } + public DateTime TimeFound { get; } + public bool IsErrorFile { get; } + public Dictionary ContentParameters { get; } + + public File UpdateContentParameters(Dictionary contentParameters) { throw new NotImplementedException(); } + public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs new file mode 100644 index 0000000..561725e --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs @@ -0,0 +1,35 @@ +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +{ + public class FilePathGenerator + { + public const char PLACEHOLDER_IDENTIFIER = '%'; + public const char PLACEHOLDER_SEPARATOR = ':'; + public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; + public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName"; + public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension"; + public const string PLACEHOLDER_DATE_TIME = "DateTime"; + public const string PLACEHOLDER_SUB_FOLDER = "SubFolder"; + public const string PLACEHOLDER_CELL_NAME = "CellName"; + + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) { throw new NotImplementedException(); } + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) { throw new NotImplementedException(); } + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) { throw new NotImplementedException(); } + + protected string SubFolderPath { get; } + protected FileConnectorConfiguration Configuration { get; } + protected File File { get; } + protected bool IsErrorFile { get; } + protected string DefaultPlaceHolderValue { get; } + + public string GetFullTargetPath() { throw new NotImplementedException(); } + public virtual string GetTargetFileName() { throw new NotImplementedException(); } + public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); } + protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); } + protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); } + protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs new file mode 100644 index 0000000..5eafd1c --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs @@ -0,0 +1,135 @@ +using Adaptation.Ifx.Eaf.Common.Configuration; +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration +{ + [System.Runtime.Serialization.DataContractAttribute] + public class FileConnectorConfiguration + { + public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360; + public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15; + + [System.Runtime.Serialization.DataMemberAttribute] + public virtual bool? TriggerOnChanged { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? PostProcessingRetries { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual bool? CopySourceFolderStructure { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string AlternateTargetFolder { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public long? FileHandleTimeout { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public bool? DeleteEmptySourceSubFolders { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public long? IdleEventWaitTimeInSeconds { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string FileAgeThreshold { get; set; } + public bool? FolderAgeCheckIndividualSubFolders { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual ZipModeEnum? ZipMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public FileAgeFilterEnum? FileAgeFilterMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string ZipTargetFileName { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string ZipErrorTargetFileName { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public long? ZipFileSubFolderLevel { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string DefaultPlaceHolderValue { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public bool? UseZip64Mode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public List ConnectionSettings { get; set; } + public string SourceDirectoryCloaking { get; set; } + public string FolderAgeThreshold { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? FileScanningIntervalInSeconds { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual bool? TriggerOnCreated { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? ZipFileTime { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string SourceFileLocation { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string SourceFileFilter { get; set; } + public List SourceFileFilters { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual bool? IncludeSubDirectories { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual FileScanningOptionEnum? FileScanningOption { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string TargetFileLocation { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string ErrorTargetFileLocation { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string TargetFileName { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? FileHandleWaitTime { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public IfFileExistEnum? IfFileExistAction { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public long? ConnectionRetryInterval { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public PreProcessingModeEnum? PreProcessingMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public PostProcessingModeEnum? PostProcessingMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long? ZipFileAmount { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string ErrorTargetFileName { get; set; } + + public void Initialize() { throw new NotImplementedException(); } + + public enum PostProcessingModeEnum + { + None = 0, + Move = 1, + Copy = 2, + Rename = 3, + Zip = 4, + Delete = 5, + MoveFolder = 6, + CopyFolder = 7, + DeleteFolder = 8 + } + public enum PreProcessingModeEnum + { + None = 0, + Process = 1 + } + public enum IfFileExistEnum + { + Overwrite = 0, + LeaveFiles = 1, + Delete = 2 + } + public enum IfPostProcessingFailsEnum + { + LeaveFiles = 0, + Delete = 1 + } + public enum FileScanningOptionEnum + { + FileWatcher = 0, + TimeBased = 1 + } + public enum ZipModeEnum + { + ZipByAmountOrTime = 0, + ZipByFileName = 1, + ZipBySubFolderName = 2 + } + public enum FileAgeFilterEnum + { + IgnoreNewer = 0, + IgnoreOlder = 1 + } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs new file mode 100644 index 0000000..55d81fd --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs @@ -0,0 +1,14 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription +{ + public class FileConnectorParameterTypeDefinitionProvider + { + public FileConnectorParameterTypeDefinitionProvider() { } + + public IEnumerable GetAllParameterTypeDefinition() { return null; } + public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; } + } +} \ No newline at end of file diff --git a/Adaptation/MET08DDUPSP1TBI.Tests.csproj b/Adaptation/MET08DDUPSP1TBI.Tests.csproj new file mode 100644 index 0000000..1f4bbbc --- /dev/null +++ b/Adaptation/MET08DDUPSP1TBI.Tests.csproj @@ -0,0 +1,73 @@ + + + SAK + SAK + SAK + SAK + + + net5.0 + false + + + trx + ../../../Trunk/MET08DDUPSP1TBI/05_TestResults/TestResults + + + true + true + true + + + Windows + + + OSX + + + Linux + + + + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + + + + + + + + + + + + + + NU1701 + + + + + + + + + + Always + + + Always + + + \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs new file mode 100644 index 0000000..c4e64f0 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs @@ -0,0 +1,10 @@ +using System; + +namespace Adaptation.PeerGroup.GCL.Annotations +{ + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)] + public sealed class NotNullAttribute : Attribute + { + public NotNullAttribute() { } + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs new file mode 100644 index 0000000..82138e2 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum HsmsConnectionMode + { + Active = 0, + Passive = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs new file mode 100644 index 0000000..b52c7a3 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum HsmsSessionMode + { + MultiSession = 0, + SingleSession = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs new file mode 100644 index 0000000..81181f0 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum SecsTransportType + { + HSMS = 0, + Serial = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs new file mode 100644 index 0000000..4511319 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs @@ -0,0 +1,16 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum SerialBaudRate + { + Baud9600 = 0, + Baud19200 = 1, + Baud4800 = 2, + Baud2400 = 3, + Baud1200 = 4, + Baud300 = 5, + Baud150 = 6, + Baud38400 = 7, + Baud57600 = 8, + Baud115200 = 9 + } +} \ No newline at end of file diff --git a/Adaptation/Shared/CellInstance.cs b/Adaptation/Shared/CellInstance.cs new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/Adaptation/Shared/CellInstance.cs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Adaptation/Shared/Deposition/Test.cs b/Adaptation/Shared/Deposition/Test.cs new file mode 100644 index 0000000..2bfa2fd --- /dev/null +++ b/Adaptation/Shared/Deposition/Test.cs @@ -0,0 +1,16 @@ +namespace Adaptation.Shared.Deposition +{ + + public enum Test + { + AFMRoughness = -1, + GRATXTCenter = 0, + GRATXTEdge = 1, + GRAXMLCenter = 2, + GRAXMLEdgeN = 3, + Health = 4, + Temps = 5, + ToolTime = 6 + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Description.cs b/Adaptation/Shared/Description.cs new file mode 100644 index 0000000..c63a405 --- /dev/null +++ b/Adaptation/Shared/Description.cs @@ -0,0 +1,192 @@ +using Adaptation.Eaf.Core; +using Adaptation.Eaf.EquipmentCore.Control; +using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; +using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription; +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.Shared +{ + + public class Description + { + + public enum RowColumn + { + Test = 1000, + Count, + Index + } + + public enum LogisticsColumn + { + EventName = 2000, + NullData, + JobID, + Sequence, + MesEntity, + ReportFullPath, + ProcessJobID, + MID + } + + public enum Param + { + String = 0, + Integer = 2, + Double = 3, + Boolean = 4, + StructuredType = 5 + } + + internal const string FileFound = "FileFound"; + + + public List EquipmentParameters { get; private set; } + public List ParameterTypeDefinitions { get; private set; } + + private readonly bool _UseCyclical; + private readonly List _HeaderNames; + private readonly Dictionary _KeyIndexPairs; + private readonly ParameterTypeDefinition _StructuredType; + private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider; + + public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl) + { + _KeyIndexPairs = new Dictionary(); + _HeaderNames = configDataBase.GetHeaderNames(logic); + _UseCyclical = configDataBase.UseCyclicalForDescription; + _StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List()); + _FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider(); + EquipmentParameters = new List(); + ParameterTypeDefinitions = new List { _StructuredType }; + Dictionary>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false); + List results = GetParameterValues(equipmentControl, keyValuePairsCollection); + } + + private List GetParameterValues(IEquipmentControl equipmentControl, Dictionary>> keyValuePairsCollection) + { + List results = new List(); + Enum param; + object value; + Enum[] @params; + string description; + List list; + EquipmentParameter equipmentParameter; + ParameterTypeDefinition parameterTypeDefinition; + bool addToEquipmentParameters = !EquipmentParameters.Any(); + foreach (KeyValuePair>> keyValuePair in keyValuePairsCollection) + { + if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key)) + continue; + @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); + if (@params.Length != 1) + throw new Exception(); + if (keyValuePair.Value[0].Item2 != keyValuePair.Key) + throw new Exception(); + param = @params[0]; + if (!addToEquipmentParameters) + equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]]; + else + { + description = keyValuePair.Value[0].Item3; + _KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count()); + if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key))) + parameterTypeDefinition = _StructuredType; + else + parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString()); + equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description); + EquipmentParameters.Add(equipmentParameter); + } + if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key)) + value = keyValuePair.Value[0].Item4; + else + { + list = new List(); + for (int i = 0; i < keyValuePair.Value.Count; i++) + list.Add(new object[] { i, keyValuePair.Value[i].Item4 }); + value = list; + } + if (equipmentControl is null || !(param is Param.StructuredType)) + results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now)); + else + results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value)); + } + return results; + } + + public List GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary keyValuePairs = null) + { + List results = new List(); + if (_UseCyclical && (i is null || i.Value > 0)) + throw new Exception(); + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + Enum param; + Tuple tuple; + JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); + Dictionary>> keyValuePairsCollection = new Dictionary>>(); + for (int r = i.Value; r < jsonElements.Length; r++) + { + foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject()) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) + { + param = Param.StructuredType; + //jValue = jObject.Value("Item1"); + throw new NotImplementedException("Item1"); + } + else + { + switch (jsonProperty.Value.ValueKind) + { + case JsonValueKind.String: + param = Param.String; + break; + case JsonValueKind.Number: + param = Param.Double; + break; + case JsonValueKind.True: + case JsonValueKind.False: + param = Param.Boolean; + break; + case JsonValueKind.Null: + param = Param.String; + break; + default: + param = Param.StructuredType; + break; + } + } + tuple = new Tuple(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString()); + if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name)) + keyValuePairsCollection.Add(jsonProperty.Name, new List>()); + keyValuePairsCollection[jsonProperty.Name].Add(tuple); + } + if (!_UseCyclical) + break; + } + results = GetParameterValues(equipmentControl, keyValuePairsCollection); + return results; + } + + public static string GetCellName() + { + string result; + if (Backbone.Instance?.CellName is null) + result = string.Empty; + else + result = Backbone.Instance.CellName; + if (result.Contains("-IO")) + result = result.Replace("-IO", string.Empty); + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/EquipmentType.cs b/Adaptation/Shared/EquipmentType.cs new file mode 100644 index 0000000..12db24d --- /dev/null +++ b/Adaptation/Shared/EquipmentType.cs @@ -0,0 +1,53 @@ +namespace Adaptation.Shared +{ + + public enum EquipmentType + { + FileEquipment, + SemiEquipment, + // + DEP08EGANAIXG5, + // + MET08ANLYSDIFAAST230_Semi, + MET08DDUPSFS6420, + MET08DDUPSP1TBI, + MET08RESIHGCV, + MET08RESIMAPCDE, + MET08THFTIRQS408M, + MET08THFTIRSTRATUS, + // + MET08AFMD3100, + MET08BVHGPROBE, + MET08CVHGPROBE802B150, + MET08CVHGPROBE802B150_Monthly, + MET08CVHGPROBE802B150_Weekly, + MET08DDINCAN8620, + MET08DDINCAN8620_Daily, + MET08EBEAMINTEGRITY26, + MET08HALLHL5580, + MET08HALLHL5580_Monthly, + MET08HALLHL5580_Weekly, + MET08MESMICROSCOPE, + MET08NDFRESIMAP151C, + MET08NDFRESIMAP151C_Verification, + MET08PLMAPRPM, + MET08PLMAPRPM_Daily, + MET08PLMAPRPM_Verification, + MET08PLMPPLATO, + MET08PRFUSB4000, + MET08PRFUSB4000_Daily, + MET08PRFUSB4000_Monthly, + MET08PRFUSB4000_Weekly, + MET08PRFUSB4000_Verification, + MET08PRFUSB4000_Villach, + MET08UVH44GS100M, + MET08VPDSUBCON, + MET08WGEOMX203641Q, + MET08WGEOMX203641Q_Verification, + MET08XRDXPERTPROMRDXL, + MET08XRDXPERTPROMRDXL_Monthly, + MET08XRDXPERTPROMRDXL_Weekly, + METBRXRAYJV7300L + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/IProcessData.cs b/Adaptation/Shared/IProcessData.cs new file mode 100644 index 0000000..e2159b1 --- /dev/null +++ b/Adaptation/Shared/IProcessData.cs @@ -0,0 +1,16 @@ +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +namespace Adaptation.Shared +{ + public interface IProcessData + { + + Tuple> GetResults(ILogic logic, ConfigDataBase configData, List fileInfoCollection); + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/IProcessDataDescription.cs b/Adaptation/Shared/IProcessDataDescription.cs new file mode 100644 index 0000000..82b5a5c --- /dev/null +++ b/Adaptation/Shared/IProcessDataDescription.cs @@ -0,0 +1,26 @@ +using Adaptation.Shared.Metrology; +using System.Collections.Generic; + +namespace Adaptation.Shared +{ + + public interface IProcessDataDescription + { + + int Test { get; set; } + int Count { get; set; } + int Index { get; set; } + IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase); + IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase); + List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData); + List GetDetailNames(ILogic logic, ConfigDataBase configDataBase); + List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase); + List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test); + List GetNames(ILogic logic, ConfigDataBase configDataBase); + List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase); + List GetParameterNames(ILogic logic, ConfigDataBase configDataBase); + string GetEventDescription(); + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/IScopeInfo.cs b/Adaptation/Shared/IScopeInfo.cs new file mode 100644 index 0000000..83b91dc --- /dev/null +++ b/Adaptation/Shared/IScopeInfo.cs @@ -0,0 +1,21 @@ +using System; + +namespace Adaptation.Shared +{ + + public interface IScopeInfo + { + + Enum Enum { get; } + string HTML { get; } + string Title { get; } + string FileName { get; } + int TestValue { get; } + string Header { get; } + string QueryFilter { get; } + string FileNameWithoutExtension { get; } + EquipmentType EquipmentType { get; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/IsEnvironment.cs b/Adaptation/Shared/IsEnvironment.cs new file mode 100644 index 0000000..c24b236 --- /dev/null +++ b/Adaptation/Shared/IsEnvironment.cs @@ -0,0 +1,171 @@ +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Shared +{ + + public class IsEnvironment + { + + public enum Name + { + LinuxDevelopment, + LinuxProduction, + LinuxStaging, + OSXDevelopment, + OSXProduction, + OSXStaging, + WindowsDevelopment, + WindowsProduction, + WindowsStaging + } + + public bool DebuggerWasAttachedDuringConstructor { get; private set; } + public bool Development { get; private set; } + public bool Linux { get; private set; } + public bool OSX { get; private set; } + public bool Production { get; private set; } + public bool Staging { get; private set; } + public bool Windows { get; private set; } + public string Profile { get; private set; } + public string AppSettingsFileName { get; private set; } + public string ASPNetCoreEnvironment { get; private set; } + + public IsEnvironment(string testCategory) + { + if (testCategory.EndsWith(".json")) + { + Production = testCategory == "appsettings.json"; + Staging = testCategory.EndsWith(nameof(Staging)); + OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + Development = testCategory.EndsWith(nameof(Development)); + Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; + Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + } + else + { + DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; + OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX)); + ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux)); + Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging)); + Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows)); + Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production)); + Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development)); + } + Profile = GetProfile(); + AppSettingsFileName = GetAppSettingsFileName(processesCount: null); + } + + public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction) + { + Staging = isStaging; + Production = isProduction; + Development = isDevelopment; + OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; + Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + Profile = GetProfile(); + AppSettingsFileName = GetAppSettingsFileName(processesCount: null); + } + + public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction) + { + OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; + Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction) + throw new Exception(); + else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction) + Production = true; + else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment) + Development = true; + else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction) + throw new Exception(); + else + { + Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging)); + Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production)); + Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development)); + } + Profile = GetProfile(); + AppSettingsFileName = GetAppSettingsFileName(processesCount); + } + + private string GetProfile() + { + string result; + if (Windows && Production) + result = nameof(Production); + else if (Windows && Staging) + result = nameof(Staging); + else if (Windows && Development) + result = nameof(Development); + else if (Linux && Production) + result = nameof(Name.LinuxProduction); + else if (Linux && Staging) + result = nameof(Name.LinuxStaging); + else if (Linux && Development) + result = nameof(Name.LinuxDevelopment); + else if (OSX && Production) + result = nameof(Name.OSXProduction); + else if (OSX && Staging) + result = nameof(Name.OSXStaging); + else if (OSX && Development) + result = nameof(Name.OSXDevelopment); + else + throw new Exception(); + return result; + } + + private string GetAppSettingsFileName(int? processesCount) + { + string result; + if (Production) + { + if (processesCount is null) + result = "appsettings.json"; + else + result = $"appsettings.{processesCount}.json"; + } + else + { + string environment; + if (Staging) + environment = nameof(Staging); + else if (Development) + environment = nameof(Development); + else + throw new Exception(); + if (processesCount is null) + result = $"appsettings.{environment}.json"; + else + result = $"appsettings.{environment}.{processesCount}.json"; + } + return result; + } + + public static string GetEnvironmentName(IsEnvironment isEnvironment) + { + string result; + if (isEnvironment.Windows) + result = nameof(IsEnvironment.Windows); + else if (isEnvironment.Linux) + result = nameof(IsEnvironment.Linux); + else if (isEnvironment.OSX) + result = nameof(IsEnvironment.OSX); + else + throw new Exception(); + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Logistics.cs b/Adaptation/Shared/Logistics.cs new file mode 100644 index 0000000..89aacac --- /dev/null +++ b/Adaptation/Shared/Logistics.cs @@ -0,0 +1,244 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Adaptation.Shared +{ + + public class Logistics + { + + public object NullData { get; private set; } + public string JobID { get; private set; } //CellName + public long Sequence { get; private set; } //Ticks + public DateTime DateTimeFromSequence { get; private set; } + public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; } + public string MesEntity { get; private set; } //SPC + public string ReportFullPath { get; private set; } //Extract file + public string ProcessJobID { get; internal set; } //Reactor (duplicate but I want it in the logistics) + public string MID { get; internal set; } //Lot & Pocket || Lot + public List Tags { get; internal set; } + public List Logistics1 { get; internal set; } + public List Logistics2 { get; internal set; } + + public Logistics() + { + DateTime dateTime = DateTime.Now; + NullData = null; + JobID = Description.GetCellName(); + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + MesEntity = DefaultMesEntity(dateTime); + ReportFullPath = string.Empty; + ProcessJobID = nameof(ProcessJobID); + MID = nameof(MID); + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + + public Logistics(object nullData, Dictionary cellNames, Dictionary mesEntities, FileInfo fileInfo, bool useSplitForMID, int? fileInfoLength = null) + { + NullData = nullData; + string mesEntity = string.Empty; + string jobID = Description.GetCellName(); + DateTime dateTime = fileInfo.LastWriteTime; + if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value) + dateTime = dateTime.AddTicks(-1); + if (string.IsNullOrEmpty(jobID)) + { + if (cellNames.Count == 1) + jobID = cellNames.ElementAt(0).Key; + else + { + foreach (var element in cellNames) + { + if (fileInfo.FullName.IndexOf(element.Key, StringComparison.OrdinalIgnoreCase) > -1 || fileInfo.FullName.IndexOf(element.Value, StringComparison.OrdinalIgnoreCase) > -1) + { + jobID = element.Key; + break; + } + } + } + } + if (string.IsNullOrEmpty(jobID)) + throw new Exception(); + if (mesEntities.ContainsKey(jobID)) + mesEntity = mesEntities[jobID]; + else if (mesEntities.Count == 1) + mesEntity = mesEntities.ElementAt(0).Value; + // + if (string.IsNullOrEmpty(mesEntity)) + throw new Exception(); + JobID = jobID; + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + MesEntity = mesEntity; + ReportFullPath = fileInfo.FullName; + ProcessJobID = nameof(ProcessJobID); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName); + if (useSplitForMID) + { + if (fileNameWithoutExtension.IndexOf(".") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim(); + if (fileNameWithoutExtension.IndexOf("_") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim(); + if (fileNameWithoutExtension.IndexOf("-") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim(); + } + MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + + public Logistics(string reportFullPath, string logistics) + { + string key; + DateTime dateTime; + string[] segments; + Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); + if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) + { + NullData = null; + JobID = "null"; + dateTime = new FileInfo(reportFullPath).LastWriteTime; + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + MesEntity = DefaultMesEntity(dateTime); + ReportFullPath = reportFullPath; + ProcessJobID = "R##"; + MID = "null"; + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + else + { + string logistics1Line1 = Logistics1[0]; + key = "NULL_DATA="; + if (!logistics1Line1.Contains(key)) + NullData = null; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + NullData = segments[1].Split(';')[0]; + } + key = "JOBID="; + if (!logistics1Line1.Contains(key)) + JobID = "null"; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + JobID = segments[1].Split(';')[0]; + } + key = "SEQUENCE="; + if (!logistics1Line1.Contains(key)) + dateTime = new FileInfo(reportFullPath).LastWriteTime; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks) + dateTime = new FileInfo(reportFullPath).LastWriteTime; + else + dateTime = new DateTime(sequence); + } + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime; + if (TotalSecondsSinceLastWriteTimeFromSequence > 600) + { + if (lastWriteTime != dateTime) + try + { File.SetLastWriteTime(reportFullPath, dateTime); } + catch (Exception) { } + } + key = "MES_ENTITY="; + if (!logistics1Line1.Contains(key)) + MesEntity = DefaultMesEntity(dateTime); + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MesEntity = segments[1].Split(';')[0]; + } + ReportFullPath = reportFullPath; + key = "PROCESS_JOBID="; + if (!logistics1Line1.Contains(key)) + ProcessJobID = "R##"; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + ProcessJobID = segments[1].Split(';')[0]; + } + key = "MID="; + if (!logistics1Line1.Contains(key)) + MID = "null"; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MID = segments[1].Split(';')[0]; + } + } + Logistics2 logistics2; + Tags = new List(); + Logistics2 = new List(); + for (int i = 1; i < Logistics1.Count(); i++) + { + if (Logistics1[i].StartsWith("LOGISTICS_2")) + { + logistics2 = new Logistics2(Logistics1[i]); + Logistics2.Add(logistics2); + } + } + for (int i = Logistics1.Count() - 1; i > -1; i--) + { + if (Logistics1[i].StartsWith("LOGISTICS_2")) + Logistics1.RemoveAt(i); + } + } + + public Logistics ShallowCopy() + { + return (Logistics)MemberwiseClone(); + } + + private string DefaultMesEntity(DateTime dateTime) + { + return string.Concat(dateTime.Ticks, "_MES_ENTITY"); + } + + internal string GetLotViaMostCommonMethod() + { + return MID.Substring(0, MID.Length - 2); + } + + internal string GetPocketNumberViaMostCommonMethod() + { + return MID.Substring(MID.Length - 2); + } + + internal void Update(string dateTime, string processJobID, string mid) + { + if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted)) + dateTimeCasted = DateTime.Now; + NullData = null; + //JobID = Description.GetCellName(); + Sequence = dateTimeCasted.Ticks; + DateTimeFromSequence = dateTimeCasted; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds; + //MesEntity = DefaultMesEntity(dateTime); + //ReportFullPath = string.Empty; + ProcessJobID = processJobID; + MID = mid; + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Logistics2.cs b/Adaptation/Shared/Logistics2.cs new file mode 100644 index 0000000..0f0f2f2 --- /dev/null +++ b/Adaptation/Shared/Logistics2.cs @@ -0,0 +1,80 @@ +using System; + +namespace Adaptation.Shared +{ + public class Logistics2 + { + + public string MID { get; private set; } + public string RunNumber { get; private set; } + public string SatelliteGroup { get; private set; } + public string PartNumber { get; private set; } + public string PocketNumber { get; private set; } + public string WaferLot { get; private set; } + public string Recipe { get; private set; } + + public Logistics2(string logistics2) + { + string key; + string[] segments; + key = "JOBID="; + if (!logistics2.Contains(key)) + MID = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MID = segments[1].Split(';')[0]; + } + key = "MID="; + if (!logistics2.Contains(key)) + RunNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + RunNumber = segments[1].Split(';')[0]; + } + key = "INFO="; + if (!logistics2.Contains(key)) + SatelliteGroup = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + SatelliteGroup = segments[1].Split(';')[0]; + } + key = "PRODUCT="; + if (!logistics2.Contains(key)) + PartNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + PartNumber = segments[1].Split(';')[0]; + } + key = "CHAMBER="; + if (!logistics2.Contains(key)) + PocketNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + PocketNumber = segments[1].Split(';')[0]; + } + key = "WAFER_ID="; + if (!logistics2.Contains(key)) + WaferLot = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + WaferLot = segments[1].Split(';')[0]; + } + key = "PPID="; + if (!logistics2.Contains(key)) + Recipe = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + Recipe = segments[1].Split(';')[0]; + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/Column.cs b/Adaptation/Shared/Metrology/Column.cs new file mode 100644 index 0000000..b03e6fe --- /dev/null +++ b/Adaptation/Shared/Metrology/Column.cs @@ -0,0 +1,1605 @@ +using System; + +namespace Adaptation.Shared.Metrology +{ + + public static class ColumnGet + { + + public static string GetDiplayName(this Column column) + { + string results; + switch (column) + { + //case Column._8in_Total_Warp_Verification: results = "8in Total Warp Verification"; break; + //case Column.AFM_Monthly_Y: results = "AFM-Monthly Y"; break; + //case Column.AFM_Monthly: results = "AFM_Monthly"; break; + case Column.AFM_Pit_Count: + results = "AFM Pit Count"; + break; + case Column.AFM_Roughness: + results = "AFM Roughness"; + break; + //case Column.Adder_Bin_1: results = "Adder Bin 1"; break; + //case Column.Adder_Bin_2: results = "Adder Bin 2"; break; + //case Column.Adder_Bin_3: results = "Adder Bin 3"; break; + //case Column.Adder_Bin_4: results = "Adder Bin 4"; break; + //case Column.Adder_Bin_5: results = "Adder Bin 5"; break; + //case Column.Adder_Bin_6: results = "Adder Bin 6"; break; + //case Column.Adder_Bin_9: results = "Adder Bin 9"; break; + case Column.Al_B_B_WTAVG: + results = "Al% B.B. WTAVG"; + break; + case Column.Al_B_B_: + results = "Al% B.B."; + break; + case Column.Al_Barrier_WTAVG: + results = "Al% Barrier WTAVG"; + break; + case Column.Al_Barrier: + results = "Al% Barrier"; + break; + case Column.Al_SLS_WTAVG: + results = "Al% SLS WTAVG"; + break; + case Column.Al_SLS: + results = "Al% SLS"; + break; + case Column.Al_TL1_WTAVG: + results = "Al% TL1 WTAVG"; + break; + case Column.Al_TL1: + results = "Al% TL1"; + break; + case Column.Al_TL2_WTAVG: + results = "Al% TL2 WTAVG"; + break; + //case Column.BV_Resistance: results = "BV Resistance"; break; //BV Monthly Verification + case Column.BandEdge_V: + results = "BandEdge_V"; + break; + case Column.BandEdge_V_XY: + results = "BandEdge_V_XY"; + break; + case Column.BandEdge_nm: + results = "BandEdge_nm"; + break; + case Column.Barrier_Composition_RPM_XY: + results = "Barrier_Composition_RPM_XY"; + break; + case Column.Bow_Calibration: + results = "Bow Calibration"; + break; + case Column.Bow_Range: + results = "Bow Range"; + break; + case Column.Bow: + results = "Bow"; + break; + case Column.BowCenter: + results = "BowCenter"; + break; + case Column.BowX: + results = "BowX"; + break; + case Column.BowY: + results = "BowY"; + break; + case Column.Breakdown_Voltage_Edge: + results = "Breakdown Voltage - Edge"; + break; + case Column.Breakdown_VoltageMiddle: + results = "Breakdown Voltage - Middle"; + break; + case Column.Breakdown_Voltage: + results = "Breakdown Voltage"; + break; + case Column.CV_C_at_10V: + results = "CV C at -10V"; + break; + case Column.CV_Nd_Min: + results = "CV Nd Min"; + break; + //case Column.Candela_Large_LPD_Quarterly: results = "Candela Large LPD Quarterly"; break; + //case Column.Candela_Medium_LPD_Quarterly: results = "Candela Medium LPD Quarterly"; break; + //case Column.Candela_Small_LPD_Quarterly: results = "Candela Small LPD Quarterly"; break; + //case Column.Candela_Total_Quarterly: results = "Candela Total Quarterly"; break; + case Column.Candela_102_83nm: + results = "102-83nm"; + break; + case Column.Candela_1_1um: + results = "1.1um"; + break; + case Column.Candela_496nm: + results = "496nm"; + break; + case Column.Candela_600nm: + results = "600nm"; + break; + case Column.Candela_8620_Small: + results = "Candela 8620 Small"; + break; + case Column.Candela_Crack_Verification: + results = "Crack Verification"; + break; + case Column.Candela_Cracking: + results = "Candela Cracking"; + break; + case Column.Candela_Cracking_Acceptable: + results = "Candela Cracking Acceptable"; + break; + case Column.Candela_Crater: + results = "Candela Crater"; + break; + case Column.Candela_Crater_Verification: + results = "Crater verification"; + break; + case Column.Candela_Haze: + results = "Candela Haze"; + break; + case Column.Candela_LPD_Large: + results = "Candela LPD Large"; + break; + case Column.Candela_LPD_Medium: + results = "Candela LPD Medium"; + break; + case Column.Candela_LPD_Small: + results = "Candela LPD Small"; + break; + case Column.Candela_Large_Verification: + results = "Large Verification"; + break; + case Column.Candela_Medium_Verification: + results = "Medium Verification"; + break; + case Column.Candela_Pits: + results = "Candela Pits"; + break; + case Column.Candela_Pits_Verification: + results = "Pits verification"; + break; + case Column.Candela_SPE: + results = "Candela SPE"; + break; + case Column.Candela_SPE_Verification: + results = "SPE verification"; + break; + case Column.Candela_Slip: + results = "Candela Slip"; + break; + case Column.Candela_Small_Verification: + results = "Small Verification"; + break; + case Column.Candela_Spirals: + results = "Candela Spirals"; + break; + case Column.Candela_Spirals_Verification: + results = "Candela Spirals Verification"; + break; + case Column.Candela_Total_Defects: + results = "Candela Total Defects"; + break; + case Column.Candela_Total_PSL: + results = "Candela Total PSL"; + break; + case Column.Candela__1_1um: + results = ">1.1um"; + break; + //case Column.Comment: results = "Comment"; break; + //case Column.Conductivity: results = "Conductivity"; break; + case Column.Contact_Symmetry: + results = "Contact Symmetry"; + break; + //case Column.Cracking_verification: results = "Cracking verification"; break; + //case Column.Crater_verification: results = "Crater verification"; break; + case Column.Date: + results = "Date"; + break; + case Column.Denton_Crystal_Life: + results = "Denton_Crystal_Life"; + break; + case Column.Denton_Current_AVG: + results = "Denton_Current_AVG"; + break; + case Column.Denton_Current_STDEV: + results = "Denton_Current_STDEV"; + break; + case Column.Denton_Deposition_Power_AVG: + results = "Denton_Deposition_Power_AVG"; + break; + case Column.Denton_Deposition_Power_STDEV: + results = "Denton_Deposition_Power_STDEV"; + break; + case Column.Denton_Deposition_Rate_AVG: + results = "Denton_Deposition_Rate_AVG"; + break; + case Column.Denton_Deposition_Rate_STDEV: + results = "Denton_Deposition_Rate_STDEV"; + break; + case Column.Denton_Gun_Pocket: + results = "Denton_Gun_Pocket"; + break; + case Column.Denton_Pumpdown_Time: + results = "Denton_Pumpdown_Time"; + break; + case Column.Denton_Voltage_AVG: + results = "Denton_Voltage_AVG"; + break; + case Column.Denton_Voltage_STDEV: + results = "Denton_Voltage_STDEV"; + break; + case Column.Employee: + results = "Employee"; + break; + case Column.Epi_Thickness_Mean: + results = "Epi Thickness Mean"; + break; + case Column.Epi_Thickness_Mean_XY: + results = "Epi Thickness Mean_XY"; + break; + case Column.Epi_Thickness_Std_Dev_: + results = "Epi Thickness Std Dev %"; + break; + case Column.FWHM_006_WTAVG: + results = "FWHM 006 WTAVG"; + break; + case Column.FWHM_006: + results = "FWHM 006"; + break; + case Column.FWHM_105_WTAVG: + results = "FWHM 105 WTAVG"; + break; + case Column.FWHM_105: + results = "FWHM 105"; + break; + case Column.Hall_Rs: + results = "Hall Rs"; + break; + case Column.Hall_Mobility_verif_sample: + results = "Hall_Mobility_verif_sample"; + break; + case Column.Hall_Ns_verif_sample: + results = "Hall_Ns_verif_sample"; + break; + case Column.Hall_Rs_verif_sample: + results = "Hall_Rs_verif_sample"; + break; + case Column.Job: + results = "Job"; + break; + case Column.LEI_RS_Average_value: + results = "LEI RS Average value"; + break; + case Column.LEI_RS_Maximum_value: + results = "LEI RS Maximum value"; + break; + case Column.LEI_RS_Minimum_value: + results = "LEI RS Minimum value"; + break; + case Column.LEI_RS_STDEV: + results = "LEI RS STDEV"; + break; + case Column.LEI_RS_STDEV_: + results = "LEI RS STDEV%"; + break; + //case Column.Large_Adder_Sum: results = "Large Adder Sum"; break; + case Column.Lot: + results = "Lot"; + break; + //case Column.Medium_Adder_Sum: results = "Medium Adder Sum"; break; + case Column.Microscope_Center_5x: + results = "Microscope Center 5x"; + break; + case Column.Microscope_Center_50x: + results = "Microscope Center 50x"; + break; + case Column.Microscope_Middle_5x: + results = "Microscope Middle 5x"; + break; + case Column.Microscope_Middle_50x: + results = "Microscope Middle 50x"; + break; + case Column.Microscope_Edge_5x: + results = "Microscope Edge 5x"; + break; + case Column.Microscope_Edge_50x: + results = "Microscope Edge 50x"; + break; + case Column.Mobility_Verification: + results = "Mobility Verification"; + break; + case Column.Mobility: + results = "Mobility"; + break; + case Column.Ns_Verification: + results = "Ns Verification"; + break; + case Column.PL_Edge_Wavelength: + results = "PL Edge Wavelength"; + break; + case Column.PL_Ratio: + results = "PL Ratio"; + break; + case Column.PR_Barrier_Composition: + results = "PR Barrier Composition"; + break; + case Column.PR_Peak: + results = "PR Peak"; + break; + case Column.Part: + results = "Part"; + break; + //case Column.Particles_verification: results = "Particles verification"; break; + //case Column.Pits_verification: results = "Pits verification"; break; + //case Column.Pocket: results = "Pocket"; break; + //case Column.Post_Bin_1: results = "Post Bin 1"; break; + //case Column.Post_Bin_2: results = "Post Bin 2"; break; + //case Column.Post_Bin_3: results = "Post Bin 3"; break; + //case Column.Post_Bin_4: results = "Post Bin 4"; break; + //case Column.Post_Bin_5: results = "Post Bin 5"; break; + //case Column.Post_Bin_6: results = "Post Bin 6"; break; + //case Column.Post_Bin_9: results = "Post Bin 9"; break; + //case Column.Pre_Bin_1: results = "Pre Bin 1"; break; + //case Column.Pre_Bin_2: results = "Pre Bin 2"; break; + //case Column.Pre_Bin_3: results = "Pre Bin 3"; break; + //case Column.Pre_Bin_4: results = "Pre Bin 4"; break; + //case Column.Pre_Bin_5: results = "Pre Bin 5"; break; + //case Column.Pre_Bin_6: results = "Pre Bin 6"; break; + //case Column.Pre_Bin_9: results = "Pre Bin 9"; break; + case Column.Process: + results = "Process"; + break; + //case Column.RPM_verif_Thickness_1: results = "RPM_verif_Thickness_1"; break; + //case Column.RPM_verif_Thickness_2: results = "RPM_verif_Thickness_2"; break; + //case Column.RPM_verif_Thickness_3: results = "RPM_verif_Thickness_3"; break; + //case Column.RPM_verif_Thickness_Average: results = "RPM_verif_Thickness_Average"; break; + //case Column.RTA_oxide_Thk_Change: results = "RTA oxide Thk Change"; break; + //case Column.RTA_oxide_post_anneal_Thk: results = "RTA oxide post-anneal Thk"; break; + //case Column.RTA_oxide_pre_anneal_Thk: results = "RTA oxide pre-anneal Thk"; break; + case Column.Recipe: + results = "Recipe"; + break; + //case Column.Resistivity_2_ohm_cm: results = "Resistivity 2 ohm cm"; break; //LEI Weekly Verification + //case Column.Resistivity_600_ohm_cm: results = "Resistivity 600 ohm cm"; break; //LEI Weekly Verification + case Column.Rs_verification: + results = "Rs verification"; + break; + case Column.Rs_verif_100kohm: + results = "Rs_verif_100kohm"; + break; + case Column.Rs_verif_10ohm: + results = "Rs_verif_10ohm"; + break; + case Column.Rs_verif_1kohm: + results = "Rs_verif_1kohm"; + break; + case Column.SID: + results = "SID"; + break; + case Column.SL_Period_WTAVG: + results = "SL Period WTAVG"; + break; + case Column.SL_Period: + results = "SL Period"; + break; + //case Column.SPE_verification: results = "SPE verification"; break; + //case Column.Sample_ID: results = "Sample ID"; break; + case Column.Sheet_Concentration: + results = "Sheet Concentration"; + break; + //case Column.Size: results = "Size"; break; + //case Column.Small_Adder_Sum: results = "Small Adder Sum"; break; + //case Column.Spirals_verification: results = "Spirals verification"; break; + case Column.Time: + results = "Time"; + break; + case Column.Tool_ID: + results = "Tool ID"; + break; + //case Column.Total_LPD_Adder: results = "Total LPD Adder"; break; + //case Column.Total_Verification: results = "Total Verification"; break; + case Column.Total_Warp_Calibration: + results = "Total Warp Calibration"; + break; + case Column.UV_Broken: + results = "UV Broken"; + break; + case Column.UV_Chipping: + results = "UV Chipping"; + break; + case Column.UV_Cracking_0_3mm_: + results = "UV Cracking (0-3mm)"; + break; + case Column.UV_Cracking_3_7mm_: + results = "UV Cracking (3-7mm)"; + break; + case Column.UV_Cracking_7mm_: + results = "UV Cracking (>7mm)"; + break; + case Column.UV_Crazing: + results = "UV Crazing"; + break; + case Column.UV_Crazing_Acceptable: + results = "UV Crazing Acceptable"; + break; + case Column.UV_FULL_Characterization_Wafer: + results = "UV FULL Characterization Wafer"; + break; + case Column.UV_Haze_count_: + results = "UV Haze (count)"; + break; + case Column.UV_LIGHT_Characterization_Wafer: + results = "UV LIGHT Characterization Wafer"; + break; + case Column.UV_Non_rotation: + results = "UV Non-rotation"; + break; + case Column.UV_Other: + results = "UV Other"; + break; + case Column.UV_Scratch_count_: + results = "UV Scratch (count)"; + break; + case Column.UV_Slip_count_: + results = "UV Slip (count)"; + break; + case Column.UV_True_Haze: + results = "UV True Haze"; + break; + case Column.UV_True_Haze_Acceptable: + results = "UV True Haze Acceptable"; + break; + case Column.UV_SPE_1mm_count: + results = "UV-SPE (>1mm) count"; + break; + case Column.UV_SPE_count_: + results = "UV-SPE (count)"; + break; + case Column.Verification_Contact_Symmetry: + results = "Verification Contact Symmetry"; + break; + case Column.Vp_Pinch_Off_Voltage: + results = "Vp Pinch Off Voltage"; + break; + case Column.Wafer_ID: + results = "Wafer ID"; + break; + //case Column.Wafer_Pocket: results = "Wafer Pocket"; break; + case Column.Wafer_Region: + results = "Wafer Region"; + break; + case Column.Wafer_Scribe: + results = "Wafer Scribe"; + break; + case Column.WaferPocket_Candela: + results = "WaferPocket_Candela"; + break; + case Column.WaferPocket_Warp: + results = "WaferPocket_Warp"; + break; + case Column.WaferPosition_CV: + results = "WaferPosition_CV"; + break; + case Column.WaferPosition_BV: + results = "WaferPosition_BV"; + break; + case Column.WaferPosition_Hall: + results = "WaferPosition_Hall"; + break; + case Column.WaferPosition_PR: + results = "WaferPosition_PR"; + break; + case Column.Warp: + results = "Warp"; + break; + case Column.X_Coord: + results = "X-Coord"; + break; + case Column.XRD_2_Theta_Peak_002: + results = "XRD 2 Theta Peak 002"; + break; + case Column.XRD_2_Theta_Peak_101: + results = "XRD 2 Theta Peak 101"; + break; + case Column.XRD_2_Theta_Position: + results = "XRD 2-Theta Position"; + break; + case Column.XRD_2_Theta_Position_Si_1: + results = "XRD 2-Theta Position Si 1"; + break; + case Column.XRD_2_Theta_Position_Si_2: + results = "XRD 2-Theta Position Si 2"; + break; + case Column.XRD_2_Theta_Position_Si_3: + results = "XRD 2-Theta Position Si 3"; + break; + case Column.XRD_Peak_002_Intensity: + results = "XRD Peak 002 Intensity"; + break; + case Column.XRD_Peak_101_Intensity: + results = "XRD Peak 101 Intensity"; + break; + case Column.XRD_Weekly_AL_Center: + results = "XRD Weekly AL% Center"; + break; + case Column.XRD_Weekly_Back_Barrier_Al_: + results = "Back Barrier Al%"; + break; + case Column.XRD_Weekly_Barrier_Al_: + results = "Barrier Al%"; + break; + case Column.XRD_Weekly_FWHM_002: + results = "XRD Weekly FWHM 002"; + break; + case Column.XRD_Weekly_FWHM_101: + results = "XRD Weekly FWHM 101"; + break; + case Column.XRD_Weekly_FWHM_105: + results = "XRD Weekly FWHM 105"; + break; + case Column.XRD_Weekly_Fringe_thick_0_0_: + results = "XRD Weekly Fringe thick (0,0)"; + break; + case Column.XRD_Weekly_Fringe_thick_48_48_: + results = "XRD Weekly Fringe thick (48,48)"; + break; + case Column.XRD_Weekly_Intensity: + results = "XRD Weekly Intensity"; + break; + case Column.XRD_Weekly_Super_Lattice_Al_: + results = "Super Lattice Al%"; + break; + case Column.XRD_Weekly_Super_Lattice_period: + results = "Super Lattice period"; + break; + case Column.XRD_Weekly_Super_Lattice_tks: + results = "Super Lattice tks"; + break; + case Column.XRR_Thickness_nm_WTAVG: + results = "XRR Thickness (nm) WTAVG"; + break; + case Column.XRR_Thickness_nm_: + results = "XRR Thickness (nm)"; + break; + case Column.Y_Coord: + results = "Y-Coord"; + break; + case Column.YellowBand_Power_mW_: + results = "YellowBand_Power (mW)"; + break; + case Column.YellowBand_V: + results = "YellowBand_V"; + break; + case Column.YellowBand_V_XY: + results = "YellowBand_V_XY"; + break; + case Column.YellowBand_nm: + results = "YellowBand_nm"; + break; + //case Column.pH: results = "pH"; break; + case Column.Ag: + results = "Ag"; + break; + case Column.Al: + results = "Al"; + break; + case Column.As: + results = "As"; + break; + case Column.Au: + results = "Au"; + break; + case Column.B: + results = "B"; + break; + case Column.Ba: + results = "Ba"; + break; + case Column.Ca: + results = "Ca"; + break; + case Column.Ce: + results = "Ce"; + break; + case Column.Co: + results = "Co"; + break; + case Column.Cr: + results = "Cr"; + break; + case Column.Cu: + results = "Cu"; + break; + case Column.Fe: + results = "Fe"; + break; + case Column.Ga: + results = "Ga"; + break; + case Column.Ge: + results = "Ge"; + break; + case Column.Hf: + results = "Hf"; + break; + case Column.K: + results = "K"; + break; + case Column.Li: + results = "Li"; + break; + case Column.Mg: + results = "Mg"; + break; + case Column.Mn: + results = "Mn"; + break; + case Column.Mo: + results = "Mo"; + break; + case Column.Na: + results = "Na"; + break; + case Column.Ni: + results = "Ni"; + break; + case Column.P: + results = "P"; + break; + case Column.Pb: + results = "Pb"; + break; + case Column.Sn: + results = "Sn"; + break; + case Column.Ta: + results = "Ta"; + break; + case Column.Ti: + results = "Ti"; + break; + case Column.W: + results = "W"; + break; + case Column.Y: + results = "Y"; + break; + case Column.Zn: + results = "Zn"; + break; + default: + throw new Exception(); + } + return results; + } + + public static Description.Param GetParam(this Column column) + { + Description.Param results; + switch (column) + { + //case Column._8in_Total_Warp_Verification: results = Description.Param.String; break; + //case Column.AFM_Monthly_Y: results = Description.Param.String; break; + //case Column.AFM_Monthly: results = Description.Param.String; break; + case Column.AFM_Pit_Count: + results = Description.Param.String; + break; + case Column.AFM_Roughness: + results = Description.Param.String; + break; + //case Column.Adder_Bin_1: results = Description.Param.String; break; + //case Column.Adder_Bin_2: results = Description.Param.String; break; + //case Column.Adder_Bin_3: results = Description.Param.String; break; + //case Column.Adder_Bin_4: results = Description.Param.String; break; + //case Column.Adder_Bin_5: results = Description.Param.String; break; + //case Column.Adder_Bin_6: results = Description.Param.String; break; + //case Column.Adder_Bin_9: results = Description.Param.String; break; + case Column.Al_B_B_WTAVG: + results = Description.Param.String; + break; + case Column.Al_B_B_: + results = Description.Param.String; + break; + case Column.Al_Barrier_WTAVG: + results = Description.Param.String; + break; + case Column.Al_Barrier: + results = Description.Param.String; + break; + case Column.Al_SLS_WTAVG: + results = Description.Param.String; + break; + case Column.Al_SLS: + results = Description.Param.String; + break; + case Column.Al_TL1_WTAVG: + results = Description.Param.String; + break; + case Column.Al_TL1: + results = Description.Param.String; + break; + case Column.Al_TL2_WTAVG: + results = Description.Param.String; + break; + //case Column.BV_Resistance: results = Description.Param.String; break; + case Column.BandEdge_V: + results = Description.Param.String; + break; + case Column.BandEdge_V_XY: + results = Description.Param.String; + break; + case Column.BandEdge_nm: + results = Description.Param.String; + break; + case Column.Barrier_Composition_RPM_XY: + results = Description.Param.String; + break; + case Column.Bow_Calibration: + results = Description.Param.String; + break; + case Column.Bow_Range: + results = Description.Param.String; + break; + case Column.Bow: + results = Description.Param.String; + break; + case Column.BowCenter: + results = Description.Param.String; + break; + case Column.BowX: + results = Description.Param.String; + break; + case Column.BowY: + results = Description.Param.String; + break; + case Column.Breakdown_Voltage_Edge: + results = Description.Param.String; + break; + case Column.Breakdown_VoltageMiddle: + results = Description.Param.String; + break; + case Column.Breakdown_Voltage: + results = Description.Param.String; + break; + case Column.CV_C_at_10V: + results = Description.Param.String; + break; + case Column.CV_Nd_Min: + results = Description.Param.String; + break; + //case Column.Candela_Large_LPD_Quarterly: results = Description.Param.String; break; + //case Column.Candela_Medium_LPD_Quarterly: results = Description.Param.String; break; + //case Column.Candela_Small_LPD_Quarterly: results = Description.Param.String; break; + //case Column.Candela_Total_Quarterly: results = Description.Param.String; break; + case Column.Candela_102_83nm: + results = Description.Param.String; + break; + case Column.Candela_1_1um: + results = Description.Param.String; + break; + case Column.Candela_496nm: + results = Description.Param.String; + break; + case Column.Candela_600nm: + results = Description.Param.String; + break; + case Column.Candela_8620_Small: + results = Description.Param.String; + break; + case Column.Candela_Crack_Verification: + results = Description.Param.String; + break; + case Column.Candela_Cracking: + results = Description.Param.String; + break; + case Column.Candela_Cracking_Acceptable: + results = Description.Param.String; + break; + case Column.Candela_Crater: + results = Description.Param.String; + break; + case Column.Candela_Crater_Verification: + results = Description.Param.String; + break; + case Column.Candela_Haze: + results = Description.Param.String; + break; + case Column.Candela_LPD_Large: + results = Description.Param.String; + break; + case Column.Candela_LPD_Medium: + results = Description.Param.String; + break; + case Column.Candela_LPD_Small: + results = Description.Param.String; + break; + case Column.Candela_Large_Verification: + results = Description.Param.String; + break; + case Column.Candela_Medium_Verification: + results = Description.Param.String; + break; + case Column.Candela_Pits: + results = Description.Param.String; + break; + case Column.Candela_Pits_Verification: + results = Description.Param.String; + break; + case Column.Candela_SPE: + results = Description.Param.String; + break; + case Column.Candela_SPE_Verification: + results = Description.Param.String; + break; + case Column.Candela_Slip: + results = Description.Param.String; + break; + case Column.Candela_Small_Verification: + results = Description.Param.String; + break; + case Column.Candela_Spirals: + results = Description.Param.String; + break; + case Column.Candela_Spirals_Verification: + results = Description.Param.String; + break; + case Column.Candela_Total_Defects: + results = Description.Param.String; + break; + case Column.Candela_Total_PSL: + results = Description.Param.String; + break; + case Column.Candela__1_1um: + results = Description.Param.String; + break; + //case Column.Comment: results = Description.Param.String; break; + //case Column.Conductivity: results = Description.Param.String; break; + case Column.Contact_Symmetry: + results = Description.Param.String; + break; + //case Column.Cracking_verification: results = Description.Param.String; break; + //case Column.Crater_verification: results = Description.Param.String; break; + case Column.Date: + results = Description.Param.String; + break; + case Column.Denton_Crystal_Life: + results = Description.Param.String; + break; + case Column.Denton_Current_AVG: + results = Description.Param.String; + break; + case Column.Denton_Current_STDEV: + results = Description.Param.String; + break; + case Column.Denton_Deposition_Power_AVG: + results = Description.Param.String; + break; + case Column.Denton_Deposition_Power_STDEV: + results = Description.Param.String; + break; + case Column.Denton_Deposition_Rate_AVG: + results = Description.Param.String; + break; + case Column.Denton_Deposition_Rate_STDEV: + results = Description.Param.String; + break; + case Column.Denton_Gun_Pocket: + results = Description.Param.String; + break; + case Column.Denton_Pumpdown_Time: + results = Description.Param.String; + break; + case Column.Denton_Voltage_AVG: + results = Description.Param.String; + break; + case Column.Denton_Voltage_STDEV: + results = Description.Param.String; + break; + case Column.Employee: + results = Description.Param.String; + break; + case Column.Epi_Thickness_Mean: + results = Description.Param.String; + break; + case Column.Epi_Thickness_Mean_XY: + results = Description.Param.String; + break; + case Column.Epi_Thickness_Std_Dev_: + results = Description.Param.String; + break; + case Column.FWHM_006_WTAVG: + results = Description.Param.String; + break; + case Column.FWHM_006: + results = Description.Param.String; + break; + case Column.FWHM_105_WTAVG: + results = Description.Param.String; + break; + case Column.FWHM_105: + results = Description.Param.String; + break; + case Column.Hall_Rs: + results = Description.Param.String; + break; + case Column.Hall_Mobility_verif_sample: + results = Description.Param.String; + break; + case Column.Hall_Ns_verif_sample: + results = Description.Param.String; + break; + case Column.Hall_Rs_verif_sample: + results = Description.Param.String; + break; + case Column.Job: + results = Description.Param.String; + break; + case Column.LEI_RS_Average_value: + results = Description.Param.String; + break; + case Column.LEI_RS_Maximum_value: + results = Description.Param.String; + break; + case Column.LEI_RS_Minimum_value: + results = Description.Param.String; + break; + case Column.LEI_RS_STDEV: + results = Description.Param.String; + break; + case Column.LEI_RS_STDEV_: + results = Description.Param.String; + break; + //case Column.Large_Adder_Sum: results = Description.Param.String; break; + case Column.Lot: + results = Description.Param.String; + break; + //case Column.Medium_Adder_Sum: results = Description.Param.String; break; + case Column.Microscope_Center_5x: + results = Description.Param.String; + break; + case Column.Microscope_Center_50x: + results = Description.Param.String; + break; + case Column.Microscope_Middle_5x: + results = Description.Param.String; + break; + case Column.Microscope_Middle_50x: + results = Description.Param.String; + break; + case Column.Microscope_Edge_5x: + results = Description.Param.String; + break; + case Column.Microscope_Edge_50x: + results = Description.Param.String; + break; + case Column.Mobility_Verification: + results = Description.Param.String; + break; + case Column.Mobility: + results = Description.Param.String; + break; + case Column.Ns_Verification: + results = Description.Param.String; + break; + case Column.PL_Edge_Wavelength: + results = Description.Param.String; + break; + case Column.PL_Ratio: + results = Description.Param.String; + break; + case Column.PR_Barrier_Composition: + results = Description.Param.String; + break; + case Column.PR_Peak: + results = Description.Param.String; + break; + case Column.Part: + results = Description.Param.String; + break; + //case Column.Particles_verification: results = Description.Param.String; break; + //case Column.Pits_verification: results = Description.Param.String; break; + //case Column.Pocket: results = Description.Param.String; break; + //case Column.Post_Bin_1: results = Description.Param.String; break; + //case Column.Post_Bin_2: results = Description.Param.String; break; + //case Column.Post_Bin_3: results = Description.Param.String; break; + //case Column.Post_Bin_4: results = Description.Param.String; break; + //case Column.Post_Bin_5: results = Description.Param.String; break; + //case Column.Post_Bin_6: results = Description.Param.String; break; + //case Column.Post_Bin_9: results = Description.Param.String; break; + //case Column.Pre_Bin_1: results = Description.Param.String; break; + //case Column.Pre_Bin_2: results = Description.Param.String; break; + //case Column.Pre_Bin_3: results = Description.Param.String; break; + //case Column.Pre_Bin_4: results = Description.Param.String; break; + //case Column.Pre_Bin_5: results = Description.Param.String; break; + //case Column.Pre_Bin_6: results = Description.Param.String; break; + //case Column.Pre_Bin_9: results = Description.Param.String; break; + case Column.Process: + results = Description.Param.String; + break; + //case Column.RPM_verif_Thickness_1: results = Description.Param.String; break; + //case Column.RPM_verif_Thickness_2: results = Description.Param.String; break; + //case Column.RPM_verif_Thickness_3: results = Description.Param.String; break; + //case Column.RPM_verif_Thickness_Average: results = Description.Param.String; break; + //case Column.RTA_oxide_Thk_Change: results = Description.Param.String; break; + //case Column.RTA_oxide_post_anneal_Thk: results = Description.Param.String; break; + //case Column.RTA_oxide_pre_anneal_Thk: results = Description.Param.String; break; + case Column.Recipe: + results = Description.Param.String; + break; + //case Column.Resistivity_2_ohm_cm: results = Description.Param.String; break; + //case Column.Resistivity_600_ohm_cm: results = Description.Param.String; break; + case Column.Rs_verification: + results = Description.Param.String; + break; + case Column.Rs_verif_100kohm: + results = Description.Param.String; + break; + case Column.Rs_verif_10ohm: + results = Description.Param.String; + break; + case Column.Rs_verif_1kohm: + results = Description.Param.String; + break; + case Column.SID: + results = Description.Param.String; + break; + case Column.SL_Period_WTAVG: + results = Description.Param.String; + break; + case Column.SL_Period: + results = Description.Param.String; + break; + //case Column.SPE_verification: results = Description.Param.String; break; + //case Column.Sample_ID: results = Description.Param.String; break; + case Column.Sheet_Concentration: + results = Description.Param.String; + break; + //case Column.Size: results = Description.Param.String; break; + //case Column.Small_Adder_Sum: results = Description.Param.String; break; + //case Column.Spirals_verification: results = Description.Param.String; break; + case Column.Time: + results = Description.Param.String; + break; + case Column.Tool_ID: + results = Description.Param.String; + break; + //case Column.Total_LPD_Adder: results = Description.Param.String; break; + //case Column.Total_Verification: results = Description.Param.String; break; + case Column.Total_Warp_Calibration: + results = Description.Param.String; + break; + case Column.UV_Broken: + results = Description.Param.String; + break; + case Column.UV_Chipping: + results = Description.Param.String; + break; + case Column.UV_Cracking_0_3mm_: + results = Description.Param.String; + break; + case Column.UV_Cracking_3_7mm_: + results = Description.Param.String; + break; + case Column.UV_Cracking_7mm_: + results = Description.Param.String; + break; + case Column.UV_Crazing: + results = Description.Param.String; + break; + case Column.UV_Crazing_Acceptable: + results = Description.Param.String; + break; + case Column.UV_FULL_Characterization_Wafer: + results = Description.Param.String; + break; + case Column.UV_Haze_count_: + results = Description.Param.String; + break; + case Column.UV_LIGHT_Characterization_Wafer: + results = Description.Param.String; + break; + case Column.UV_Non_rotation: + results = Description.Param.String; + break; + case Column.UV_Other: + results = Description.Param.String; + break; + case Column.UV_Scratch_count_: + results = Description.Param.String; + break; + case Column.UV_Slip_count_: + results = Description.Param.String; + break; + case Column.UV_True_Haze: + results = Description.Param.String; + break; + case Column.UV_True_Haze_Acceptable: + results = Description.Param.String; + break; + case Column.UV_SPE_1mm_count: + results = Description.Param.String; + break; + case Column.UV_SPE_count_: + results = Description.Param.String; + break; + case Column.Verification_Contact_Symmetry: + results = Description.Param.String; + break; + case Column.Vp_Pinch_Off_Voltage: + results = Description.Param.String; + break; + case Column.Wafer_ID: + results = Description.Param.String; + break; + //case Column.Wafer_Pocket: results = Description.Param.String; break; + case Column.Wafer_Region: + results = Description.Param.String; + break; + case Column.Wafer_Scribe: + results = Description.Param.String; + break; + case Column.WaferPocket_Candela: + results = Description.Param.String; + break; + case Column.WaferPocket_Warp: + results = Description.Param.String; + break; + case Column.WaferPosition_CV: + results = Description.Param.String; + break; + case Column.WaferPosition_BV: + results = Description.Param.String; + break; + case Column.WaferPosition_Hall: + results = Description.Param.String; + break; + case Column.WaferPosition_PR: + results = Description.Param.String; + break; + case Column.Warp: + results = Description.Param.String; + break; + case Column.X_Coord: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Peak_002: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Peak_101: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Position: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Position_Si_1: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Position_Si_2: + results = Description.Param.String; + break; + case Column.XRD_2_Theta_Position_Si_3: + results = Description.Param.String; + break; + case Column.XRD_Peak_002_Intensity: + results = Description.Param.String; + break; + case Column.XRD_Peak_101_Intensity: + results = Description.Param.String; + break; + case Column.XRD_Weekly_AL_Center: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Back_Barrier_Al_: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Barrier_Al_: + results = Description.Param.String; + break; + case Column.XRD_Weekly_FWHM_002: + results = Description.Param.String; + break; + case Column.XRD_Weekly_FWHM_101: + results = Description.Param.String; + break; + case Column.XRD_Weekly_FWHM_105: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Fringe_thick_0_0_: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Fringe_thick_48_48_: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Intensity: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Super_Lattice_Al_: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Super_Lattice_period: + results = Description.Param.String; + break; + case Column.XRD_Weekly_Super_Lattice_tks: + results = Description.Param.String; + break; + case Column.XRR_Thickness_nm_WTAVG: + results = Description.Param.String; + break; + case Column.XRR_Thickness_nm_: + results = Description.Param.String; + break; + case Column.Y_Coord: + results = Description.Param.String; + break; + case Column.YellowBand_Power_mW_: + results = Description.Param.String; + break; + case Column.YellowBand_V: + results = Description.Param.String; + break; + case Column.YellowBand_V_XY: + results = Description.Param.String; + break; + case Column.YellowBand_nm: + results = Description.Param.String; + break; + //case Column.pH: results = Description.Param.String; break; + case Column.Ag: + results = Description.Param.String; + break; + case Column.Al: + results = Description.Param.String; + break; + case Column.As: + results = Description.Param.String; + break; + case Column.Au: + results = Description.Param.String; + break; + case Column.B: + results = Description.Param.String; + break; + case Column.Ba: + results = Description.Param.String; + break; + case Column.Ca: + results = Description.Param.String; + break; + case Column.Ce: + results = Description.Param.String; + break; + case Column.Co: + results = Description.Param.String; + break; + case Column.Cr: + results = Description.Param.String; + break; + case Column.Cu: + results = Description.Param.String; + break; + case Column.Fe: + results = Description.Param.String; + break; + case Column.Ga: + results = Description.Param.String; + break; + case Column.Ge: + results = Description.Param.String; + break; + case Column.Hf: + results = Description.Param.String; + break; + case Column.K: + results = Description.Param.String; + break; + case Column.Li: + results = Description.Param.String; + break; + case Column.Mg: + results = Description.Param.String; + break; + case Column.Mn: + results = Description.Param.String; + break; + case Column.Mo: + results = Description.Param.String; + break; + case Column.Na: + results = Description.Param.String; + break; + case Column.Ni: + results = Description.Param.String; + break; + case Column.P: + results = Description.Param.String; + break; + case Column.Pb: + results = Description.Param.String; + break; + case Column.Sn: + results = Description.Param.String; + break; + case Column.Ta: + results = Description.Param.String; + break; + case Column.Ti: + results = Description.Param.String; + break; + case Column.W: + results = Description.Param.String; + break; + case Column.Y: + results = Description.Param.String; + break; + case Column.Zn: + results = Description.Param.String; + break; + default: + throw new Exception(); + } + return results; + } + + } + + public enum Column + { + //_8in_Total_Warp_Verification, + //AFM_Monthly_Y, + //AFM_Monthly, + AFM_Pit_Count, + AFM_Roughness, + //Adder_Bin_1, + //Adder_Bin_2, + //Adder_Bin_3, + //Adder_Bin_4, + //Adder_Bin_5, + //Adder_Bin_6, + //Adder_Bin_9, + Al_B_B_WTAVG, + Al_B_B_, + Al_Barrier_WTAVG, + Al_Barrier, + Al_SLS_WTAVG, + Al_SLS, + Al_TL1_WTAVG, + Al_TL1, + Al_TL2_WTAVG, + //BV_Resistance, + BandEdge_V, + BandEdge_V_XY, + BandEdge_nm, + Barrier_Composition_RPM_XY, + Bow_Calibration, + Bow_Range, + Bow, + BowCenter, + BowX, + BowY, + Breakdown_Voltage_Edge, + Breakdown_VoltageMiddle, + Breakdown_Voltage, + CV_C_at_10V, + CV_Nd_Min, + //Candela_Large_LPD_Quarterly, + //Candela_Medium_LPD_Quarterly, + //Candela_Small_LPD_Quarterly, + //Candela_Total_Quarterly, + Candela_102_83nm, + Candela_1_1um, + Candela_496nm, + Candela_600nm, + Candela_8620_Small, + Candela_Crack_Verification, + Candela_Cracking, + Candela_Cracking_Acceptable, + Candela_Crater, + Candela_Crater_Verification, + Candela_Haze, + Candela_LPD_Large, + Candela_LPD_Medium, + Candela_LPD_Small, + Candela_Large_Verification, + Candela_Medium_Verification, + Candela_Pits, + Candela_Pits_Verification, + Candela_SPE, + Candela_SPE_Verification, + Candela_Slip, + Candela_Small_Verification, + Candela_Spirals, + Candela_Spirals_Verification, + Candela_Total_Defects, + Candela_Total_PSL, + Candela__1_1um, + //Comment, + //Conductivity, + Contact_Symmetry, + //Cracking_verification, + //Crater_verification, + Date, + Denton_Crystal_Life, + Denton_Current_AVG, + Denton_Current_STDEV, + Denton_Deposition_Power_AVG, + Denton_Deposition_Power_STDEV, + Denton_Deposition_Rate_AVG, + Denton_Deposition_Rate_STDEV, + Denton_Gun_Pocket, + Denton_Pumpdown_Time, + Denton_Voltage_AVG, + Denton_Voltage_STDEV, + Employee, + Epi_Thickness_Mean, + Epi_Thickness_Mean_XY, + Epi_Thickness_Std_Dev_, + FWHM_006_WTAVG, + FWHM_006, + FWHM_105_WTAVG, + FWHM_105, + Hall_Rs, + Hall_Mobility_verif_sample, + Hall_Ns_verif_sample, + Hall_Rs_verif_sample, + Job, + LEI_RS_Average_value, + LEI_RS_Maximum_value, + LEI_RS_Minimum_value, + LEI_RS_STDEV, + LEI_RS_STDEV_, + //Large_Adder_Sum, + Lot, + //Medium_Adder_Sum, + Microscope_Center_50x, + Microscope_Center_5x, + Microscope_Edge_50x, + Microscope_Edge_5x, + Microscope_Middle_50x, + Microscope_Middle_5x, + Mobility_Verification, + Mobility, + Ns_Verification, + PL_Edge_Wavelength, + PL_Ratio, + PR_Barrier_Composition, + PR_Peak, + Part, + //Particles_verification, + //Pits_verification, + //Pocket, + //Post_Bin_1, + //Post_Bin_2, + //Post_Bin_3, + //Post_Bin_4, + //Post_Bin_5, + //Post_Bin_6, + //Post_Bin_9, + //Pre_Bin_1, + //Pre_Bin_2, + //Pre_Bin_3, + //Pre_Bin_4, + //Pre_Bin_5, + //Pre_Bin_6, + //Pre_Bin_9, + Process, + //RPM_verif_Thickness_1, + //RPM_verif_Thickness_2, + //RPM_verif_Thickness_3, + //RPM_verif_Thickness_Average, + //RTA_oxide_Thk_Change, + //RTA_oxide_post_anneal_Thk, + //RTA_oxide_pre_anneal_Thk, + Recipe, + //Resistivity_2_ohm_cm, + //Resistivity_600_ohm_cm, + Rs_verification, + Rs_verif_100kohm, + Rs_verif_10ohm, + Rs_verif_1kohm, + SID, + SL_Period_WTAVG, + SL_Period, + //SPE_verification, + //Sample_ID, + Sheet_Concentration, + //Size, + //Small_Adder_Sum, + //Spirals_verification, + Time, + Tool_ID, + //Total_LPD_Adder, + //Total_Verification, + Total_Warp_Calibration, + UV_Broken, + UV_Chipping, + UV_Cracking_0_3mm_, + UV_Cracking_3_7mm_, + UV_Cracking_7mm_, + UV_Crazing, + UV_Crazing_Acceptable, + UV_FULL_Characterization_Wafer, + UV_Haze_count_, + UV_LIGHT_Characterization_Wafer, + UV_Non_rotation, + UV_Other, + UV_Scratch_count_, + UV_Slip_count_, + UV_True_Haze, + UV_True_Haze_Acceptable, + UV_SPE_1mm_count, + UV_SPE_count_, + Verification_Contact_Symmetry, + Vp_Pinch_Off_Voltage, + Wafer_ID, + //Wafer_Pocket, + Wafer_Region, + Wafer_Scribe, + WaferPocket_Candela, + WaferPocket_Warp, + WaferPosition_CV, + WaferPosition_BV, + WaferPosition_Hall, + WaferPosition_PR, + Warp, + X_Coord, + XRD_2_Theta_Peak_002, + XRD_2_Theta_Peak_101, + XRD_2_Theta_Position, + XRD_2_Theta_Position_Si_1, + XRD_2_Theta_Position_Si_2, + XRD_2_Theta_Position_Si_3, + XRD_Peak_002_Intensity, + XRD_Peak_101_Intensity, + XRD_Weekly_AL_Center, + XRD_Weekly_Back_Barrier_Al_, + XRD_Weekly_Barrier_Al_, + XRD_Weekly_FWHM_002, + XRD_Weekly_FWHM_101, + XRD_Weekly_FWHM_105, + XRD_Weekly_Fringe_thick_0_0_, + XRD_Weekly_Fringe_thick_48_48_, + XRD_Weekly_Intensity, + XRD_Weekly_Super_Lattice_Al_, + XRD_Weekly_Super_Lattice_period, + XRD_Weekly_Super_Lattice_tks, + XRR_Thickness_nm_, + XRR_Thickness_nm_WTAVG, + Y_Coord, + YellowBand_Power_mW_, + YellowBand_V, + YellowBand_V_XY, + YellowBand_nm, + //pH, + Ag, + Al, + As, + Au, + B, + Ba, + Ca, + Ce, + Co, + Cr, + Cu, + Fe, + Ga, + Ge, + Hf, + K, + Li, + Mg, + Mn, + Mo, + Na, + Ni, + P, + Pb, + Sn, + Ta, + Ti, + W, + Y, + Zn + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ConfigDataBase.cs b/Adaptation/Shared/Metrology/ConfigDataBase.cs new file mode 100644 index 0000000..d89d907 --- /dev/null +++ b/Adaptation/Shared/Metrology/ConfigDataBase.cs @@ -0,0 +1,419 @@ +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Adaptation.Shared.Metrology +{ + + public class ConfigDataBase + { + + public bool UseCyclicalForDescription { get; protected set; } + public Dictionary CellNames { get; protected set; } + public Dictionary MesEntities { get; protected set; } + public IProcessDataDescription ProcessDataDescription { get; protected set; } + + public bool IsEvent { get; private set; } + public bool EafHosted { get; private set; } + public string CellName { get; private set; } + public bool IsSourceTimer { get; private set; } + public EquipmentType EquipmentType => _EquipmentType; + public string EquipmentElementName { get; private set; } + public bool IsDatabaseExportToIPDSF { get; private set; } + public EquipmentType? EquipmentConnection => _EquipmentConnection; + public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } + + protected readonly EventName _EventName; + protected readonly EquipmentType _EquipmentType; + protected readonly EquipmentType? _EquipmentConnection; + protected readonly Dictionary _Reactors; + + public ConfigDataBase(string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, bool isEAFHosted) + { + CellName = cellName; + EafHosted = isEAFHosted; + EquipmentType equipmentTypeValue; + _Reactors = new Dictionary(); + CellNames = new Dictionary(); + MesEntities = new Dictionary(); + EquipmentElementName = cellInstanceConnectionName; + FileConnectorConfiguration = fileConnectorConfiguration; + string[] segments = parameterizedModelObjectDefinitionType.Split('.'); + IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt")); + string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty); + IsDatabaseExportToIPDSF = (fileConnectorConfiguration.SourceFileLocation.Contains("DatabaseExport")); + if (!Enum.TryParse(segments[segments.Length - 1], out EventName eventNameValue)) + throw new Exception(cellInstanceConnectionName); + if (!Enum.TryParse(cellInstanceConnectionNameBase, out equipmentTypeValue)) + _EquipmentConnection = null; + else + _EquipmentConnection = equipmentTypeValue; + string suffix; + switch (eventNameValue) + { + case EventName.FileRead: + suffix = string.Empty; + break; + case EventName.FileReadDaily: + suffix = "_Daily"; + break; + case EventName.FileReadWeekly: + suffix = "_Weekly"; + break; + case EventName.FileReadMonthly: + suffix = "_Monthly"; + break; + case EventName.FileReadVerification: + suffix = "_Verification"; + break; + default: + throw new Exception(cellInstanceConnectionName); + } + string parameterizedModelObjectDefinitionTypeAppended = string.Concat(segments[0], suffix); + IsEvent = cellInstanceConnectionNameBase != parameterizedModelObjectDefinitionTypeAppended; + _EventName = eventNameValue; + if (!Enum.TryParse(parameterizedModelObjectDefinitionTypeAppended, out equipmentTypeValue)) + throw new Exception(cellInstanceConnectionName); + _EquipmentType = equipmentTypeValue; + if (!isEAFHosted && equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended) + throw new Exception(cellInstanceConnectionName); + } + + public string GetEventName() + { + string result = _EventName.ToString(); + return result; + } + + public EventName GetEventNameValue() + { + EventName result = _EventName; + return result; + } + + public string GetEquipmentType() + { + string result; + if (_EquipmentConnection is null) + result = _EquipmentType.ToString(); + else + result = _EquipmentConnection.Value.ToString(); + return result; + } + + public string GetEventDescription() + { + string result = ProcessDataDescription.GetEventDescription(); + return result; + } + + public IProcessDataDescription GetDefault(ILogic logic) + { + IProcessDataDescription result = ProcessDataDescription.GetDefault(logic, this); + return result; + } + + public IProcessDataDescription GetDisplayNames(ILogic logic) + { + IProcessDataDescription result = ProcessDataDescription.GetDisplayNames(logic, this); + return result; + } + + public List GetDetailNames(ILogic logic) + { + List results = ProcessDataDescription.GetDetailNames(logic, this); + return results; + } + + public List GetHeaderNames(ILogic logic) + { + List results = ProcessDataDescription.GetHeaderNames(logic, this); + return results; + } + + public List GetNames(ILogic logic) + { + List results = ProcessDataDescription.GetNames(logic, this); + return results; + } + + public List GetPairedParameterNames(ILogic logic) + { + List results = ProcessDataDescription.GetPairedParameterNames(logic, this); + return results; + } + + public List GetParameterNames(ILogic logic) + { + List results = ProcessDataDescription.GetParameterNames(logic, this); + return results; + } + + public List GetDescription(ILogic logic, List tests, IProcessData iProcessData) + { + List results = ProcessDataDescription.GetDescription(logic, this, tests, iProcessData); + return results; + } + + public string GetCurrentReactor(ILogic logic) + { + string result = string.Empty; + foreach (KeyValuePair keyValuePair in _Reactors) + { + foreach (string filePrefix in keyValuePair.Value.Split('|')) + { + if (logic.Logistics.MID.StartsWith(filePrefix) || (_EventName != EventName.FileRead && MesEntities.ContainsKey(logic.Logistics.JobID) && keyValuePair.Value == MesEntities[logic.Logistics.JobID])) + { + result = keyValuePair.Key; + break; + } + } + } + if (string.IsNullOrEmpty(result) && _Reactors.Count == 1) + result = _Reactors.ElementAt(0).Key; + return result; + } + + protected JsonElement GetDefaultJsonElement(ILogic logic) + { + JsonElement result; + IProcessDataDescription processDataDescription = ProcessDataDescription.GetDefault(logic, this); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + object @object = JsonSerializer.Deserialize(json); + result = (JsonElement)@object; + return result; + } + + public Dictionary>> GetParameterInfo(ILogic logic, bool allowNull) + { + Dictionary>> results = new Dictionary>>(); + string description; + Enum param; + Tuple tuple; + JsonElement defaultJsonElement = GetDefaultJsonElement(logic); + Dictionary keyValuePairs = GetDisplayNamesJsonElement(logic); + foreach (JsonProperty jsonProperty in defaultJsonElement.EnumerateObject()) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) + throw new Exception(); + if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) + { + description = string.Empty; + param = Description.Param.StructuredType; + //jValue = jObject.Value("Item1"); + throw new NotImplementedException("Item1"); + } + else + { + switch (jsonProperty.Value.ValueKind) + { + case JsonValueKind.String: + param = Description.Param.String; + break; + case JsonValueKind.Number: + param = Description.Param.Double; + break; + case JsonValueKind.True: + case JsonValueKind.False: + param = Description.Param.Boolean; + break; + case JsonValueKind.Null: + param = Description.Param.String; + break; + default: + param = Description.Param.StructuredType; + break; + } + } + if (!keyValuePairs.ContainsKey(jsonProperty.Name)) + description = string.Empty; + else + description = keyValuePairs[jsonProperty.Name]; + tuple = new Tuple(param, jsonProperty.Name, description, jsonProperty.Value.ToString()); + if (!results.ContainsKey(jsonProperty.Name)) + results.Add(jsonProperty.Name, new List>()); + results[jsonProperty.Name].Add(tuple); + } + return results; + } + + protected void WriteExportAliases(ILogic logic, string cellName, string equipmentElementName) + { + int i = 0; + Enum param; + object value; + Enum[] @params; + string description; + StringBuilder stringBuilder = new StringBuilder(); + string shareRoot = @"\\messv02ecc1.ec.local\EC_EDA"; + string shareDirectory = string.Concat(shareRoot, @"\Staging\Pdsf\", cellName, @"\ExportAliases\", equipmentElementName); + Dictionary>> keyValuePairs; + if (!(logic is null)) + keyValuePairs = GetParameterInfo(logic, allowNull: false); + else + keyValuePairs = new Dictionary>>(); + stringBuilder.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\""); + if (!Directory.Exists(shareRoot)) + return; + if (!Directory.Exists(shareDirectory)) + Directory.CreateDirectory(shareDirectory); + string shareFile = string.Concat(shareDirectory, @"\", DateTime.Now.Ticks, ".csv"); + foreach (KeyValuePair>> keyValuePair in keyValuePairs) + { + i += 1; + @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); + if (@params.Length != 1) + throw new Exception(); + if (keyValuePair.Value[0].Item2 != keyValuePair.Key) + throw new Exception(); + param = @params[0]; + if (!(param is Description.Param.String)) + stringBuilder.AppendLine($"\"{keyValuePair.Key}\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{keyValuePair.Key}\";\"\";\"{cellName}/{EquipmentElementName}/{_EventName}\";\"\";\"True\""); + else + { + description = keyValuePair.Value[0].Item3.Split('|')[0]; + if (string.IsNullOrEmpty(description)) + continue; + value = keyValuePair.Value[0].Item4; + stringBuilder.AppendLine($"\"'{description}'\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{value}\";\"\";\"{cellName}/{EquipmentElementName}/{_EventName}\";\"\";\"True\""); + } + } + if (keyValuePairs.Any()) + File.WriteAllText(shareFile, stringBuilder.ToString()); + } + + public Dictionary GetDisplayNamesJsonElement(ILogic logic) + { + Dictionary results = new Dictionary(); + IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + { + if (!results.ContainsKey(jsonProperty.Name)) + results.Add(jsonProperty.Name, string.Empty); + if (jsonProperty.Value is JsonElement jsonPropertyValue) + results[jsonProperty.Name] = jsonPropertyValue.ToString(); + } + return results; + } + + public List GetIgnoreParameterNames(ILogic logic, Test test, bool includePairedParameterNames) + { + List results = ProcessDataDescription.GetIgnoreParameterNames(logic, this, test); + if (includePairedParameterNames) + { + string value; + List pairedParameterNames = ProcessDataDescription.GetPairedParameterNames(logic, this); + IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) + throw new Exception(); + value = jsonProperty.Value.ToString(); + if (!results.Contains(jsonProperty.Name) && pairedParameterNames.Contains(jsonProperty.Name) && (string.IsNullOrEmpty(value) || value[0] == '|')) + results.Add(jsonProperty.Name); + } + } + return results; + } + + public List GetProcessDataDescriptions(JsonElement jsonElement) + { + List results; + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; + results = JsonSerializer.Deserialize>(jsonElement.ToString(), jsonSerializerOptions); + return results; + } + + public Dictionary> GetKeyValuePairs(List processDataDescriptions) + { + Dictionary> results = new Dictionary>(); + Test testKey; + for (int i = 0; i < processDataDescriptions.Count; i++) + { + testKey = (Test)processDataDescriptions[i].Test; + if (!results.ContainsKey(testKey)) + results.Add(testKey, new List()); + results[testKey].Add(processDataDescriptions[i]); + } + return results; + } + + public Dictionary> GetKeyValuePairs(JsonElement jsonElement, List processDataDescriptions, Test test) + { + Dictionary> results = new Dictionary>(); + Test testKey; + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); + if (processDataDescriptions.Count != jsonElements.Length) + throw new Exception(); + for (int i = 0; i < processDataDescriptions.Count; i++) + { + testKey = (Test)processDataDescriptions[i].Test; + if (testKey != test) + continue; + foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject()) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) + throw new Exception(); + if (!results.ContainsKey(jsonProperty.Name)) + results.Add(jsonProperty.Name, new List()); + results[jsonProperty.Name].Add(jsonProperty.Value.ToString()); + } + } + return results; + } + + protected void VerifyProcessDataDescription(ILogic logic) + { + string description; + bool allowNull = false; + JsonElement defaultJsonElement = GetDefaultJsonElement(logic); + Dictionary keyValuePairs = GetDisplayNamesJsonElement(logic); + JsonProperty[] jsonProperties = defaultJsonElement.EnumerateObject().ToArray(); + foreach (JsonProperty jsonProperty in jsonProperties) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) + throw new Exception(); + if (!(jsonProperty.Value.ValueKind is JsonValueKind.String) || !keyValuePairs.ContainsKey(jsonProperty.Name)) + description = string.Empty; + else + description = keyValuePairs[jsonProperty.Name].Split('|')[0]; + } + } + + public List GetIProcessDataDescriptions(JsonElement jsonElement) + { + List results = new List(); + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + object @object; + Type type = ProcessDataDescription.GetType(); + JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); + JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; + for (int i = 0; i < jsonElements.Length; i++) + { + @object = JsonSerializer.Deserialize(jsonElements[i].ToString(), type, jsonSerializerOptions); + if (!(@object is IProcessDataDescription processDataDescription)) + continue; + results.Add(processDataDescription); + } + return results; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/EventName.cs b/Adaptation/Shared/Metrology/EventName.cs new file mode 100644 index 0000000..0a1cf0d --- /dev/null +++ b/Adaptation/Shared/Metrology/EventName.cs @@ -0,0 +1,13 @@ +namespace Adaptation.Shared.Metrology +{ + + public enum EventName + { + FileRead, + FileReadDaily, + FileReadMonthly, + FileReadVerification, + FileReadWeekly + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ILogic.cs b/Adaptation/Shared/Metrology/ILogic.cs new file mode 100644 index 0000000..01176cf --- /dev/null +++ b/Adaptation/Shared/Metrology/ILogic.cs @@ -0,0 +1,45 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology +{ + + public interface ILogic + { + + ILogic ShallowCopy(); + Logistics Logistics { get; } + + void ConfigurationRestore(); + string GetConfigurationErrorTargetFileLocation(); + string GetConfigurationSourceFileLocation(); + string GetConfigurationTarget2FileLocation(); + string GetConfigurationTargetFileLocation(); + string GetConfigurationTargetFileName(); + Tuple> GetExtractResult(string reportFullPath, string eventName); + object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile); + string GetReportFullPath(Dictionary keyValuePairs); + string GetTarget2FileLocation(); + void Move(string reportFullPath, Tuple> extractResults, Exception exception = null); + Tuple> ReExtract(string searchDirectory, string sourceFileFilter); + void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums); + ConfigDataBase ReflectionCreateSelfDescriptionV2(string json); + string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); + string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true); + string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); + string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); + void SetFileParameter(string key, string value); + void SetFileParameterLotID(string value, bool includeLogisticsSequence = false); + void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true); + void SetFileParameterSystemDateTimeToLogisticsSequence(); + void SetPlaceHolder(string reportFullPath, string key, string value); + void SetTarget2FileLocation(string value); + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs b/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs new file mode 100644 index 0000000..2214dc4 --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08DDUPSFS6420 + { + + public enum Test + { + Tencor = Metrology.Test.Tencor + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs b/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs new file mode 100644 index 0000000..751e9a4 --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08DDUPSP1TBI + { + + public enum Test + { + SP1 = Metrology.Test.SP1 + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08RESIHGCV.cs b/Adaptation/Shared/Metrology/MET08RESIHGCV.cs new file mode 100644 index 0000000..36d411f --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08RESIHGCV.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08RESIHGCV + { + + public enum Test + { + HgCV = Metrology.Test.HgCV + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs b/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs new file mode 100644 index 0000000..2628764 --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08RESIMAPCDE + { + + public enum Test + { + CDE = Metrology.Test.CDE + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs b/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs new file mode 100644 index 0000000..07aa62d --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08THFTIRQS408M + { + + public enum Test + { + BioRadQS408M = Metrology.Test.BioRadQS408M + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs b/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs new file mode 100644 index 0000000..4e4ce83 --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs @@ -0,0 +1,14 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08THFTIRSTRATUS + { + + public enum Test + { + BioRadStratus = Metrology.Test.BioRadStratus + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs b/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs new file mode 100644 index 0000000..15dc076 --- /dev/null +++ b/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs @@ -0,0 +1,23 @@ +namespace Adaptation.Shared.Metrology +{ + + public class MET08XRDXPERTPROMRDXL + { + + public enum Test + { + XRDXY = Metrology.Test.XRDXY, + XRDWeightedAverage = Metrology.Test.XRDWeightedAverage, + MonthlyXRD = Metrology.Test.MonthlyXRD, + WeeklyXRD = Metrology.Test.WeeklyXRD, + WeeklyXRDAIcomp = Metrology.Test.WeeklyXRDAIcomp, + WeeklyXRDFWHM002 = Metrology.Test.WeeklyXRDFWHM002, + WeeklyXRDFWHM105 = Metrology.Test.WeeklyXRDFWHM105, + WeeklyXRDSLStks = Metrology.Test.WeeklyXRDSLStks, + WeeklyXRDXRR = Metrology.Test.WeeklyXRDXRR, + JVXRD = Metrology.Test.JVXRD + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/OISiViewer.cs b/Adaptation/Shared/Metrology/OISiViewer.cs new file mode 100644 index 0000000..d29b992 --- /dev/null +++ b/Adaptation/Shared/Metrology/OISiViewer.cs @@ -0,0 +1,36 @@ +using System; + +namespace Adaptation.Shared.Metrology +{ + + internal class OISiViewer + { + + private static System.Net.WebClient _WebClient; + + internal static string WebClientDownloadString(string baseAddress, ConfigDataBase configDataBase, string reportFullPath, bool isErrorFile, string target) + { + string result = string.Empty; + if (System.Diagnostics.Debugger.IsAttached) + result = DateTime.Now.ToString(); + else + { + if (string.IsNullOrEmpty(baseAddress) || !baseAddress.Contains(":") || !baseAddress.Contains(".")) + throw new Exception("Invalid URL"); + try + { + if (_WebClient is null) + _WebClient = new System.Net.WebClient(); + string address = string.Concat(baseAddress, "/Home/ExtractMove/?equipment_connection=", configDataBase.GetEquipmentType(), "&is_error_file=", isErrorFile); + _WebClient.OpenRead(address); + result = _WebClient.ResponseHeaders["Date"]; + _WebClient.CancelAsync(); + } + catch (Exception) { } + } + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs b/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs new file mode 100644 index 0000000..1a7dc26 --- /dev/null +++ b/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology +{ + + public class Duplicator + { + + public class Description : IProcessDataDescription + { + + public int Test { get; set; } + public int Count { get; set; } + public int Index { get; set; } + // + public string EventName { get; set; } + public string NullData { get; set; } + public string JobID { get; set; } + public string Sequence { get; set; } + public string MesEntity { get; set; } + public string ReportFullPath { get; set; } + public string ProcessJobID { get; set; } + public string MID { get; set; } + public string Date { get; set; } //2021-02-22 + + public string GetEventDescription() { return "File Has been read and parsed"; } + + public List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetDetailNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test) + { + List results = new List(); + return results; + } + + public List GetNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + results.Add(jsonProperty.Name); + return results; + } + + public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description(); + return result; + } + + public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description + { + Test = -1, + Count = 0, + Index = -1, + // + EventName = configDataBase.GetEventName(), + NullData = string.Empty, + JobID = logic.Logistics.JobID, + Sequence = logic.Logistics.Sequence.ToString(), + MesEntity = logic.Logistics.MesEntity, + ReportFullPath = logic.Logistics.ReportFullPath, + ProcessJobID = logic.Logistics.ProcessJobID, + MID = logic.Logistics.MID, + Date = logic.Logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss"), + }; + return result; + } + + public List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData) + { + List results = new List(); + return results; + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs b/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs new file mode 100644 index 0000000..478b208 --- /dev/null +++ b/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs @@ -0,0 +1,527 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology +{ + + public class ProcessDataStandardFormat + { + + public const string RecordStart = "RECORD_START"; + + public enum SearchFor + { + EquipmentIntegration = 1, + BusinessIntegration = 2, + SystemExport = 3, + Archive = 4 + } + + public static string GetPDSFText(ILogic logic, string eventName, string equipmentType, JsonElement jsonElement, string logisticsText) + { + string result; + if (jsonElement.ValueKind != JsonValueKind.Array) + result = string.Empty; + else + { + int columns = 0; + List lines; + string endOffset = "E#######T"; + string dataOffset = "D#######T"; + string headerOffset = "H#######T"; + string format = "MM/dd/yyyy HH:mm:ss"; + StringBuilder stringBuilder = new StringBuilder(); + lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList(); + stringBuilder.Append("\"Time\"").Append('\t'); + stringBuilder.Append("\"A_LOGISTICS\"").Append('\t'); + stringBuilder.Append("\"B_LOGISTICS\"").Append('\t'); + JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); + for (int i = 0; i < jsonElements.Length;) + { + foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject()) + { + columns += 1; + stringBuilder.Append("\"").Append(jsonProperty.Name).Append("\"").Append('\t'); + } + break; + } + stringBuilder.Remove(stringBuilder.Length - 1, 1); + lines.Add(stringBuilder.ToString()); + for (int i = 0; i < jsonElements.Length; i++) + { + stringBuilder.Clear(); + stringBuilder.Append("0.1").Append('\t'); + stringBuilder.Append("1").Append('\t'); + stringBuilder.Append("2").Append('\t'); + foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject()) + stringBuilder.Append(jsonProperty.Value).Append('\t'); + stringBuilder.Remove(stringBuilder.Length - 1, 1); + lines.Add(stringBuilder.ToString()); + } + lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0'))); + lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0'))); + lines.Add("DELIMITER ;"); + lines.Add(string.Concat("START_TIME_FORMAT ", format)); + lines.Add(string.Concat("START_TIME ", logic.Logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44 + lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS")); + lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS")); + if (!string.IsNullOrEmpty(logisticsText)) + lines.Add(logisticsText); + else + { + lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", eventName, ";A_INFO2=", equipmentType, ";A_JOBID=", logic.Logistics.JobID, ";A_MES_ENTITY=", logic.Logistics.MesEntity, ";A_MID=", logic.Logistics.MID, ";A_NULL_DATA=", logic.Logistics.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logic.Logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logic.Logistics.Sequence, ";A_WAFER_ID=;")); + lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", eventName, ";B_INFO2=", equipmentType, ";B_JOBID=", logic.Logistics.JobID, ";B_MES_ENTITY=", logic.Logistics.MesEntity, ";B_MID=", logic.Logistics.MID, ";B_NULL_DATA=", logic.Logistics.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logic.Logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logic.Logistics.Sequence, ";B_WAFER_ID=;")); + lines.Add("END_HEADER"); + } + stringBuilder.Clear(); + foreach (string line in lines) + stringBuilder.AppendLine(line); + result = stringBuilder.ToString(); + result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')). + Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')). + Replace(endOffset, result.Length.ToString().PadLeft(9, '0')); + } + return result; + } + + public static Tuple GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null) + { + string segment; + List body = new List(); + StringBuilder logistics = new StringBuilder(); + if (lines is null) + lines = File.ReadAllLines(reportFullPath); + string[] segments; + if (lines.Length < 7) + segments = new string[] { }; + else + segments = lines[6].Trim().Split('\t'); + List columns = new List(); + for (int c = 0; c < segments.Length; c++) + { + segment = segments[c].Substring(1, segments[c].Length - 2); + if (!columns.Contains(segment)) + columns.Add(segment); + else + { + for (short i = 1; i < short.MaxValue; i++) + { + segment = string.Concat(segment, "_", i); + if (!columns.Contains(segment)) + { + columns.Add(segment); + break; + } + } + } + } + bool lookForLogistics = false; + for (int r = 7; r < lines.Count(); r++) + { + if (lines[r].StartsWith("NUM_DATA_ROWS")) + lookForLogistics = true; + if (!lookForLogistics) + { + body.Add(lines[r]); + continue; + } + if (lines[r].StartsWith("LOGISTICS_1")) + { + for (int i = r; i < lines.Count(); i++) + { + if (lines[r].StartsWith("END_HEADER")) + break; + logistics.AppendLine(lines[i]); + } + break; + } + } + return new Tuple(logistics.ToString(), columns.ToArray(), body.ToArray()); + } + + public static JsonElement GetArray(Tuple pdsf, bool lookForNumbers = false) + { + JsonElement result; + string logistics = pdsf.Item1; + string[] columns = pdsf.Item2; + string[] bodyLines = pdsf.Item3; + if (!bodyLines.Any() || !bodyLines[0].Contains('\t')) + result = JsonSerializer.Deserialize("[]"); + else + { + string value; + string[] segments; + StringBuilder stringBuilder = new StringBuilder(); + foreach (string bodyLine in bodyLines) + { + stringBuilder.Append('{'); + segments = bodyLine.Trim().Split('\t'); + if (!lookForNumbers) + { + for (int c = 1; c < segments.Length; c++) + { + value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\"); + stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\","); + } + } + else + { + for (int c = 1; c < segments.Length; c++) + { + value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\"); + if (string.IsNullOrEmpty(value)) + stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,"); + else if (value.All(char.IsDigit)) + stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(","); + else + stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\","); + } + } + stringBuilder.Remove(stringBuilder.Length - 1, 1); + stringBuilder.AppendLine("},"); + } + stringBuilder.Remove(stringBuilder.Length - 3, 3); + result = JsonSerializer.Deserialize(string.Concat("[", stringBuilder, "]")); + } + return result; + } + + public static Dictionary> GetDictionary(Tuple pdsf) + { + Dictionary> results = new Dictionary>(); + string[] segments; + string[] columns = pdsf.Item2; + string[] bodyLines = pdsf.Item3; + foreach (string column in columns) + results.Add(column, new List()); + foreach (string bodyLine in bodyLines) + { + segments = bodyLine.Split('\t'); + for (int c = 1; c < segments.Length; c++) + { + if (c >= columns.Length) + continue; + results[columns[c]].Add(segments[c]); + } + } + return results; + } + + public static Tuple>>> GetTestDictionary(Tuple pdsf) + { + Dictionary>> results = new Dictionary>>(); + string testColumn = Description.RowColumn.Test.ToString(); + Dictionary> keyValuePairs = GetDictionary(pdsf); + if (!keyValuePairs.ContainsKey(testColumn)) + throw new Exception(); + int min; + int max; + Test testKey; + List vs; + string columnKey; + Dictionary> tests = new Dictionary>(); + for (int i = 0; i < keyValuePairs[testColumn].Count; i++) + { + if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test)) + { + if (!results.ContainsKey(test)) + { + tests.Add(test, new List()); + results.Add(test, new Dictionary>()); + } + tests[test].Add(i); + } + } + foreach (KeyValuePair> testKeyValuePair in tests) + { + testKey = testKeyValuePair.Key; + min = testKeyValuePair.Value.Min(); + max = testKeyValuePair.Value.Max() + 1; + foreach (KeyValuePair> keyValuePair in keyValuePairs) + results[testKey].Add(keyValuePair.Key, new List()); + foreach (KeyValuePair> keyValuePair in keyValuePairs) + { + vs = keyValuePair.Value; + columnKey = keyValuePair.Key; + for (int i = min; i < max; i++) + { + if (vs.Count > i) + results[testKey][columnKey].Add(vs[i]); + else + results[testKey][columnKey].Add(string.Empty); + } + } + } + return new Tuple>>>(pdsf.Item1, results); + } + + private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ') + { + if (!addSpaces) + return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor); + else + return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex"))); + } + + public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.EquipmentIntegration, addSpaces, separator); + } + + public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.BusinessIntegration, addSpaces, separator); + } + + public static string SystemExport(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.SystemExport, addSpaces, separator); + } + + public static string Archive(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.Archive, addSpaces, separator); + } + + public static string GetLines(Logistics logistics, IScopeInfo scopeInfo, Dictionary> keyValuePairs, Enum[] enumColumns, string dateFormat, string timeFormat, Column[] pairedColumns, bool useDateTimeFromSequence = true, string format = "", Dictionary alternateDisplayName = null, Enum[] ignoreColumns = null) + { + StringBuilder result = new StringBuilder(); + if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) + throw new Exception(); + else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) + throw new Exception(); + int start; + string ckey; + string pKey; + int pairedColumnsCount; + string firstDuplicate = "_1"; + if (ignoreColumns is null) + ignoreColumns = new Enum[] { }; + if (alternateDisplayName is null) + alternateDisplayName = new Dictionary(); + string columnDate = Column.Date.ToString(); + string columnTime = Column.Time.ToString(); + List columnKeys = new List(); + foreach (Enum item in enumColumns) + { + if (ignoreColumns.Contains(item)) + continue; + columnKeys.Add(item.ToString()); + } + result.AppendLine(scopeInfo.Header); + StringBuilder line = new StringBuilder(); + int count = keyValuePairs[Description.RowColumn.Count.ToString()].Count(); + string nullData; + if (logistics.NullData is null) + nullData = string.Empty; + else + nullData = logistics.NullData.ToString(); + if (pairedColumns is null) + { + start = -1; + pairedColumnsCount = 0; + } + else + { + start = 0; + pairedColumnsCount = pairedColumns.Length; + } + for (int r = 0; r < count; r++) + { + for (int p = start; p < pairedColumnsCount; p++) + { + if (pairedColumnsCount == 0) + pKey = string.Empty; + else if (!(ignoreColumns is null) && ignoreColumns.Contains(pairedColumns[p])) + continue; + else + { + pKey = pairedColumns[p].ToString(); + if (!keyValuePairs.ContainsKey(pKey)) + continue; + else if (keyValuePairs[pKey][r] == nullData) + continue; + } + if (pairedColumnsCount == 0 || !string.IsNullOrEmpty(pKey)) + { + line.Clear(); + line.Append("!"); + for (int i = 0; i < columnKeys.Count; i++) + { + ckey = columnKeys[i]; + if (!keyValuePairs.ContainsKey(ckey)) + line.Append(string.Empty); + else + { + if (useDateTimeFromSequence && ckey == columnDate) + line.Append(logistics.DateTimeFromSequence.ToString(dateFormat)); + else if (useDateTimeFromSequence && ckey == columnTime) + line.Append(logistics.DateTimeFromSequence.ToString(timeFormat)); + else if (!useDateTimeFromSequence && ckey == columnDate && keyValuePairs[ckey][r].Length == format.Length) + line.Append(DateTime.ParseExact(keyValuePairs[ckey][r], format, CultureInfo.InvariantCulture).ToString(dateFormat)); + else if (!useDateTimeFromSequence && ckey == columnTime && keyValuePairs.ContainsKey(string.Concat(ckey, firstDuplicate)) && keyValuePairs[string.Concat(ckey, firstDuplicate)][r].Length == format.Length) + line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(ckey, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat)); + else + line.Append(keyValuePairs[ckey][r]); + } + line.Append(';'); + } + if (pairedColumnsCount > 0) + { + if (!alternateDisplayName.ContainsKey(pairedColumns[p])) + line.Append(pairedColumns[p].GetDiplayName()); + else + line.Append(alternateDisplayName[pairedColumns[p]]); + line.Append(';'); + line.Append(keyValuePairs[pKey][r]); + line.Append(';'); + } + line.Remove(line.Length - 1, 1); + result.AppendLine(line.ToString()); + } + } + } + return result.ToString(); + } + + public static string GetLines(Logistics logistics, IScopeInfo scopeInfo, List names, Dictionary> keyValuePairs, string dateFormat, string timeFormat, List pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List ignoreParameterNames = null) + { + StringBuilder result = new StringBuilder(); + if (ignoreParameterNames is null) + ignoreParameterNames = new List(); + if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) + throw new Exception(); + else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) + throw new Exception(); + string nullData; + const string columnDate = "Date"; + const string columnTime = "Time"; + const string firstDuplicate = "_1"; + result.AppendLine(scopeInfo.Header); + StringBuilder line = new StringBuilder(); + if (logistics.NullData is null) + nullData = string.Empty; + else + nullData = logistics.NullData.ToString(); + int count = (from l in keyValuePairs select l.Value.Count).Min(); + for (int r = 0; r < count; r++) + { + line.Clear(); + line.Append("!"); + foreach (KeyValuePair> keyValuePair in keyValuePairs) + { + if (!names.Contains(keyValuePair.Key)) + continue; + if (ignoreParameterNames.Contains(keyValuePair.Key)) + continue; + if (pairedParameterNames.Contains(keyValuePair.Key)) + { + if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) + continue; + else + result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]); + } + else + { + if (useDateTimeFromSequence && keyValuePair.Key == columnDate) + line.Append(logistics.DateTimeFromSequence.ToString(dateFormat)); + else if (useDateTimeFromSequence && keyValuePair.Key == columnTime) + line.Append(logistics.DateTimeFromSequence.ToString(timeFormat)); + else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length) + line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat)); + else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length) + line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat)); + else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) + line.Append(nullData); + else + line.Append(keyValuePair.Value[r]); + line.Append(';'); + } + } + if (!pairedParameterNames.Any()) + { + line.Remove(line.Length - 1, 1); + result.AppendLine(line.ToString()); + } + } + return result.ToString(); + } + + public static List PDSFToFixedWidth(string reportFullPath) + { + List results = new List(); + if (!File.Exists(reportFullPath)) + throw new Exception(); + int[] group; + string line; + int startsAt = 0; + string[] segments; + int? currentGroup = null; + char inputSeperator = '\t'; + char outputSeperator = '\t'; + List vs = new List(); + List groups = new List(); + string[] lines = File.ReadAllLines(reportFullPath); + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < lines.Length; i++) + { + if (string.IsNullOrEmpty(lines[i])) + continue; + segments = lines[i].Split(inputSeperator); + if (currentGroup is null) + currentGroup = segments.Length; + if (segments.Length != currentGroup) + { + currentGroup = segments.Length; + groups.Add(new int[] { startsAt, i - 1 }); + startsAt = i; + } + } + if (startsAt == lines.Length - 1 && lines[0].Split(inputSeperator).Length != currentGroup) + groups.Add(new int[] { lines.Length - 1, lines.Length - 1 }); + for (int g = 0; g < groups.Count; g++) + { + vs.Clear(); + group = groups[g]; + line = lines[group[0]]; + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + vs.Add(segments[s].Length); + for (int i = group[0]; i <= group[1]; i++) + { + line = lines[i]; + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + { + if (vs[s] < segments[s].Length) + vs[s] = segments[s].Length; + } + } + stringBuilder.Clear(); + for (int s = 0; s < segments.Length; s++) + stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator); + stringBuilder.Remove(stringBuilder.Length - 1, 1); + results.Add(stringBuilder.ToString()); + for (int i = group[0]; i <= group[1]; i++) + { + line = lines[i]; + stringBuilder.Clear(); + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator); + stringBuilder.Remove(stringBuilder.Length - 1, 1); + results.Add(stringBuilder.ToString()); + } + results.Add(string.Empty); + } + return results; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ScopeInfo.cs b/Adaptation/Shared/Metrology/ScopeInfo.cs new file mode 100644 index 0000000..037d8a6 --- /dev/null +++ b/Adaptation/Shared/Metrology/ScopeInfo.cs @@ -0,0 +1,409 @@ +using System; +using System.IO; + +namespace Adaptation.Shared.Metrology +{ + + public class ScopeInfo : IScopeInfo + { + + public Test Test { get; private set; } + public Enum Enum { get; private set; } + public string HTML { get; private set; } + public string Title { get; private set; } + public string FileName { get; private set; } + public int TestValue { get; private set; } + public string Header { get; private set; } + public string QueryFilter { get; private set; } + public string FileNameWithoutExtension { get; private set; } + public EquipmentType EquipmentType { get; private set; } + + public ScopeInfo(ILogic logic, ConfigDataBase configDataBase, Test test) + { + Enum = test; + Test = test; + TestValue = (int)test; + if (configDataBase.EquipmentConnection is null) + EquipmentType = configDataBase.EquipmentType; + else + EquipmentType = configDataBase.EquipmentConnection.Value; + string eventName = GetEventNameAndSetRemaining(); + if (eventName != configDataBase.GetEventName()) + { + File.Move(logic.Logistics.ReportFullPath, Path.ChangeExtension(logic.Logistics.ReportFullPath, eventName)); + throw new Exception(); + } + else if (EquipmentType != configDataBase.EquipmentType && EquipmentType != configDataBase.EquipmentConnection) + { + File.Move(logic.Logistics.ReportFullPath, Path.ChangeExtension(logic.Logistics.ReportFullPath, EquipmentType.ToString())); + throw new Exception(); + } + } + + public ScopeInfo(ILogic logic, ConfigDataBase configDataBase, Test test, string fileName, string queryFilter, string title = "", string html = "") + { + Enum = test; + Test = test; + TestValue = (int)test; + if (configDataBase.EquipmentConnection is null) + EquipmentType = configDataBase.EquipmentType; + else + EquipmentType = configDataBase.EquipmentConnection.Value; + FileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); + Header = string.Empty; + QueryFilter = queryFilter; + Title = title; + HTML = html; + FileName = fileName; + } + + public ScopeInfo ShallowCopy() + { + return (ScopeInfo)MemberwiseClone(); + } + + private string GetEventNameAndSetRemaining() + { + EventName eventName; + switch (Test) + { + case Test.AFMRoughness: + EquipmentType = EquipmentType.MET08AFMD3100; + eventName = EventName.FileRead; + FileNameWithoutExtension = "afm_iqs_01"; + Header = string.Empty; + QueryFilter = "AFM Roughness"; + Title = "AFM"; + HTML = @"GaN Epi Data\10 - afm.html"; + break; + case Test.BreakdownVoltageCenter: + EquipmentType = EquipmentType.MET08BVHGPROBE; + eventName = EventName.FileRead; + FileNameWithoutExtension = "bv_iqs_01"; + Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool"; + QueryFilter = "Breakdown Voltage"; + Title = "Breakdown Voltage-Center"; + HTML = @"GaN Epi Data\03 - bv-production.html"; + break; + case Test.BreakdownVoltageEdge: + EquipmentType = EquipmentType.MET08BVHGPROBE; + eventName = EventName.FileRead; + FileNameWithoutExtension = "bv_iqs_01_Edge"; + Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool"; + QueryFilter = "Breakdown Voltage - Edge"; + Title = "Breakdown Voltage-Edge"; + HTML = @"GaN Epi Data\03 - bv-production.html"; + break; + case Test.BreakdownVoltageMiddle8in: + EquipmentType = EquipmentType.MET08BVHGPROBE; + eventName = EventName.FileRead; + FileNameWithoutExtension = "bv_iqs_01_Middle"; + Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool"; + QueryFilter = "Breakdown Voltage - Middle"; + Title = "Breakdown Voltage-Middle (8 in)"; + HTML = @"GaN Epi Data\03 - bv-production.html"; + break; + case Test.CV: + EquipmentType = EquipmentType.MET08CVHGPROBE802B150; + eventName = EventName.FileRead; + FileNameWithoutExtension = "cv_iqs_01"; + Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap"; + QueryFilter = "CV_Ns"; + Title = "CV"; + HTML = @"GaN Epi Data\05 - cv.html"; + break; + case Test.MonthlyCV: + EquipmentType = EquipmentType.MET08CVHGPROBE802B150_Monthly; + eventName = EventName.FileReadMonthly; + FileNameWithoutExtension = "cv_iqs_01"; + Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap"; + QueryFilter = "CV_Ns"; + Title = "CV Monthly Verification"; + HTML = @"Metrology\07 - cv_verif_monthly.html"; + break; + case Test.WeeklyCV: + EquipmentType = EquipmentType.MET08CVHGPROBE802B150_Weekly; + eventName = EventName.FileReadWeekly; + FileNameWithoutExtension = "cv_iqs_01"; + Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap"; + QueryFilter = "CV_Ns"; + Title = "CV Weekly Verification"; + HTML = @"Metrology\16 - cv_verif_weekly.html"; + break; + case Test.CandelaKlarfDC: + EquipmentType = EquipmentType.MET08DDINCAN8620; + eventName = EventName.FileRead; + FileNameWithoutExtension = "candela_iqs_01"; + Header = "LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;Epi;SlipLines;Cracks;EpiDef;HazeSpot;SmallLpd;MediumLpd;LargeLpd;Cracks_A;Spirals;Craters;8620 Small;Pits;Tool ID;Defect Count"; + QueryFilter = "Candela Cracking"; + Title = "Candela"; + HTML = @"GaN Epi Data\12 - candela.html"; + break; + case Test.CandelaLaser: + EquipmentType = EquipmentType.MET08DDINCAN8620; + eventName = EventName.FileRead; + FileNameWithoutExtension = "candela_iqs_01"; + Header = "LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;Epi;SlipLines;Cracks;EpiDef;HazeSpot;SmallLpd;MediumLpd;LargeLpd;Cracks_A;Spirals;Craters;Pits;Tool ID;Defect Count"; + QueryFilter = "Candela Cracking"; + Title = "Candela"; + HTML = @"GaN Epi Data\12 - candela.html"; + break; + case Test.CandelaVerify: + EquipmentType = EquipmentType.MET08DDINCAN8620; + eventName = EventName.FileRead; + FileNameWithoutExtension = "candela_iqs_01"; + Header = string.Concat("LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;RunID;Reactor;", "Slip Lines;Cracks;Epi Def;Haze Spot;Small LPD;Medium LPD;Large LPD;Cracks_A;Spirals;Craters;8620 Small;Pits;Tool ID;Defect Count"); + QueryFilter = "Candela Cracking"; + Title = "Candela"; + HTML = @"GaN Epi Data\12 - candela.html"; + break; + case Test.CandelaPSL: + EquipmentType = EquipmentType.MET08DDINCAN8620_Daily; + eventName = EventName.FileReadDaily; + FileNameWithoutExtension = "candela_iqs_01"; + Header = string.Empty; + QueryFilter = "102-83nm"; + Title = "Candela"; + HTML = @"GaN Epi Data\12 - candela.html"; + break; + case Test.CandelaProdU: + EquipmentType = EquipmentType.MET08DDINCAN8620_Daily; + eventName = EventName.FileReadDaily; + FileNameWithoutExtension = "candela_iqs_01"; + Header = string.Empty; + QueryFilter = "SPE verification"; + Title = "Candela"; + HTML = @"GaN Epi Data\12 - candela.html"; + break; + case Test.Denton: + EquipmentType = EquipmentType.MET08EBEAMINTEGRITY26; + eventName = EventName.FileRead; + FileNameWithoutExtension = "denton_iqs_01"; + Header = "Tool;fDate;Run;Recipe;Operator;Name;Value"; + QueryFilter = "Denton_Voltage_AVG"; + Title = "Denton Data"; + HTML = @"Support Process\03 - ebeam02_denton_v1.html"; + break; + case Test.Hall: + EquipmentType = EquipmentType.MET08HALLHL5580; + eventName = EventName.FileRead; + FileNameWithoutExtension = "hall_iqs_01"; + Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value"; + QueryFilter = "Hall Rs"; + Title = "Hall Data"; + HTML = @"GaN Epi Data\04 - hall.html"; + break; + case Test.MonthlyHall: + EquipmentType = EquipmentType.MET08HALLHL5580_Monthly; + eventName = EventName.FileReadMonthly; + FileNameWithoutExtension = "hall_iqs_01"; + Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value"; + QueryFilter = "Hall Rs"; + Title = "Hall Monthly Verification"; + HTML = @"Metrology\06 - hall_verif_monthly.html"; + break; + case Test.WeeklyHall: + EquipmentType = EquipmentType.MET08HALLHL5580_Weekly; + eventName = EventName.FileReadWeekly; + FileNameWithoutExtension = "hall_iqs_01"; + Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value"; + QueryFilter = "Hall Rs"; + Title = "Hall Weekly Verification"; + HTML = @"Metrology\15 - hall_verif_weekly.html"; + break; + case Test.Lehighton: + EquipmentType = EquipmentType.MET08NDFRESIMAP151C; + eventName = EventName.FileRead; + FileNameWithoutExtension = "lei_iqs_01"; + Header = "Reactor;Date;Recipe;Lot;Pocket;Scribe;Tool;Name;Value"; + QueryFilter = "LEI RS Average value"; + Title = "Lehighton"; + HTML = @"GaN Epi Data\13 - lehighton.html"; + break; + case Test.VerificationLehighton: + EquipmentType = EquipmentType.MET08NDFRESIMAP151C_Verification; + eventName = EventName.FileRead; + FileNameWithoutExtension = "___"; + Header = "Reactor;Date;Recipe;Lot;Pocket;Scribe;Tool;Name;Value"; + QueryFilter = "___"; + Title = "LEI Weekly Verification 2 Ohm cm"; + HTML = @"Metrology\14 - lei_verif_weekly.html.html"; + break; + case Test.Microscope: + EquipmentType = EquipmentType.MET08MESMICROSCOPE; + eventName = EventName.FileRead; + FileNameWithoutExtension = string.Empty; + Header = string.Empty; + QueryFilter = "Microscope Center 5x"; + Title = "Total Microscope Defects"; + HTML = string.Empty; + break; + case Test.RPMXY: + EquipmentType = EquipmentType.MET08PLMAPRPM; + eventName = EventName.FileRead; + FileNameWithoutExtension = "RPM_Data"; + Header = "Lot;Date;Recipe;Reactor;Scribe;Pocket;Tool;Name;Value"; + QueryFilter = "Barrier_Composition_RPM_XY"; + Title = "RPM XY Data ***&*** View Data"; + HTML = @"GaN Epi Data\09 - rpm --- 08 - photoluminescence.html"; + break; + case Test.RPMAverage: + EquipmentType = EquipmentType.MET08PLMAPRPM; + eventName = EventName.FileRead; + FileNameWithoutExtension = "RPMdata-short"; + Header = "fProductId;fDate;average;stdDev;fRecipeName;Reactor;g4Scribe;Pocket Number;Tool ID;Recipe From Rpm File"; + QueryFilter = "Epi Thickness Mean"; + Title = "RPM Average Data"; + HTML = @"GaN Epi Data\09 - rpm.html"; + break; + case Test.RPMPLRatio: + EquipmentType = EquipmentType.MET08PLMAPRPM; + eventName = EventName.FileRead; + FileNameWithoutExtension = "PHOTOLUMINESCENCE_data-short"; + Header = "fProductId;fDate;g4Scribe;fRecipeName;bandEdge_nm;bandEdge_V;yellowBand_Pmw;yellowBand_nm;yellowBand_V;Reactor;Pocket Number;Tool ID"; + QueryFilter = "PL Ratio"; + Title = "Photoluminescence: PL Ratio"; + HTML = @"GaN Epi Data\08 - photoluminescence.html"; + break; + case Test.DailyRPMXY: + EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; + eventName = EventName.FileReadDaily; + FileNameWithoutExtension = "RPM_Data"; + Header = "Lot;Date;Recipe;Reactor;Scribe;Pocket;Tool;Name;Value"; + QueryFilter = "Barrier_Composition_RPM_XY"; + Title = ""; + HTML = @"Metrology\?"; + break; + case Test.DailyRPMAverage: + EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; + eventName = EventName.FileReadDaily; + FileNameWithoutExtension = "RPMdata-short"; + Header = "fProductId;fDate;average;stdDev;fRecipeName;Reactor;g4Scribe;Pocket Number;Tool ID;Recipe From Rpm File"; + QueryFilter = "Epi Thickness Mean"; + Title = ""; + HTML = @"Metrology\?"; + break; + case Test.DailyRPMPLRatio: + EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; + eventName = EventName.FileReadDaily; + FileNameWithoutExtension = "PHOTOLUMINESCENCE_data-short"; + Header = "fProductId;fDate;g4Scribe;fRecipeName;bandEdge_nm;bandEdge_V;yellowBand_Pmw;yellowBand_nm;yellowBand_V;Reactor;Pocket Number;Tool ID"; + QueryFilter = "PL Ratio"; + Title = "RPM Daily Verification"; + HTML = @"Metrology\17 - rpm_verif_daily.html"; + break; + case Test.VerificationRPM: + EquipmentType = EquipmentType.MET08PLMAPRPM_Verification; + eventName = EventName.FileReadVerification; + FileNameWithoutExtension = "PhotoLuminescence_Ver"; + Header = "Part;Process;Date;Test;Value"; + QueryFilter = "PL Edge Wavelength"; + Title = "PL Daily Verification - [PL Edge Wavelength]"; + HTML = @"Metrology\18 - photoluminescence_verif_daily.html"; + break; + case Test.Photoreflectance: + EquipmentType = EquipmentType.MET08PRFUSB4000; + eventName = EventName.FileRead; + FileNameWithoutExtension = "photoreflect_iqs_01"; + Header = "Lot;Date;Part;Reactor;Scribe;Pocket;Tool;Point;WaferPosition_PR;PR_Peak"; + QueryFilter = "PR Barrier Composition"; + Title = "Photoreflectance 6 in, Photoreflectance 8 in"; + HTML = @"GaN Epi Data\07 - photoreflectance.html"; + break; + case Test.UV: + EquipmentType = EquipmentType.MET08UVH44GS100M; + eventName = EventName.FileRead; + FileNameWithoutExtension = "uv_iqs_01"; + Header = string.Empty; + QueryFilter = "UV Broken"; + Title = "UV"; + HTML = @"GaN Epi Data\15 - uv 2.1.html"; + break; + case Test.VpdIcpmsAnalyte: + EquipmentType = EquipmentType.MET08VPDSUBCON; + eventName = EventName.FileRead; + FileNameWithoutExtension = "VPD_iqs_01"; + Header = "Reactor;RunID;RunDate;PartNumber;PocketNumber;WaferScribe;Analyte;Value"; + QueryFilter = "Mg"; + Title = "VpdIcpmsAnalyteData"; + HTML = @""; + break; + case Test.WarpAndBow: + EquipmentType = EquipmentType.MET08WGEOMX203641Q; + eventName = EventName.FileRead; + FileNameWithoutExtension = "warp_iqs_01"; + Header = "fDate;fRecipeName;fProductId;g4Scribe;warp;bow;tool;Reactor;Pocket ID;bow_range;BowX;BowY;CenterBow"; + QueryFilter = "BowCenter"; + Title = "Warp and Bow"; + HTML = @"GaN Epi Data\14 - warp.html"; + break; + case Test.VerificationWarpAndBow: + EquipmentType = EquipmentType.MET08WGEOMX203641Q_Verification; + eventName = EventName.FileReadVerification; + FileNameWithoutExtension = "warp_ver_iqs_01"; + Header = "Part;Process;Date;WaferScribe;totWarp;bow"; + QueryFilter = "Bow Calibration"; + Title = "6 Inch Warp/Bow Daily Verification, 8 Inch Warp/Bow Daily Verification"; + HTML = @"Metrology\19 - warp_cal_daily.html"; + break; + case Test.XRDXY: + EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL; + eventName = EventName.FileRead; + FileNameWithoutExtension = "xrd_iqs_NEW_01"; + Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;ToolID;Name;Value;Group"; + QueryFilter = "SL Period"; + Title = "XRD XY Raw Data Viewer"; + HTML = @"GaN Epi Data\11 - xrd.html"; + break; + case Test.XRDWeightedAverage: + EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL; + eventName = EventName.FileRead; + FileNameWithoutExtension = "xrd_iqs_NEW_01_WtAVG"; + Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;Name;Value;Group"; + //QueryFilter = "Al% Barrier WTAVG"; + QueryFilter = "SL Period WTAVG"; + Title = "XRD Weighted Average Data"; + HTML = @"GaN Epi Data\11 - xrd.html"; + break; + case Test.MonthlyXRD: + EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL_Monthly; + eventName = EventName.FileReadMonthly; + FileNameWithoutExtension = "xrd_monthly_ver_iqs_01"; + Header = "Part;Process;Date;TestName;Value"; + QueryFilter = "XRD 2-Theta Position"; + Title = "XRD Monthly Verification"; + HTML = @"Metrology\03 - xrd_verif_monthly.html"; + break; + case Test.WeeklyXRD: + EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL_Weekly; + eventName = EventName.FileReadWeekly; + FileNameWithoutExtension = "xrd_weekly_ver_iqs_01"; + Header = "Part;Process;Lot;Date;TestName;Value"; + QueryFilter = "XRD Weekly AL% Center"; + Title = "XRD Weekly Verification"; + HTML = @"Metrology\12 - xrd_verif_weekly.html"; + break; + case Test.JVXRD: + EquipmentType = EquipmentType.METBRXRAYJV7300L; + eventName = EventName.FileRead; + FileNameWithoutExtension = "xrd_iqs_NEW_01"; + Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;ToolID;Name;Value;Group"; + QueryFilter = "SL Period"; + Title = "XRD XY Raw Data Viewer"; + HTML = @"GaN Epi Data\11 - xrd.html"; + break; + default: + throw new Exception(); + } + FileName = string.Concat(FileNameWithoutExtension, ".txt"); + return eventName.ToString(); + } + + public override string ToString() + { + return string.Concat(EquipmentType, " - (", Enum, ""); + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/Test.cs b/Adaptation/Shared/Metrology/Test.cs new file mode 100644 index 0000000..3771e68 --- /dev/null +++ b/Adaptation/Shared/Metrology/Test.cs @@ -0,0 +1,57 @@ +namespace Adaptation.Shared.Metrology +{ + + public enum Test + { + AFMRoughness = 34, + BioRadQS408M = 25, + BioRadStratus = 26, + BreakdownVoltageCenter = 0, + BreakdownVoltageEdge = 1, + BreakdownVoltageMiddle8in = 2, + CandelaKlarfDC = 6, + CandelaLaser = 36, + CandelaProdU = 39, + CandelaPSL = 38, + CandelaVerify = 37, + CDE = 24, + CV = 3, + DailyRPMAverage = 19, + DailyRPMPLRatio = 20, + DailyRPMXY = 18, + Denton = 9, + DiffusionLength = 45, + Hall = 10, + HgCV = 23, + Lehighton = 13, + Microscope = 46, + MonthlyCV = 4, + MonthlyHall = 11, + MonthlyXRD = 32, + Photoreflectance = 22, + PlatoA = 48, //Largest + RPMAverage = 16, + RPMPLRatio = 17, + RPMXY = 15, + SP1 = 8, + Tencor = 7, + UV = 35, + VerificationLehighton = 14, + VerificationRPM = 21, + VerificationWarpAndBow = 29, + VpdIcpmsAnalyte = 27, + WarpAndBow = 28, + WeeklyCV = 5, + WeeklyHall = 12, + WeeklyXRD = 33, + WeeklyXRDAIcomp = 40, + WeeklyXRDFWHM002 = 41, + WeeklyXRDFWHM105 = 42, + WeeklyXRDSLStks = 43, + WeeklyXRDXRR = 44, + XRDWeightedAverage = 31, + JVXRD = 47, + XRDXY = 30 + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.Attachment.cs b/Adaptation/Shared/Metrology/WS.Attachment.cs new file mode 100644 index 0000000..540e760 --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.Attachment.cs @@ -0,0 +1,24 @@ +namespace Adaptation.Shared.Metrology +{ + + public partial class WS + { + public class Attachment + { + + public string UniqueId { get; set; } + public string DestinationFileName { get; set; } + public string SourceFileName { get; set; } + + public Attachment(string uniqueId, string destinationFileName, string sourceFileName) + { + UniqueId = uniqueId; + DestinationFileName = destinationFileName; + SourceFileName = sourceFileName; + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.Results.cs b/Adaptation/Shared/Metrology/WS.Results.cs new file mode 100644 index 0000000..ada4b97 --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.Results.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology +{ + + public partial class WS + { + // this class represents the response from the Inbound API endpoint + public class Results + { + // true or false if data was written to the database + public bool Success { get; set; } + + // if true, contains ID of the Header record in the database + public long HeaderID { get; set; } + + // if false, this collection will contain a list of errors + public List Errors { get; set; } + + // this collection will contain a list of warnings, they will not prevent data from being saved + public List Warnings { get; set; } + + // this is just a helper function to make displaying the results easier + public override string ToString() + { + return JsonSerializer.Serialize(this, GetType()); + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs new file mode 100644 index 0000000..1fa6b5a --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology +{ + + public partial class WS + { + + public static Tuple SendData(string url, object payload, int timeoutSeconds = 120) + { + Results results = new Results(); + string resultsJson = string.Empty; + try + { + string json = JsonSerializer.Serialize(payload, payload.GetType()); + if (string.IsNullOrEmpty(url) || !url.Contains(":") || !url.Contains(".")) + throw new Exception("Invalid URL"); + using (HttpClient httpClient = new HttpClient()) + { + httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0); + HttpRequestMessage httpRequestMessage = new HttpRequestMessage + { + RequestUri = new Uri(url), + Method = HttpMethod.Post, + Content = new StringContent(json, Encoding.UTF8, "application/json") + }; + HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result; + resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result; + results = JsonSerializer.Deserialize(resultsJson); + } + if (!results.Success) + results.Errors.Add(results.ToString()); + } + catch (Exception e) + { + Exception exception = e; + StringBuilder stringBuilder = new StringBuilder(); + while (!(exception is null)) + { + stringBuilder.AppendLine(exception.Message); + exception = exception.InnerException; + } + if (results.Errors is null) + results.Errors = new List(); + results.Errors.Add(stringBuilder.ToString()); + } + return new Tuple(resultsJson, results); + } + + // this method is a wrapper for attaching a file to either a header or data record + // URL is the same URL used for SendData, ex: http://localhost/api/inbound/CDE + // attachToHeaderId is the ID returned by SendData + // attachToDataUniqueId is the string unique ID for the data record, aka the Title of the Sharepoint list entry + // fileContents is a byte array with the contents of the file + // fileName is which attachment this is, image.pdf, data.pdf, data.txt, header.pdf, etc + // timeoutSeconds is configured as the request timeout + // this method will either succeed or throw an exception + // also, this has been made synchronous + public static void AttachFile(string url, long attachToHeaderId, string attachToDataUniqueId, byte[] fileContents, string fileName, int timeoutSeconds = 60) + { + using (HttpClient httpClient = new HttpClient()) + { + string requestUrl = url + "/attachment?headerid=" + attachToHeaderId.ToString(); + if (!string.IsNullOrWhiteSpace(attachToDataUniqueId)) + { + requestUrl += "&datauniqueid="; + requestUrl += System.Net.WebUtility.UrlEncode(attachToDataUniqueId); + } + requestUrl += "&filename="; // this is just so the web server log shows the filename + requestUrl += System.Net.WebUtility.UrlEncode(fileName); + + httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0); + + MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent(); + ByteArrayContent byteArrayContent = new ByteArrayContent(fileContents); + byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); + + multipartFormDataContent.Add(byteArrayContent, "attachment", fileName); + + HttpResponseMessage httpResponseMessage = httpClient.PostAsync(requestUrl, multipartFormDataContent).Result; + + if (httpResponseMessage.IsSuccessStatusCode) + return; + + string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result; + + throw new Exception("Attachment failed: " + resultBody); + } + } + + public static void AttachFiles(string url, long headerID, List headerAttachments = null, List dataAttachments = null) + { + try + { + if (!(headerAttachments is null)) + { + foreach (Attachment attachment in headerAttachments) + AttachFile(url, headerID, "", System.IO.File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); + } + if (!(dataAttachments is null)) + { + foreach (Attachment attachment in dataAttachments) + AttachFile(url, headerID, attachment.UniqueId, System.IO.File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); + } + //MessageBox.Show(r.ToString()); + } + catch (Exception e) + { + Exception exception = e; + StringBuilder stringBuilder = new StringBuilder(); + while (!(exception is null)) + { + stringBuilder.AppendLine(exception.Message); + exception = exception.InnerException; + } + //MessageBox.Show(msgs.ToString(), "Exception", //MessageBoxButtons.OK, //MessageBoxIcon.Error); + throw new Exception(stringBuilder.ToString()); + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/package.json b/Adaptation/package.json new file mode 100644 index 0000000..8247f48 --- /dev/null +++ b/Adaptation/package.json @@ -0,0 +1,8 @@ +{ + "scripts": { + "build": "dotnet build --runtime win-x64 --self-contained", + "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity error", + "pull": "git pull", + "garbage-collect": "git gc" + } +} \ No newline at end of file diff --git a/FileHandlers/FileRead.cs b/FileHandlers/FileRead.cs new file mode 100644 index 0000000..1439563 --- /dev/null +++ b/FileHandlers/FileRead.cs @@ -0,0 +1,95 @@ +using Eaf.Core.Smtp; +using Adaptation.Shared.Metrology; +using Eaf.Core; +using Ifx.Eaf.EquipmentConnector.File.Component.Reader; +using log4net; +using Shared; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Text; +using System.Text.Json; +using System.Linq; + +namespace MET08DDUPSP1TBI.FileHandlers +{ + + public partial class FileRead : FileReaderHandler + { + + private Adaptation.FileHandlers.FileRead _FileRead; + + public FileRead() + { + _Log = LogManager.GetLogger(typeof(FileRead)); + _FileRead = new Adaptation.FileHandlers.FileRead(); + } + + public override bool Extract(string reportFullPath, string eventName) + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}")); + Tuple> extractResults = null; + try + { + extractResults = _FileRead.GetExtractResult(reportFullPath, eventName); + TriggerEvents(reportFullPath, extractResults); + _FileRead.Move(reportFullPath, extractResults); + FilePathGeneratorInfoMove(reportFullPath, extractResults); + _FileRead.WaitForThread(); + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); + return true; + } + catch (Exception ex) + { + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + _FileRead.Move(reportFullPath, extractResults, exception: ex); + FilePathGeneratorInfoMove(reportFullPath, extractResults, exception: ex); + return false; + } + } + + public Tuple> ReExtract(string searchDirectory, string sourceFileFilter) + { + Tuple> results = _FileRead.ReExtract(searchDirectory, sourceFileFilter); + if (!(results?.Item2 is null)) + { + TriggerEvents(_FileRead.Logistics.ReportFullPath, results); + _FileRead.Move(_FileRead.Logistics.ReportFullPath, results); + FilePathGeneratorInfoMove(_FileRead.Logistics.ReportFullPath, results); + } + return results; + } + + private void FilePathGeneratorInfoMove(string reportFullPath, Tuple> extractResults, Exception exception = null) + { + bool isErrorFile = !(exception is null); + object filePathGeneratorInfo = GetFilePathGeneratorInfo(reportFullPath, isErrorFile); + Tuple tuple = _FileRead.GetOpenInsightTuple(); + if (filePathGeneratorInfo is null || !(filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator)) + OISiViewer.WebClientDownloadString(tuple.Item1, tuple.Item2, reportFullPath, isErrorFile, string.Empty); + else + { + OISiViewer.WebClientDownloadString(tuple.Item1, tuple.Item2, reportFullPath, isErrorFile, filePathGenerator.To); + string[] exceptionLines = _FileRead.Shared1124(reportFullPath, extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception); + if (isErrorFile) + { + try + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (string item in exceptionLines) + stringBuilder.Append("<").Append(item).AppendLine(">"); + ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + EmailMessage emailMessage = new EmailMessage(string.Concat("Exception:", _ConfigDataBase.EquipmentElementName, _ConfigDataBase.FileConnectorConfiguration?.SourceDirectoryCloaking), stringBuilder.ToString(), MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + } + + } + +} diff --git a/FileHandlers/FileReadShared.cs b/FileHandlers/FileReadShared.cs new file mode 100644 index 0000000..12ae48d --- /dev/null +++ b/FileHandlers/FileReadShared.cs @@ -0,0 +1,249 @@ +using Adaptation.Shared.Metrology; +using Eaf.Core; +using Eaf.EquipmentCore.DataCollection.Reporting; +using Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Eaf.EquipmentCore.SelfDescription.EquipmentStructure; +using Eaf.Management.ConfigurationData.CellAutomation; +using Ifx.Eaf.EquipmentConnector.File.Configuration; +using log4net; +using Shared; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text.Json; +using System.Threading; + +namespace MET08DDUPSP1TBI.FileHandlers +{ + + public partial class FileRead + { + +#pragma warning disable CS0169 + private readonly ILog _Log; + private Description _Description; + private ConfigDataBase _ConfigDataBase; + private EquipmentEvent _EquipmentEvent; + private FilePathGenerator _FilePathGeneratorForError; + private FilePathGenerator _FilePathGeneratorForTarget; +#pragma warning restore CS0169 + + public override void CreateSelfDescription() + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry")); + try + { + if (Equipment is null) + throw new Exception(); + string cellInstanceName; + if (Backbone.Instance?.CellName is null) + cellInstanceName = string.Empty; + else + cellInstanceName = Backbone.Instance.CellName; + if (cellInstanceName.Contains("-IO")) + cellInstanceName = cellInstanceName.Replace("-IO", string.Empty); + EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item; + Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration fileConnectorConfiguration = Map(Configuration); + IList modelObjectParameterDefinitions = Map(ConfiguredParameters); + _ConfigDataBase = _FileRead.GetConfigDataBase(methodBase, cellInstanceName, equipmentElement.Name, fileConnectorConfiguration, modelObjectParameterDefinitions, eafHosted: !(Equipment is null)); + if (Configuration.SourceFileLocation != _ConfigDataBase.FileConnectorConfiguration.SourceFileLocation) + Configuration.SourceFileLocation = _ConfigDataBase.FileConnectorConfiguration.SourceFileLocation; + _Description = new Description(_FileRead, _ConfigDataBase, Equipment); + _FileRead.Shared0749(); + if (FileParameter is null) + FileParameter = new Dictionary(); + _FileRead.Shared1301(FileParameter, fileConnectorConfiguration); + if (!(Equipment is null) && _ConfigDataBase.IsEvent) + { + if (_Description.ParameterTypeDefinitions.Any()) + { + foreach (Eaf.EquipmentCore.SelfDescription.ParameterTypes.ParameterTypeDefinition item in _Description.ParameterTypeDefinitions) + { + Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(item); + } + } + Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_Description.EquipmentParameters); + _EquipmentEvent = new EquipmentEvent(_ConfigDataBase.GetEventName(), _ConfigDataBase.GetEventDescription(), _Description.EquipmentParameters); + Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent); + } + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); + } + catch (Exception ex) + { + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + long breakAfter = DateTime.Now.AddSeconds(30).Ticks; + for (short i = 0; i < short.MaxValue; i++) + { + if (DateTime.Now.Ticks > breakAfter) + break; + Thread.Sleep(500); + } + throw; + } + } + + public object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) + { + FilePathGeneratorInfo result; + FilePathGenerator filePathGeneratorOriginal; + if (Configuration is null) + result = null; + else + { + if (isErrorFile) + { + if (_FilePathGeneratorForError is null) + _FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true); + filePathGeneratorOriginal = _FilePathGeneratorForError; + } + else + { + if (_FilePathGeneratorForTarget is null) + _FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false); + filePathGeneratorOriginal = _FilePathGeneratorForTarget; + } + result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter); + } + return result; + } + + private Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration Map(FileConnectorConfiguration configuration) + { + Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration result = new Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration + { + AlternateTargetFolder = configuration.AlternateTargetFolder, + ConnectionRetryInterval = configuration.ConnectionRetryInterval, + ConnectionSettings = new List(), + CopySourceFolderStructure = configuration.CopySourceFolderStructure, + DefaultPlaceHolderValue = configuration.DefaultPlaceHolderValue, + //DeleteAbandonedEmptySourceSubFolders = configuration.DeleteAbandonedEmptySourceSubFolders, + DeleteEmptySourceSubFolders = configuration.DeleteEmptySourceSubFolders, + ErrorPostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.ErrorPostProcessingMode, + ErrorTargetFileLocation = configuration.ErrorTargetFileLocation, + ErrorTargetFileName = configuration.ErrorTargetFileName, + FileAgeFilterMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileAgeFilterEnum)configuration.FileAgeFilterMode, + FileAgeThreshold = configuration.FileAgeThreshold, + //FileHandlers = configuration.FileHandlers, + FileHandleTimeout = (long)configuration.FileHandleTimeout, + FileHandleWaitTime = configuration.FileHandleWaitTime, + FileScanningIntervalInSeconds = configuration.FileScanningIntervalInSeconds, + FileScanningOption = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileScanningOptionEnum)configuration.FileScanningOption, + FolderAgeCheckIndividualSubFolders = configuration.FolderAgeCheckIndividualSubFolders, + FolderAgeThreshold = configuration.FolderAgeThreshold, + //FolderOperationsSubFolderLevel = configuration.FolderOperationsSubFolderLevel, + IdleEventWaitTimeInSeconds = (long)configuration.IdleEventWaitTimeInSeconds, + IfFileExistAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfFileExistEnum)configuration.IfFileExistAction, + IfPostProcessingFailsAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfPostProcessingFailsEnum)configuration.IfPostProcessingFailsAction, + IncludeSubDirectories = configuration.IncludeSubDirectories, + PostProcessingRetries = configuration.PostProcessingRetries, + PreProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PreProcessingModeEnum)configuration.PreProcessingMode, + PostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.PostProcessingMode, + SourceDirectoryCloaking = configuration.SourceDirectoryCloaking, + SourceFileFilter = configuration.SourceFileFilter, + SourceFileFilters = configuration.SourceFileFilters, + SourceFileLocation = configuration.SourceFileLocation, + TargetFileLocation = configuration.TargetFileLocation, + TargetFileName = configuration.TargetFileName, + TriggerOnChanged = configuration.TriggerOnChanged, + TriggerOnCreated = configuration.TriggerOnCreated, + UseZip64Mode = configuration.UseZip64Mode, + ZipErrorTargetFileName = configuration.ZipErrorTargetFileName, + ZipFileAmount = configuration.ZipFileAmount, + ZipFileSubFolderLevel = configuration.ZipFileSubFolderLevel, + ZipFileTime = configuration.ZipFileTime, + ZipMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.ZipModeEnum)configuration.ZipMode, + ZipTargetFileName = configuration.ZipTargetFileName, + }; + foreach (Ifx.Eaf.Common.Configuration.ConnectionSetting connectionSetting in configuration.ConnectionSettings) + result.ConnectionSettings.Add(new Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting(connectionSetting.Name, connectionSetting.Value)); + return result; + } + + private IList Map(IList configuredParameters) + { + List results = new List(); + Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType modelObjectParameterType; + for (int i = 0; i < configuredParameters.Count; i++) + { + modelObjectParameterType = (Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType)configuredParameters[i].ValueType; + results.Add(new Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition() { Id = i, Name = configuredParameters[i].Name, Value = configuredParameters[i].Value, ValueType = modelObjectParameterType, EnumType = modelObjectParameterType.ToString() }); + } + return results; + } + + public ConfigDataBase ReflectionCreateSelfDescriptionV2(string json) + { + ConfigDataBase result = _FileRead.ReflectionCreateSelfDescriptionV2(json); + _ConfigDataBase = result; + _Description = new Description(_FileRead, result, Equipment); + return result; + } + + private void TriggerEvents(string reportFullPath, Tuple> extractResults) + { + List parameters; + int count = extractResults.Item2.Value.GetArrayLength(); + for (int i = 0; i < count; i++) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); + parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, i); + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + if (_ConfigDataBase.UseCyclicalForDescription) + break; + } + if (_ConfigDataBase.IsDatabaseExportToIPDSF && count > 0) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); + parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, null); + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + } + } + + private void TriggerEvents(string reportFullPath, Tuple> extractResults, Dictionary eventDataList, int count) + { + const string DATA_LIST_KEY = "DataList"; + const int RESULT_CODE_SUCCESS = 0; + const string RESULT_CODE_KEY = "ReturnCode"; + const string RESULT_EMAIL_FAILURE_TYPE = "ReturnEmailFailureType"; + const string RESULT_EMAIL_FAILURE_NONE = "EmailFailureNone"; + const string RESULT_TEXT_KEY = "ReturnText"; + List parameters; + for (int i = 0; i < count; i++) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); + //parameters = _Description.GetParameterValues(this, Equipment, extractResults.Item2, count, i); + // add the final results fields to the data dictionary + Dictionary finalDictionary = new Dictionary + { + [RESULT_CODE_KEY] = RESULT_CODE_SUCCESS, + [RESULT_TEXT_KEY] = "success", + [RESULT_EMAIL_FAILURE_TYPE] = RESULT_EMAIL_FAILURE_NONE, + [DATA_LIST_KEY] = eventDataList + }; + // trigger File Read event + //Equipment.DataCollection.TriggerEvent(mFileReadEvent, new List() { new ParameterValue(mMyParameter, finalDictionary) }); + // + parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, i, keyValuePairs: finalDictionary); + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + if (_ConfigDataBase.UseCyclicalForDescription) + break; + } + if (_ConfigDataBase.IsDatabaseExportToIPDSF && count > 0) + { + _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); + parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, null); + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + } + } + + } + +} \ No newline at end of file diff --git a/MET08DDUPSP1TBI.csproj b/MET08DDUPSP1TBI.csproj new file mode 100644 index 0000000..e89068b --- /dev/null +++ b/MET08DDUPSP1TBI.csproj @@ -0,0 +1,166 @@ + + + + + Debug + AnyCPU + {2C94F9E3-FAF0-4625-9315-EA2FC32E71A1} + 9.0 + Library + Properties + MET08DDUPSP1TBI + MET08DDUPSP1TBI + v4.7.2 + 512 + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\None\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.36.0 + + + 5.0.1 + + + + + + + + + \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..49b21d0 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MET08DDUPSP1TBI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MET08DDUPSP1TBI")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2c94f9e3-faf0-4625-9315-ea2fc32e71a1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.36.0.0")] +[assembly: AssemblyFileVersion("2.36.0.0")] diff --git a/README.md b/README.md index 0ca446a..094208d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # Introduction -TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. +MET08DDUPSP1TBI EAF adaptation # Getting Started -TODO: Guide users through getting your code up and running on their own system. In this section you can talk about: -1. Installation process -2. Software dependencies -3. Latest releases -4. API references +1. Framework - MET08DDUPSP1TBI.csproj +2. dotnet core - Adaptation\MET08DDUPSP1TBI.Tests.csproj +3. https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json +4. https://packagemanagement.eu.infineon.com:4430/packages # Build and Test -TODO: Describe and show how to build your code and run the tests. +See Adaptation\_Tests for dotnet core tests -# Contribute -TODO: Explain how other users and developers can contribute to make your code better. +# TFS +$/MIT_EAF_Adaptations/Trunk/MET08DDUPSP1TBI/06_SourceCode -If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files: -- [ASP.NET Core](https://github.com/aspnet/Home) -- [Visual Studio Code](https://github.com/Microsoft/vscode) -- [Chakra Core](https://github.com/Microsoft/ChakraCore) \ No newline at end of file +# Last TFS Changeset +303336 Phares Mike (IFAM IT FI MES) 2/1/2022 4:49:07 PM MET08DDUPSP1TBI - Move solution for Azure DevOps git + +# Git +git@tfs.intra.infineon.com:22/tfs/ManufacturingIT/Mesa_FI/_git/MET08DDUPSP1TBI diff --git a/Shared/Description.cs b/Shared/Description.cs new file mode 100644 index 0000000..839cfbb --- /dev/null +++ b/Shared/Description.cs @@ -0,0 +1,182 @@ +using Adaptation.Shared.Metrology; +using Eaf.Core; +using Eaf.EquipmentCore.Control; +using Eaf.EquipmentCore.DataCollection.Reporting; +using Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Eaf.EquipmentCore.SelfDescription.ParameterTypes; +using Ifx.Eaf.EquipmentConnector.File.SelfDescription; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace Shared +{ + + public class Description + { + + public enum RowColumn + { + Test = 1000, + Count, + Index + } + + public enum LogisticsColumn + { + EventName = 2000, + NullData, + JobID, + Sequence, + MesEntity, + ReportFullPath, + ProcessJobID, + MID + } + + public enum Param + { + String = 0, + Integer = 2, + Double = 3, + Boolean = 4, + StructuredType = 5 + } + + internal const string FileFound = "FileFound"; + + + public List EquipmentParameters { get; private set; } + public List ParameterTypeDefinitions { get; private set; } + + private readonly bool _UseCyclical; + private readonly List _HeaderNames; + private readonly Dictionary _KeyIndexPairs; + private readonly ParameterTypeDefinition _StructuredType; + private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider; + + public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl) + { + _KeyIndexPairs = new Dictionary(); + _HeaderNames = configDataBase.GetHeaderNames(logic); + _UseCyclical = configDataBase.UseCyclicalForDescription; + _StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List()); + _FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider(); + EquipmentParameters = new List(); + ParameterTypeDefinitions = new List { _StructuredType }; + Dictionary>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false); + List results = GetParameterValues(equipmentControl, keyValuePairsCollection); + } + + private List GetParameterValues(IEquipmentControl equipmentControl, Dictionary>> keyValuePairsCollection) + { + List results = new List(); + Enum param; + object value; + Enum[] @params; + string description; + List list; + EquipmentParameter equipmentParameter; + ParameterTypeDefinition parameterTypeDefinition; + bool addToEquipmentParameters = !EquipmentParameters.Any(); + foreach (KeyValuePair>> keyValuePair in keyValuePairsCollection) + { + if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key)) + continue; + @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); + if (@params.Length != 1) + throw new Exception(); + if (keyValuePair.Value[0].Item2 != keyValuePair.Key) + throw new Exception(); + param = @params[0]; + if (!addToEquipmentParameters) + equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]]; + else + { + description = keyValuePair.Value[0].Item3; + _KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count()); + if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key))) + parameterTypeDefinition = _StructuredType; + else + parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString()); + equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description); + EquipmentParameters.Add(equipmentParameter); + } + if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key)) + value = keyValuePair.Value[0].Item4; + else + { + list = new List(); + for (int i = 0; i < keyValuePair.Value.Count; i++) + list.Add(new object[] { i, keyValuePair.Value[i].Item4 }); + value = list; + } + if (equipmentControl is null || !(param is Param.StructuredType)) + results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now)); + else + results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value)); + } + return results; + } + + public List GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary keyValuePairs = null) + { + List results = new List(); + if (_UseCyclical && (i is null || i.Value > 0)) + throw new Exception(); + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + Enum param; + Tuple tuple; + JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); + Dictionary>> keyValuePairsCollection = new Dictionary>>(); + for (int r = i.Value; r < jsonElements.Length; r++) + { + foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject()) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) + { + param = Param.StructuredType; + //jValue = jObject.Value("Item1"); + throw new NotImplementedException("Item1"); + } + else + { + switch (jsonProperty.Value.ValueKind) + { + case JsonValueKind.String: param = Param.String; break; + case JsonValueKind.Number: param = Param.Double; break; + case JsonValueKind.True: + case JsonValueKind.False: param = Param.Boolean; break; + case JsonValueKind.Null: param = Param.String; break; + default: param = Param.StructuredType; break; + } + } + tuple = new Tuple(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString()); + if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name)) + keyValuePairsCollection.Add(jsonProperty.Name, new List>()); + keyValuePairsCollection[jsonProperty.Name].Add(tuple); + } + if (!_UseCyclical) + break; + } + results = GetParameterValues(equipmentControl, keyValuePairsCollection); + return results; + } + + public static string GetCellName() + { + string result; + if (Backbone.Instance?.CellName is null) + result = string.Empty; + else + result = Backbone.Instance.CellName; + if (result.Contains("-IO")) + result = result.Replace("-IO", string.Empty); + return result; + } + + } + +} diff --git a/Shared/ExtendedParameter.cs b/Shared/ExtendedParameter.cs new file mode 100644 index 0000000..3db345a --- /dev/null +++ b/Shared/ExtendedParameter.cs @@ -0,0 +1,178 @@ +using Shared.Metrology; +using System; +using System.Collections.Generic; + +namespace Shared +{ + + public class ExtendedParameter + { + + public string DiplayName { get; set; } + public string ControlPlanName { get; set; } + public bool? CriticalToShip { get; set; } + public string Unit { get; set; } + public double? LSL { get; set; } + public double? TSL { get; set; } + public double? USL { get; set; } + public string Value { get; set; } + public bool? Ignore { get; set; } + + //public class ExtractorKeys + public string Lot { get; set; } //1 + public string ToolID { get; set; } //2 + public string Process { get; set; } //3 + public string WaferID { get; set; } //4 + public string Part { get; set; } //5 + public string Recipe { get; set; } //6 + public string ProcessFlow { get; set; } //7 + + //public class DataKeys + public string Employee { get; set; } //1 + public string SID { get; set; } //2 + public string WaferRegion { get; set; } //3 + public string WaferScribe { get; set; } //4 + public string WaferPosition { get; set; } //5 + public string X { get; set; } //6 + public string Y { get; set; } //7 + public string EAFCellInstance { get; set; } //8 + public string EAFReference { get; set; } //9 + public string IQSReference { get; set; } //10 + + public ExtendedParameter(Logistics logistics, string diplayName, string controlPlanName) + { + DiplayName = diplayName; + ControlPlanName = controlPlanName; + CriticalToShip = null; + Unit = string.Empty; + LSL = null; + TSL = null; + USL = null; + Ignore = null; + Value = string.Empty; + //public class ExtractorKeys + Lot = string.Empty; //1 + ToolID = string.Empty; //2 + Process = string.Empty; //3 + WaferID = string.Empty; //4 + Part = string.Empty; //5 + Recipe = string.Empty; //6 + ProcessFlow = string.Empty; //7 + //public class DataKeys + Employee = string.Empty; //1 + SID = string.Empty; //2 + WaferRegion = string.Empty; //3 + WaferScribe = string.Empty; //4 + WaferPosition = string.Empty; //5 + X = string.Empty; //6 + Y = string.Empty; //7 + EAFCellInstance = string.Empty; //8 + EAFReference = string.Empty; //9 + IQSReference = string.Empty; //10 + // + Lot = "-"; + SID = "-"; + Part = "-"; + if (!(logistics is null)) + { + ToolID = logistics.MesEntity; + EAFCellInstance = logistics.JobID; + } + } + + public override string ToString() + { + return Value; + } + + internal void Set(EquipmentConnection equipmentConnection, string queryFilter, Dictionary allColumnCollection) + { + Column key; + EAFReference = equipmentConnection.ToString(); + if (string.IsNullOrEmpty(queryFilter)) + IQSReference = null; + else + IQSReference = queryFilter; + // + key = Column.SID; + if (!allColumnCollection.ContainsKey(key)) + SID = "-"; + else + SID = allColumnCollection[key]; + key = Column.Employee; + if (!allColumnCollection.ContainsKey(key)) + Employee = "AUTO"; + else + Employee = allColumnCollection[key]; + // + key = Column.Lot; + if (allColumnCollection.ContainsKey(key)) + Lot = allColumnCollection[key]; + // + key = Column.Part; + if (allColumnCollection.ContainsKey(key)) + Part = allColumnCollection[key]; + // + key = Column.Process; + if (allColumnCollection.ContainsKey(key)) + Process = allColumnCollection[key]; + // + key = Column.Recipe; + if (allColumnCollection.ContainsKey(key)) + Recipe = allColumnCollection[key]; + // + key = Column.Wafer_ID; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.Denton_Gun_Pocket; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.WaferPocket_Candela; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.WaferPocket_Warp; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + // + key = Column.Wafer_ID; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.Denton_Gun_Pocket; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.WaferPocket_Candela; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + key = Column.WaferPocket_Warp; + if (allColumnCollection.ContainsKey(key)) + WaferID = allColumnCollection[key]; + // + key = Column.Wafer_Region; + if (allColumnCollection.ContainsKey(key)) + WaferRegion = allColumnCollection[key]; + key = Column.Wafer_Scribe; + if (allColumnCollection.ContainsKey(key)) + WaferScribe = allColumnCollection[key]; + key = Column.WaferPosition_BV; + if (allColumnCollection.ContainsKey(key)) + WaferPosition = allColumnCollection[key]; + key = Column.WaferPosition_CV; + if (allColumnCollection.ContainsKey(key)) + WaferPosition = allColumnCollection[key]; + key = Column.WaferPosition_Hall; + if (allColumnCollection.ContainsKey(key)) + WaferPosition = allColumnCollection[key]; + key = Column.WaferPosition_PR; + if (allColumnCollection.ContainsKey(key)) + WaferPosition = allColumnCollection[key]; + key = Column.X_Coord; + if (allColumnCollection.ContainsKey(key)) + X = allColumnCollection[key]; + key = Column.Y_Coord; + if (allColumnCollection.ContainsKey(key)) + Y = allColumnCollection[key]; + } + + } + +} diff --git a/Shared/FilePathGenerator.cs b/Shared/FilePathGenerator.cs new file mode 100644 index 0000000..0a441f6 --- /dev/null +++ b/Shared/FilePathGenerator.cs @@ -0,0 +1,35 @@ +using Ifx.Eaf.EquipmentConnector.File.Component; +using Ifx.Eaf.EquipmentConnector.File.Configuration; +using System.Collections.Generic; + +namespace Shared +{ + + public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator + { + + public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } + + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) : base(config, customPattern) + { + FileConnectorConfiguration = config; + } + + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) : base(config, file, isErrorFile, customPattern) + { + FileConnectorConfiguration = config; + } + + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) + { + FileConnectorConfiguration = config; + } + + public string GetSubFolderPath() + { + return SubFolderPath; + } + + } + +} diff --git a/Shared/FilePathGeneratorInfo.cs b/Shared/FilePathGeneratorInfo.cs new file mode 100644 index 0000000..e44626b --- /dev/null +++ b/Shared/FilePathGeneratorInfo.cs @@ -0,0 +1,67 @@ +using System.IO; + +namespace Shared +{ + + public class FilePathGeneratorInfo + { + + public string To { get; protected set; } + public string From { get; protected set; } + public bool IsErrorFile { get; protected set; } + public string SubFolderPath { get; protected set; } + public string FirstDirectory { get; protected set; } + public string ReportFullPath { get; protected set; } + public string ResolvedFileLocation { get; protected set; } + + public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary fileParameter) + { + ReportFullPath = reportFullPath; + IsErrorFile = isErrorFile; + if (originalFilePathGenerator is null || !(originalFilePathGenerator is FilePathGenerator)) + { + FirstDirectory = string.Empty; + ResolvedFileLocation = string.Empty; + To = string.Empty; + From = string.Empty; + } + else + { + string directorySeparatorChar = Path.DirectorySeparatorChar.ToString(); + FilePathGenerator original = (FilePathGenerator)originalFilePathGenerator; + FilePathGenerator filePathGenerator = new FilePathGenerator(original.FileConnectorConfiguration, reportFullPath, isErrorFile); + SubFolderPath = filePathGenerator.GetSubFolderPath(); + if (string.IsNullOrEmpty(SubFolderPath)) + FirstDirectory = SubFolderPath; + else + FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0]; + ResolvedFileLocation = filePathGenerator.GetTargetFolder(); + if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath)) + To = string.Empty; + else if (string.IsNullOrEmpty(SubFolderPath)) + To = ResolvedFileLocation; + else + To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory); +#if (true) + if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA"; + if (!(fileParameter is null) && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + { + foreach (var keyValuePair in fileParameter) + To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value); + } +#endif + if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar)) + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory); + else + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory); + if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar)) + To = string.Concat(To, Path.DirectorySeparatorChar); + else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar)) + To = To.Remove(To.Length - 1, 1); + } + } + + } + +}