MET08ANLYSDIFAAST230 - v4.43.0 - Use EDA multiple
This commit is contained in:
parent
9c042d3871
commit
2685dd79d5
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,7 +22,6 @@ x86/
|
|||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
172
.groovy
Normal file
172
.groovy
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
#!/usr/bin/env groovy
|
||||||
|
/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
|
||||||
|
import groovy.transform.Field
|
||||||
|
|
||||||
|
@Field String _DDrive = 'D:/'
|
||||||
|
@Field String _AssemblyName = '...'
|
||||||
|
@Field String _TargetLocation = '...'
|
||||||
|
@Field String _GitCommitSeven = '...'
|
||||||
|
@Field String _GitName = 'MET08ANLYSDIFAAST230'
|
||||||
|
@Field String _TestProjectDirectory = 'Adaptation'
|
||||||
|
@Field String _AgentStaging = 'mestsa07ec-ecmeseaf'
|
||||||
|
@Field String _DDriveNet = "${_DDrive}Framework4.8"
|
||||||
|
@Field String _AgentProduction = 'messa08ec-ecmeseaf'
|
||||||
|
@Field String _AgentDevelopment = 'mestsa003-mesedasvc'
|
||||||
|
@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe'
|
||||||
|
@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe'
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
|
||||||
|
}
|
||||||
|
parameters {
|
||||||
|
string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server')
|
||||||
|
string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...')
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Git') {
|
||||||
|
steps {
|
||||||
|
bat(returnStatus: true, script: 'git init')
|
||||||
|
bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git')
|
||||||
|
bat(returnStatus: true, script: 'git pull origin master')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Setup') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
_AssemblyName = "${env.JOB_NAME}"
|
||||||
|
_GitCommitSeven = '1234567'
|
||||||
|
// _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
|
||||||
|
def files = findFiles(glob: '*.csproj')
|
||||||
|
if (files.length != 1) {
|
||||||
|
error("Build failed because couldn't find a *.csproj file")
|
||||||
|
}
|
||||||
|
echo """
|
||||||
|
${files[0].name}
|
||||||
|
${files[0].path}
|
||||||
|
${files[0].directory}
|
||||||
|
${files[0].length}
|
||||||
|
${files[0].lastModified}
|
||||||
|
"""
|
||||||
|
_AssemblyName = files[0].name.split('[.]csproj')[0]
|
||||||
|
_TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Info') {
|
||||||
|
steps {
|
||||||
|
echo "_AssemblyName ${_AssemblyName}" // ...
|
||||||
|
echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
|
||||||
|
echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11
|
||||||
|
echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
|
||||||
|
echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
|
||||||
|
echo "GIT_SERVER ${params.GIT_SERVER}" // ...
|
||||||
|
echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git
|
||||||
|
echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11
|
||||||
|
echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
|
||||||
|
echo "JOB_NAME ${env.JOB_NAME}" // ...
|
||||||
|
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// stage('Restore') {
|
||||||
|
// steps {
|
||||||
|
// bat(returnStatus: true, script: 'dotnet --info')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
stage('Safe storage of app secrets') {
|
||||||
|
steps {
|
||||||
|
dir(_TestProjectDirectory) {
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
|
||||||
|
'user-secrets init')
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
|
||||||
|
'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"')
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
|
||||||
|
'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"')
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
|
||||||
|
'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Core Build') {
|
||||||
|
steps {
|
||||||
|
echo "Build number is ${currentBuild.number}"
|
||||||
|
dir(_TestProjectDirectory) {
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
|
||||||
|
'build --runtime win-x64 --self-contained --verbosity quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// stage('Test') {
|
||||||
|
// options {
|
||||||
|
// timeout(time: 10, unit: 'MINUTES')
|
||||||
|
// }
|
||||||
|
// steps {
|
||||||
|
// dir(_TestProjectDirectory) {
|
||||||
|
// bat('dotnet --info')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
stage('Framework Build') {
|
||||||
|
steps {
|
||||||
|
echo "Build number is ${currentBuild.number}"
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
|
||||||
|
'/target:Restore ' +
|
||||||
|
'/detailedsummary ' +
|
||||||
|
'/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
|
||||||
|
'/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
|
||||||
|
_AssemblyName + '.csproj')
|
||||||
|
bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
|
||||||
|
'/target:Build ' +
|
||||||
|
'/detailedsummary ' +
|
||||||
|
'/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
|
||||||
|
'/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
|
||||||
|
_AssemblyName + '.csproj')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Commit Id') {
|
||||||
|
steps {
|
||||||
|
dir('bin/Debug') {
|
||||||
|
writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Package') {
|
||||||
|
steps {
|
||||||
|
fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")])
|
||||||
|
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// stage('Force Fail') {
|
||||||
|
// steps {
|
||||||
|
// error("Build failed because of this and that..")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
stage('Copy Files to: file-share') {
|
||||||
|
steps {
|
||||||
|
dir('bin/Debug') {
|
||||||
|
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
|
||||||
|
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
|
||||||
|
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
|
||||||
|
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
dir('bin') {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
dir('obj') {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
dir(_TestProjectDirectory + '/bin') {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
dir(_TestProjectDirectory + '/obj') {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
// cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,137 +1,10 @@
|
|||||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
|
||||||
root = true
|
|
||||||
|
|
||||||
# C# files
|
|
||||||
[*.cs]
|
[*.cs]
|
||||||
|
csharp_indent_block_contents = true
|
||||||
#### Core EditorConfig Options ####
|
csharp_indent_braces = false
|
||||||
|
csharp_indent_case_contents = true
|
||||||
# Indentation and spacing
|
csharp_indent_case_contents_when_block = true
|
||||||
indent_size = 4
|
csharp_indent_labels = one_less_than_current
|
||||||
indent_style = space
|
csharp_indent_switch_labels = true
|
||||||
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_catch = true
|
||||||
csharp_new_line_before_else = true
|
csharp_new_line_before_else = true
|
||||||
csharp_new_line_before_finally = true
|
csharp_new_line_before_finally = true
|
||||||
@ -139,16 +12,13 @@ csharp_new_line_before_members_in_anonymous_types = true
|
|||||||
csharp_new_line_before_members_in_object_initializers = true
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
csharp_new_line_before_open_brace = all
|
csharp_new_line_before_open_brace = all
|
||||||
csharp_new_line_between_query_expression_clauses = true
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
csharp_prefer_braces = false
|
||||||
# Indentation preferences
|
csharp_prefer_simple_default_expression = true:warning
|
||||||
csharp_indent_block_contents = true
|
csharp_prefer_simple_using_statement = true:warning
|
||||||
csharp_indent_braces = false
|
csharp_prefer_static_local_function = true:warning
|
||||||
csharp_indent_case_contents = true
|
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
||||||
csharp_indent_case_contents_when_block = true
|
csharp_preserve_single_line_blocks = true
|
||||||
csharp_indent_labels = one_less_than_current
|
csharp_preserve_single_line_statements = false
|
||||||
csharp_indent_switch_labels = true
|
|
||||||
|
|
||||||
# Space preferences
|
|
||||||
csharp_space_after_cast = false
|
csharp_space_after_cast = false
|
||||||
csharp_space_after_colon_in_inheritance_clause = true
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
csharp_space_after_comma = true
|
csharp_space_after_comma = true
|
||||||
@ -171,166 +41,203 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
|||||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
csharp_space_between_parentheses = false
|
csharp_space_between_parentheses = false
|
||||||
csharp_space_between_square_brackets = false
|
csharp_space_between_square_brackets = false
|
||||||
|
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||||
# Wrapping preferences
|
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||||
csharp_preserve_single_line_blocks = true
|
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||||
csharp_preserve_single_line_statements = false
|
csharp_style_conditional_delegate_call = true
|
||||||
|
csharp_style_deconstructed_variable_declaration = false
|
||||||
#### Naming styles ####
|
csharp_style_expression_bodied_accessors = when_on_single_line:warning
|
||||||
|
csharp_style_expression_bodied_constructors = when_on_single_line:warning
|
||||||
# Naming rules
|
csharp_style_expression_bodied_indexers = when_on_single_line:warning
|
||||||
|
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
|
||||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
csharp_style_expression_bodied_methods = when_on_single_line:warning
|
||||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
csharp_style_expression_bodied_operators = when_on_single_line:warning
|
||||||
|
csharp_style_expression_bodied_properties = when_on_single_line:warning
|
||||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
|
||||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
csharp_style_inlined_variable_declaration = false
|
||||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
csharp_style_namespace_declarations = file_scoped:warning
|
||||||
|
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
csharp_style_prefer_index_operator = false:warning
|
||||||
|
csharp_style_prefer_not_pattern = true:warning
|
||||||
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
csharp_style_prefer_null_check_over_type_check = true
|
||||||
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
csharp_style_prefer_pattern_matching = true:warning
|
||||||
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
csharp_style_prefer_range_operator = false:warning
|
||||||
|
csharp_style_prefer_switch_expression = true:warning
|
||||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
|
csharp_style_throw_expression = true
|
||||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
|
csharp_style_unused_value_assignment_preference = discard_variable:warning
|
||||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
|
||||||
|
csharp_style_var_elsewhere = false:warning
|
||||||
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
csharp_style_var_for_built_in_types = false:warning
|
||||||
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
csharp_style_var_when_type_is_apparent = false:warning
|
||||||
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
csharp_using_directive_placement = outside_namespace
|
||||||
|
dotnet_code_quality_unused_parameters = all
|
||||||
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
|
||||||
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
dotnet_code_quality.CAXXXX.api_surface = private, internal
|
||||||
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
|
||||||
|
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
||||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||||
|
dotnet_diagnostic.IDE0005.severity = suggestion # Using directive is unnecessary using System.Text;
|
||||||
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||||
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
|
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
|
||||||
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.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.abstract_method_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||||
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
||||||
|
|
||||||
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.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.delegate_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
|
||||||
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
||||||
|
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
|
||||||
|
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||||
|
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
||||||
|
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
||||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.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
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||||
# Symbol specifications
|
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
||||||
|
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_symbols.class.applicable_kinds = class
|
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
||||||
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
||||||
dotnet_naming_symbols.class.required_modifiers =
|
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||||
|
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
||||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
||||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||||
dotnet_naming_symbols.interface.required_modifiers =
|
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
||||||
|
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_symbols.struct.applicable_kinds = struct
|
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
|
||||||
dotnet_naming_symbols.struct.required_modifiers =
|
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
|
||||||
|
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||||
dotnet_naming_symbols.enum.applicable_kinds = enum
|
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
|
||||||
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_symbols.enum.required_modifiers =
|
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
|
||||||
|
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
|
||||||
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_symbols.delegate.required_modifiers =
|
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
|
||||||
|
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
||||||
dotnet_naming_symbols.event.applicable_kinds = event
|
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
||||||
dotnet_naming_symbols.event.required_modifiers =
|
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||||
dotnet_naming_symbols.method.applicable_kinds = method
|
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||||
dotnet_naming_symbols.method.applicable_accessibilities = public
|
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||||
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_prefix = I
|
||||||
dotnet_naming_style.begins_with_i.required_suffix =
|
dotnet_naming_style.begins_with_i.required_suffix =
|
||||||
dotnet_naming_style.begins_with_i.word_separator =
|
dotnet_naming_style.begins_with_i.word_separator =
|
||||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
dotnet_naming_style.pascal_case.required_prefix =
|
||||||
|
dotnet_naming_style.pascal_case.required_suffix =
|
||||||
|
dotnet_naming_style.pascal_case.word_separator =
|
||||||
|
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
||||||
dotnet_naming_style.private_of_internal_field.required_prefix = _
|
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.required_suffix =
|
||||||
dotnet_naming_style.private_of_internal_field.word_separator =
|
dotnet_naming_style.private_of_internal_field.word_separator =
|
||||||
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.abstract_method.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
|
||||||
|
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.class.applicable_kinds = class
|
||||||
|
dotnet_naming_symbols.class.required_modifiers =
|
||||||
|
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
||||||
|
dotnet_naming_symbols.delegate.required_modifiers =
|
||||||
|
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.enum.applicable_kinds = enum
|
||||||
|
dotnet_naming_symbols.enum.required_modifiers =
|
||||||
|
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.event.applicable_kinds = event
|
||||||
|
dotnet_naming_symbols.event.required_modifiers =
|
||||||
|
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interface.required_modifiers =
|
||||||
|
dotnet_naming_symbols.method.applicable_accessibilities = public
|
||||||
|
dotnet_naming_symbols.method.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.method.required_modifiers =
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||||
|
dotnet_naming_symbols.private_method.applicable_accessibilities = private
|
||||||
|
dotnet_naming_symbols.private_method.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.private_method.required_modifiers =
|
||||||
|
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
|
||||||
|
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
|
||||||
|
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
|
||||||
|
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
|
||||||
|
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.property.applicable_kinds = property
|
||||||
|
dotnet_naming_symbols.property.required_modifiers =
|
||||||
|
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
|
||||||
|
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
|
||||||
|
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.static_field.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.static_field.required_modifiers = static
|
||||||
|
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.static_method.applicable_kinds = method
|
||||||
|
dotnet_naming_symbols.static_method.required_modifiers = static
|
||||||
|
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.struct.applicable_kinds = struct
|
||||||
|
dotnet_naming_symbols.struct.required_modifiers =
|
||||||
|
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.types.required_modifiers =
|
||||||
|
dotnet_remove_unnecessary_suppression_exclusions = 0
|
||||||
|
dotnet_separate_import_directive_groups = false
|
||||||
|
dotnet_sort_system_directives_first = false
|
||||||
|
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
|
||||||
|
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||||
|
dotnet_style_coalesce_expression = true
|
||||||
|
dotnet_style_collection_initializer = true:warning
|
||||||
|
dotnet_style_explicit_tuple_names = true:warning
|
||||||
|
dotnet_style_namespace_match_folder = true
|
||||||
|
dotnet_style_null_propagation = true:warning
|
||||||
|
dotnet_style_object_initializer = true:warning
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||||
|
dotnet_style_predefined_type_for_member_access = true
|
||||||
|
dotnet_style_prefer_auto_properties = true:warning
|
||||||
|
dotnet_style_prefer_compound_assignment = true:warning
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = false
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = false
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||||
|
dotnet_style_prefer_simplified_interpolation = true
|
||||||
|
dotnet_style_qualification_for_event = false:error
|
||||||
|
dotnet_style_qualification_for_field = false
|
||||||
|
dotnet_style_qualification_for_method = false:error
|
||||||
|
dotnet_style_qualification_for_property = false:error
|
||||||
|
dotnet_style_readonly_field = true:warning
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||||
|
end_of_line = crlf
|
||||||
|
file_header_template = unset
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
root = true
|
||||||
|
tab_width = 4
|
||||||
|
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
|
||||||
|
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
|
||||||
|
# https://github.com/dotnet/project-system/blob/main/.editorconfig
|
1
Adaptation/.vscode/format-report.json
vendored
Normal file
1
Adaptation/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
10
Adaptation/.vscode/launch.json
vendored
Normal file
10
Adaptation/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": ".NET Core Attach",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": 14072
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
45
Adaptation/.vscode/settings.json
vendored
Normal file
45
Adaptation/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"cSpell.words": [
|
||||||
|
"ANLYSDIFAAST",
|
||||||
|
"datauniqueid",
|
||||||
|
"Epuipment",
|
||||||
|
"EQPT",
|
||||||
|
"headerid",
|
||||||
|
"Idrv",
|
||||||
|
"ipdsf",
|
||||||
|
"Irng",
|
||||||
|
"ISMTP",
|
||||||
|
"JOBID",
|
||||||
|
"messa",
|
||||||
|
"messv",
|
||||||
|
"pdsf",
|
||||||
|
"pdsfc",
|
||||||
|
"PPID",
|
||||||
|
"Rcpe",
|
||||||
|
"RESIMAPCDE",
|
||||||
|
"Rsens",
|
||||||
|
"Smpl",
|
||||||
|
"Villach",
|
||||||
|
"Vrng"
|
||||||
|
],
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"activityBar.activeBackground": "#0fc5f0",
|
||||||
|
"activityBar.activeBorder": "#d20dac",
|
||||||
|
"activityBar.background": "#0fc5f0",
|
||||||
|
"activityBar.foreground": "#15202b",
|
||||||
|
"activityBar.inactiveForeground": "#15202b99",
|
||||||
|
"activityBarBadge.background": "#d20dac",
|
||||||
|
"activityBarBadge.foreground": "#e7e7e7",
|
||||||
|
"sash.hoverBorder": "#0fc5f0",
|
||||||
|
"statusBar.background": "#0c9ec0",
|
||||||
|
"statusBar.foreground": "#e7e7e7",
|
||||||
|
"statusBarItem.hoverBackground": "#0fc5f0",
|
||||||
|
"statusBarItem.remoteBackground": "#0c9ec0",
|
||||||
|
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||||
|
"titleBar.activeBackground": "#0c9ec0",
|
||||||
|
"titleBar.activeForeground": "#e7e7e7",
|
||||||
|
"titleBar.inactiveBackground": "#0c9ec099",
|
||||||
|
"titleBar.inactiveForeground": "#e7e7e799"
|
||||||
|
},
|
||||||
|
"peacock.color": "#0c9ec0"
|
||||||
|
}
|
42
Adaptation/.vscode/tasks.json
vendored
Normal file
42
Adaptation/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "publish",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "watch",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"watch",
|
||||||
|
"run",
|
||||||
|
"${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj",
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.Core
|
namespace Adaptation.Eaf.Core;
|
||||||
|
|
||||||
|
public class BackboneComponent
|
||||||
{
|
{
|
||||||
public class BackboneComponent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.Core
|
namespace Adaptation.Eaf.Core;
|
||||||
|
|
||||||
|
public class BackboneStatusCache
|
||||||
{
|
{
|
||||||
public class BackboneStatusCache
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.Core
|
namespace Adaptation.Eaf.Core;
|
||||||
|
|
||||||
|
public interface ILoggingSetupManager
|
||||||
{
|
{
|
||||||
public interface ILoggingSetupManager
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.Core
|
namespace Adaptation.Eaf.Core;
|
||||||
|
|
||||||
|
public class StatusItem
|
||||||
{
|
{
|
||||||
public class StatusItem
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -2,47 +2,52 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.Core
|
namespace Adaptation.Eaf.Core;
|
||||||
|
|
||||||
|
public class Backbone
|
||||||
{
|
{
|
||||||
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() { }
|
#pragma warning disable CA1822
|
||||||
|
#pragma warning disable CA2254
|
||||||
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
[NotNull]
|
public const string STATE_ERROR = "Error";
|
||||||
public static Backbone Instance { get; }
|
public const string STATE_OFFLINE = "Offline";
|
||||||
[NotNull]
|
public const string STATE_RUNNING = "Running";
|
||||||
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
|
public const string STATE_SHUTDOWN = "Shutting Down";
|
||||||
public BackboneStatusCache Status { get; }
|
public const string STATE_STARTING = "Starting";
|
||||||
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<string, BackboneComponent> BackboneComponents { get; }
|
|
||||||
|
|
||||||
public void AddBackboneComponent(BackboneComponent backboneComponent) { }
|
protected Backbone() { }
|
||||||
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.")]
|
[NotNull]
|
||||||
public List<StatusItem> GetAllStatuses() { throw new NotImplementedException(); }
|
public static Backbone Instance { get; }
|
||||||
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); }
|
[NotNull]
|
||||||
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); }
|
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
|
||||||
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); }
|
public BackboneStatusCache Status { get; }
|
||||||
public void RegisterSubprocess(int pid) { }
|
public bool IsAutomatedRestartActive { get; }
|
||||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
public bool IsReadyForRestart { get; }
|
||||||
public void SetStatus(string statusName, string statusValue) { }
|
public string StartTime { get; }
|
||||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
public string State { get; }
|
||||||
public void SetStatus(BackboneComponent source, string statusName, string statusValue) { }
|
public string Name { get; }
|
||||||
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
|
public string ConfigurationServiceAddress { get; }
|
||||||
protected virtual void StopAllComponents() { }
|
public string CellName { get; }
|
||||||
protected void StopComponents(List<BackboneComponent> components) { }
|
protected bool IsInitialized { get; set; }
|
||||||
}
|
protected Dictionary<string, BackboneComponent> 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<StatusItem> GetAllStatuses() => throw new NotImplementedException();
|
||||||
|
public BackboneComponent GetBackboneComponentById(string id) => throw new NotImplementedException();
|
||||||
|
public List<T> GetBackboneComponentsOfType<T>() => throw new NotImplementedException();
|
||||||
|
public List<BackboneComponent> 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<BackboneComponent> components) { }
|
||||||
|
protected virtual void StopAllComponents() { }
|
||||||
|
protected void StopComponents(List<BackboneComponent> components) { }
|
||||||
|
|
||||||
|
}
|
@ -1,24 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.Core.Smtp
|
namespace Adaptation.Eaf.Core.Smtp;
|
||||||
|
|
||||||
|
public class EmailMessage
|
||||||
{
|
{
|
||||||
|
|
||||||
public class EmailMessage
|
#pragma warning disable CA2254
|
||||||
{
|
#pragma warning disable IDE0060
|
||||||
public EmailMessage() { }
|
|
||||||
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
|
|
||||||
|
|
||||||
public string Body { get; }
|
public EmailMessage() { }
|
||||||
public MailPriority Priority { get; }
|
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
|
||||||
public string Subject { get; }
|
|
||||||
|
|
||||||
public EmailMessage PriorityHigh() { throw new NotImplementedException(); }
|
public string Body { get; }
|
||||||
public EmailMessage PriorityLow() { throw new NotImplementedException(); }
|
public MailPriority Priority { get; }
|
||||||
public EmailMessage PriorityNormal() { throw new NotImplementedException(); }
|
public string Subject { get; }
|
||||||
public EmailMessage SetBody(string body) { throw new NotImplementedException(); }
|
|
||||||
public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); }
|
|
||||||
public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); }
|
|
||||||
|
|
||||||
}
|
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();
|
||||||
|
|
||||||
}
|
}
|
@ -1,9 +1,6 @@
|
|||||||
namespace Adaptation.Eaf.Core.Smtp
|
namespace Adaptation.Eaf.Core.Smtp;
|
||||||
|
|
||||||
|
public interface ISmtp
|
||||||
{
|
{
|
||||||
|
void Send(EmailMessage message);
|
||||||
public interface ISmtp
|
}
|
||||||
{
|
|
||||||
void Send(EmailMessage message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +1,8 @@
|
|||||||
namespace Adaptation.Eaf.Core.Smtp
|
namespace Adaptation.Eaf.Core.Smtp;
|
||||||
|
|
||||||
|
public enum MailPriority
|
||||||
{
|
{
|
||||||
|
Low = 0,
|
||||||
public enum MailPriority
|
Normal = 1,
|
||||||
{
|
High = 2
|
||||||
Low = 0,
|
}
|
||||||
Normal = 1,
|
|
||||||
High = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class ChangeDataCollectionHandler
|
||||||
{
|
{
|
||||||
public class ChangeDataCollectionHandler
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class DataCollectionRequest
|
||||||
{
|
{
|
||||||
public class DataCollectionRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class EquipmentEvent
|
||||||
{
|
{
|
||||||
public class EquipmentEvent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class EquipmentException
|
||||||
{
|
{
|
||||||
public class EquipmentException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class EquipmentSelfDescription
|
||||||
{
|
{
|
||||||
public class EquipmentSelfDescription
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class GetParameterValuesHandler
|
||||||
{
|
{
|
||||||
public class GetParameterValuesHandler
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IConnectionControl
|
||||||
{
|
{
|
||||||
public interface IConnectionControl
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IDataTracingHandler
|
||||||
{
|
{
|
||||||
public interface IDataTracingHandler
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IEquipmentCommandService
|
||||||
{
|
{
|
||||||
public interface IEquipmentCommandService
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,16 +1,15 @@
|
|||||||
using Adaptation.PeerGroup.GCL.Annotations;
|
using Adaptation.PeerGroup.GCL.Annotations;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IEquipmentControl : IPackageSource
|
||||||
{
|
{
|
||||||
public interface IEquipmentControl : IPackageSource
|
[NotNull]
|
||||||
{
|
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
|
||||||
[NotNull]
|
[NotNull]
|
||||||
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
|
IEquipmentDataCollection DataCollection { get; }
|
||||||
[NotNull]
|
[NotNull]
|
||||||
IEquipmentDataCollection DataCollection { get; }
|
IEquipmentCommandService Commands { get; }
|
||||||
[NotNull]
|
[NotNull]
|
||||||
IEquipmentCommandService Commands { get; }
|
IConnectionControl Connection { get; }
|
||||||
[NotNull]
|
|
||||||
IConnectionControl Connection { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IEquipmentSelfDescriptionBuilder
|
||||||
{
|
{
|
||||||
public interface IEquipmentSelfDescriptionBuilder
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IPackage
|
||||||
{
|
{
|
||||||
public interface IPackage
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface ISelfDescriptionLookup
|
||||||
{
|
{
|
||||||
public interface ISelfDescriptionLookup
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IVirtualParameterValuesHandler
|
||||||
{
|
{
|
||||||
public interface IVirtualParameterValuesHandler
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class SetParameterValuesHandler
|
||||||
{
|
{
|
||||||
public class SetParameterValuesHandler
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public class TraceRequest
|
||||||
{
|
{
|
||||||
public class TraceRequest
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -3,37 +3,36 @@ using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
{
|
|
||||||
public interface IEquipmentDataCollection
|
|
||||||
{
|
|
||||||
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
|
|
||||||
ISelfDescriptionLookup SelfDescriptionLookup { get; }
|
|
||||||
EquipmentSelfDescription SelfDescription { get; }
|
|
||||||
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
|
|
||||||
IDataTracingHandler DataTracingHandler { get; }
|
|
||||||
|
|
||||||
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
|
public interface IEquipmentDataCollection
|
||||||
void NotifyDataTracingAvailable(bool isAvailable);
|
{
|
||||||
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
|
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
|
||||||
void RegisterDataTracingHandler(IDataTracingHandler handler);
|
ISelfDescriptionLookup SelfDescriptionLookup { get; }
|
||||||
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
|
EquipmentSelfDescription SelfDescription { get; }
|
||||||
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
|
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
|
||||||
void TriggerDeactivate(DataCollectionRequest deactivateRequest);
|
IDataTracingHandler DataTracingHandler { get; }
|
||||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
|
|
||||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
|
||||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
void NotifyDataTracingAvailable(bool isAvailable);
|
||||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
|
||||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
void RegisterDataTracingHandler(IDataTracingHandler handler);
|
||||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
|
||||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
|
||||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
void TriggerDeactivate(DataCollectionRequest deactivateRequest);
|
||||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
|
||||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||||
void TriggerPerformanceRestored();
|
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||||
void TriggerPerformanceWarning();
|
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
|
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
|
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||||
}
|
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||||
|
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||||
|
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||||
|
void TriggerPerformanceRestored();
|
||||||
|
void TriggerPerformanceWarning();
|
||||||
|
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
|
||||||
|
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||||
|
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.Control
|
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||||
|
|
||||||
|
public interface IPackageSource
|
||||||
{
|
{
|
||||||
public interface IPackageSource
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -2,19 +2,24 @@
|
|||||||
using Adaptation.PeerGroup.GCL.Annotations;
|
using Adaptation.PeerGroup.GCL.Annotations;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting
|
namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting;
|
||||||
|
|
||||||
|
public class ParameterValue
|
||||||
{
|
{
|
||||||
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; }
|
#pragma warning disable CA1822
|
||||||
[NotNull]
|
#pragma warning disable CA2254
|
||||||
public EquipmentParameter Definition { get; }
|
#pragma warning disable IDE0060
|
||||||
public DateTime Timestamp { get; protected set; }
|
|
||||||
|
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() => base.ToString();
|
||||||
|
|
||||||
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); }
|
|
||||||
public override string ToString() { return base.ToString(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,24 +1,27 @@
|
|||||||
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription
|
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||||
|
|
||||||
|
public class EquipmentParameter
|
||||||
{
|
{
|
||||||
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; }
|
#pragma warning disable CA2254
|
||||||
public string Id { get; }
|
#pragma warning disable IDE0060
|
||||||
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 EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
|
||||||
public string ToStringWithDetails() { return base.ToString(); }
|
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() => base.ToString();
|
||||||
|
public string ToStringWithDetails() => base.ToString();
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,16 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||||
{
|
|
||||||
public class Field
|
|
||||||
{
|
|
||||||
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
|
|
||||||
|
|
||||||
public string Name { get; }
|
public class Field
|
||||||
public string Description { get; }
|
{
|
||||||
public ParameterTypeDefinition TypeDefinition { get; }
|
|
||||||
public bool CanBeNull { get; }
|
#pragma warning disable CA2254
|
||||||
}
|
#pragma warning disable IDE0060
|
||||||
}
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,16 @@
|
|||||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||||
|
|
||||||
|
public abstract class ParameterTypeDefinition
|
||||||
{
|
{
|
||||||
public abstract class ParameterTypeDefinition
|
|
||||||
{
|
|
||||||
public ParameterTypeDefinition(string name, string description) { }
|
|
||||||
|
|
||||||
public string Name { get; }
|
#pragma warning disable CA2254
|
||||||
public string Description { get; }
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
public override string ToString() { return base.ToString(); }
|
public ParameterTypeDefinition(string name, string description) { }
|
||||||
}
|
|
||||||
}
|
public string Name { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
|
public override string ToString() => base.ToString();
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||||
|
|
||||||
|
public class StructuredType : ParameterTypeDefinition
|
||||||
{
|
{
|
||||||
public class StructuredType : ParameterTypeDefinition
|
|
||||||
{
|
|
||||||
|
|
||||||
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
#pragma warning disable CA1822
|
||||||
|
#pragma warning disable CA2254
|
||||||
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
public IList<Field> Fields { get; }
|
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
||||||
}
|
|
||||||
}
|
public IList<Field> Fields { get; }
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
|
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
|
||||||
|
public interface IConfigurationObject
|
||||||
{
|
{
|
||||||
public interface IConfigurationObject
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,26 +1,30 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
|
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.DataContract(IsReference = true)]
|
||||||
|
public class ModelObjectParameterDefinition : IConfigurationObject
|
||||||
{
|
{
|
||||||
[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]
|
#pragma warning disable CA2254
|
||||||
public virtual long Id { get; set; }
|
#pragma warning disable IDE0060
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
|
||||||
public virtual string Name { get; set; }
|
public ModelObjectParameterDefinition() { }
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
|
||||||
public virtual string Value { get; set; }
|
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
|
||||||
public virtual ModelObjectParameterType ValueType { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual long Id { get; set; }
|
||||||
public virtual string EnumType { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual string Name { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual string Value { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual ModelObjectParameterType ValueType { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual string EnumType { get; set; }
|
||||||
|
|
||||||
|
public virtual ModelObjectParameterDefinition Clone() => null;
|
||||||
|
public virtual bool IsValidValue(string value) => false;
|
||||||
|
|
||||||
public virtual ModelObjectParameterDefinition Clone() { return null; }
|
|
||||||
public virtual bool IsValidValue(string value) { return false; }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,17 +1,16 @@
|
|||||||
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
|
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
|
||||||
|
public enum ModelObjectParameterType
|
||||||
{
|
{
|
||||||
public enum ModelObjectParameterType
|
String = 0,
|
||||||
{
|
Bool = 1,
|
||||||
String = 0,
|
Byte = 2,
|
||||||
Bool = 1,
|
SignedByte = 3,
|
||||||
Byte = 2,
|
Integer = 4,
|
||||||
SignedByte = 3,
|
UnsignedInteger = 5,
|
||||||
Integer = 4,
|
LongInteger = 6,
|
||||||
UnsignedInteger = 5,
|
UnsignedLongInteger = 7,
|
||||||
LongInteger = 6,
|
Double = 8,
|
||||||
UnsignedLongInteger = 7,
|
Float = 9,
|
||||||
Double = 8,
|
Enum = 10
|
||||||
Float = 9,
|
|
||||||
Enum = 10
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,44 +1,43 @@
|
|||||||
using Adaptation.PeerGroup.GCL.SecsDriver;
|
using Adaptation.PeerGroup.GCL.SecsDriver;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances
|
namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances;
|
||||||
{
|
|
||||||
[System.Runtime.Serialization.DataContractAttribute]
|
|
||||||
public class SecsConnectionConfiguration
|
|
||||||
{
|
|
||||||
public SecsConnectionConfiguration() { }
|
|
||||||
|
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
[System.Runtime.Serialization.DataContract]
|
||||||
public virtual TimeSpan T6HsmsControlMessage { get; set; }
|
public class SecsConnectionConfiguration
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
{
|
||||||
public virtual TimeSpan T5ConnectionSeperation { get; set; }
|
public SecsConnectionConfiguration() { }
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
|
||||||
public virtual TimeSpan T4InterBlock { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T6HsmsControlMessage { get; set; }
|
||||||
public virtual TimeSpan T3MessageReply { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T5ConnectionSeperation { get; set; }
|
||||||
public virtual TimeSpan T2Protocol { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T4InterBlock { get; set; }
|
||||||
public virtual TimeSpan T1InterCharacter { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T3MessageReply { get; set; }
|
||||||
public virtual SerialBaudRate? BaudRate { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T2Protocol { get; set; }
|
||||||
public virtual SecsTransportType? PortType { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan T1InterCharacter { get; set; }
|
||||||
public virtual long? Port { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual SerialBaudRate? BaudRate { get; set; }
|
||||||
public virtual TimeSpan LinkTestTimer { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual SecsTransportType? PortType { get; set; }
|
||||||
public virtual string Host { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual long? Port { get; set; }
|
||||||
public virtual long? DeviceId { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual TimeSpan LinkTestTimer { get; set; }
|
||||||
public virtual HsmsSessionMode? SessionMode { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual string Host { get; set; }
|
||||||
public virtual HsmsConnectionMode? ConnectionMode { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual long? DeviceId { get; set; }
|
||||||
public virtual TimeSpan T7ConnectionIdle { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public virtual HsmsSessionMode? SessionMode { get; set; }
|
||||||
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
|
[System.Runtime.Serialization.DataMember]
|
||||||
}
|
public virtual HsmsConnectionMode? ConnectionMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual TimeSpan T7ConnectionIdle { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
|
||||||
}
|
}
|
123
Adaptation/FileHandlers/APC/FileRead.cs
Normal file
123
Adaptation/FileHandlers/APC/FileRead.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.APC;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
139
Adaptation/FileHandlers/Archive/FileRead.cs
Normal file
139
Adaptation/FileHandlers/Archive/FileRead.cs
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.Archive;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MoveArchive(DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
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(_FileConnectorConfiguration.TargetFileLocation, @"\", _Logistics.JobID);
|
||||||
|
if (!Directory.Exists(jobIdDirectory))
|
||||||
|
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||||
|
//string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory);
|
||||||
|
string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||||
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
|
Tuple<Test[], Dictionary<Test, List<Shared.Properties.IDescription>>> tuple = GetTuple(this, descriptions, extra: false);
|
||||||
|
MoveArchive(dateTime);
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tuple.Item1, jsonElements, new List<FileInfo>());
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
Adaptation/FileHandlers/CellInstanceConnectionName.cs
Normal file
31
Adaptation/FileHandlers/CellInstanceConnectionName.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers;
|
||||||
|
|
||||||
|
public class CellInstanceConnectionName
|
||||||
|
{
|
||||||
|
|
||||||
|
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
|
||||||
|
{
|
||||||
|
IFileRead result = cellInstanceConnectionName switch
|
||||||
|
{
|
||||||
|
nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(OpenInsightMetrologyViewer) => new OpenInsightMetrologyViewer.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(OpenInsightMetrologyViewerAttachments) => new OpenInsightMetrologyViewerAttachments.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(Processed) => new Processed.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
nameof(SPaCe) => new SPaCe.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||||
|
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
292
Adaptation/FileHandlers/Dummy/FileRead.cs
Normal file
292
Adaptation/FileHandlers/Dummy/FileRead.cs
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
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.Text.Json;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.Dummy;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly Timer _Timer;
|
||||||
|
private int _LastDummyRunIndex;
|
||||||
|
private readonly string[] _CellNames;
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
_LastDummyRunIndex = -1;
|
||||||
|
List<string> cellNames = new();
|
||||||
|
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
|
||||||
|
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Alias");
|
||||||
|
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
|
||||||
|
cellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1]);
|
||||||
|
_CellNames = cellNames.ToArray();
|
||||||
|
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||||
|
Callback(null);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||||
|
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName) => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract() => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CallbackInProcessCleared(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, string inProcessDirectory, long sequence, bool warning)
|
||||||
|
{
|
||||||
|
const string site = "sjc";
|
||||||
|
string stateName = string.Concat("Dummy_", _EventName);
|
||||||
|
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
|
||||||
|
MonIn monIn = MonIn.GetInstance(monInURL);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (warning)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory);
|
||||||
|
string[] 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 (!_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||||
|
{
|
||||||
|
foreach (string file in files)
|
||||||
|
File.Move(file, Path.Combine(targetFileLocation, Path.GetFileName(file)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||||
|
foreach (string directory in directories)
|
||||||
|
_ = Directory.CreateDirectory(string.Concat(targetFileLocation, directory.Substring(inProcessDirectory.Length)));
|
||||||
|
foreach (string file in files)
|
||||||
|
File.Move(file, string.Concat(targetFileLocation, 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)
|
||||||
|
{
|
||||||
|
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||||
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
|
try
|
||||||
|
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||||
|
catch (Exception) { }
|
||||||
|
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
|
||||||
|
_ = monIn.SendStatus(site, monARessource, stateName, State.Critical);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CallbackFileExists(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, long sequence)
|
||||||
|
{
|
||||||
|
string[] files;
|
||||||
|
bool warning = false;
|
||||||
|
if (!_DummyRuns.ContainsKey(monARessource))
|
||||||
|
_DummyRuns.Add(monARessource, new List<long>());
|
||||||
|
if (!_DummyRuns[monARessource].Contains(sequence))
|
||||||
|
_DummyRuns[monARessource].Add(sequence);
|
||||||
|
File.AppendAllLines(traceDummyFile, new string[] { sourceArchiveFile });
|
||||||
|
string inProcessDirectory = Path.Combine(_ProgressPath, "Dummy In-Process", sequence.ToString());
|
||||||
|
if (!Directory.Exists(inProcessDirectory))
|
||||||
|
_ = Directory.CreateDirectory(inProcessDirectory);
|
||||||
|
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||||
|
if (files.Any())
|
||||||
|
{
|
||||||
|
if (files.Length > 250)
|
||||||
|
throw new Exception("Safety net!");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string file in files)
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||||
|
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.AllDirectories);
|
||||||
|
else
|
||||||
|
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
if (new FileInfo(file).LastWriteTime.Ticks == sequence)
|
||||||
|
{
|
||||||
|
warning = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CallbackInProcessCleared(sourceArchiveFile, traceDummyFile, targetFileLocation, monARessource, inProcessDirectory, sequence, warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetCellName(string pathSegment)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
foreach (string cellName in _CellNames)
|
||||||
|
{
|
||||||
|
if (pathSegment.ToLower().Contains(cellName.ToLower()))
|
||||||
|
{
|
||||||
|
result = cellName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(result))
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
List<(string CellName, int Count)> cellNames = new();
|
||||||
|
foreach (string cellName in _CellNames)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
foreach (char @char in cellName.ToLower())
|
||||||
|
count += pathSegment.Length - pathSegment.ToLower().Replace(@char.ToString(), string.Empty).Length;
|
||||||
|
cellNames.Add(new(cellName, count));
|
||||||
|
}
|
||||||
|
result = (from l in cellNames orderby l.CellName.Length, l.Count descending select l.CellName).First();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Callback(object state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sourceParentDirectory;
|
||||||
|
string targetParentDirectory;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.SourceFileLocation)))
|
||||||
|
sourceParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation);
|
||||||
|
else
|
||||||
|
sourceParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation));
|
||||||
|
if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.TargetFileLocation)))
|
||||||
|
targetParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
|
||||||
|
else
|
||||||
|
targetParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation));
|
||||||
|
if (sourceParentDirectory != targetParentDirectory)
|
||||||
|
throw new Exception("Target and source must have the same parent for Si Dummy FileConnectorConfiguration!");
|
||||||
|
bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday;
|
||||||
|
if (!_IsEAFHosted || check)
|
||||||
|
{
|
||||||
|
string monARessource;
|
||||||
|
string sourceFileFilter;
|
||||||
|
string sourceArchiveFile;
|
||||||
|
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
|
string traceDummyDirectory = Path.Combine(Path.GetPathRoot(_TracePath), "TracesDummy", _CellInstanceName, "Source", $"{dateTime:yyyy}___Week_{weekOfYear}");
|
||||||
|
if (!Directory.Exists(traceDummyDirectory))
|
||||||
|
_ = Directory.CreateDirectory(traceDummyDirectory);
|
||||||
|
string traceDummyFile = Path.Combine(traceDummyDirectory, $"{dateTime.Ticks} - {_CellInstanceName}.txt");
|
||||||
|
File.AppendAllText(traceDummyFile, string.Empty);
|
||||||
|
for (int i = 0; i < _FileConnectorConfiguration.SourceFileFilters.Count; i++)
|
||||||
|
{
|
||||||
|
_LastDummyRunIndex += 1;
|
||||||
|
if (_LastDummyRunIndex >= _FileConnectorConfiguration.SourceFileFilters.Count)
|
||||||
|
_LastDummyRunIndex = 0;
|
||||||
|
sourceFileFilter = _FileConnectorConfiguration.SourceFileFilters[_LastDummyRunIndex];
|
||||||
|
sourceArchiveFile = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, sourceFileFilter);
|
||||||
|
if (File.Exists(sourceArchiveFile))
|
||||||
|
{
|
||||||
|
if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
|
||||||
|
throw new Exception("Invalid file name for source archive file!");
|
||||||
|
monARessource = GetCellName(sourceArchiveFile);
|
||||||
|
if (string.IsNullOrEmpty(monARessource))
|
||||||
|
throw new Exception("Could not determine which cell archive file is associated with!");
|
||||||
|
if (_IsEAFHosted)
|
||||||
|
CallbackFileExists(sourceArchiveFile, traceDummyFile, _FileConnectorConfiguration.TargetFileLocation, monARessource, sequence);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||||
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
|
try
|
||||||
|
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||||
|
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||||
|
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||||
|
try
|
||||||
|
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
204
Adaptation/FileHandlers/EDA/FileRead.cs
Normal file
204
Adaptation/FileHandlers/EDA/FileRead.cs
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.MoveMatchingFiles;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<string> GetSearchDirectories(int numberLength, string parentDirectory)
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string directory in directories)
|
||||||
|
{
|
||||||
|
if (Path.GetFileName(directory).Length != numberLength)
|
||||||
|
continue;
|
||||||
|
results.Add(directory);
|
||||||
|
}
|
||||||
|
results.Sort();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetMatchingFiles(long ticks, string reportFullPath, List<string> searchDirectories)
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
string[] found;
|
||||||
|
string fileName = Path.GetFileName(reportFullPath);
|
||||||
|
foreach (string searchDirectory in searchDirectories)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < int.MaxValue; i++)
|
||||||
|
{
|
||||||
|
found = Directory.GetFiles(searchDirectory, fileName, SearchOption.AllDirectories);
|
||||||
|
if (found.Any())
|
||||||
|
{
|
||||||
|
results.AddRange(found);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<(string matchingFile, string checkFile)> GetCollection(int numberLength, string parentDirectory, List<string> matchingFiles)
|
||||||
|
{
|
||||||
|
List<(string matchingFile, string checkFile)> results = new();
|
||||||
|
string checkFile;
|
||||||
|
int parentDirectoryLength = parentDirectory.Length;
|
||||||
|
foreach (string matchingFile in matchingFiles)
|
||||||
|
{
|
||||||
|
checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}";
|
||||||
|
results.Add(new(matchingFile, checkFile));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MoveCollection(long ticks, List<(string matchingFile, string checkFile)> collection)
|
||||||
|
{
|
||||||
|
string errFile;
|
||||||
|
string checkDirectory;
|
||||||
|
foreach ((string matchingFile, string checkFile) in collection)
|
||||||
|
{
|
||||||
|
errFile = string.Concat(checkFile, ".err");
|
||||||
|
checkDirectory = Path.GetDirectoryName(checkFile);
|
||||||
|
if (!Directory.Exists(checkDirectory))
|
||||||
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
|
File.Move(matchingFile, checkFile);
|
||||||
|
for (int i = 0; i < int.MaxValue; i++)
|
||||||
|
{
|
||||||
|
if (File.Exists(errFile))
|
||||||
|
throw new Exception(File.ReadAllText(errFile));
|
||||||
|
if (!File.Exists(checkFile))
|
||||||
|
break;
|
||||||
|
if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds)
|
||||||
|
throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
int numberLength = 2;
|
||||||
|
long ticks = DateTime.Now.Ticks;
|
||||||
|
string parentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath));
|
||||||
|
List<string> searchDirectories = GetSearchDirectories(numberLength, parentDirectory);
|
||||||
|
List<string> matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories);
|
||||||
|
if (matchingFiles.Count != searchDirectories.Count)
|
||||||
|
throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!");
|
||||||
|
List<(string matchingFile, string checkFile)> collection = GetCollection(numberLength, parentDirectory, matchingFiles);
|
||||||
|
MoveCollection(ticks, collection);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,324 +0,0 @@
|
|||||||
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.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class FileRead : ILogic
|
|
||||||
{
|
|
||||||
|
|
||||||
private ConfigData _ConfigData;
|
|
||||||
|
|
||||||
public FileRead()
|
|
||||||
{
|
|
||||||
Logistics = new Logistics();
|
|
||||||
_Log = LogManager.GetLogger(typeof(FileRead));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ILogic ShallowCopy()
|
|
||||||
{
|
|
||||||
return (ILogic)MemberwiseClone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WaitForThread()
|
|
||||||
{
|
|
||||||
WaitForThread(thread: null, threadExceptions: null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tuple<string, ConfigDataBase> GetOpenInsightTuple()
|
|
||||||
{
|
|
||||||
Tuple<string, ConfigDataBase> restuls = new Tuple<string, ConfigDataBase>(_ConfigData.OpenInsightSiViewer, _ConfigData);
|
|
||||||
return restuls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Extract(string reportFullPath, string eventName)
|
|
||||||
{
|
|
||||||
MethodBase methodBase = new StackFrame().GetMethod();
|
|
||||||
_Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}"));
|
|
||||||
Tuple<string, JsonElement?, List<FileInfo>> extractResults = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
extractResults = GetExtractResult(reportFullPath, eventName);
|
|
||||||
int count = extractResults.Item2.Value.GetArrayLength();
|
|
||||||
if (count > 0 && _ConfigData.EafHosted && (_ConfigData.IsDatabaseExportToIPDSF || !_ConfigData.IsSourceTimer))
|
|
||||||
Shared1140(extractResults.Item2.Value);
|
|
||||||
Shared0704(reportFullPath, extractResults, count);
|
|
||||||
Move(reportFullPath, extractResults);
|
|
||||||
Shared0406(reportFullPath);
|
|
||||||
_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));
|
|
||||||
Move(reportFullPath, extractResults, exception: ex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//public void SetColumns(string equipmentElementName, EquipmentType? equipmentType, string reportFullPath, Exception ex) //GaN
|
|
||||||
//{
|
|
||||||
// if (equipmentConnection is null)
|
|
||||||
// throw new Exception(string.Concat("Unable to cast EquipmentElementName {", equipmentElementName, "}!"));
|
|
||||||
// int breakAfterSeconds;
|
|
||||||
// if (_Configuration is null)
|
|
||||||
// breakAfterSeconds = 360;
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// if (_Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased)
|
|
||||||
// breakAfterSeconds = 360;
|
|
||||||
// else
|
|
||||||
// breakAfterSeconds = Math.Abs(_Configuration.FileScanningIntervalInSeconds);
|
|
||||||
// }
|
|
||||||
// ExtractResult = new ExtractResult(breakAfterSeconds, enumColumns: null, pairedColumns: null);
|
|
||||||
// switch (equipmentConnection.Value)
|
|
||||||
// {
|
|
||||||
// case EquipmentConnection.MET08DDUPSFS6420:
|
|
||||||
// ExtractResult.HeadersAddRange(Column.Process);
|
|
||||||
// ExtractResult.DetailsAddRange();
|
|
||||||
// ExtractResult.ParametersAddRange();
|
|
||||||
// ExtractResult.DatabaseHeadersAddRange();
|
|
||||||
// ExtractResult.DatabaseDetailsAddRange();
|
|
||||||
// break;
|
|
||||||
// case EquipmentConnection.MET08DDUPSP1TBI:
|
|
||||||
// ExtractResult.HeadersAddRange(Column.Process);
|
|
||||||
// ExtractResult.DetailsAddRange();
|
|
||||||
// ExtractResult.ParametersAddRange();
|
|
||||||
// ExtractResult.DatabaseHeadersAddRange();
|
|
||||||
// ExtractResult.DatabaseDetailsAddRange();
|
|
||||||
// break;
|
|
||||||
// case EquipmentConnection.MET08RESIHGCV:
|
|
||||||
// ExtractResult.HeadersAddRange(Column.Process);
|
|
||||||
// ExtractResult.DetailsAddRange();
|
|
||||||
// ExtractResult.ParametersAddRange();
|
|
||||||
// ExtractResult.DatabaseHeadersAddRange();
|
|
||||||
// ExtractResult.DatabaseDetailsAddRange();
|
|
||||||
// break;
|
|
||||||
// case EquipmentConnection.MET08THFTIRQS408M:
|
|
||||||
// ExtractResult.HeadersAddRange(Column.Process);
|
|
||||||
// ExtractResult.DetailsAddRange();
|
|
||||||
// ExtractResult.ParametersAddRange();
|
|
||||||
// ExtractResult.DatabaseHeadersAddRange();
|
|
||||||
// ExtractResult.DatabaseDetailsAddRange();
|
|
||||||
// break;
|
|
||||||
// case EquipmentConnection.MET08THFTIRSTRATUS:
|
|
||||||
// ExtractResult.HeadersAddRange(Column.Process);
|
|
||||||
// ExtractResult.DetailsAddRange();
|
|
||||||
// ExtractResult.ParametersAddRange();
|
|
||||||
// ExtractResult.DatabaseHeadersAddRange();
|
|
||||||
// ExtractResult.DatabaseDetailsAddRange();
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// throw new Exception(string.Concat("Else {", equipmentElementName, "}!"));
|
|
||||||
// }
|
|
||||||
// if (!string.IsNullOrEmpty(reportFullPath) && !(ex is null))
|
|
||||||
// {
|
|
||||||
// if (!(_Configuration is null) && _ConfigData.IsDuplicator)
|
|
||||||
// try { File.WriteAllLines(string.Concat(_Configuration.ErrorTargetFileLocation, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".err"), new string[] { Logistics.Sequence.ToString(), ex.Message, string.Empty, string.Empty, ex.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(), ex.Message, string.Empty, string.Empty, ex.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(), ex.Message, string.Empty, string.Empty, ex.StackTrace }); } catch (Exception) { }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// List<string> debug = new List<string> { "//Exception:" };
|
|
||||||
// if (!(Logistics is null) && !(Logistics.Tags is null))
|
|
||||||
// debug.AddRange(Logistics.Tags);
|
|
||||||
// debug.Add(ex.Message);
|
|
||||||
// debug.Add(ex.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 Tuple<string, JsonElement?, List<FileInfo>> GetExtractResult(string reportFullPath, string eventName)
|
|
||||||
{
|
|
||||||
Tuple<string, JsonElement?, List<FileInfo>> 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 if (!_ConfigData.IsSourceIPDSF && reportFullPath.EndsWith(".ipdsf"))
|
|
||||||
{
|
|
||||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(string.Empty, null, new List<FileInfo>());
|
|
||||||
NewMethod1(reportFullPath);
|
|
||||||
}
|
|
||||||
else if (reportFullPath.EndsWith(".pdsf"))
|
|
||||||
{
|
|
||||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(string.Empty, null, new List<FileInfo>());
|
|
||||||
NewMethod2(reportFullPath, results);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
if (results.Item2 is null)
|
|
||||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(results.Item1, JsonSerializer.Deserialize<JsonElement>("[]"), 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 void NewMethod2(string reportFullPath, Tuple<string, JsonElement?, List<FileInfo>> results)
|
|
||||||
{
|
|
||||||
FileInfo fileInfo = new FileInfo(reportFullPath);
|
|
||||||
Logistics = new Logistics(ConfigData.NullData, _ConfigData.CellNames, _ConfigData.MesEntities, fileInfo, useSplitForMID: false);
|
|
||||||
ProcessData processData = new ProcessData(this, _ConfigData, results.Item3, string.Empty, string.Empty);
|
|
||||||
if (!processData.Details.Any())
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//foreach (var item in result.Details)
|
|
||||||
//{
|
|
||||||
// ExtractResult.RowColumns[Description.RowColumn.Test].Add((int)Shared.Metrology.MET08ANLYSDIFAAST230.Test.DiffusionLength);
|
|
||||||
// ExtractResult.Headers[Column.Process].Add(item.Reactor);
|
|
||||||
// ExtractResult.Headers[Column.Employee].Add(item.Employee);
|
|
||||||
// ExtractResult.Headers[Column.Wafer_ID].Add(item.Slot);
|
|
||||||
// ExtractResult.Headers[Column.Recipe].Add(item.Recipe);
|
|
||||||
// ExtractResult.Parameters[Column.Wafer_Region].Add(item.DiffusionLength);
|
|
||||||
// ExtractResult.Parameters[Column.Wafer_Scribe].Add(item.DiffusionLengthStandardDeviation);
|
|
||||||
//}
|
|
||||||
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Reactor)).Append(";");
|
|
||||||
stringBuilder.Append("Date").Append(";");
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Employee)).Append(";");
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Slot)).Append(";");
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Recipe)).Append(";");
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.DiffusionLength)).Append(";");
|
|
||||||
stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.DiffusionLengthStandardDeviation)).Append(";");
|
|
||||||
stringBuilder.AppendLine();
|
|
||||||
foreach (var item in processData.Details)
|
|
||||||
{
|
|
||||||
stringBuilder.Append("!");
|
|
||||||
stringBuilder.Append(item.Reactor).Append(";");
|
|
||||||
stringBuilder.Append(Logistics.DateTimeFromSequence.ToString("MM/dd/yyyy HH:mm:ss")).Append(";");
|
|
||||||
stringBuilder.Append(item.Employee).Append(";");
|
|
||||||
stringBuilder.Append(item.Slot).Append(";");
|
|
||||||
stringBuilder.Append(item.Recipe).Append(";");
|
|
||||||
stringBuilder.Append(item.DiffusionLength).Append(";");
|
|
||||||
stringBuilder.Append(item.DiffusionLengthStandardDeviation);
|
|
||||||
stringBuilder.AppendLine();
|
|
||||||
}
|
|
||||||
string copyFile = string.Concat(_ConfigData.IqsTempPath, @"\", _ConfigData.IqsFile, ".txt");
|
|
||||||
File.WriteAllText(copyFile, stringBuilder.ToString());
|
|
||||||
File.Copy(copyFile, string.Concat(_ConfigData.IqsPath, @"\", _ConfigData.IqsFile, ".txt"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NewMethod1(string reportFullPath)
|
|
||||||
{
|
|
||||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
|
||||||
Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
|
||||||
SetFileParameterSystemDateTimeToLogisticsSequence();
|
|
||||||
var data = ProcessDataStandardFormat.GetTestDictionary(pdsf);
|
|
||||||
ExtractResult.SetCollections(Logistics, data.Item2);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NewMethod(string reportFullPath)
|
|
||||||
{
|
|
||||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
|
||||||
Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
|
||||||
SetFileParameterLotIDToLogisticsMID();
|
|
||||||
SetFileParameterSystemDateTimeToLogisticsSequence();
|
|
||||||
bool hardSkip = _Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased; //false;
|
|
||||||
if (!hardSkip && _Configuration.FileScanningIntervalInSeconds > 0 && !_ConfigData.IsArchive)
|
|
||||||
{
|
|
||||||
string successDirectory;
|
|
||||||
string duplicateDirectory;
|
|
||||||
if (!_ConfigData.IsXToAPC)
|
|
||||||
successDirectory = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
successDirectory = string.Concat(Path.GetDirectoryName(_Configuration.TargetFileLocation), @"\ViewerPath");
|
|
||||||
if (!Directory.Exists(successDirectory))
|
|
||||||
Directory.CreateDirectory(successDirectory);
|
|
||||||
}
|
|
||||||
if (_ConfigData.IsXToSPaCe || _ConfigData.IsXToSPaCeVillach)
|
|
||||||
duplicateDirectory = _Configuration.TargetFileLocation;
|
|
||||||
else
|
|
||||||
duplicateDirectory = string.Concat(_Configuration.TargetFileLocation, @"\", Logistics.JobID);
|
|
||||||
if (!Directory.Exists(duplicateDirectory))
|
|
||||||
Directory.CreateDirectory(duplicateDirectory);
|
|
||||||
string logisticsSequence = Logistics.Sequence.ToString();
|
|
||||||
List<Tuple<IScopeInfo, string>> tuples = new List<Tuple<IScopeInfo, string>>();
|
|
||||||
string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath));
|
|
||||||
if (!_ConfigData.IsXToArchive && !_ConfigData.IsXToIQS)
|
|
||||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Enum[] enumColumns = new Enum[] { ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Move(string reportFullPath, Tuple<string, JsonElement?, List<FileInfo>> extractResults, Exception exception = null)
|
|
||||||
{
|
|
||||||
bool isErrorFile = !(exception is null);
|
|
||||||
object filePathGeneratorInfo = GetFilePathGeneratorInfo(reportFullPath, isErrorFile);
|
|
||||||
if (filePathGeneratorInfo is null || !(filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator))
|
|
||||||
OISiViewer.WebClientDownloadString(_Description, reportFullPath, isErrorFile, string.Empty);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FilePathGeneratorInfo info = (FilePathGeneratorInfo)filePathGeneratorInfo;
|
|
||||||
OISiViewer.WebClientDownloadString(_Description, reportFullPath, isErrorFile, filePathGenerator.To);
|
|
||||||
if (isErrorFile)
|
|
||||||
{
|
|
||||||
string[] exceptionLines = new string[] { Logistics.Sequence.ToString(), filePathGenerator.ReportFullPath, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, filePathGenerator.To, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
|
|
||||||
if (_ConfigData.IsDuplicator)
|
|
||||||
CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, level, exceptionLines);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string fileName = string.Concat(filePathGenerator.To, @"\readme.txt");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(filePathGenerator.To))
|
|
||||||
Directory.CreateDirectory(filePathGenerator.To);
|
|
||||||
File.WriteAllLines(fileName, exceptionLines);
|
|
||||||
}
|
|
||||||
catch (Exception ex) { _Log.Error(ex.Message); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isErrorFile && _ConfigData.IsDuplicator)
|
|
||||||
{
|
|
||||||
if (_ConfigData.IsXToArchive)
|
|
||||||
Shared0192(reportFullPath);
|
|
||||||
else if (_ConfigData.IsArchive)
|
|
||||||
{
|
|
||||||
//Archive
|
|
||||||
}
|
|
||||||
if (_ConfigData.EafHosted && !string.IsNullOrEmpty(_ConfigData.ProgressPath))
|
|
||||||
CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, level, exceptionLines: null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
145
Adaptation/FileHandlers/IQSSi/FileRead.cs
Normal file
145
Adaptation/FileHandlers/IQSSi/FileRead.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.IQSSi;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyFileAndWait(string reportFullPath)
|
||||||
|
{
|
||||||
|
long ticks = DateTime.Now.Ticks;
|
||||||
|
string parentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)));
|
||||||
|
string jobIdDirectory = Path.Combine(parentDirectory, _Logistics.JobID);
|
||||||
|
string jobIdDirectoryFile = Path.Combine(jobIdDirectory, Path.GetFileName(reportFullPath));
|
||||||
|
string errFile = string.Concat(jobIdDirectoryFile, ".err");
|
||||||
|
if (!Directory.Exists(jobIdDirectory))
|
||||||
|
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||||
|
File.Copy(reportFullPath, jobIdDirectoryFile);
|
||||||
|
for (int i = 0; i < int.MaxValue; i++)
|
||||||
|
{
|
||||||
|
if (File.Exists(errFile))
|
||||||
|
throw new Exception(File.ReadAllText(errFile));
|
||||||
|
if (!File.Exists(jobIdDirectoryFile))
|
||||||
|
break;
|
||||||
|
if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds)
|
||||||
|
throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
CopyFileAndWait(reportFullPath);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
Adaptation/FileHandlers/OpenInsight/FileRead.cs
Normal file
123
Adaptation/FileHandlers/OpenInsight/FileRead.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.OpenInsight;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs
Normal file
123
Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewerAttachments;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
Adaptation/FileHandlers/Processed/FileRead.cs
Normal file
123
Adaptation/FileHandlers/Processed/FileRead.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.Processed;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
Adaptation/FileHandlers/SPaCe/FileRead.cs
Normal file
123
Adaptation/FileHandlers/SPaCe/FileRead.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared;
|
||||||
|
using Adaptation.Shared.Duplicator;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.FileHandlers.SPaCe;
|
||||||
|
|
||||||
|
public class FileRead : Shared.FileRead, IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||||
|
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||||
|
{
|
||||||
|
_MinFileLength = 10;
|
||||||
|
_NullData = string.Empty;
|
||||||
|
_Logistics = new Logistics(this);
|
||||||
|
if (_FileParameter is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (_ModelObjectParameterDefinitions is null)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (!_IsDuplicator)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||||
|
{
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||||
|
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||||
|
}
|
||||||
|
Move(extractResults, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||||
|
|
||||||
|
string IFileRead.GetEventDescription()
|
||||||
|
{
|
||||||
|
string result = _Description.GetEventDescription();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IFileRead.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = _Description.GetHeaderNames();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IFileRead.GetDefault()
|
||||||
|
{
|
||||||
|
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (string.IsNullOrEmpty(eventName))
|
||||||
|
throw new Exception();
|
||||||
|
_ReportFullPath = reportFullPath;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
results = GetExtractResult(reportFullPath, dateTime);
|
||||||
|
if (results.Item3 is null)
|
||||||
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||||
|
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||||
|
WritePDSF(this, results.Item3);
|
||||||
|
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
List<string> headerNames = _Description.GetHeaderNames();
|
||||||
|
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||||
|
results = ReExtract(this, headerNames, keyValuePairs);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||||
|
{
|
||||||
|
if (_Description is not Description)
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime == DateTime.MinValue)
|
||||||
|
{ }
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||||
|
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||||
|
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||||
|
SetFileParameterLotIDToLogisticsMID();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,20 +0,0 @@
|
|||||||
namespace Adaptation.Helpers
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class ConfigData
|
|
||||||
{
|
|
||||||
public enum Level
|
|
||||||
{
|
|
||||||
IsXToIQS,
|
|
||||||
IsXToOpenInsight,
|
|
||||||
IsXToAPC,
|
|
||||||
IsXToSPaCe,
|
|
||||||
IsXToSPaCeVillach,
|
|
||||||
IsXToArchive,
|
|
||||||
IsArchive,
|
|
||||||
IsDummy
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,711 +0,0 @@
|
|||||||
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.Text.Json;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Adaptation.Helpers
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class ConfigData : ConfigDataBase
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class Reactor
|
|
||||||
{
|
|
||||||
public string Name { get; internal set; }
|
|
||||||
public string FilePrefix { get; internal set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal const object NullData = null;
|
|
||||||
internal const int MinFileLength = 100;
|
|
||||||
|
|
||||||
public bool EC { get; private set; }
|
|
||||||
public string ApcPath { get; private set; }
|
|
||||||
public string EdaPath { get; private set; }
|
|
||||||
public string IqsFile { get; private set; }
|
|
||||||
public string IqsPath { get; private set; }
|
|
||||||
public string TracePath { get; private set; }
|
|
||||||
public Level? Duplicator { get; private set; }
|
|
||||||
public string IfxChannel { get; private set; }
|
|
||||||
public string IfxSubject { get; private set; }
|
|
||||||
public string IqsTempPath { get; private set; }
|
|
||||||
public string VillachPath { get; private set; }
|
|
||||||
public string LogisticPath { get; private set; }
|
|
||||||
public string ProgressPath { get; private set; }
|
|
||||||
public string IqsQueryFilter { get; private set; }
|
|
||||||
public string IfxSubjectPrefix { get; private set; }
|
|
||||||
public List<string> MappedParts { get; private set; }
|
|
||||||
public string OpenInsightSiViewer { get; internal set; }
|
|
||||||
public string ArchiveSourceDirectory { get; private set; }
|
|
||||||
public string ConnectionStringIrmnSpc { get; private set; }
|
|
||||||
public string ConnectionStringG4Wafers { get; private set; }
|
|
||||||
public string IfxConfigurationLocation { get; private set; }
|
|
||||||
public List<string> TransportSetupMessages { get; private set; }
|
|
||||||
public string IfxConfigurationLocationLocalCopy { get; private set; }
|
|
||||||
public static Dictionary<string, List<long>> 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<ModelObjectParameterDefinition> modelObjectParameterDefinitions, string parameterizedModelObjectDefinitionType, bool isEAFHosted) :
|
|
||||||
base(cellName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, isEAFHosted)
|
|
||||||
{
|
|
||||||
_LastDummyRunIndex = -1;
|
|
||||||
TransportSetupMessages = new List<string>();
|
|
||||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
|
||||||
_Calendar = cultureInfo.Calendar;
|
|
||||||
string firstSourceFileFilter = fileConnectorConfiguration.SourceFileFilter.Split('|')[0];
|
|
||||||
IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter == "*Timer.txt");
|
|
||||||
if (DummyRuns is null)
|
|
||||||
DummyRuns = new Dictionary<string, List<long>>();
|
|
||||||
bool isDuplicator = cellInstanceConnectionName.StartsWith(cellName);
|
|
||||||
if (!isDuplicator)
|
|
||||||
Duplicator = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CellNames.Add(cellName, cellName);
|
|
||||||
MesEntities.Add(cellName, cellName);
|
|
||||||
int level = (cellInstanceConnectionName.Length - cellInstanceConnectionName.Replace("-", string.Empty).Length);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
MappedParts = new List<string>();
|
|
||||||
System.Net.NetworkInformation.IPGlobalProperties ipGlobalProperties = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties();
|
|
||||||
EC = (ipGlobalProperties.DomainName.ToLower().Contains("ec.local"));
|
|
||||||
bool isMET08PRFUSB4000Villach = (equipmentElementName == string.Concat(EquipmentType.MET08PRFUSB4000, "_Villach"));
|
|
||||||
if (!modelObjectParameterDefinitions.Any())
|
|
||||||
{
|
|
||||||
CellNames.Add(cellName, "****"); MesEntities.Add(cellName, "****");
|
|
||||||
IfxChannel = string.Empty;
|
|
||||||
IfxSubjectPrefix = string.Empty;
|
|
||||||
IfxConfigurationLocation = string.Empty;
|
|
||||||
IfxConfigurationLocationLocalCopy = string.Empty;
|
|
||||||
IfxSubject = string.Empty;
|
|
||||||
ArchiveSourceDirectory = string.Empty;
|
|
||||||
ConnectionStringG4Wafers = string.Empty;
|
|
||||||
ConnectionStringIrmnSpc = string.Empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
string key;
|
|
||||||
string variable = string.Empty;
|
|
||||||
Dictionary<string, string> iqsSection = new Dictionary<string, string>();
|
|
||||||
Dictionary<string, string> pathSection = new Dictionary<string, string>();
|
|
||||||
Dictionary<string, string> tibcoSection = new Dictionary<string, string>();
|
|
||||||
Dictionary<string, string> commonSection = new Dictionary<string, string>();
|
|
||||||
List<Tuple<string, string>> reactorTuples = new List<Tuple<string, string>>();
|
|
||||||
Dictionary<string, string> openInsightSection = new Dictionary<string, string>();
|
|
||||||
Dictionary<string, string> connectionStringsSection = new Dictionary<string, string>();
|
|
||||||
Dictionary<string, Dictionary<string, string>> reactorSection = new Dictionary<string, Dictionary<string, string>>();
|
|
||||||
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 == "PATH")
|
|
||||||
pathSection.Add(variable, modelObjectParameterDefinition.Value);
|
|
||||||
else if (key == "REACTOR")
|
|
||||||
reactorTuples.Add(new Tuple<string, string>(variable, modelObjectParameterDefinition.Value));
|
|
||||||
else if (key == "TIBCO")
|
|
||||||
tibcoSection.Add(variable, modelObjectParameterDefinition.Value);
|
|
||||||
else if (key == "OpenInsight")
|
|
||||||
openInsightSection.Add(variable, modelObjectParameterDefinition.Value);
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
foreach (Tuple<string, string> tuple in reactorTuples)
|
|
||||||
{
|
|
||||||
if (!tuple.Item1.Contains('.'))
|
|
||||||
continue;
|
|
||||||
index = tuple.Item1.IndexOf(".");
|
|
||||||
if (index <= -1)
|
|
||||||
continue;
|
|
||||||
key = tuple.Item1.Substring(0, index);
|
|
||||||
variable = tuple.Item1.Substring(index + 1);
|
|
||||||
if (!reactorSection.ContainsKey(key))
|
|
||||||
reactorSection.Add(key, new Dictionary<string, string>() { { "NAME", key } });
|
|
||||||
reactorSection[key].Add(variable, tuple.Item2);
|
|
||||||
}
|
|
||||||
if (!iqsSection.Any())
|
|
||||||
throw new Exception("IQS section is missing from configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
key = "PATH";
|
|
||||||
if (iqsSection.ContainsKey(key))
|
|
||||||
IqsPath = iqsSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception(string.Concat("Missing IQS Configuration entry for ", key));
|
|
||||||
if (string.IsNullOrEmpty(IqsPath))
|
|
||||||
throw new Exception(string.Format("IQS key {0} is empty", key));
|
|
||||||
key = "FILE";
|
|
||||||
if (iqsSection.ContainsKey(key))
|
|
||||||
IqsFile = iqsSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception(string.Concat("Missing IQS Configuration entry for ", key));
|
|
||||||
if (eventName.HasValue && eventName.Value == EventName.FileRead && 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 (eventName.HasValue && eventName.Value == EventName.FileRead && 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 = "LOGISTIC";
|
|
||||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
|
||||||
LogisticPath = pathSection[key];
|
|
||||||
if (!string.IsNullOrEmpty(LogisticPath) && !Directory.Exists(LogisticPath))
|
|
||||||
Directory.CreateDirectory(LogisticPath);
|
|
||||||
key = "VILLACH";
|
|
||||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
|
||||||
VillachPath = pathSection[key];
|
|
||||||
if (!string.IsNullOrEmpty(VillachPath) && !Directory.Exists(VillachPath))
|
|
||||||
Directory.CreateDirectory(VillachPath);
|
|
||||||
key = "IQS";
|
|
||||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
|
||||||
IqsTempPath = pathSection[key];
|
|
||||||
if (!string.IsNullOrEmpty(IqsTempPath) && !Directory.Exists(IqsTempPath))
|
|
||||||
Directory.CreateDirectory(IqsTempPath);
|
|
||||||
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 = "EDA";
|
|
||||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
|
||||||
EdaPath = pathSection[key];
|
|
||||||
if (!string.IsNullOrEmpty(EdaPath) && !Directory.Exists(EdaPath))
|
|
||||||
Directory.CreateDirectory(EdaPath);
|
|
||||||
key = "APC";
|
|
||||||
if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\"))
|
|
||||||
ApcPath = pathSection[key];
|
|
||||||
if (!string.IsNullOrEmpty(ApcPath) && !Directory.Exists(ApcPath))
|
|
||||||
Directory.CreateDirectory(ApcPath);
|
|
||||||
}
|
|
||||||
if (!commonSection.Any())
|
|
||||||
throw new Exception("Common section is missing from configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isMET08PRFUSB4000Villach)
|
|
||||||
{
|
|
||||||
key = "MAPPED_PARTS";
|
|
||||||
if (!commonSection.ContainsKey(key))
|
|
||||||
throw new Exception("Mapped Parts KEY is missing from Equipment Type Configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string mappedParts = commonSection[key];
|
|
||||||
if (mappedParts.Contains(','))
|
|
||||||
MappedParts = mappedParts.Split(',').ToList();
|
|
||||||
else
|
|
||||||
MappedParts = new string[] { mappedParts }.ToList();
|
|
||||||
}
|
|
||||||
if (!MappedParts.Any())
|
|
||||||
throw new Exception(string.Format("Common section key {0} is empty", key));
|
|
||||||
key = "ARCHIVE_SOURCE_DIRECTORY";
|
|
||||||
if (commonSection.ContainsKey(key))
|
|
||||||
ArchiveSourceDirectory = commonSection[key];
|
|
||||||
}
|
|
||||||
key = "CELL_NAMES";
|
|
||||||
if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':'))
|
|
||||||
throw new Exception();
|
|
||||||
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();
|
|
||||||
key = "MES_ENTITIES";
|
|
||||||
if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) throw new Exception();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
if (isMET08PRFUSB4000Villach)
|
|
||||||
{
|
|
||||||
if (!tibcoSection.Any())
|
|
||||||
throw new Exception("TIBCO section is missing from configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
key = "IFX_CHANNEL";
|
|
||||||
if (tibcoSection.ContainsKey(key))
|
|
||||||
IfxChannel = tibcoSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IFX_CHANNEL is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(IfxChannel))
|
|
||||||
throw new Exception(string.Format("TIBCO section key {0} is empty", key));
|
|
||||||
key = "IFX_SUBJECT_PREFIX";
|
|
||||||
if (tibcoSection.ContainsKey(key))
|
|
||||||
IfxSubjectPrefix = tibcoSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IFX_SUBJECT_PREFIX is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(IfxSubjectPrefix))
|
|
||||||
throw new Exception(string.Format("TIBCO section key {0} is empty", key));
|
|
||||||
key = "IFX_CONFIGURATION_LOCATION";
|
|
||||||
if (tibcoSection.ContainsKey(key))
|
|
||||||
IfxConfigurationLocation = tibcoSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IFX_CONFIGURATION_LOCATION is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(IfxConfigurationLocation))
|
|
||||||
throw new Exception(string.Format("TIBCO section key {0} is empty", key));
|
|
||||||
key = "IFX_CONFIGURATION_LOCATION_LOCAL_COPY";
|
|
||||||
if (tibcoSection.ContainsKey(key))
|
|
||||||
IfxConfigurationLocationLocalCopy = tibcoSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IFX_CONFIGURATION_LOCATION_LOCAL_COPY is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(IfxConfigurationLocationLocalCopy))
|
|
||||||
throw new Exception(string.Format("TIBCO section key {0} is empty", key));
|
|
||||||
key = "IFX_SUBJECT";
|
|
||||||
if (tibcoSection.ContainsKey(key))
|
|
||||||
IfxSubject = tibcoSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IFX_SUBJECT KEY is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(IfxSubject))
|
|
||||||
throw new Exception(string.Format("TIBCO section key {0} is empty", key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (IsDatabaseExportToIPDSF || isMET08PRFUSB4000Villach)
|
|
||||||
{
|
|
||||||
if (!connectionStringsSection.Any())
|
|
||||||
throw new Exception("Connection Strings section is missing from configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
key = "G4WAFERS";
|
|
||||||
if (connectionStringsSection.ContainsKey(key))
|
|
||||||
ConnectionStringG4Wafers = connectionStringsSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("G4WAFERS is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(ConnectionStringG4Wafers))
|
|
||||||
throw new Exception(string.Format("Connection String key {0} is empty", key));
|
|
||||||
key = "IRMNSPC";
|
|
||||||
if (connectionStringsSection.ContainsKey(key))
|
|
||||||
ConnectionStringIrmnSpc = connectionStringsSection[key];
|
|
||||||
else
|
|
||||||
throw new Exception("IRMNSPC is missing from Equipment Type Configuration");
|
|
||||||
if (string.IsNullOrEmpty(ConnectionStringIrmnSpc))
|
|
||||||
throw new Exception(string.Format("IRMNSPC key {0} is empty", key));
|
|
||||||
//
|
|
||||||
Si.SQLDatabase.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc);
|
|
||||||
Si.SQLDatabase.SetConnectionStringG4Wafers(ConnectionStringG4Wafers);
|
|
||||||
Si.EpiControlPlan.CPGet.Parameters.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc);
|
|
||||||
Si.EpiControlPlan.CPGet.Parameters.SetConnectionStringG4Wafers(ConnectionStringG4Wafers);
|
|
||||||
Si.EpiControlPlan.CPGet.PartHistory.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc);
|
|
||||||
Si.EpiControlPlan.CPGet.PartHistory.SetConnectionStringG4Wafers(ConnectionStringG4Wafers);
|
|
||||||
Si.EpiControlPlan.CPGet.PartParameters.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc);
|
|
||||||
Si.EpiControlPlan.CPGet.PartParameters.SetConnectionStringG4Wafers(ConnectionStringG4Wafers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!openInsightSection.Any())
|
|
||||||
throw new Exception("OpenInsight section is missing from configuration");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
if (!MesEntities.Any())
|
|
||||||
throw new Exception();
|
|
||||||
if (isMET08PRFUSB4000Villach)
|
|
||||||
{
|
|
||||||
Si.Transport.Initialize(this);
|
|
||||||
if (!string.IsNullOrEmpty(fileConnectorConfiguration.SourceFileLocation))
|
|
||||||
TransportSetupMessages = Si.Transport.Setup(useSleep: true, setIfxTransport: true, setParameters: true);
|
|
||||||
else
|
|
||||||
TransportSetupMessages = Si.Transport.Setup(useSleep: false, setIfxTransport: false, setParameters: false);
|
|
||||||
}
|
|
||||||
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<Test, List<Duplicator.Description>> results, bool extra)
|
|
||||||
{
|
|
||||||
foreach (Test test in results.Keys)
|
|
||||||
{
|
|
||||||
if (test == Test)
|
|
||||||
{
|
|
||||||
if (!(ProcessDataDescription is ProcessData.FileRead.Description))
|
|
||||||
ProcessDataDescription = new ProcessData.FileRead.Description();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CallbackIsDummy(string traceDummyFile, List<Tuple<string, string, string, string, int>> 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<string, string, string, string, int> 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<Eaf.Core.Smtp.ISmtp>().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 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<Tuple<string, string, string, string, int>> tuples = new List<Tuple<string, string, string, string, int>>();
|
|
||||||
string progressDirectory = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\_ Progress"));
|
|
||||||
if (progressDirectory != ProgressPath || !Directory.Exists(progressDirectory))
|
|
||||||
throw new Exception("Invalid progress path");
|
|
||||||
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));
|
|
||||||
if (!File.Exists(sourceArchiveFile))
|
|
||||||
continue;
|
|
||||||
if (!DummyRuns.ContainsKey(monARessource))
|
|
||||||
DummyRuns.Add(monARessource, new List<long>());
|
|
||||||
tuples.Add(new Tuple<string, string, string, string, int>(monARessource, sourceFileFilter, sourceFileLocation, 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;
|
|
||||||
string sourceFileFilter = tuples[_LastDummyRunIndex].Item2;
|
|
||||||
sourceFileLocation = 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(progressDirectory, @"\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<string, string, string, string, int>(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount));
|
|
||||||
checkDirectory = sourceFileLocation;
|
|
||||||
files = Directory.GetFiles(checkDirectory, string.Concat("*", sequence, "*"), SearchOption.TopDirectoryOnly);
|
|
||||||
fileCount = files.Length;
|
|
||||||
tuples.Add(new Tuple<string, string, string, string, int>(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<Eaf.Core.Smtp.ISmtp>().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<Eaf.Core.Smtp.ISmtp>().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<string, JsonElement?, List<FileInfo>> IsManualOIEntry(string reportFullPath)
|
|
||||||
{
|
|
||||||
Tuple<string, JsonElement?, List<FileInfo>> 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<JsonElement>(json);
|
|
||||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(string.Empty, jsonElement, new List<FileInfo>());
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Archive(string sourceFileLocation, string sourceFileFilter, Calendar calendar, string directoryName, string newDirectoryName, int minFiles)
|
|
||||||
{
|
|
||||||
string newDirectroyRoot = sourceFileLocation.Replace(directoryName, newDirectoryName);
|
|
||||||
if (!Directory.Exists(newDirectroyRoot))
|
|
||||||
Directory.CreateDirectory(newDirectroyRoot);
|
|
||||||
if (Directory.Exists(sourceFileLocation))
|
|
||||||
{
|
|
||||||
string[] files = Directory.GetFiles(sourceFileLocation, sourceFileFilter, SearchOption.TopDirectoryOnly);
|
|
||||||
if (files.Length > minFiles)
|
|
||||||
{
|
|
||||||
string newFile;
|
|
||||||
string weekOfYear;
|
|
||||||
DateTime dateTime;
|
|
||||||
string newDirectroy;
|
|
||||||
DateTime creationTime;
|
|
||||||
DateTime lastWriteTime;
|
|
||||||
for (int i = 1; i < 50; i++)
|
|
||||||
Thread.Sleep(500);
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
|
||||||
creationTime = new FileInfo(file).CreationTime;
|
|
||||||
lastWriteTime = new FileInfo(file).LastWriteTime;
|
|
||||||
if (creationTime < lastWriteTime)
|
|
||||||
dateTime = creationTime;
|
|
||||||
else
|
|
||||||
dateTime = lastWriteTime;
|
|
||||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
|
||||||
newDirectroy = string.Concat(newDirectroyRoot, @"\", dateTime.ToString("yyyy"), "___Week_", weekOfYear);
|
|
||||||
if (!Directory.Exists(newDirectroy))
|
|
||||||
Directory.CreateDirectory(newDirectroy);
|
|
||||||
newFile = string.Concat(newDirectroy, @"\", Path.GetFileName(file));
|
|
||||||
if (File.Exists(newFile))
|
|
||||||
File.Delete(newFile);
|
|
||||||
try { File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file))); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); }
|
|
||||||
try { Directory.SetLastWriteTime(newDirectroy, dateTime); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); }
|
|
||||||
}
|
|
||||||
try { Directory.SetLastWriteTime(sourceFileLocation, DateTime.Now); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,147 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using log4net;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Adaptation.Helpers
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class ProcessData : IProcessData
|
|
||||||
{
|
|
||||||
|
|
||||||
public class DiffusionLengthDetail
|
|
||||||
{
|
|
||||||
|
|
||||||
public string Reactor { get; set; }
|
|
||||||
public string Employee { get; set; }
|
|
||||||
public string Recipe { get; set; }
|
|
||||||
public string Slot { get; set; }
|
|
||||||
public string DiffusionLength { get; set; }
|
|
||||||
public string DiffusionLengthStandardDeviation { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ILog _Log;
|
|
||||||
public List<DiffusionLengthDetail> Details { get; private set; }
|
|
||||||
|
|
||||||
public ProcessData(ILogic logic, ConfigData configData, List<FileInfo> fileInfoCollection, string lot, string pocketNumber)
|
|
||||||
{
|
|
||||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
|
||||||
Details = new List<DiffusionLengthDetail>();
|
|
||||||
DiffusionLengthDetail diffusionLengthDetail;
|
|
||||||
var data = ProcessDataStandardFormat.GetProcessDataStandardFormat(logic.Logistics.ReportFullPath);
|
|
||||||
Dictionary<Test, Dictionary<string, List<string>>> item2 = data.Item2;
|
|
||||||
if (item2.Any())
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>> keyValuePairs = item2.ElementAt(0).Value;
|
|
||||||
int count = keyValuePairs[Column.Time.ToString()].Count;
|
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
string key;
|
|
||||||
string carrier;
|
|
||||||
string[] segments;
|
|
||||||
string logistics = data.Item1;
|
|
||||||
key = "CARRIER=";
|
|
||||||
if (!logistics.Contains(key))
|
|
||||||
carrier = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
carrier = segments[1].Split(';')[0];
|
|
||||||
}
|
|
||||||
string mid;
|
|
||||||
key = "MID=";
|
|
||||||
if (!logistics.Contains(key))
|
|
||||||
mid = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
mid = segments[1].Split(';')[0];
|
|
||||||
}
|
|
||||||
string ppid;
|
|
||||||
key = "PPID=";
|
|
||||||
if (!logistics.Contains(key))
|
|
||||||
ppid = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
ppid = segments[1].Split(';')[0];
|
|
||||||
}
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
diffusionLengthDetail = new DiffusionLengthDetail
|
|
||||||
{
|
|
||||||
Reactor = string.Empty,
|
|
||||||
Employee = "AUTO",
|
|
||||||
Recipe = ppid,
|
|
||||||
Slot = keyValuePairs["SlotNumber"][i],
|
|
||||||
DiffusionLength = keyValuePairs["WW_SPV_DL_LBEF_AVG"][i],
|
|
||||||
DiffusionLengthStandardDeviation = keyValuePairs["WW_SPV_DL_LBEF_STD"][i]
|
|
||||||
};
|
|
||||||
if (!string.IsNullOrEmpty(mid))
|
|
||||||
diffusionLengthDetail.Reactor = mid.Substring(0, 3);
|
|
||||||
Details.Add(diffusionLengthDetail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configDataBase, List<FileInfo> fileInfoCollection)
|
|
||||||
{
|
|
||||||
Tuple<string, JsonElement?, List<FileInfo>> results;
|
|
||||||
if (!(configDataBase is ConfigData configData))
|
|
||||||
throw new Exception();
|
|
||||||
List<Test> tests = new List<Test>();
|
|
||||||
List<IProcessDataDescription> descriptions;
|
|
||||||
EventName eventName = configData.GetEventNameValue();
|
|
||||||
if (eventName == EventName.FileRead && Details.Any())
|
|
||||||
{
|
|
||||||
foreach (var item in Details)
|
|
||||||
tests.Add(Test);
|
|
||||||
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<Duplicator.Description> duplicatorDescriptions = (from l in descriptions select (Duplicator.Description)l).ToList();
|
|
||||||
json = JsonSerializer.Serialize(duplicatorDescriptions, duplicatorDescriptions.GetType());
|
|
||||||
}
|
|
||||||
else if (descriptions[0] is FileRead.Description)
|
|
||||||
{
|
|
||||||
List<FileRead.Description> fileReadDescriptions = (from l in descriptions select (FileRead.Description)l).ToList();
|
|
||||||
json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
object @object = JsonSerializer.Deserialize<object>(json);
|
|
||||||
if (!(@object is JsonElement jsonElement))
|
|
||||||
throw new Exception();
|
|
||||||
results = new Tuple<string, JsonElement?, List<FileInfo>>(logic.Logistics.Logistics1[0], jsonElement, fileInfoCollection);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<Test, List<Duplicator.Description>> GetKeyValuePairs(ConfigData configData, JsonElement jsonElement, List<Duplicator.Description> processDataDescriptions, bool extra = false)
|
|
||||||
{
|
|
||||||
Dictionary<Test, List<Duplicator.Description>> results = configData.GetKeyValuePairs(processDataDescriptions);
|
|
||||||
configData.CheckProcessDataDescription(results, extra);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,218 +0,0 @@
|
|||||||
using Infineon.Yoda;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using TIBCO.Rendezvous;
|
|
||||||
|
|
||||||
namespace Adaptation.Si
|
|
||||||
{
|
|
||||||
|
|
||||||
public class LDS2559Reply
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum FieldName
|
|
||||||
{
|
|
||||||
ETC,
|
|
||||||
ETX,
|
|
||||||
IFX_ECD,
|
|
||||||
IFX_ETX,
|
|
||||||
PARAMETER,
|
|
||||||
ACCEPTED,
|
|
||||||
EXCLUDE,
|
|
||||||
HIT,
|
|
||||||
CALCULATED,
|
|
||||||
CHANNEL,
|
|
||||||
CKC,
|
|
||||||
OOB,
|
|
||||||
VIOLATION,
|
|
||||||
MEAN,
|
|
||||||
OFFLINE,
|
|
||||||
PARAMETERNAME,
|
|
||||||
SAMPID_64,
|
|
||||||
REPLY,
|
|
||||||
UNACCEPTED,
|
|
||||||
VIOLATIONS
|
|
||||||
}
|
|
||||||
|
|
||||||
public class HIT
|
|
||||||
{
|
|
||||||
|
|
||||||
public object CALCULATED { get; set; } //bool
|
|
||||||
public object CHANNEL { get; set; } //Int32
|
|
||||||
public object CKC { get; set; } //Int32
|
|
||||||
public object OOB { get; set; } //bool
|
|
||||||
public object VIOLATION { get; set; } //Int32
|
|
||||||
|
|
||||||
public HIT(Message value)
|
|
||||||
{
|
|
||||||
MessageField messageField;
|
|
||||||
for (uint i = 0; i < value.FieldCount; i++)
|
|
||||||
{
|
|
||||||
messageField = value.GetFieldByIndex(i);
|
|
||||||
if (messageField.Name == FieldName.CALCULATED.ToString())
|
|
||||||
CALCULATED = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.CHANNEL.ToString())
|
|
||||||
CHANNEL = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.CKC.ToString())
|
|
||||||
CKC = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.OOB.ToString())
|
|
||||||
OOB = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.VIOLATION.ToString())
|
|
||||||
VIOLATION = messageField.Value;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return string.Concat(CALCULATED, '\t', CHANNEL, '\t', CKC, '\t', OOB, '\t', VIOLATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PARAMETER
|
|
||||||
{
|
|
||||||
|
|
||||||
public object ACCEPTED { get; set; } //bool
|
|
||||||
public object EXCLUDE { get; set; } //Int32
|
|
||||||
public List<HIT> HIT { get; set; }
|
|
||||||
public object MEAN { get; set; } //double
|
|
||||||
public object OFFLINE { get; set; } //bool
|
|
||||||
public object PARAMETERNAME { get; set; } //string
|
|
||||||
public object SAMPID_64 { get; set; } //Int64
|
|
||||||
|
|
||||||
public PARAMETER(Message value)
|
|
||||||
{
|
|
||||||
HIT hit;
|
|
||||||
Message message;
|
|
||||||
HIT = new List<HIT>();
|
|
||||||
object objectFieldValue;
|
|
||||||
MessageField messageField;
|
|
||||||
for (uint i = 0; i < value.FieldCount; i++)
|
|
||||||
{
|
|
||||||
messageField = value.GetFieldByIndex(i);
|
|
||||||
if (messageField.Name == FieldName.ACCEPTED.ToString())
|
|
||||||
ACCEPTED = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.EXCLUDE.ToString())
|
|
||||||
EXCLUDE = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.HIT.ToString())
|
|
||||||
{
|
|
||||||
if (!(messageField.Value is null) && messageField.Value is Message)
|
|
||||||
{
|
|
||||||
message = (Message)messageField.Value;
|
|
||||||
{
|
|
||||||
for (uint j = 0; j < message.FieldCount; j++)
|
|
||||||
{
|
|
||||||
objectFieldValue = message.GetFieldByIndex(j).Value;
|
|
||||||
if (!(objectFieldValue is null) && objectFieldValue is Message)
|
|
||||||
{
|
|
||||||
hit = new HIT((Message)objectFieldValue);
|
|
||||||
HIT.Add(hit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (messageField.Name == FieldName.MEAN.ToString())
|
|
||||||
MEAN = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.OFFLINE.ToString())
|
|
||||||
OFFLINE = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.PARAMETERNAME.ToString())
|
|
||||||
PARAMETERNAME = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.SAMPID_64.ToString())
|
|
||||||
SAMPID_64 = messageField.Value;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
if (!HIT.Any())
|
|
||||||
result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "HIT = 0", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64);
|
|
||||||
else
|
|
||||||
result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "[Count ", HIT.Count, " - 0 {", HIT[0], "}]", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DATA
|
|
||||||
{
|
|
||||||
|
|
||||||
public object ETC { get; set; } //Int32
|
|
||||||
public object ETX { get; set; }
|
|
||||||
public object IFX_ECD { get; set; } //Int32
|
|
||||||
public object IFX_ETX { get; set; } //string
|
|
||||||
public List<PARAMETER> PARAMETER { get; set; }
|
|
||||||
public object REPLY { get; set; } //Int32
|
|
||||||
public object UNACCEPTED { get; set; } //Int32
|
|
||||||
public object VIOLATIONS { get; set; } //Int32
|
|
||||||
|
|
||||||
public DATA(IfxDoc ifxDoc = null)
|
|
||||||
{
|
|
||||||
PARAMETER = new List<PARAMETER>();
|
|
||||||
if (!(ifxDoc is null))
|
|
||||||
{
|
|
||||||
Message message;
|
|
||||||
PARAMETER parameter;
|
|
||||||
object objectFieldValue;
|
|
||||||
MessageField messageField;
|
|
||||||
for (uint i = 0; i < ifxDoc.msg.FieldCount; i++)
|
|
||||||
{
|
|
||||||
messageField = ifxDoc.msg.GetFieldByIndex(i);
|
|
||||||
if (messageField.Name == FieldName.ETC.ToString())
|
|
||||||
ETC = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.ETX.ToString())
|
|
||||||
ETX = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.IFX_ECD.ToString())
|
|
||||||
IFX_ECD = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.IFX_ETX.ToString())
|
|
||||||
IFX_ETX = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.PARAMETER.ToString())
|
|
||||||
{
|
|
||||||
if (!(messageField.Value is null) && messageField.Value is Message)
|
|
||||||
{
|
|
||||||
message = (Message)messageField.Value;
|
|
||||||
{
|
|
||||||
for (uint j = 0; j < message.FieldCount; j++)
|
|
||||||
{
|
|
||||||
objectFieldValue = message.GetFieldByIndex(j).Value;
|
|
||||||
if (!(objectFieldValue is null) && objectFieldValue is Message)
|
|
||||||
{
|
|
||||||
parameter = new PARAMETER((Message)objectFieldValue);
|
|
||||||
PARAMETER.Add(parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (messageField.Name == FieldName.REPLY.ToString())
|
|
||||||
REPLY = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.UNACCEPTED.ToString())
|
|
||||||
UNACCEPTED = messageField.Value;
|
|
||||||
else if (messageField.Name == FieldName.VIOLATIONS.ToString())
|
|
||||||
VIOLATIONS = messageField.Value;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
if (!PARAMETER.Any())
|
|
||||||
result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "PARAMETER = 0", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS);
|
|
||||||
else
|
|
||||||
result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "[Count ", PARAMETER.Count, " - 0 {", PARAMETER[0], "}]", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,317 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Infineon.Yoda;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Adaptation.Si
|
|
||||||
{
|
|
||||||
|
|
||||||
public class LDS2559Send
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum FieldName
|
|
||||||
{
|
|
||||||
IFX_SERVICE,
|
|
||||||
KEYS,
|
|
||||||
PARAMETER,
|
|
||||||
SETTINGS,
|
|
||||||
PARAMETERNAME,
|
|
||||||
VALUE
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Settings
|
|
||||||
{
|
|
||||||
public string MODE { get; set; }
|
|
||||||
public int COMTIMEOUT { get; set; }
|
|
||||||
public string DATE { get; private set; }
|
|
||||||
public int KEY { get; set; }
|
|
||||||
public int LDS { get; set; }
|
|
||||||
public string SENDER { get; set; }
|
|
||||||
|
|
||||||
public Settings(string ifxSubjectPrefix, Logistics logistics)
|
|
||||||
{
|
|
||||||
MODE = "FULL";
|
|
||||||
COMTIMEOUT = 10;
|
|
||||||
KEY = 0;
|
|
||||||
switch (ifxSubjectPrefix)
|
|
||||||
{
|
|
||||||
case "VIH_D": LDS = 2599; break;
|
|
||||||
case "VIH_P": LDS = 2500; break;
|
|
||||||
default: LDS = -1; break;
|
|
||||||
}
|
|
||||||
SENDER = Environment.MachineName;
|
|
||||||
DATE = logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmss");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Value
|
|
||||||
{
|
|
||||||
public DataKeys DataKeys { get; set; }
|
|
||||||
public string VALUE { get; set; }
|
|
||||||
|
|
||||||
public Value(Logistics logistics)
|
|
||||||
{
|
|
||||||
DataKeys = new DataKeys(logistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Parameter
|
|
||||||
{
|
|
||||||
|
|
||||||
public ExtractorKeys ExtractorKeys { get; set; }
|
|
||||||
public DataKeys DataKeys { get; set; }
|
|
||||||
public string COMMENT { get; set; }
|
|
||||||
public double? LSL { get; set; }
|
|
||||||
public string PARAMETERNAME { get; set; }
|
|
||||||
public double? TSL { get; set; }
|
|
||||||
public string UNIT { get; set; }
|
|
||||||
public double? USL { get; set; }
|
|
||||||
public string VALUE { get; set; }
|
|
||||||
|
|
||||||
public Parameter(Logistics logistics)
|
|
||||||
{
|
|
||||||
ExtractorKeys = new ExtractorKeys(logistics);
|
|
||||||
DataKeys = new DataKeys(logistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parameter(Logistics logistics, string parameterName, string value)
|
|
||||||
{
|
|
||||||
ExtractorKeys = new ExtractorKeys(logistics);
|
|
||||||
DataKeys = new DataKeys(logistics);
|
|
||||||
PARAMETERNAME = parameterName;
|
|
||||||
VALUE = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parameter(Logistics logistics, ExtendedParameter extendedParameter)
|
|
||||||
{
|
|
||||||
ExtractorKeys = new ExtractorKeys(logistics);
|
|
||||||
DataKeys = new DataKeys(logistics);
|
|
||||||
PARAMETERNAME = extendedParameter.DiplayName;
|
|
||||||
LSL = extendedParameter.LSL;
|
|
||||||
TSL = extendedParameter.TSL;
|
|
||||||
UNIT = extendedParameter.Unit;
|
|
||||||
USL = extendedParameter.USL;
|
|
||||||
VALUE = extendedParameter.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 DataKeys(Logistics logistics, IScopeInfo scopeInfo = null, string sID = null)
|
|
||||||
{
|
|
||||||
if (scopeInfo is null)
|
|
||||||
{
|
|
||||||
SID = null;
|
|
||||||
EAFReference = null;
|
|
||||||
IQSReference = null;
|
|
||||||
EAFCellInstance = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(sID))
|
|
||||||
SID = "-";
|
|
||||||
else
|
|
||||||
SID = sID;
|
|
||||||
EAFReference = scopeInfo.EquipmentType.ToString();
|
|
||||||
if (string.IsNullOrEmpty(scopeInfo.QueryFilter))
|
|
||||||
IQSReference = null;
|
|
||||||
else
|
|
||||||
IQSReference = scopeInfo.QueryFilter;
|
|
||||||
if (logistics is null)
|
|
||||||
EAFCellInstance = null;
|
|
||||||
else
|
|
||||||
EAFCellInstance = logistics.JobID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ExtractorKeys(Logistics logistics, IScopeInfo scopeInfo = null)
|
|
||||||
{
|
|
||||||
if (scopeInfo is null)
|
|
||||||
{
|
|
||||||
ToolID = null;
|
|
||||||
Lot = null;
|
|
||||||
Part = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ToolID = logistics.MesEntity;
|
|
||||||
Lot = "-";
|
|
||||||
Part = "-";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DATA
|
|
||||||
{
|
|
||||||
public string IFX_SERVICE { get; set; }
|
|
||||||
public ExtractorKeys ExtractorKeys { get; set; }
|
|
||||||
public DataKeys DataKeys { get; set; }
|
|
||||||
public Parameter Parameter { get; set; }
|
|
||||||
public Settings Settings { get; set; }
|
|
||||||
|
|
||||||
public DATA(string ifxSubjectPrefix, Logistics logistics, IScopeInfo scopeInfo, string sID)
|
|
||||||
{
|
|
||||||
ExtractorKeys = new ExtractorKeys(logistics, scopeInfo);
|
|
||||||
DataKeys = new DataKeys(logistics, scopeInfo, sID);
|
|
||||||
Parameter = new Parameter(logistics);
|
|
||||||
Settings = new Settings(ifxSubjectPrefix, logistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static IfxDoc GetIfxDoc(string service, string value, DataKeys dataKeys, ExtractorKeys extractorKeys, Settings settings)
|
|
||||||
{
|
|
||||||
IfxDoc result = new IfxDoc();
|
|
||||||
if (!string.IsNullOrEmpty(service))
|
|
||||||
result.Add(string.Concat(FieldName.IFX_SERVICE), service);
|
|
||||||
if (!(value is null))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
result.Add(string.Concat(FieldName.VALUE), "-");
|
|
||||||
else
|
|
||||||
result.Add(string.Concat(FieldName.VALUE), value);
|
|
||||||
}
|
|
||||||
if (!(dataKeys is null))
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.EAFCellInstance))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFCellInstance)), dataKeys.EAFCellInstance);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.EAFReference))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFReference)), dataKeys.EAFReference);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.Employee))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Employee)), dataKeys.Employee);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.IQSReference))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.IQSReference)), dataKeys.IQSReference);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.SID))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.SID)), dataKeys.SID);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.WaferPosition))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferPosition)), dataKeys.WaferPosition);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.WaferRegion))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferRegion)), dataKeys.WaferRegion);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.WaferScribe))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferScribe)), dataKeys.WaferScribe);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.X))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.X)), dataKeys.X);
|
|
||||||
if (!string.IsNullOrEmpty(dataKeys.Y))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Y)), dataKeys.Y);
|
|
||||||
}
|
|
||||||
if (!(extractorKeys is null))
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.Lot))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Lot)), extractorKeys.Lot);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.Part))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Part)), extractorKeys.Part);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.Process))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Process)), extractorKeys.Process);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.ProcessFlow))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ProcessFlow)), extractorKeys.ProcessFlow);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.Recipe))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Recipe)), extractorKeys.Recipe);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.ToolID))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ToolID)), extractorKeys.ToolID);
|
|
||||||
if (!string.IsNullOrEmpty(extractorKeys.WaferID))
|
|
||||||
result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.WaferID)), extractorKeys.WaferID);
|
|
||||||
}
|
|
||||||
if (!(settings is null))
|
|
||||||
{
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.MODE)), settings.MODE);
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.COMTIMEOUT)), settings.COMTIMEOUT);
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.DATE)), settings.DATE);
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.KEY)), settings.KEY);
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.LDS)), settings.LDS);
|
|
||||||
result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.SENDER)), settings.SENDER);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IfxDoc GetIfxDoc(List<IfxDoc> parameters)
|
|
||||||
{
|
|
||||||
IfxDoc result = GetIfxDoc("EVALUATESPCDATA", value: null, dataKeys: DataKeys, extractorKeys: ExtractorKeys, settings: Settings);
|
|
||||||
result.Add(string.Concat(FieldName.PARAMETER), parameters.ToArray());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ParameterCollection
|
|
||||||
{
|
|
||||||
public List<Parameter> Collection { get; set; }
|
|
||||||
|
|
||||||
public ParameterCollection()
|
|
||||||
{
|
|
||||||
Collection = new List<Parameter>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IfxDoc GetIfxDoc()
|
|
||||||
{
|
|
||||||
IfxDoc value;
|
|
||||||
IfxDoc result = new IfxDoc();
|
|
||||||
Parameter parameter;
|
|
||||||
List<IfxDoc> values = new List<IfxDoc>();
|
|
||||||
for (int i = 0; i < Collection.Count; i++)
|
|
||||||
{
|
|
||||||
parameter = Collection[i];
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
if (parameter.TSL.HasValue & parameter.USL.HasValue && parameter.TSL.Value > parameter.USL.Value)
|
|
||||||
parameter.USL = parameter.TSL.Value;
|
|
||||||
if (parameter.TSL.HasValue & parameter.LSL.HasValue && parameter.TSL.Value < parameter.LSL.Value)
|
|
||||||
parameter.LSL = parameter.TSL.Value;
|
|
||||||
//
|
|
||||||
if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value && parameter.USL.Value == 0)
|
|
||||||
parameter.USL = null;
|
|
||||||
//
|
|
||||||
if (parameter.USL.HasValue & parameter.LSL.HasValue && parameter.USL.Value < parameter.LSL.Value)
|
|
||||||
throw new Exception();
|
|
||||||
if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value)
|
|
||||||
throw new Exception();
|
|
||||||
//
|
|
||||||
if (parameter.LSL.HasValue)
|
|
||||||
result.Add(nameof(Parameter.LSL), parameter.LSL);
|
|
||||||
if (!string.IsNullOrEmpty(parameter.PARAMETERNAME))
|
|
||||||
result.Add(string.Concat(FieldName.PARAMETERNAME), parameter.PARAMETERNAME);
|
|
||||||
if (parameter.TSL.HasValue)
|
|
||||||
result.Add(nameof(Parameter.TSL), parameter.TSL.Value);
|
|
||||||
if (!string.IsNullOrEmpty(parameter.UNIT))
|
|
||||||
result.Add(nameof(Parameter.UNIT), parameter.UNIT);
|
|
||||||
if (parameter.USL.HasValue)
|
|
||||||
result.Add(nameof(Parameter.USL), parameter.USL.Value);
|
|
||||||
}
|
|
||||||
value = DATA.GetIfxDoc(service: string.Empty, value: parameter.VALUE, dataKeys: parameter.DataKeys, extractorKeys: parameter.ExtractorKeys, settings: null);
|
|
||||||
values.Add(value);
|
|
||||||
}
|
|
||||||
result.Add(string.Concat(FieldName.VALUE), values.ToArray());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08ANLYSDIFAAST230
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
Dictionary<int, List<object>> results = new Dictionary<int, List<object>>();
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08DDUPSFS6420
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08DDUPSP1TBI
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08RESIHGCV
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08RESIMAPCDE
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08THFTIRQS408M
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Metrology
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class MET08THFTIRSTRATUS
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static Dictionary<int, List<object>> GetPreRunInfo(Logistics logistics, EventName eventName)
|
|
||||||
{
|
|
||||||
//2019-12-27 - 001
|
|
||||||
Dictionary<int, List<object>> results;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( ").
|
|
||||||
Append(" SELECT max(startstamp) ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.ToolTimeInfo ").
|
|
||||||
Append(" WHERE (lot = @mid OR lot = @midSubstring) ").
|
|
||||||
Append(" ), date) startstamp ").
|
|
||||||
Append(" FROM G4Wafers_01.dbo.[prerun info] ").
|
|
||||||
Append(" WHERE (wafer_id = @mid OR [run number] = @mid) ").
|
|
||||||
Append(" ORDER by date ");
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new Tuple<string, string>("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")),
|
|
||||||
new Tuple<string, string>("@mid", string.Concat("'", logistics.MID, "'"))
|
|
||||||
};
|
|
||||||
results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<PreRunInfo> Verify(EventName eventName, List<PreRunInfo> results)
|
|
||||||
{
|
|
||||||
//2019-12-28 - 004
|
|
||||||
if (results.Any())
|
|
||||||
{
|
|
||||||
string partFromRecipe;
|
|
||||||
Dictionary<int, List<object>> check;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
string lastPartFromRecipe = string.Empty;
|
|
||||||
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
partFromRecipe = results[i].Recipe;
|
|
||||||
if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe)
|
|
||||||
{
|
|
||||||
// re-format recipe name by extracting middle part of it
|
|
||||||
if ((!partFromRecipe.ToUpper().StartsWith("PROD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("MAMD")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("QUAL")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ENGR")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("ANKO")) &&
|
|
||||||
(!partFromRecipe.ToUpper().StartsWith("U")))
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 3)
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name
|
|
||||||
else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts
|
|
||||||
partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name
|
|
||||||
if (results[i].PartNumber != partFromRecipe)
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
if (partFromRecipe != "ENG")
|
|
||||||
{
|
|
||||||
sql.Append(" SELECT ").
|
|
||||||
Append(" count(*) AS my_count ").
|
|
||||||
Append(" FROM IRMNSPC.dbo.part_dat ").
|
|
||||||
Append(" WHERE f_name = @part ");
|
|
||||||
parameters.Clear();
|
|
||||||
parameters.Add(new Tuple<string, string>("@part", string.Concat("'", partFromRecipe, "'")));
|
|
||||||
check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false);
|
|
||||||
if (check.ElementAt(0).Value[0].ToString() == "0")
|
|
||||||
{
|
|
||||||
partFromRecipe = "ENG";
|
|
||||||
results[i].PartNumber = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastPartFromRecipe = partFromRecipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetSid(List<PreRunInfo> preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List<string> tags)
|
|
||||||
{
|
|
||||||
string result = string.Empty;
|
|
||||||
if (preRunInfo.Any())
|
|
||||||
{
|
|
||||||
result = tags[0];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
namespace Adaptation.Si
|
|
||||||
{
|
|
||||||
|
|
||||||
public class PreRunInfo
|
|
||||||
{
|
|
||||||
|
|
||||||
public string MID { get; private set; }
|
|
||||||
public string RunNumber { get; private set; }
|
|
||||||
public string Recipe { get; private set; }
|
|
||||||
public string PartNumber { get; internal set; }
|
|
||||||
public string Date { get; private set; }
|
|
||||||
public string PocketNumber { get; private set; }
|
|
||||||
public string WaferLot { get; private set; }
|
|
||||||
public string SatelliteGroup { get; private set; }
|
|
||||||
public string StartStamp { get; private set; }
|
|
||||||
public Logistics Logistics { get; private set; }
|
|
||||||
|
|
||||||
public PreRunInfo(Logistics logistics, object partNumber)
|
|
||||||
{
|
|
||||||
MID = logistics.MID;
|
|
||||||
RunNumber = string.Empty;
|
|
||||||
Recipe = string.Empty;
|
|
||||||
PartNumber = partNumber.ToString();
|
|
||||||
Date = logistics.DateTimeFromSequence.ToString();
|
|
||||||
PocketNumber = "00";
|
|
||||||
WaferLot = string.Empty;
|
|
||||||
SatelliteGroup = string.Empty;
|
|
||||||
StartStamp = logistics.DateTimeFromSequence.ToString();
|
|
||||||
Logistics = logistics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PreRunInfo(Logistics logistics, object mID, object runNumber, object recipe, object partNumber, object date, object pocketNumber, object waferLot, object satelliteGroup, object startStamp)
|
|
||||||
{
|
|
||||||
MID = mID.ToString();
|
|
||||||
RunNumber = runNumber.ToString();
|
|
||||||
Recipe = recipe.ToString();
|
|
||||||
PartNumber = partNumber.ToString();
|
|
||||||
Date = date.ToString();
|
|
||||||
PocketNumber = pocketNumber.ToString();
|
|
||||||
WaferLot = waferLot.ToString();
|
|
||||||
SatelliteGroup = satelliteGroup.ToString();
|
|
||||||
StartStamp = startStamp.ToString();
|
|
||||||
Logistics = logistics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return string.Concat(MID, " - ", RunNumber, " - ", Recipe, " - ", PartNumber, " - ", Date, " - ", PocketNumber, " - ", WaferLot, " - ", SatelliteGroup, " - ", StartStamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Adaptation.Si
|
|
||||||
{
|
|
||||||
|
|
||||||
public class SQLDatabase
|
|
||||||
{
|
|
||||||
|
|
||||||
private static string _ConnectionStringIrmnSpc;
|
|
||||||
private static string _ConnectionStringG4Wafers;
|
|
||||||
|
|
||||||
public static void SetConnectionStringIrmnSpc(string connectionString)
|
|
||||||
{
|
|
||||||
_ConnectionStringIrmnSpc = connectionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetConnectionStringG4Wafers(string connectionString)
|
|
||||||
{
|
|
||||||
_ConnectionStringG4Wafers = connectionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<string, List<object>> ExecuteReader(StringBuilder rawSql, List<Tuple<string, string>> parameters, List<Tuple<string, int>> columns, bool isG4Wafers, bool isIrmnSpc)
|
|
||||||
{
|
|
||||||
Dictionary<string, List<object>> results = new Dictionary<string, List<object>>();
|
|
||||||
foreach (var item in parameters)
|
|
||||||
rawSql.Replace(item.Item1, item.Item2);
|
|
||||||
string sql = rawSql.ToString();
|
|
||||||
if (sql.Contains("@"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains("<"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains(">"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains("!"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
foreach (var item in columns)
|
|
||||||
results.Add(item.Item1, new List<object>());
|
|
||||||
string connectionString;
|
|
||||||
if (isG4Wafers && isIrmnSpc)
|
|
||||||
throw new Exception();
|
|
||||||
else if (isG4Wafers)
|
|
||||||
connectionString = _ConnectionStringG4Wafers;
|
|
||||||
else if (isIrmnSpc)
|
|
||||||
connectionString = _ConnectionStringIrmnSpc;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
|
||||||
{
|
|
||||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (sqlReader.Read())
|
|
||||||
{
|
|
||||||
foreach (var item in columns)
|
|
||||||
results[item.Item1].Add(sqlReader.GetSqlValue(item.Item2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<int, List<object>> ExecuteReader(StringBuilder rawSql, List<Tuple<string, string>> parameters, int columns, bool isG4Wafers, bool isIrmnSpc)
|
|
||||||
{
|
|
||||||
Dictionary<int, List<object>> results = new Dictionary<int, List<object>>();
|
|
||||||
foreach (var item in parameters)
|
|
||||||
rawSql.Replace(item.Item1, item.Item2);
|
|
||||||
string sql = rawSql.ToString();
|
|
||||||
if (sql.Contains("@"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains("{"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains("}"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
if (sql.Contains("!"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
string connectionString;
|
|
||||||
if (isG4Wafers && isIrmnSpc)
|
|
||||||
throw new Exception();
|
|
||||||
else if (isG4Wafers)
|
|
||||||
connectionString = _ConnectionStringG4Wafers;
|
|
||||||
else if (isIrmnSpc)
|
|
||||||
connectionString = _ConnectionStringIrmnSpc;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
|
||||||
{
|
|
||||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (sqlReader.Read())
|
|
||||||
{
|
|
||||||
for (int i = 0; i < columns; i++)
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(i))
|
|
||||||
results.Add(i, new List<object>());
|
|
||||||
results[i].Add(sqlReader.GetSqlValue(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int? CheckDisableHistory(string sid)
|
|
||||||
{
|
|
||||||
int? result = null;
|
|
||||||
if (sid != "1")
|
|
||||||
{
|
|
||||||
object exits;
|
|
||||||
StringBuilder sql = new StringBuilder();
|
|
||||||
sql.Append("SELECT ");
|
|
||||||
sql.Append("hs.SID [SID] ");
|
|
||||||
sql.Append("FROM [IRMNSPC].[dbo].[HIST_DISABLE] hs ");
|
|
||||||
sql.Append("WHERE hs.SID = '").Append(sid).Append("' ");
|
|
||||||
using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
|
||||||
exits = sqlComm.ExecuteScalar();
|
|
||||||
}
|
|
||||||
if (exits is null)
|
|
||||||
{
|
|
||||||
sql.Clear();
|
|
||||||
sql.Append("INSERT INTO HIST_DISABLE VALUES ('").Append(sid).Append("' , 0) ");
|
|
||||||
using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn))
|
|
||||||
result = sqlComm.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static object ExecuteScalar(string sql, bool isMappedPart, double totalSecondsSinceLastWriteTime, Tuple<string, string> replace, bool selectForSID, bool isG4Wafers, bool isIrmnSpc)
|
|
||||||
{
|
|
||||||
object result;
|
|
||||||
if (sql.Contains("@"))
|
|
||||||
throw new Exception("Invalid query (a parameter didn't get populated)!");
|
|
||||||
List<object> results = new List<object>();
|
|
||||||
for (int i = 1; i < 15; i++)
|
|
||||||
{
|
|
||||||
string connectionString;
|
|
||||||
if (isG4Wafers && isIrmnSpc)
|
|
||||||
throw new Exception();
|
|
||||||
else if (isG4Wafers)
|
|
||||||
connectionString = _ConnectionStringG4Wafers;
|
|
||||||
else if (isIrmnSpc)
|
|
||||||
connectionString = _ConnectionStringIrmnSpc;
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
using (SqlConnection conn = new SqlConnection(connectionString))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
using (SqlCommand sqlComm = new SqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
using (SqlDataReader sqlReader = sqlComm.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (sqlReader.Read())
|
|
||||||
results.Add(sqlReader.GetSqlValue(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (results.Any())
|
|
||||||
break;
|
|
||||||
if ((i > 10 && !(replace is null)) || (!isMappedPart && totalSecondsSinceLastWriteTime > 1800) || totalSecondsSinceLastWriteTime > 432000 && sql.Contains(replace.Item1)) //30 minutes and 5 days
|
|
||||||
{
|
|
||||||
sql = sql.Replace(replace.Item1, replace.Item2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!isMappedPart)
|
|
||||||
break;
|
|
||||||
for (int j = 1; j < 60; j++)
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
if (!isMappedPart && !results.Any())
|
|
||||||
result = "-";
|
|
||||||
else if (isMappedPart && !results.Any())
|
|
||||||
throw new Exception("Didn't find a matching record!");
|
|
||||||
else if (isMappedPart && results.Count > 1)
|
|
||||||
throw new Exception("Found more than one matching record!");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = results[0];
|
|
||||||
if (selectForSID && results.Count() == 1)
|
|
||||||
{
|
|
||||||
int? exits = CheckDisableHistory(result.ToString());
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,945 +0,0 @@
|
|||||||
using Adaptation.Shared;
|
|
||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using Infineon.Yoda;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Xml;
|
|
||||||
|
|
||||||
namespace Adaptation.Si
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class Transport
|
|
||||||
{
|
|
||||||
|
|
||||||
private static object _IfxTransport;
|
|
||||||
private static ConfigData _ConfigData;
|
|
||||||
private static Dictionary<string, List<Parameters>> _Parameters;
|
|
||||||
|
|
||||||
internal static void Initialize(ConfigData configData)
|
|
||||||
{
|
|
||||||
_IfxTransport = null;
|
|
||||||
_ConfigData = configData;
|
|
||||||
_Parameters = new Dictionary<string, List<Parameters>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<string> Setup(bool useSleep, bool setIfxTransport, bool setParameters)
|
|
||||||
{
|
|
||||||
List<string> results = new List<string>();
|
|
||||||
if (useSleep)
|
|
||||||
{
|
|
||||||
for (int i = 1; i < 50; i++)
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
if (setIfxTransport)
|
|
||||||
{
|
|
||||||
results.Add(string.Concat("IfxTransport Subject: ", _ConfigData.IfxSubject));
|
|
||||||
IfxDoc ifxDoc = new IfxDoc();
|
|
||||||
ifxDoc.Add(IfxConst.SUBJECT_PREFIX, _ConfigData.IfxSubjectPrefix);
|
|
||||||
ifxDoc.Add(IfxConst.IFX_CHANNEL, _ConfigData.IfxChannel);
|
|
||||||
ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION, _ConfigData.IfxConfigurationLocation);
|
|
||||||
ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION_LOCAL_COPY, _ConfigData.IfxConfigurationLocationLocalCopy);
|
|
||||||
results.Add(string.Concat("IfxTransport Config: ", ifxDoc));
|
|
||||||
_IfxTransport = new IfxTransport();
|
|
||||||
IfxTransport ifxTransport = (IfxTransport)_IfxTransport;
|
|
||||||
ifxTransport.Create(ifxDoc);
|
|
||||||
if (useSleep)
|
|
||||||
{
|
|
||||||
for (int i = 1; i < 10; i++)
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
results.Add(string.Concat("IfxTransport Current Daemon: ", ifxTransport.CurrentDaemon));
|
|
||||||
results.Add(string.Concat("IfxTransport Current Network: ", ifxTransport.CurrentNetwork));
|
|
||||||
results.Add(string.Concat("IfxTransport Current Service: ", ifxTransport.CurrentService));
|
|
||||||
results.Add(string.Concat("IfxTransport Current PoolName: ", ifxTransport.CurrentPoolName));
|
|
||||||
}
|
|
||||||
if (setParameters)
|
|
||||||
{
|
|
||||||
try { _Parameters = GetParameters(); } catch { /* Dev doesn't have this table */ }
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dictionary<string, List<Parameters>> GetParameters()
|
|
||||||
{
|
|
||||||
Dictionary<string, List<Parameters>> results = new Dictionary<string, List<Parameters>>();
|
|
||||||
List<Parameters> parameters = Parameters.GetParameters();
|
|
||||||
string iqsName;
|
|
||||||
foreach (var parameter in parameters)
|
|
||||||
{
|
|
||||||
iqsName = string.Concat(parameter.Iqs_name);
|
|
||||||
if (!results.ContainsKey(iqsName))
|
|
||||||
results.Add(iqsName, new List<Parameters>());
|
|
||||||
results[iqsName].Add(parameter);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static bool IsMappedPart(List<string> parts)
|
|
||||||
{
|
|
||||||
List<string> check = (from l in parts where _ConfigData.MappedParts.Contains(l) select l).ToList();
|
|
||||||
return check.Any();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<string> GetDistinctParts(List<PreRunInfo> preRunInfo)
|
|
||||||
{
|
|
||||||
List<string> results = new List<string>();
|
|
||||||
foreach (var item in preRunInfo)
|
|
||||||
results.Add(item.PartNumber);
|
|
||||||
results = results.Distinct().ToList();
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Dictionary<Test, IScopeInfo> GetScopeInfoCollections(ILogic logic, ConfigData configData, Dictionary<Test, Dictionary<string, List<string>>> rawData, Dictionary<Test, List<int>> tests)
|
|
||||||
{
|
|
||||||
Dictionary<Test, IScopeInfo> results = new Dictionary<Test, IScopeInfo>();
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
IScopeInfo scopeInfo;
|
|
||||||
foreach (var element in rawData)
|
|
||||||
{
|
|
||||||
min = tests[element.Key].Min();
|
|
||||||
max = tests[element.Key].Max() + 1;
|
|
||||||
scopeInfo = new ScopeInfo(logic, configData, element.Key);
|
|
||||||
results.Add(element.Key, scopeInfo);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ExtractResult MergeAndMaybeSort(ExtractResult extractResult, List<PreRunInfo> preRunInfo, Dictionary<Test, List<int>> tests)
|
|
||||||
{
|
|
||||||
if (!preRunInfo.Any())
|
|
||||||
throw new Exception();
|
|
||||||
if (tests.ElementAt(0).Key != Test.AFMRoughness && tests.ElementAt(0).Key != Test.UV)
|
|
||||||
{
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
List<PreRunInfo> matchingPreRunInfo;
|
|
||||||
Dictionary<Enum, List<string>> keyValuePairs;
|
|
||||||
foreach (var testKeyValuePair in tests)
|
|
||||||
{
|
|
||||||
min = testKeyValuePair.Value.Min();
|
|
||||||
max = testKeyValuePair.Value.Max() + 1;
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
{
|
|
||||||
switch (testKeyValuePair.Key)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
if (preRunInfo.Count != 1)
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
matchingPreRunInfo = preRunInfo;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (matchingPreRunInfo.Count > 1)
|
|
||||||
throw new Exception();
|
|
||||||
for (int g = 1; g < 3; g++)
|
|
||||||
{
|
|
||||||
switch (g)
|
|
||||||
{
|
|
||||||
case 1: keyValuePairs = extractResult.DatabaseHeaders; break;
|
|
||||||
case 2: keyValuePairs = extractResult.DatabaseDetails; break;
|
|
||||||
default: throw new Exception();
|
|
||||||
}
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (matchingPreRunInfo.Count == 0)
|
|
||||||
element.Value[i] = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (element.Key)
|
|
||||||
{
|
|
||||||
case Column.SID: break;
|
|
||||||
//case "MID": element.Value[i] = matchingPreRunInfo[0].MID; break;
|
|
||||||
case Column.Lot: element.Value[i] = matchingPreRunInfo[0].RunNumber; break;
|
|
||||||
case Column.Recipe: element.Value[i] = matchingPreRunInfo[0].Recipe; break;
|
|
||||||
case Column.Part: element.Value[i] = matchingPreRunInfo[0].PartNumber; break;
|
|
||||||
case Column.Date: element.Value[i] = matchingPreRunInfo[0].Date; break;
|
|
||||||
case Column.Wafer_ID: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break;
|
|
||||||
case Column.WaferPocket_Candela: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break;
|
|
||||||
case Column.Wafer_Scribe: element.Value[i] = matchingPreRunInfo[0].WaferLot; break;
|
|
||||||
//case "SatelliteGroup": element.Value[i] = matchingPreRunInfo[0].SatelliteGroup; break;
|
|
||||||
//case "StartStamp": element.Value[i] = matchingPreRunInfo[0].StartStamp; break;
|
|
||||||
default: throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tests.ElementAt(0).Key == Test.CandelaKlarfDC || tests.ElementAt(0).Key == Test.CandelaLaser || tests.ElementAt(0).Key == Test.CandelaPSL || tests.ElementAt(0).Key == Test.CandelaVerify)
|
|
||||||
{
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
List<int> sortIndeices;
|
|
||||||
List<string> singleColumnSortedValues;
|
|
||||||
List<string> singleColumnBeforeSortValues;
|
|
||||||
Dictionary<Enum, List<string>> valuesCollection;
|
|
||||||
foreach (var testKeyValuePair in tests)
|
|
||||||
{
|
|
||||||
if (testKeyValuePair.Key == Test.CandelaKlarfDC || testKeyValuePair.Key == Test.CandelaLaser || testKeyValuePair.Key == Test.CandelaPSL || testKeyValuePair.Key == Test.CandelaVerify)
|
|
||||||
{
|
|
||||||
min = testKeyValuePair.Value.Min();
|
|
||||||
max = testKeyValuePair.Value.Max() + 1;
|
|
||||||
sortIndeices = new List<int>();
|
|
||||||
singleColumnBeforeSortValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] select l).ToList();
|
|
||||||
singleColumnSortedValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] orderby !string.IsNullOrEmpty(l), l select l).ToList();
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
sortIndeices.Add(singleColumnBeforeSortValues.IndexOf(singleColumnSortedValues[i]));
|
|
||||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
|
||||||
foreach (var element in extractResult.DatabaseDetails)
|
|
||||||
{
|
|
||||||
valuesCollection.Add(element.Key, new List<string>());
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
valuesCollection[element.Key].Add(extractResult.DatabaseDetails[element.Key][i]);
|
|
||||||
element.Value.Clear();
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
extractResult.DatabaseDetails[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
|
||||||
}
|
|
||||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
|
||||||
foreach (var element in extractResult.Details)
|
|
||||||
{
|
|
||||||
valuesCollection.Add(element.Key, new List<string>());
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
valuesCollection[element.Key].Add(extractResult.Details[element.Key][i]);
|
|
||||||
element.Value.Clear();
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
extractResult.Details[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
|
||||||
}
|
|
||||||
valuesCollection = new Dictionary<Enum, List<string>>();
|
|
||||||
foreach (var element in extractResult.Parameters)
|
|
||||||
{
|
|
||||||
valuesCollection.Add(element.Key, new List<string>());
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
valuesCollection[element.Key].Add(extractResult.Parameters[element.Key][i]);
|
|
||||||
element.Value.Clear();
|
|
||||||
for (int i = min; i < max; i++)
|
|
||||||
extractResult.Parameters[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return extractResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dictionary<Column, List<PartParameters>> GetPartParameters(string partNumber, bool isMappedPart)
|
|
||||||
{
|
|
||||||
Dictionary<Column, List<PartParameters>> results = new Dictionary<Column, List<PartParameters>>();
|
|
||||||
List<PartParameters> partParameters = PartParameters.GetPartParameters(partNumber);
|
|
||||||
foreach (var partParameter in partParameters)
|
|
||||||
{
|
|
||||||
if (Convert.IsDBNull(partParameter.Enum) || !Enum.TryParse(partParameter.Enum.ToString(), out Column column))
|
|
||||||
{
|
|
||||||
if (isMappedPart && partParameter.Crit_to_ship.ToString() == "CRIT")
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(column))
|
|
||||||
results.Add(column, new List<PartParameters>());
|
|
||||||
results[column].Add(partParameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<PartHistory> GetPartHistory(string partNumber)
|
|
||||||
{
|
|
||||||
List<PartHistory> results = PartHistory.GetPartHistory(partNumber);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DataKeys GetDataKeys(Dictionary<Enum, List<string>> columns, Logistics logistics, Dictionary<Enum, List<int>> ignoreIndeices, DataKeys dataKeys, int r, bool forParameter)
|
|
||||||
{
|
|
||||||
DataKeys result = dataKeys;
|
|
||||||
Column key;
|
|
||||||
if (!forParameter)
|
|
||||||
{
|
|
||||||
key = Column.Employee;
|
|
||||||
if (!columns.ContainsKey(key))
|
|
||||||
result.Employee = "AUTO";
|
|
||||||
else
|
|
||||||
result.Employee = columns[key][r];
|
|
||||||
}
|
|
||||||
key = Column.WaferPosition_BV;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferPosition = columns[key][r];
|
|
||||||
key = Column.WaferPosition_CV;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferPosition = columns[key][r];
|
|
||||||
key = Column.WaferPosition_Hall;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferPosition = columns[key][r];
|
|
||||||
key = Column.WaferPosition_PR;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferPosition = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Wafer_Region;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferRegion = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Wafer_Scribe;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferScribe = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.X_Coord;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.X = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Y_Coord;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.Y = columns[key][r];
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ExtractorKeys GetExtractorKeys(Dictionary<Enum, List<string>> columns, Logistics logistics, Dictionary<Enum, List<int>> ignoreIndeices, ExtractorKeys extractorKeys, int r, bool forParameter)
|
|
||||||
{
|
|
||||||
ExtractorKeys result = extractorKeys;
|
|
||||||
Column key;
|
|
||||||
key = Column.Lot;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.Lot = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Part;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.Part = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Process;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.Process = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Recipe;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.Recipe = columns[key][r];
|
|
||||||
//
|
|
||||||
key = Column.Wafer_ID;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferID = columns[key][r];
|
|
||||||
key = Column.Denton_Gun_Pocket;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferID = columns[key][r];
|
|
||||||
key = Column.WaferPocket_Candela;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferID = columns[key][r];
|
|
||||||
key = Column.WaferPocket_Warp;
|
|
||||||
if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r)))
|
|
||||||
result.WaferID = columns[key][r];
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetUnit(string columnDiplayName, string columnDatabaseName)
|
|
||||||
{
|
|
||||||
string result;
|
|
||||||
if (_Parameters.ContainsKey(columnDiplayName) && !(_Parameters[columnDiplayName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDiplayName][0].Units.ToString()))
|
|
||||||
result = _Parameters[columnDiplayName][0].Units.ToString();
|
|
||||||
else if (_Parameters.ContainsKey(columnDatabaseName) && !(_Parameters[columnDatabaseName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDatabaseName][0].Units.ToString()))
|
|
||||||
result = _Parameters[columnDatabaseName][0].Units.ToString();
|
|
||||||
else
|
|
||||||
result = "xx";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double? GetLsl(PartParameters partParameters)
|
|
||||||
{
|
|
||||||
if (!(partParameters.Lsl is null) && !string.IsNullOrEmpty(partParameters.Lsl.ToString()))
|
|
||||||
{
|
|
||||||
double.TryParse(partParameters.Lsl.ToString(), out double lsl);
|
|
||||||
return lsl;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double? GetUsl(PartParameters partParameters)
|
|
||||||
{
|
|
||||||
if (!(partParameters.Usl is null) && !string.IsNullOrEmpty(partParameters.Usl.ToString()))
|
|
||||||
{
|
|
||||||
double.TryParse(partParameters.Usl.ToString(), out double usl);
|
|
||||||
return usl;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double? GetTsl(PartParameters partParameters)
|
|
||||||
{
|
|
||||||
if (!(partParameters.Target is null) && !string.IsNullOrEmpty(partParameters.Target.ToString()))
|
|
||||||
{
|
|
||||||
double.TryParse(partParameters.Target.ToString(), out double tsl);
|
|
||||||
return tsl;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dictionary<string, List<string>> GetKeyValuePairs(Logistics logistics, ExtractResult extractResult, string xml2Text)
|
|
||||||
{
|
|
||||||
Dictionary<string, List<string>> results = new Dictionary<string, List<string>>();
|
|
||||||
bool documentKeys = false;
|
|
||||||
bool fieldParameter = false;
|
|
||||||
bool isFirstParmeter = true;
|
|
||||||
bool documnetParameter = false;
|
|
||||||
string elementName = string.Empty;
|
|
||||||
const string elementField = "Field";
|
|
||||||
bool fieldParameterNameKeys = false;
|
|
||||||
bool fieldParameterNameValue = false;
|
|
||||||
string attributeNameValue = string.Empty;
|
|
||||||
const string elementDocument = "Document";
|
|
||||||
string parameterAttributeNameValue = string.Empty;
|
|
||||||
string keyOrSettingAttributeNameValue = string.Empty;
|
|
||||||
string parameterKeyAttributeNameValue = string.Empty;
|
|
||||||
const string attributeNameValueParameter = "PARAMETER";
|
|
||||||
const string attributeNameValueParameterName = "PARAMETERNAME";
|
|
||||||
StringReader stringReader = new StringReader(xml2Text);
|
|
||||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { IgnoreWhitespace = true };
|
|
||||||
XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSettings);
|
|
||||||
while (xmlReader.Read())
|
|
||||||
{
|
|
||||||
switch (xmlReader.NodeType)
|
|
||||||
{
|
|
||||||
case XmlNodeType.Element:
|
|
||||||
elementName = xmlReader.Name;
|
|
||||||
if (elementName == elementDocument || elementName == elementField)
|
|
||||||
{
|
|
||||||
while (xmlReader.HasAttributes && xmlReader.MoveToNextAttribute())
|
|
||||||
{
|
|
||||||
if (xmlReader.Name == "name")
|
|
||||||
{
|
|
||||||
attributeNameValue = xmlReader.Value;
|
|
||||||
if (!documentKeys && attributeNameValue == "KEYS")
|
|
||||||
documentKeys = true;
|
|
||||||
else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue != attributeNameValueParameter)
|
|
||||||
keyOrSettingAttributeNameValue = attributeNameValue;
|
|
||||||
else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue == attributeNameValueParameter)
|
|
||||||
fieldParameter = true;
|
|
||||||
else if (documentKeys && fieldParameter && elementName == elementDocument && attributeNameValue == attributeNameValueParameter && !documnetParameter)
|
|
||||||
documnetParameter = true;
|
|
||||||
else if (documentKeys && fieldParameter && documnetParameter && elementName == elementField && attributeNameValue == attributeNameValueParameterName && string.IsNullOrEmpty(parameterAttributeNameValue))
|
|
||||||
{
|
|
||||||
xmlReader.Read(); xmlReader.Read(); parameterAttributeNameValue = xmlReader.Value;
|
|
||||||
}
|
|
||||||
else if (documentKeys && fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue))
|
|
||||||
{
|
|
||||||
if (elementName == elementDocument && attributeNameValue == attributeNameValueParameter)
|
|
||||||
{
|
|
||||||
parameterAttributeNameValue = string.Empty;
|
|
||||||
if (isFirstParmeter)
|
|
||||||
isFirstParmeter = false;
|
|
||||||
if (fieldParameterNameValue)
|
|
||||||
fieldParameterNameValue = false;
|
|
||||||
if (fieldParameterNameKeys)
|
|
||||||
fieldParameterNameKeys = false;
|
|
||||||
if (!string.IsNullOrEmpty(parameterKeyAttributeNameValue))
|
|
||||||
parameterKeyAttributeNameValue = string.Empty;
|
|
||||||
}
|
|
||||||
else if (attributeNameValue == "VALUE")
|
|
||||||
{
|
|
||||||
if (!fieldParameterNameValue)
|
|
||||||
fieldParameterNameValue = true;
|
|
||||||
if (fieldParameterNameKeys)
|
|
||||||
fieldParameterNameKeys = false;
|
|
||||||
}
|
|
||||||
else if (!fieldParameterNameKeys && attributeNameValue == "KEYS")
|
|
||||||
fieldParameterNameKeys = true;
|
|
||||||
else if (fieldParameterNameValue && fieldParameterNameKeys)
|
|
||||||
parameterKeyAttributeNameValue = attributeNameValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XmlNodeType.Text:
|
|
||||||
if (documentKeys && !documnetParameter)
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(keyOrSettingAttributeNameValue))
|
|
||||||
results.Add(keyOrSettingAttributeNameValue, new List<string>());
|
|
||||||
results[keyOrSettingAttributeNameValue].Add(xmlReader.Value);
|
|
||||||
}
|
|
||||||
else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && !fieldParameterNameKeys)
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(parameterAttributeNameValue))
|
|
||||||
results.Add(parameterAttributeNameValue, new List<string>());
|
|
||||||
results[parameterAttributeNameValue].Add(xmlReader.Value);
|
|
||||||
}
|
|
||||||
else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && fieldParameterNameKeys && isFirstParmeter)
|
|
||||||
{
|
|
||||||
if (!results.ContainsKey(parameterKeyAttributeNameValue))
|
|
||||||
results.Add(parameterKeyAttributeNameValue, new List<string>());
|
|
||||||
results[parameterKeyAttributeNameValue].Add(xmlReader.Value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void SaveXmlAsHtml(Logistics logistics, ExtractResult extractResult, ConfigData configData, string xml2Text, string htmlDirectory, string file)
|
|
||||||
{
|
|
||||||
StringBuilder html = new StringBuilder();
|
|
||||||
html.Clear();
|
|
||||||
html.AppendLine("<html>");
|
|
||||||
html.AppendLine("<head>");
|
|
||||||
html.Append("<title>").Append(configData.GetEquipmentType()).AppendLine("</title>");
|
|
||||||
html.AppendLine("</head>");
|
|
||||||
html.AppendLine("<body>");
|
|
||||||
int count;
|
|
||||||
string htmlFile;
|
|
||||||
List<int> counts = new List<int>();
|
|
||||||
Array array = Enum.GetValues(typeof(Column));
|
|
||||||
List<string> allDataKeyNames = new List<string>();
|
|
||||||
List<string> allSettingNames = new List<string>();
|
|
||||||
List<string> logisticsColumns = new List<string>();
|
|
||||||
List<string> presentSettingNames = new List<string>();
|
|
||||||
List<string> allLDSParameterNames = new List<string>();
|
|
||||||
List<string> allExtractorKeyNames = new List<string>();
|
|
||||||
List<string> parameterOrRowColumns = new List<string>();
|
|
||||||
Dictionary<string, List<string>> keyValuePairs = GetKeyValuePairs(logistics, extractResult, xml2Text);
|
|
||||||
foreach (var item in typeof(Settings).GetProperties())
|
|
||||||
allSettingNames.Add(item.Name);
|
|
||||||
foreach (var item in typeof(ExtractorKeys).GetProperties())
|
|
||||||
allExtractorKeyNames.Add(item.Name);
|
|
||||||
foreach (var item in typeof(DataKeys).GetProperties())
|
|
||||||
allDataKeyNames.Add(item.Name);
|
|
||||||
foreach (var item in typeof(Parameter).GetProperties())
|
|
||||||
allLDSParameterNames.Add(item.Name);
|
|
||||||
Dictionary<string, Column> columnNames = new Dictionary<string, Column>();
|
|
||||||
foreach (Column column in array)
|
|
||||||
columnNames.Add(column.GetDiplayName(), column);
|
|
||||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
|
||||||
{
|
|
||||||
counts.Add(element.Value.Count());
|
|
||||||
if (columnNames.ContainsKey(element.Key))
|
|
||||||
parameterOrRowColumns.Add(element.Key);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(element.Key, out Description.RowColumn rowColumnTry))
|
|
||||||
parameterOrRowColumns.Add(rowColumnTry.ToString());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(element.Key, out Description.LogisticsColumn logisticsColumnTry))
|
|
||||||
logisticsColumns.Add(logisticsColumnTry.ToString());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (allSettingNames.Contains(element.Key))
|
|
||||||
presentSettingNames.Add(element.Key);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (allExtractorKeyNames.Contains(element.Key))
|
|
||||||
parameterOrRowColumns.Add(element.Key);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (allDataKeyNames.Contains(element.Key))
|
|
||||||
parameterOrRowColumns.Add(element.Key);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (allLDSParameterNames.Contains(element.Key))
|
|
||||||
parameterOrRowColumns.Add(element.Key);
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
count = counts.Max();
|
|
||||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
|
||||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
|
||||||
html.Append(" title = '").Append("Missing \"Column\"(s)").AppendLine("' ");
|
|
||||||
html.AppendLine(">");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (element.Value.Count() == 0 && parameterOrRowColumns.Contains(element.Key))
|
|
||||||
html.Append("<th nowrap>").Append(element.Key).AppendLine("</th>");
|
|
||||||
}
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
html.AppendLine("</table>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<hr>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
|
||||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
|
||||||
html.Append(" title = '").Append("\"settingNames\"(s)").AppendLine("' ");
|
|
||||||
html.AppendLine(">");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var item in presentSettingNames)
|
|
||||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (presentSettingNames.Contains(element.Key))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(element.Value[0]))
|
|
||||||
html.AppendLine("<td nowrap> </td>");
|
|
||||||
else
|
|
||||||
html.Append("<td nowrap>").Append(element.Value[0]).AppendLine("</td>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
html.AppendLine("</table>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<hr>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
|
||||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
|
||||||
html.Append(" title = '").Append("\"LogisticsColumn\"(s)").AppendLine("' ");
|
|
||||||
html.AppendLine(">");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var item in logisticsColumns)
|
|
||||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
for (int i = 0; i < 1; i++)
|
|
||||||
{
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (logisticsColumns.Contains(element.Key))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(element.Value[i]))
|
|
||||||
html.AppendLine("<td nowrap> </td>");
|
|
||||||
else
|
|
||||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
html.AppendLine("</table>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<hr>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
|
||||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
|
||||||
html.Append(" title = '").Append("\"Parameter\"(s) Single-row").AppendLine("' ");
|
|
||||||
html.AppendLine(">");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var item in parameterOrRowColumns)
|
|
||||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
for (int i = 0; i < 1; i++)
|
|
||||||
{
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (parameterOrRowColumns.Contains(element.Key))
|
|
||||||
{
|
|
||||||
if (element.Value.Count() > 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i]))
|
|
||||||
html.Append("<td nowrap> </td>");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!allExtractorKeyNames.Contains(element.Key) && element.Key != "SID")
|
|
||||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
|
||||||
else
|
|
||||||
html.Append("<td nowrap style = \"background:yellow;\">").Append(element.Value[i]).AppendLine("</td>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
}
|
|
||||||
html.AppendLine("</table>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<hr>");
|
|
||||||
//
|
|
||||||
html.AppendLine("<table border = '2' CellPadding = '2' ");
|
|
||||||
html.Append(" id = '").Append(configData.GetEquipmentType()).AppendLine("' ");
|
|
||||||
html.Append(" title = '").Append("\"Parameter\"(s) Multi-row").AppendLine("' ");
|
|
||||||
html.AppendLine(">");
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var item in parameterOrRowColumns)
|
|
||||||
html.Append("<th nowrap>").Append(item).AppendLine("</th>");
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
html.AppendLine("<tr>");
|
|
||||||
foreach (var element in keyValuePairs)
|
|
||||||
{
|
|
||||||
if (parameterOrRowColumns.Contains(element.Key))
|
|
||||||
{
|
|
||||||
if (element.Value.Count() == 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i]))
|
|
||||||
html.Append("<td nowrap> </td>");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!allExtractorKeyNames.Contains(element.Key))
|
|
||||||
html.Append("<td nowrap>").Append(element.Value[i]).AppendLine("</td>");
|
|
||||||
else
|
|
||||||
html.Append("<td nowrap style = \"background:yellow;\">").Append(element.Value[i]).AppendLine("</td>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.AppendLine("</tr>");
|
|
||||||
}
|
|
||||||
html.AppendLine("</table>");
|
|
||||||
//
|
|
||||||
html.AppendLine("</body>");
|
|
||||||
html.AppendLine("</html>");
|
|
||||||
htmlFile = string.Concat(htmlDirectory, @"\", Path.GetFileNameWithoutExtension(file), ".html");
|
|
||||||
File.WriteAllText(htmlFile, html.ToString());
|
|
||||||
File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence);
|
|
||||||
try { File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence); } catch (Exception) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Dictionary<string, IfxDoc> GetIfxDocs(Logistics logistics, ExtractResult extractResult, ConfigData configData, string writePath, Dictionary<Test, List<int>> tests, List<string> distinctParts, Dictionary<Test, IScopeInfo> scopeInfoCollections, bool isMappedPart)
|
|
||||||
{
|
|
||||||
Dictionary<string, IfxDoc> results = new Dictionary<string, IfxDoc>();
|
|
||||||
int c;
|
|
||||||
int min;
|
|
||||||
int max;
|
|
||||||
DATA data;
|
|
||||||
string sid;
|
|
||||||
string file;
|
|
||||||
IfxDoc ifxDoc;
|
|
||||||
string nullData;
|
|
||||||
string xml2Text;
|
|
||||||
IScopeInfo scopeInfo;
|
|
||||||
Parameter parameter;
|
|
||||||
string testAppendage;
|
|
||||||
string htmlDirectory;
|
|
||||||
List<PartHistory> partHistory;
|
|
||||||
List<int> rowCheck = new List<int>();
|
|
||||||
if (scopeInfoCollections.Any())
|
|
||||||
{
|
|
||||||
string xmlDirectory = string.Empty;
|
|
||||||
ExtendedParameter extendedParameter;
|
|
||||||
List<ExtendedParameter> extendedParameters;
|
|
||||||
Dictionary<Enum, List<int>> ignoreIndeices;
|
|
||||||
List<IfxDoc> parameters = new List<IfxDoc>();
|
|
||||||
List<ParameterCollection> parameterCollections = new List<ParameterCollection>();
|
|
||||||
string directory = string.Concat(writePath, @"\", configData.GetEquipmentType(), @"\Target");
|
|
||||||
Dictionary<Enum, List<string>> toolHeadersAndDatabaseHeadersCollection = extractResult.GetToolHeadersAndDatabaseHeadersCollection();
|
|
||||||
Dictionary<Enum, List<string>> toolDetailsAndDatabaseDetailsCollection = extractResult.GetToolDetailsAndDatabaseDetailsCollection();
|
|
||||||
if (logistics.NullData is null)
|
|
||||||
nullData = string.Empty;
|
|
||||||
else
|
|
||||||
nullData = logistics.NullData.ToString();
|
|
||||||
if (!distinctParts.Any())
|
|
||||||
partHistory = new List<PartHistory>();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (distinctParts.Count != 1)
|
|
||||||
throw new Exception();
|
|
||||||
partHistory = GetPartHistory(distinctParts[0]);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(writePath))
|
|
||||||
{
|
|
||||||
xmlDirectory = string.Concat(directory, @"\xml");
|
|
||||||
if (!Directory.Exists(xmlDirectory))
|
|
||||||
Directory.CreateDirectory(xmlDirectory);
|
|
||||||
}
|
|
||||||
foreach (var testKeyValuePair in tests)
|
|
||||||
{
|
|
||||||
if (isMappedPart && !partHistory.Any())
|
|
||||||
throw new Exception();
|
|
||||||
min = testKeyValuePair.Value.Min();
|
|
||||||
max = testKeyValuePair.Value.Max() + 1;
|
|
||||||
scopeInfo = scopeInfoCollections[testKeyValuePair.Key];
|
|
||||||
ignoreIndeices = extractResult.IgnoreIndeices[testKeyValuePair.Key];
|
|
||||||
data = new DATA(_ConfigData.IfxSubjectPrefix, logistics, scopeInfo, extractResult.DatabaseHeaders[Column.SID][min]);
|
|
||||||
if (toolHeadersAndDatabaseHeadersCollection.Any())
|
|
||||||
{
|
|
||||||
data.DataKeys = GetDataKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.DataKeys, r: min, forParameter: false);
|
|
||||||
data.ExtractorKeys = GetExtractorKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.ExtractorKeys, r: min, forParameter: false);
|
|
||||||
}
|
|
||||||
if (partHistory.Any())
|
|
||||||
{
|
|
||||||
if (!(partHistory[0].Process_flow is null) && !string.IsNullOrEmpty(partHistory[0].Process_flow.ToString()))
|
|
||||||
data.ExtractorKeys.ProcessFlow = partHistory[0].Process_flow.ToString();
|
|
||||||
}
|
|
||||||
c = 0;
|
|
||||||
parameterCollections.Clear();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> element in extractResult.Parameters)
|
|
||||||
{
|
|
||||||
rowCheck.Clear();
|
|
||||||
for (int r = min; r < max; r++)
|
|
||||||
{
|
|
||||||
if (ignoreIndeices[element.Key].Contains(r))
|
|
||||||
rowCheck.Add(r);
|
|
||||||
}
|
|
||||||
if (rowCheck.Count != (max - min))
|
|
||||||
{
|
|
||||||
extendedParameters = extractResult.ExtendedParameters[element.Key];
|
|
||||||
parameterCollections.Add(new ParameterCollection());
|
|
||||||
for (int r = min; r < max; r++)
|
|
||||||
{
|
|
||||||
if (!ignoreIndeices[element.Key].Contains(r))
|
|
||||||
{
|
|
||||||
extendedParameter = extendedParameters[r];
|
|
||||||
if (!extendedParameter.Ignore.Value && extendedParameter.CriticalToShip.HasValue && extendedParameter.CriticalToShip.Value)
|
|
||||||
{
|
|
||||||
parameter = new Parameter(logistics, extendedParameter);
|
|
||||||
if (toolDetailsAndDatabaseDetailsCollection.Any())
|
|
||||||
{
|
|
||||||
parameter.DataKeys = GetDataKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.DataKeys, r, forParameter: true);
|
|
||||||
parameter.ExtractorKeys = GetExtractorKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.ExtractorKeys, r, forParameter: true);
|
|
||||||
}
|
|
||||||
parameterCollections[c].Collection.Add(parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (parameterCollections.Any())
|
|
||||||
parameterCollections = (from l in parameterCollections where l.Collection.Any() select l).ToList();
|
|
||||||
if (parameterCollections.Any())
|
|
||||||
{
|
|
||||||
parameters.Clear();
|
|
||||||
foreach (var item in parameterCollections)
|
|
||||||
parameters.Add(item.GetIfxDoc());
|
|
||||||
ifxDoc = data.GetIfxDoc(parameters);
|
|
||||||
if (ifxDoc.GetFieldCount() == 0)
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xml2Text = ifxDoc.GetAsXml2();
|
|
||||||
if (!(logistics.NullData is null) && !string.IsNullOrEmpty(nullData) && xml2Text.Contains(nullData))
|
|
||||||
throw new Exception();
|
|
||||||
if (xml2Text.Contains("<Field name=\"Lot\"><String>-</String>") && !(rowCheck is null))
|
|
||||||
throw new Exception();
|
|
||||||
if (!string.IsNullOrEmpty(writePath))
|
|
||||||
{
|
|
||||||
//testAppendage = string.Concat(" - ", (int)element.Key);
|
|
||||||
testAppendage = string.Concat(" - ", scopeInfo.FileNameWithoutExtension);
|
|
||||||
file = string.Concat(xmlDirectory, @"\", logistics.JobID, "_", logistics.Sequence, testAppendage, ".xml");
|
|
||||||
ifxDoc.Save(file, IfxConst.IfxDocFileType.Xml2, Overwrite: true);
|
|
||||||
if (logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
|
||||||
{
|
|
||||||
try { File.SetLastWriteTime(file, logistics.DateTimeFromSequence); } catch (Exception) { }
|
|
||||||
}
|
|
||||||
htmlDirectory = string.Concat(directory, @"\html");
|
|
||||||
if (!Directory.Exists(htmlDirectory))
|
|
||||||
Directory.CreateDirectory(htmlDirectory);
|
|
||||||
SaveXmlAsHtml(logistics, extractResult, configData, xml2Text, htmlDirectory, file);
|
|
||||||
}
|
|
||||||
sid = extractResult.DatabaseHeaders[Column.SID][min];
|
|
||||||
if (!isMappedPart && results.ContainsKey(sid))
|
|
||||||
{
|
|
||||||
sid = string.Concat(sid, " ", DateTime.Now.Ticks.ToString());
|
|
||||||
Thread.Sleep(100);
|
|
||||||
}
|
|
||||||
results.Add(sid, ifxDoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<LDS2559Reply.DATA> SendIfxDocs(ILogic logic, ConfigData configData, bool isMappedPart, Dictionary<string, IfxDoc> ifxDocs)
|
|
||||||
{
|
|
||||||
List<LDS2559Reply.DATA> results = new List<LDS2559Reply.DATA>();
|
|
||||||
IfxDoc reply;
|
|
||||||
string replyString;
|
|
||||||
LDS2559Reply.DATA lds2559Data;
|
|
||||||
if (_IfxTransport is null)
|
|
||||||
{
|
|
||||||
bool setParameters = !_Parameters.Any();
|
|
||||||
List<string> messages = Setup(useSleep: false, setIfxTransport: true, setParameters: setParameters);
|
|
||||||
foreach (string message in messages)
|
|
||||||
{
|
|
||||||
System.Diagnostics.Debug.Print(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_IfxTransport is null)
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IfxTransport ifxTransport = (IfxTransport)_IfxTransport;
|
|
||||||
if (isMappedPart && !(configData.EquipmentConnection is null))
|
|
||||||
{
|
|
||||||
DateTime dateTime = new DateTime(2019, 08, 25);
|
|
||||||
if (!(logic.Logistics is null) && logic.Logistics.DateTimeFromSequence >= dateTime)
|
|
||||||
{
|
|
||||||
foreach (var element in ifxDocs)
|
|
||||||
{
|
|
||||||
if (element.Value.GetFieldCount() == 0)
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
element.Value.Save(string.Concat(@"\\MESSV02ECC1.EC.LOCAL\EC_EAFLog\Production\IFXDocs\", configData.GetEquipmentType(), @"\", element.Key.Replace("*", string.Empty), ".xml"), IfxConst.IfxDocFileType.Xml2, Overwrite: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var element in ifxDocs)
|
|
||||||
{
|
|
||||||
if (element.Value.GetFieldCount() == 0)
|
|
||||||
throw new Exception();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
element.Value.SendSubject = string.Concat(ifxTransport.SubjectPrefix, ".", _ConfigData.IfxSubject);
|
|
||||||
if (ifxTransport.SubjectPrefix.StartsWith("MES_"))
|
|
||||||
{
|
|
||||||
ifxTransport.Publish(element.Value, false, 60);
|
|
||||||
lds2559Data = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!isMappedPart)
|
|
||||||
lds2559Data = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IfxEnvelope ifxEnvelope = ifxTransport.SendRequest(element.Value, false, 60, IfxConst.IfxMessageType.Yoda);
|
|
||||||
if (ifxEnvelope is null)
|
|
||||||
throw new Exception("SendRequest timeout occurred");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reply = ifxEnvelope.ExtractDocument();
|
|
||||||
replyString = reply.ToString();
|
|
||||||
try { lds2559Data = new LDS2559Reply.DATA(reply); } catch (Exception) { lds2559Data = null; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results.Add(lds2559Data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string EvaluateSendResults(ILogic logic, ConfigData configData, List<string> distinctParts, bool isMappedPart, List<LDS2559Reply.DATA> transportSendResults)
|
|
||||||
{
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
string mID;
|
|
||||||
if (logic is null || logic.Logistics is null || logic.Logistics.MID is null)
|
|
||||||
mID = string.Empty;
|
|
||||||
else
|
|
||||||
mID = logic.Logistics.MID;
|
|
||||||
string part;
|
|
||||||
if (!distinctParts.Any())
|
|
||||||
part = string.Empty;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!isMappedPart)
|
|
||||||
part = distinctParts[0];
|
|
||||||
else
|
|
||||||
part = string.Concat(distinctParts[0], " (Mapped) ");
|
|
||||||
}
|
|
||||||
if (!transportSendResults.Any())
|
|
||||||
throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Nothing was sent!"));
|
|
||||||
foreach (var item in transportSendResults)
|
|
||||||
{
|
|
||||||
if (item is null)
|
|
||||||
result.AppendLine(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " null"));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (item.UNACCEPTED is null || (!(item.ETC is null) && item.ETC.ToString() == "-1"))
|
|
||||||
throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Invalid data"));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double.TryParse(item.UNACCEPTED.ToString(), out double unaccepted);
|
|
||||||
if (unaccepted > 0)
|
|
||||||
throw new Exception("Unaccepted record present");
|
|
||||||
else
|
|
||||||
result.AppendLine(string.Concat("Reply: ", item, Environment.NewLine, Environment.NewLine));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +1,17 @@
|
|||||||
namespace Adaptation.Ifx.Eaf.Common.Configuration
|
namespace Adaptation.Ifx.Eaf.Common.Configuration;
|
||||||
{
|
|
||||||
[System.Runtime.Serialization.DataContractAttribute]
|
[System.Runtime.Serialization.DataContract]
|
||||||
public class ConnectionSetting
|
public class ConnectionSetting
|
||||||
{
|
{
|
||||||
public ConnectionSetting(string name, string value) { }
|
|
||||||
|
#pragma warning disable CA2254
|
||||||
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
|
public ConnectionSetting(string name, string value) { }
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
|
||||||
public string Name { get; set; }
|
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
|
||||||
public string Value { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,19 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component
|
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
|
||||||
|
|
||||||
|
public class File
|
||||||
{
|
{
|
||||||
public class File
|
|
||||||
{
|
|
||||||
public File(string filePath) { throw new NotImplementedException(); }
|
|
||||||
public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); }
|
|
||||||
|
|
||||||
public string Path { get; }
|
#pragma warning disable CA2254
|
||||||
public DateTime TimeFound { get; }
|
#pragma warning disable IDE0060
|
||||||
public bool IsErrorFile { get; }
|
|
||||||
public Dictionary<string, string> ContentParameters { get; }
|
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<string, string> ContentParameters { get; }
|
||||||
|
|
||||||
|
public File UpdateContentParameters(Dictionary<string, string> contentParameters) => throw new NotImplementedException();
|
||||||
|
public File UpdateParsingStatus(bool isErrorFile) => throw new NotImplementedException();
|
||||||
|
|
||||||
public File UpdateContentParameters(Dictionary<string, string> contentParameters) { throw new NotImplementedException(); }
|
|
||||||
public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -2,34 +2,39 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component
|
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
|
||||||
|
|
||||||
|
public class FilePathGenerator
|
||||||
{
|
{
|
||||||
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<string, string> customPattern = null) { throw new NotImplementedException(); }
|
#pragma warning disable CA1822
|
||||||
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
#pragma warning disable CA2254
|
||||||
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
protected string SubFolderPath { get; }
|
public const char PLACEHOLDER_IDENTIFIER = '%';
|
||||||
protected FileConnectorConfiguration Configuration { get; }
|
public const char PLACEHOLDER_SEPARATOR = ':';
|
||||||
protected File File { get; }
|
public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
|
||||||
protected bool IsErrorFile { get; }
|
public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName";
|
||||||
protected string DefaultPlaceHolderValue { get; }
|
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<string, string> customPattern = null) => throw new NotImplementedException();
|
||||||
|
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) => throw new NotImplementedException();
|
||||||
|
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> 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();
|
||||||
|
|
||||||
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(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -2,134 +2,133 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration
|
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.DataContract]
|
||||||
|
public class FileConnectorConfiguration
|
||||||
{
|
{
|
||||||
[System.Runtime.Serialization.DataContractAttribute]
|
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
|
||||||
public class FileConnectorConfiguration
|
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual bool? TriggerOnChanged { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual long? PostProcessingRetries { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual bool? CopySourceFolderStructure { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string AlternateTargetFolder { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public long? FileHandleTimeout { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public bool? DeleteEmptySourceSubFolders { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public long? IdleEventWaitTimeInSeconds { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string FileAgeThreshold { get; set; }
|
||||||
|
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual ZipModeEnum? ZipMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string ZipTargetFileName { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string ZipErrorTargetFileName { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public long? ZipFileSubFolderLevel { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string DefaultPlaceHolderValue { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public bool? UseZip64Mode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public List<ConnectionSetting> ConnectionSettings { get; set; }
|
||||||
|
public string SourceDirectoryCloaking { get; set; }
|
||||||
|
public string FolderAgeThreshold { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual long? FileScanningIntervalInSeconds { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual bool? TriggerOnCreated { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual long? ZipFileTime { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string SourceFileLocation { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string SourceFileFilter { get; set; }
|
||||||
|
public List<string> SourceFileFilters { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual bool? IncludeSubDirectories { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string TargetFileLocation { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string ErrorTargetFileLocation { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string TargetFileName { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual long? FileHandleWaitTime { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public IfFileExistEnum? IfFileExistAction { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public long? ConnectionRetryInterval { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public PreProcessingModeEnum? PreProcessingMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public PostProcessingModeEnum? PostProcessingMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public virtual long? ZipFileAmount { get; set; }
|
||||||
|
[System.Runtime.Serialization.DataMember]
|
||||||
|
public string ErrorTargetFileName { get; set; }
|
||||||
|
|
||||||
|
public void Initialize() => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public enum PostProcessingModeEnum
|
||||||
{
|
{
|
||||||
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
|
None = 0,
|
||||||
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
|
Move = 1,
|
||||||
|
Copy = 2,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Rename = 3,
|
||||||
public virtual bool? TriggerOnChanged { get; set; }
|
Zip = 4,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Delete = 5,
|
||||||
public virtual long? PostProcessingRetries { get; set; }
|
MoveFolder = 6,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
CopyFolder = 7,
|
||||||
public virtual bool? CopySourceFolderStructure { get; set; }
|
DeleteFolder = 8
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
}
|
||||||
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
|
public enum PreProcessingModeEnum
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
{
|
||||||
public string AlternateTargetFolder { get; set; }
|
None = 0,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Process = 1
|
||||||
public long? FileHandleTimeout { get; set; }
|
}
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public enum IfFileExistEnum
|
||||||
public bool? DeleteEmptySourceSubFolders { get; set; }
|
{
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Overwrite = 0,
|
||||||
public long? IdleEventWaitTimeInSeconds { get; set; }
|
LeaveFiles = 1,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Delete = 2
|
||||||
public string FileAgeThreshold { get; set; }
|
}
|
||||||
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
|
public enum IfPostProcessingFailsEnum
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
{
|
||||||
public virtual ZipModeEnum? ZipMode { get; set; }
|
LeaveFiles = 0,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
Delete = 1
|
||||||
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
|
}
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
public enum FileScanningOptionEnum
|
||||||
public string ZipTargetFileName { get; set; }
|
{
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
FileWatcher = 0,
|
||||||
public string ZipErrorTargetFileName { get; set; }
|
TimeBased = 1
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
}
|
||||||
public long? ZipFileSubFolderLevel { get; set; }
|
public enum ZipModeEnum
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
{
|
||||||
public string DefaultPlaceHolderValue { get; set; }
|
ZipByAmountOrTime = 0,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
ZipByFileName = 1,
|
||||||
public bool? UseZip64Mode { get; set; }
|
ZipBySubFolderName = 2
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
}
|
||||||
public List<ConnectionSetting> ConnectionSettings { get; set; }
|
public enum FileAgeFilterEnum
|
||||||
public string SourceDirectoryCloaking { get; set; }
|
{
|
||||||
public string FolderAgeThreshold { get; set; }
|
IgnoreNewer = 0,
|
||||||
[System.Runtime.Serialization.DataMemberAttribute]
|
IgnoreOlder = 1
|
||||||
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<string> 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,13 +2,18 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription
|
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription;
|
||||||
{
|
|
||||||
public class FileConnectorParameterTypeDefinitionProvider
|
|
||||||
{
|
|
||||||
public FileConnectorParameterTypeDefinitionProvider() { }
|
|
||||||
|
|
||||||
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() { return null; }
|
public class FileConnectorParameterTypeDefinitionProvider
|
||||||
public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; }
|
{
|
||||||
}
|
|
||||||
}
|
#pragma warning disable CA1822
|
||||||
|
#pragma warning disable CA2254
|
||||||
|
#pragma warning disable IDE0060
|
||||||
|
|
||||||
|
public FileConnectorParameterTypeDefinitionProvider() { }
|
||||||
|
|
||||||
|
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null;
|
||||||
|
public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null;
|
||||||
|
|
||||||
|
}
|
92
Adaptation/MET08ANLYSDIFAAST230.Tests.csproj
Normal file
92
Adaptation/MET08ANLYSDIFAAST230.Tests.csproj
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<SccProjectName>SAK</SccProjectName>
|
||||||
|
<SccProvider>SAK</SccProvider>
|
||||||
|
<SccAuxPath>SAK</SccAuxPath>
|
||||||
|
<SccLocalPath>SAK</SccLocalPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<LangVersion>10.0</LangVersion>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<VSTestLogger>trx</VSTestLogger>
|
||||||
|
<VSTestResultsDirectory>../../../../MET08ANLYSDIFAAST230/05_TestResults/TestResults</VSTestResultsDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||||
|
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||||
|
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||||
|
<DefineConstants>Windows</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||||
|
<DefineConstants>OSX</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||||
|
<DefineConstants>Linux</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
|
||||||
|
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
|
||||||
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||||
|
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||||
|
<PackageReference Include="System.Text.Json" Version="6.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.1" />
|
||||||
|
<PackageReference Include="FFMpegCore" Version="4.7.0" />
|
||||||
|
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||||
|
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
|
||||||
|
<PackageReference Include="Instances" Version="1.6.1" />
|
||||||
|
<PackageReference Include="RoboSharp" Version="1.2.5" />
|
||||||
|
<PackageReference Include="Tesseract" Version="4.1.1" />
|
||||||
|
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Text" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="appsettings.Development.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.PeerGroup.GCL.Annotations
|
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
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)]
|
public NotNullAttribute() { }
|
||||||
public sealed class NotNullAttribute : Attribute
|
|
||||||
{
|
|
||||||
public NotNullAttribute() { }
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
namespace Adaptation.PeerGroup.GCL.SecsDriver
|
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||||
|
|
||||||
|
public enum HsmsConnectionMode
|
||||||
{
|
{
|
||||||
public enum HsmsConnectionMode
|
Active = 0,
|
||||||
{
|
Passive = 1
|
||||||
Active = 0,
|
|
||||||
Passive = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
namespace Adaptation.PeerGroup.GCL.SecsDriver
|
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||||
|
|
||||||
|
public enum HsmsSessionMode
|
||||||
{
|
{
|
||||||
public enum HsmsSessionMode
|
MultiSession = 0,
|
||||||
{
|
SingleSession = 1
|
||||||
MultiSession = 0,
|
|
||||||
SingleSession = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
namespace Adaptation.PeerGroup.GCL.SecsDriver
|
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||||
|
|
||||||
|
public enum SecsTransportType
|
||||||
{
|
{
|
||||||
public enum SecsTransportType
|
HSMS = 0,
|
||||||
{
|
Serial = 1
|
||||||
HSMS = 0,
|
|
||||||
Serial = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,16 +1,15 @@
|
|||||||
namespace Adaptation.PeerGroup.GCL.SecsDriver
|
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||||
|
|
||||||
|
public enum SerialBaudRate
|
||||||
{
|
{
|
||||||
public enum SerialBaudRate
|
Baud9600 = 0,
|
||||||
{
|
Baud19200 = 1,
|
||||||
Baud9600 = 0,
|
Baud4800 = 2,
|
||||||
Baud19200 = 1,
|
Baud2400 = 3,
|
||||||
Baud4800 = 2,
|
Baud1200 = 4,
|
||||||
Baud2400 = 3,
|
Baud300 = 5,
|
||||||
Baud1200 = 4,
|
Baud150 = 6,
|
||||||
Baud300 = 5,
|
Baud38400 = 7,
|
||||||
Baud150 = 6,
|
Baud57600 = 8,
|
||||||
Baud38400 = 7,
|
Baud115200 = 9
|
||||||
Baud57600 = 8,
|
|
||||||
Baud115200 = 9
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
namespace Adaptation.Shared.Deposition
|
|
||||||
{
|
|
||||||
|
|
||||||
public class DEP08EGANAIXG5
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum Test
|
|
||||||
{
|
|
||||||
GRATXTCenter = Deposition.Test.GRATXTCenter,
|
|
||||||
GRATXTEdge = Deposition.Test.GRATXTEdge,
|
|
||||||
GRAXMLCenter = Deposition.Test.GRAXMLCenter,
|
|
||||||
GRAXMLEdgeN = Deposition.Test.GRAXMLEdgeN,
|
|
||||||
Health = Deposition.Test.Health,
|
|
||||||
Temps = Deposition.Test.Temps,
|
|
||||||
ToolTime = Deposition.Test.ToolTime
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
namespace Adaptation.Shared.Deposition
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum Test
|
|
||||||
{
|
|
||||||
AFMRoughness = -1,
|
|
||||||
GRATXTCenter = 0,
|
|
||||||
GRATXTEdge = 1,
|
|
||||||
GRAXMLCenter = 2,
|
|
||||||
GRAXMLEdgeN = 3,
|
|
||||||
Health = 4,
|
|
||||||
Temps = 5,
|
|
||||||
ToolTime = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,182 +0,0 @@
|
|||||||
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<EquipmentParameter> EquipmentParameters { get; private set; }
|
|
||||||
public List<ParameterTypeDefinition> ParameterTypeDefinitions { get; private set; }
|
|
||||||
|
|
||||||
private readonly bool _UseCyclical;
|
|
||||||
private readonly List<string> _HeaderNames;
|
|
||||||
private readonly Dictionary<string, int> _KeyIndexPairs;
|
|
||||||
private readonly ParameterTypeDefinition _StructuredType;
|
|
||||||
private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider;
|
|
||||||
|
|
||||||
public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl)
|
|
||||||
{
|
|
||||||
_KeyIndexPairs = new Dictionary<string, int>();
|
|
||||||
_HeaderNames = configDataBase.GetHeaderNames(logic);
|
|
||||||
_UseCyclical = configDataBase.UseCyclicalForDescription;
|
|
||||||
_StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List<Field>());
|
|
||||||
_FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider();
|
|
||||||
EquipmentParameters = new List<EquipmentParameter>();
|
|
||||||
ParameterTypeDefinitions = new List<ParameterTypeDefinition> { _StructuredType };
|
|
||||||
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false);
|
|
||||||
List<ParameterValue> results = GetParameterValues(equipmentControl, keyValuePairsCollection);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ParameterValue> GetParameterValues(IEquipmentControl equipmentControl, Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection)
|
|
||||||
{
|
|
||||||
List<ParameterValue> results = new List<ParameterValue>();
|
|
||||||
Enum param;
|
|
||||||
object value;
|
|
||||||
Enum[] @params;
|
|
||||||
string description;
|
|
||||||
List<object[]> list;
|
|
||||||
EquipmentParameter equipmentParameter;
|
|
||||||
ParameterTypeDefinition parameterTypeDefinition;
|
|
||||||
bool addToEquipmentParameters = !EquipmentParameters.Any();
|
|
||||||
foreach (KeyValuePair<string, List<Tuple<Enum, string, string, object>>> 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<object[]>();
|
|
||||||
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<ParameterValue> GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary<string, object> keyValuePairs = null)
|
|
||||||
{
|
|
||||||
List<ParameterValue> results = new List<ParameterValue>();
|
|
||||||
if (_UseCyclical && (i is null || i.Value > 0))
|
|
||||||
throw new Exception();
|
|
||||||
if (jsonElement.ValueKind != JsonValueKind.Array)
|
|
||||||
throw new Exception();
|
|
||||||
Enum param;
|
|
||||||
Tuple<Enum, string, string, object> tuple;
|
|
||||||
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
|
|
||||||
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = new Dictionary<string, List<Tuple<Enum, string, string, object>>>();
|
|
||||||
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<JValue>("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<Enum, string, string, object>(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString());
|
|
||||||
if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name))
|
|
||||||
keyValuePairsCollection.Add(jsonProperty.Name, new List<Tuple<Enum, string, string, object>>());
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
142
Adaptation/Shared/Duplicator/Description.cs
Normal file
142
Adaptation/Shared/Duplicator/Description.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.Shared.Duplicator;
|
||||||
|
|
||||||
|
public class Description : IDescription, Properties.IDescription
|
||||||
|
{
|
||||||
|
|
||||||
|
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-10-23
|
||||||
|
|
||||||
|
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||||
|
|
||||||
|
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
IDescription description = GetDefault(fileRead, logistics);
|
||||||
|
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||||
|
object @object = JsonSerializer.Deserialize<object>(json);
|
||||||
|
if (@object is not JsonElement jsonElement)
|
||||||
|
throw new Exception();
|
||||||
|
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||||
|
results.Add(jsonProperty.Name);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IDescription.GetDetailNames()
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IDescription.GetHeaderNames()
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDescription IDescription.GetDisplayNames()
|
||||||
|
{
|
||||||
|
Description result = GetDisplayNames();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IDescription.GetParameterNames()
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
|
||||||
|
{
|
||||||
|
JsonProperty[] results;
|
||||||
|
IDescription description = GetDefault(fileRead, logistics);
|
||||||
|
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||||
|
object @object = JsonSerializer.Deserialize<object>(json);
|
||||||
|
results = ((JsonElement)@object).EnumerateObject().ToArray();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IDescription.GetPairedParameterNames()
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> IDescription.GetIgnoreParameterNames(Test test)
|
||||||
|
{
|
||||||
|
List<string> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
|
||||||
|
{
|
||||||
|
Description result = GetDefault(fileRead, logistics);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> results = new();
|
||||||
|
IDescription description = GetDisplayNames();
|
||||||
|
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||||
|
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
|
||||||
|
{
|
||||||
|
List<IDescription> results = new();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Description GetDisplayNames()
|
||||||
|
{
|
||||||
|
Description result = new();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Description GetDefault(IFileRead fileRead, Logistics logistics)
|
||||||
|
{
|
||||||
|
Description result = new()
|
||||||
|
{
|
||||||
|
Test = -1,
|
||||||
|
Count = 0,
|
||||||
|
Index = -1,
|
||||||
|
//
|
||||||
|
EventName = fileRead.EventName,
|
||||||
|
NullData = fileRead.NullData,
|
||||||
|
JobID = fileRead.CellInstanceName,
|
||||||
|
Sequence = logistics.Sequence.ToString(),
|
||||||
|
MesEntity = fileRead.MesEntity,
|
||||||
|
ReportFullPath = logistics.ReportFullPath,
|
||||||
|
ProcessJobID = logistics.ProcessJobID,
|
||||||
|
MID = logistics.MID,
|
||||||
|
Date = logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss")
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,53 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,178 +0,0 @@
|
|||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Adaptation.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(EquipmentType equipmentConnection, string queryFilter, Dictionary<Enum, string> 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];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,613 +0,0 @@
|
|||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Adaptation.Shared
|
|
||||||
{
|
|
||||||
|
|
||||||
public class ExtractResult
|
|
||||||
{
|
|
||||||
|
|
||||||
public object ProcessData { get; internal set; }
|
|
||||||
public long LastTicksDuration { get; private set; }
|
|
||||||
public long BreakAfterSeconds { get; private set; }
|
|
||||||
public Enum[] EnumColumns { get; protected set; }
|
|
||||||
public List<string> SourceFiles { get; private set; }
|
|
||||||
public Column[] PairedColumns { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<string>> Headers { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<string>> Details { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<string>> Parameters { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<ExtendedParameter>> ExtendedParameters { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<string>> DatabaseHeaders { get; protected set; }
|
|
||||||
public Dictionary<Enum, List<string>> DatabaseDetails { get; protected set; }
|
|
||||||
public Dictionary<Description.RowColumn, List<int>> RowColumns { get; protected set; }
|
|
||||||
public Dictionary<Test, Dictionary<Enum, List<int>>> IgnoreIndeices { get; protected set; }
|
|
||||||
public Dictionary<Description.LogisticsColumn, List<string>> LogisticsColumns { get; protected set; }
|
|
||||||
|
|
||||||
public ExtractResult(ExtractResult extractResult, long breakAfterSeconds, Enum[] enumColumns, Column[] pairedColumns)
|
|
||||||
{
|
|
||||||
if (enumColumns is null)
|
|
||||||
enumColumns = new Enum[] { };
|
|
||||||
if (pairedColumns is null)
|
|
||||||
pairedColumns = new Column[] { };
|
|
||||||
ProcessData = null;
|
|
||||||
EnumColumns = enumColumns;
|
|
||||||
PairedColumns = pairedColumns;
|
|
||||||
SourceFiles = new List<string>();
|
|
||||||
if (!(extractResult is null) && !(extractResult.SourceFiles is null))
|
|
||||||
SourceFiles.AddRange(extractResult.SourceFiles);
|
|
||||||
BreakAfterSeconds = breakAfterSeconds;
|
|
||||||
List<Enum> headers = new List<Enum>();
|
|
||||||
List<Enum> details = new List<Enum>();
|
|
||||||
List<Enum> parameters = new List<Enum>();
|
|
||||||
List<Enum> databaseHeaders = new List<Enum>();
|
|
||||||
List<Enum> databaseDetails = new List<Enum>();
|
|
||||||
UpdateLastTicksDuration(breakAfterSeconds * 10000000);
|
|
||||||
Common(headers, details, parameters, databaseHeaders, databaseDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Common(List<Enum> headers, List<Enum> details, List<Enum> parameters, List<Enum> databaseHeaders, List<Enum> databaseDetails)
|
|
||||||
{
|
|
||||||
Headers = new Dictionary<Enum, List<string>>();
|
|
||||||
Details = new Dictionary<Enum, List<string>>();
|
|
||||||
Parameters = new Dictionary<Enum, List<string>>();
|
|
||||||
ExtendedParameters = new Dictionary<Enum, List<ExtendedParameter>>();
|
|
||||||
DatabaseHeaders = new Dictionary<Enum, List<string>>();
|
|
||||||
DatabaseDetails = new Dictionary<Enum, List<string>>();
|
|
||||||
IgnoreIndeices = new Dictionary<Test, Dictionary<Enum, List<int>>>();
|
|
||||||
LogisticsColumns = new Dictionary<Description.LogisticsColumn, List<string>>();
|
|
||||||
foreach (Enum item in headers)
|
|
||||||
Headers.Add(item, new List<string>());
|
|
||||||
foreach (Enum item in details)
|
|
||||||
Details.Add(item, new List<string>());
|
|
||||||
foreach (Enum item in parameters)
|
|
||||||
Parameters.Add(item, new List<string>());
|
|
||||||
foreach (Enum item in parameters)
|
|
||||||
ExtendedParameters.Add(item, new List<ExtendedParameter>());
|
|
||||||
foreach (Enum item in databaseHeaders)
|
|
||||||
DatabaseHeaders.Add(item, new List<string>());
|
|
||||||
foreach (Enum item in databaseDetails)
|
|
||||||
DatabaseDetails.Add(item, new List<string>());
|
|
||||||
Array array;
|
|
||||||
array = Enum.GetValues(typeof(Description.RowColumn));
|
|
||||||
RowColumns = new Dictionary<Description.RowColumn, List<int>>();
|
|
||||||
foreach (Description.RowColumn item in array)
|
|
||||||
RowColumns.Add(item, new List<int>());
|
|
||||||
array = Enum.GetValues(typeof(Description.LogisticsColumn));
|
|
||||||
foreach (Description.LogisticsColumn item in array)
|
|
||||||
LogisticsColumns.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Reset()
|
|
||||||
{
|
|
||||||
ProcessData = null;
|
|
||||||
SourceFiles.Clear();
|
|
||||||
List<Enum> headers = new List<Enum>();
|
|
||||||
List<Enum> details = new List<Enum>();
|
|
||||||
List<Enum> parameters = new List<Enum>();
|
|
||||||
List<Enum> databaseHeaders = new List<Enum>();
|
|
||||||
List<Enum> databaseDetails = new List<Enum>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
headers.Add(item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
details.Add(item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
parameters.Add(item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
databaseHeaders.Add(item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
databaseDetails.Add(item.Key);
|
|
||||||
Common(headers, details, parameters, databaseHeaders, databaseDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExtractResult ShallowCopy()
|
|
||||||
{
|
|
||||||
return (ExtractResult)this.MemberwiseClone();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void HeadersAddRange(Enum column)
|
|
||||||
{
|
|
||||||
Headers.Add(column, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void HeadersAddRange(params Enum[] columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Headers.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void HeadersAddRange(List<Enum> columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Headers.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DetailsAddRange(Enum column)
|
|
||||||
{
|
|
||||||
Details.Add(column, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DetailsAddRange(params Enum[] columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Details.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DetailsAddRange(List<Enum> columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Details.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void ParametersAddRange(Enum column)
|
|
||||||
{
|
|
||||||
Parameters.Add(column, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void ParametersAddRange(params Enum[] columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Parameters.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void ParametersAddRange(List<Enum> columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
Parameters.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseHeadersAddRange(Enum column)
|
|
||||||
{
|
|
||||||
DatabaseHeaders.Add(column, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseHeadersAddRange(params Enum[] columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
DatabaseHeaders.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseHeadersAddRange(List<Enum> columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
DatabaseHeaders.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseDetailsAddRange(Enum column)
|
|
||||||
{
|
|
||||||
DatabaseDetails.Add(column, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseDetailsAddRange(params Enum[] columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
DatabaseDetails.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DatabaseDetailsAddRange(List<Enum> columns)
|
|
||||||
{
|
|
||||||
foreach (Enum item in columns)
|
|
||||||
DatabaseDetails.Add(item, new List<string>());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal int GetCount()
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
List<int> counts = new List<int>
|
|
||||||
{
|
|
||||||
RowColumns[Description.RowColumn.Test].Count()
|
|
||||||
};
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
counts.Add(item.Value.Count());
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
counts.Add(item.Value.Count());
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
counts.Add(item.Value.Count());
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
counts.Add(item.Value.Count());
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
counts.Add(item.Value.Count());
|
|
||||||
result = counts.Max();
|
|
||||||
if (counts.Distinct().Count() != 1)
|
|
||||||
throw new Exception();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<Enum, List<string>> Merge(List<KeyValuePair<Enum, List<string>>> keyValuePairs)
|
|
||||||
{
|
|
||||||
Dictionary<Enum, List<string>> results = new Dictionary<Enum, List<string>>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> element in keyValuePairs)
|
|
||||||
results.Add(element.Key, element.Value);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<KeyValuePair<Enum, List<string>>> GetAllColumnKeyValuePairs()
|
|
||||||
{
|
|
||||||
List<KeyValuePair<Enum, List<string>>> results = new List<KeyValuePair<Enum, List<string>>>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<Enum, List<string>> GetAllColumnCollection()
|
|
||||||
{
|
|
||||||
Dictionary<Enum, List<string>> results;
|
|
||||||
if (!EnumColumns.Any())
|
|
||||||
{
|
|
||||||
List<KeyValuePair<Enum, List<string>>> keyValuePairs = GetAllColumnKeyValuePairs();
|
|
||||||
results = Merge(keyValuePairs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
results = new Dictionary<Enum, List<string>>();
|
|
||||||
foreach (Enum item in EnumColumns)
|
|
||||||
results.Add(item, new List<string>());
|
|
||||||
foreach (Column item in PairedColumns)
|
|
||||||
results.Add(item, new List<string>());
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
results[item.Key].AddRange(item.Value);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
results[item.Key].AddRange(item.Value);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
results[item.Key].AddRange(item.Value);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
results[item.Key].AddRange(item.Value);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
results[item.Key].AddRange(item.Value);
|
|
||||||
int count = GetCount();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> keyValuePair in results)
|
|
||||||
{
|
|
||||||
for (int i = keyValuePair.Value.Count; i < count; i++)
|
|
||||||
results[keyValuePair.Key].Add(string.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<Enum, string> Merge(List<KeyValuePair<Enum, string>> keyValuePairs)
|
|
||||||
{
|
|
||||||
Dictionary<Enum, string> results = new Dictionary<Enum, string>();
|
|
||||||
foreach (KeyValuePair<Enum, string> element in keyValuePairs)
|
|
||||||
results.Add(element.Key, element.Value);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<KeyValuePair<Enum, string>> GetAllColumnKeyValuePairs(int? i)
|
|
||||||
{
|
|
||||||
List<KeyValuePair<Enum, string>> results = new List<KeyValuePair<Enum, string>>();
|
|
||||||
if (i.HasValue)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
results.Add(new KeyValuePair<Enum, string>(item.Key, item.Value[i.Value]));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
results.Add(new KeyValuePair<Enum, string>(item.Key, item.Value[i.Value]));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
results.Add(new KeyValuePair<Enum, string>(item.Key, item.Value[i.Value]));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
results.Add(new KeyValuePair<Enum, string>(item.Key, item.Value[i.Value]));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
results.Add(new KeyValuePair<Enum, string>(item.Key, item.Value[i.Value]));
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<Enum, string> GetAllColumnCollection(int? i)
|
|
||||||
{
|
|
||||||
Dictionary<Enum, string> results;
|
|
||||||
List<KeyValuePair<Enum, string>> keyValuePairs = GetAllColumnKeyValuePairs(i);
|
|
||||||
results = Merge(keyValuePairs);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<KeyValuePair<Enum, List<string>>> GetToolHeadersAndDatabaseHeadersColumnKeyValuePairs()
|
|
||||||
{
|
|
||||||
List<KeyValuePair<Enum, List<string>>> results = new List<KeyValuePair<Enum, List<string>>>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<Enum, List<string>> GetToolHeadersAndDatabaseHeadersCollection()
|
|
||||||
{
|
|
||||||
Dictionary<Enum, List<string>> results;
|
|
||||||
List<KeyValuePair<Enum, List<string>>> keyValuePairs = GetToolHeadersAndDatabaseHeadersColumnKeyValuePairs();
|
|
||||||
results = Merge(keyValuePairs);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<KeyValuePair<Enum, List<string>>> GetToolDetailsAndDatabaseDetailsColumnKeyValuePairs()
|
|
||||||
{
|
|
||||||
List<KeyValuePair<Enum, List<string>>> results = new List<KeyValuePair<Enum, List<string>>>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
results.Add(new KeyValuePair<Enum, List<string>>(item.Key, item.Value));
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<Enum, List<string>> GetToolDetailsAndDatabaseDetailsCollection()
|
|
||||||
{
|
|
||||||
Dictionary<Enum, List<string>> results;
|
|
||||||
List<KeyValuePair<Enum, List<string>>> keyValuePairs = GetToolDetailsAndDatabaseDetailsColumnKeyValuePairs();
|
|
||||||
results = Merge(keyValuePairs);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<Test, List<int>> GetTests()
|
|
||||||
{
|
|
||||||
Dictionary<Test, List<int>> results = new Dictionary<Test, List<int>>();
|
|
||||||
Test test;
|
|
||||||
for (int i = 0; i < RowColumns[Description.RowColumn.Test].Count; i++)
|
|
||||||
{
|
|
||||||
test = (Test)RowColumns[Description.RowColumn.Test][i];
|
|
||||||
if (!results.ContainsKey(test))
|
|
||||||
results.Add(test, new List<int>());
|
|
||||||
results[test].Add(i);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void FillIn(string nullData, int count, Enum[] currentColumns)
|
|
||||||
{
|
|
||||||
foreach (Enum column in Headers.Keys)
|
|
||||||
{
|
|
||||||
for (int i = Headers[column].Count(); i < count; i++)
|
|
||||||
Headers[column].Add(nullData);
|
|
||||||
}
|
|
||||||
foreach (Enum column in Details.Keys)
|
|
||||||
{
|
|
||||||
for (int i = Details[column].Count(); i < count; i++)
|
|
||||||
Details[column].Add(nullData);
|
|
||||||
}
|
|
||||||
if (!(currentColumns is null))
|
|
||||||
{
|
|
||||||
foreach (Enum column in currentColumns)
|
|
||||||
{
|
|
||||||
for (int i = Parameters[column].Count(); i < count; i++)
|
|
||||||
Parameters[column].Add(nullData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (Enum column in Parameters.Keys)
|
|
||||||
{
|
|
||||||
for (int i = Parameters[column].Count(); i < count; i++)
|
|
||||||
Parameters[column].Add(string.Empty);
|
|
||||||
}
|
|
||||||
foreach (Enum column in DatabaseHeaders.Keys)
|
|
||||||
{
|
|
||||||
for (int i = DatabaseHeaders[column].Count(); i < count; i++)
|
|
||||||
DatabaseHeaders[column].Add(string.Empty);
|
|
||||||
}
|
|
||||||
foreach (Enum column in DatabaseDetails.Keys)
|
|
||||||
{
|
|
||||||
for (int i = DatabaseDetails[column].Count(); i < count; i++)
|
|
||||||
DatabaseDetails[column].Add(string.Empty);
|
|
||||||
}
|
|
||||||
if (RowColumns[Description.RowColumn.Count].Count() != RowColumns[Description.RowColumn.Test].Count())
|
|
||||||
{
|
|
||||||
count = RowColumns[Description.RowColumn.Test].Count();
|
|
||||||
RowColumns[Description.RowColumn.Count].Clear();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
RowColumns[Description.RowColumn.Count].Add(count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetCollections(Logistics logistics, Dictionary<Test, Dictionary<string, List<string>>> rawData)
|
|
||||||
{
|
|
||||||
Array array;
|
|
||||||
Column? column;
|
|
||||||
bool recordStartPresent = false;
|
|
||||||
Description.RowColumn? rowColumn;
|
|
||||||
Description.LogisticsColumn? logisticsColumn;
|
|
||||||
array = Enum.GetValues(typeof(Description.RowColumn));
|
|
||||||
Dictionary<string, Enum> headers = new Dictionary<string, Enum>();
|
|
||||||
Dictionary<string, Enum> details = new Dictionary<string, Enum>();
|
|
||||||
Dictionary<string, Enum> parameters = new Dictionary<string, Enum>();
|
|
||||||
Dictionary<string, Enum> databaseHeaders = new Dictionary<string, Enum>();
|
|
||||||
Dictionary<string, Enum> databaseDetails = new Dictionary<string, Enum>();
|
|
||||||
Dictionary<Description.RowColumn, List<string>> rowColumns = new Dictionary<Description.RowColumn, List<string>>();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Headers)
|
|
||||||
headers.Add(item.Key.ToString(), item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Details)
|
|
||||||
details.Add(item.Key.ToString(), item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in Parameters)
|
|
||||||
parameters.Add(item.Key.ToString(), item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseHeaders)
|
|
||||||
databaseHeaders.Add(item.Key.ToString(), item.Key);
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> item in DatabaseDetails)
|
|
||||||
databaseDetails.Add(item.Key.ToString(), item.Key);
|
|
||||||
foreach (Description.RowColumn item in array)
|
|
||||||
rowColumns.Add(item, new List<string>());
|
|
||||||
foreach (KeyValuePair<Test, Dictionary<string, List<string>>> element in rawData)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<string, List<string>> item in element.Value)
|
|
||||||
{
|
|
||||||
column = null;
|
|
||||||
rowColumn = null;
|
|
||||||
logisticsColumn = null;
|
|
||||||
if (item.Key == "Time")
|
|
||||||
continue;
|
|
||||||
else if (item.Key == "A_LOGISTICS")
|
|
||||||
continue;
|
|
||||||
else if (item.Key == "B_LOGISTICS")
|
|
||||||
continue;
|
|
||||||
else if (item.Key == "EventId")
|
|
||||||
continue;
|
|
||||||
else if (item.Key == ProcessDataStandardFormat.RecordStart)
|
|
||||||
{
|
|
||||||
recordStartPresent = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (Enum.TryParse(item.Key, out Column columnTry))
|
|
||||||
column = columnTry;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(item.Key, out Description.LogisticsColumn logisticsColumnTry))
|
|
||||||
logisticsColumn = logisticsColumnTry;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(item.Key, out Description.RowColumn rowColumnTry))
|
|
||||||
rowColumn = rowColumnTry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rowColumn.HasValue)
|
|
||||||
rowColumns[rowColumn.Value].AddRange(item.Value);
|
|
||||||
else if (logisticsColumn.HasValue)
|
|
||||||
LogisticsColumns[logisticsColumn.Value].AddRange(item.Value);
|
|
||||||
else if (column.HasValue)
|
|
||||||
{
|
|
||||||
if (Headers.ContainsKey(column.Value))
|
|
||||||
Headers[column.Value].AddRange(item.Value);
|
|
||||||
else if (Details.ContainsKey(column.Value))
|
|
||||||
Details[column.Value].AddRange(item.Value);
|
|
||||||
else if (Parameters.ContainsKey(column.Value))
|
|
||||||
Parameters[column.Value].AddRange(item.Value);
|
|
||||||
else if (DatabaseHeaders.ContainsKey(column.Value))
|
|
||||||
DatabaseHeaders[column.Value].AddRange(item.Value);
|
|
||||||
else if (DatabaseDetails.ContainsKey(column.Value))
|
|
||||||
DatabaseDetails[column.Value].AddRange(item.Value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!recordStartPresent)
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (headers.ContainsKey(item.Key))
|
|
||||||
Headers[headers[item.Key]].AddRange(item.Value);
|
|
||||||
else if (details.ContainsKey(item.Key))
|
|
||||||
Details[details[item.Key]].AddRange(item.Value);
|
|
||||||
else if (parameters.ContainsKey(item.Key))
|
|
||||||
Parameters[parameters[item.Key]].AddRange(item.Value);
|
|
||||||
else if (databaseHeaders.ContainsKey(item.Key))
|
|
||||||
DatabaseHeaders[databaseHeaders[item.Key]].AddRange(item.Value);
|
|
||||||
else if (databaseDetails.ContainsKey(item.Key))
|
|
||||||
DatabaseDetails[databaseDetails[item.Key]].AddRange(item.Value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!recordStartPresent)
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<Description.RowColumn, List<string>> element in rowColumns)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < element.Value.Count(); i++)
|
|
||||||
{
|
|
||||||
int.TryParse(element.Value[i], out int rowColumnTry);
|
|
||||||
RowColumns[element.Key].Add(rowColumnTry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
array = Enum.GetValues(typeof(Description.RowColumn));
|
|
||||||
foreach (Description.RowColumn item in array)
|
|
||||||
{
|
|
||||||
if (!RowColumns.ContainsKey(item))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
array = Enum.GetValues(typeof(Description.LogisticsColumn));
|
|
||||||
foreach (Description.LogisticsColumn item in array)
|
|
||||||
{
|
|
||||||
if (!LogisticsColumns.ContainsKey(item))
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
int count = rowColumns[Description.RowColumn.Test].Count();
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> element in DatabaseHeaders)
|
|
||||||
{
|
|
||||||
for (int i = element.Value.Count(); i < count; i++)
|
|
||||||
element.Value.Add(string.Empty);
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> element in DatabaseDetails)
|
|
||||||
{
|
|
||||||
for (int i = element.Value.Count(); i < count; i++)
|
|
||||||
element.Value.Add(string.Empty);
|
|
||||||
}
|
|
||||||
string nullData;
|
|
||||||
if (logistics.NullData is null)
|
|
||||||
nullData = string.Empty;
|
|
||||||
else
|
|
||||||
nullData = logistics.NullData.ToString();
|
|
||||||
Dictionary<Enum, List<string>> keyValuePairs;
|
|
||||||
foreach (Test key in rawData.Keys)
|
|
||||||
{
|
|
||||||
IgnoreIndeices.Add(key, new Dictionary<Enum, List<int>>());
|
|
||||||
for (int g = 1; g < 4; g++)
|
|
||||||
{
|
|
||||||
switch (g)
|
|
||||||
{
|
|
||||||
case 1: keyValuePairs = Details; break;
|
|
||||||
case 2: keyValuePairs = Parameters; break;
|
|
||||||
case 3: keyValuePairs = DatabaseDetails; break;
|
|
||||||
default: throw new Exception();
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<Enum, List<string>> element in keyValuePairs)
|
|
||||||
{
|
|
||||||
IgnoreIndeices[key].Add(element.Key, new List<int>());
|
|
||||||
if (!element.Value.Any())
|
|
||||||
{
|
|
||||||
for (int i = 0; i < RowColumns[Description.RowColumn.Test].Count(); i++)
|
|
||||||
{
|
|
||||||
IgnoreIndeices[key][element.Key].Add(i);
|
|
||||||
element.Value.Add(string.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < element.Value.Count(); i++)
|
|
||||||
{
|
|
||||||
if (RowColumns[Description.RowColumn.Test][i] == (int)key)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(element.Value[i]))
|
|
||||||
IgnoreIndeices[key][element.Key].Add(i);
|
|
||||||
else if (!(logistics.NullData is null) && element.Value[i] == nullData)
|
|
||||||
IgnoreIndeices[key][element.Key].Add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (recordStartPresent)
|
|
||||||
FillIn(string.Empty, RowColumns[Description.RowColumn.Test].Count(), currentColumns: null);
|
|
||||||
GetCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void UpdateLastTicksDuration(long ticksDuration)
|
|
||||||
{
|
|
||||||
if (ticksDuration < 50000000)
|
|
||||||
ticksDuration = 50000000;
|
|
||||||
LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void AutoAdd(Enum key, string value)
|
|
||||||
{
|
|
||||||
if (Headers.ContainsKey(key))
|
|
||||||
Headers[key].Add(value);
|
|
||||||
else if (Details.ContainsKey(key))
|
|
||||||
Details[key].Add(value);
|
|
||||||
else if (Parameters.ContainsKey(key))
|
|
||||||
Parameters[key].Add(value);
|
|
||||||
else if (DatabaseHeaders.ContainsKey(key))
|
|
||||||
DatabaseHeaders[key].Add(value);
|
|
||||||
else if (DatabaseDetails.ContainsKey(key))
|
|
||||||
DatabaseDetails[key].Add(value);
|
|
||||||
else
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
815
Adaptation/Shared/FileRead.cs
Normal file
815
Adaptation/Shared/FileRead.cs
Normal file
@ -0,0 +1,815 @@
|
|||||||
|
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||||
|
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||||
|
using Adaptation.Shared.Methods;
|
||||||
|
using log4net;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Adaptation.Shared;
|
||||||
|
|
||||||
|
public class FileRead : Properties.IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
protected string _NullData;
|
||||||
|
protected readonly ILog _Log;
|
||||||
|
protected long _MinFileLength;
|
||||||
|
protected Logistics _Logistics;
|
||||||
|
protected readonly ISMTP _SMTP;
|
||||||
|
protected readonly int _Hyphens;
|
||||||
|
protected readonly bool _IsEvent;
|
||||||
|
protected string _ReportFullPath;
|
||||||
|
protected long _LastTicksDuration;
|
||||||
|
protected readonly bool _IsEAFHosted;
|
||||||
|
protected readonly string _EventName;
|
||||||
|
protected readonly string _MesEntity;
|
||||||
|
protected readonly string _TracePath;
|
||||||
|
protected readonly bool _IsDuplicator;
|
||||||
|
protected readonly Calendar _Calendar;
|
||||||
|
protected readonly bool _IsSourceTimer;
|
||||||
|
protected readonly string _VillachPath;
|
||||||
|
protected readonly string _ProgressPath;
|
||||||
|
protected readonly string _EquipmentType;
|
||||||
|
protected readonly long _BreakAfterSeconds;
|
||||||
|
protected readonly string _ExceptionSubject;
|
||||||
|
protected readonly string _CellInstanceName;
|
||||||
|
protected readonly string _EventNameFileRead;
|
||||||
|
protected readonly IDescription _Description;
|
||||||
|
protected readonly bool _UseCyclicalForDescription;
|
||||||
|
protected readonly string _CellInstanceConnectionName;
|
||||||
|
protected readonly string _CellInstanceConnectionNameBase;
|
||||||
|
protected readonly Dictionary<string, List<long>> _DummyRuns;
|
||||||
|
protected readonly Dictionary<string, string> _FileParameter;
|
||||||
|
protected readonly string _ParameterizedModelObjectDefinitionType;
|
||||||
|
protected readonly FileConnectorConfiguration _FileConnectorConfiguration;
|
||||||
|
protected readonly IList<ModelObjectParameterDefinition> _ModelObjectParameterDefinitions;
|
||||||
|
|
||||||
|
bool Properties.IFileRead.IsEvent => _IsEvent;
|
||||||
|
string Properties.IFileRead.NullData => _NullData;
|
||||||
|
string Properties.IFileRead.EventName => _EventName;
|
||||||
|
string Properties.IFileRead.MesEntity => _MesEntity;
|
||||||
|
bool Properties.IFileRead.IsEAFHosted => _IsEAFHosted;
|
||||||
|
string Properties.IFileRead.EquipmentType => _EquipmentType;
|
||||||
|
string Properties.IFileRead.ReportFullPath => _ReportFullPath;
|
||||||
|
string Properties.IFileRead.CellInstanceName => _CellInstanceName;
|
||||||
|
string Properties.IFileRead.ExceptionSubject => _ExceptionSubject;
|
||||||
|
bool Properties.IFileRead.UseCyclicalForDescription => _UseCyclicalForDescription;
|
||||||
|
string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName;
|
||||||
|
string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType;
|
||||||
|
|
||||||
|
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
|
||||||
|
{
|
||||||
|
_SMTP = smtp;
|
||||||
|
_IsEvent = isEvent;
|
||||||
|
_DummyRuns = dummyRuns;
|
||||||
|
_LastTicksDuration = 0;
|
||||||
|
_IsEAFHosted = isEAFHosted;
|
||||||
|
_Description = description;
|
||||||
|
_FileParameter = fileParameter;
|
||||||
|
_ReportFullPath = string.Empty;
|
||||||
|
_CellInstanceName = cellInstanceName;
|
||||||
|
_Calendar = new CultureInfo("en-US").Calendar;
|
||||||
|
_Log = LogManager.GetLogger(typeof(FileRead));
|
||||||
|
_UseCyclicalForDescription = useCyclicalForDescription;
|
||||||
|
_CellInstanceConnectionName = cellInstanceConnectionName;
|
||||||
|
_ModelObjectParameterDefinitions = modelObjectParameters;
|
||||||
|
_FileConnectorConfiguration = fileConnectorConfiguration;
|
||||||
|
_ParameterizedModelObjectDefinitionType = parameterizedModelObjectDefinitionType;
|
||||||
|
_IsSourceTimer = fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt");
|
||||||
|
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
|
||||||
|
_Hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
|
||||||
|
_ExceptionSubject = string.Concat("Exception:", _CellInstanceConnectionName, _FileConnectorConfiguration?.SourceDirectoryCloaking);
|
||||||
|
string suffix;
|
||||||
|
string[] segments = _ParameterizedModelObjectDefinitionType.Split('.');
|
||||||
|
string @namespace = segments[0];
|
||||||
|
string eventNameFileRead = "FileRead";
|
||||||
|
string eventName = segments[segments.Length - 1];
|
||||||
|
bool isDuplicator = segments[0] == cellInstanceName;
|
||||||
|
_IsDuplicator = isDuplicator;
|
||||||
|
_CellInstanceConnectionNameBase = cellInstanceConnectionNameBase;
|
||||||
|
if (eventName == eventNameFileRead)
|
||||||
|
suffix = string.Empty;
|
||||||
|
else
|
||||||
|
suffix = string.Concat('_', eventName.Split(new string[] { eventNameFileRead }, StringSplitOptions.RemoveEmptyEntries)[1]);
|
||||||
|
string parameterizedModelObjectDefinitionTypeAppended = string.Concat(@namespace, suffix);
|
||||||
|
if (!isEAFHosted)
|
||||||
|
{
|
||||||
|
// if (string.IsNullOrEmpty(equipmentTypeName) || equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended)
|
||||||
|
// throw new Exception(cellInstanceConnectionName);
|
||||||
|
// if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
|
||||||
|
// throw new Exception(cellInstanceConnectionName);
|
||||||
|
// if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
|
||||||
|
// throw new Exception(cellInstanceConnectionName);
|
||||||
|
// if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
|
||||||
|
// throw new Exception(cellInstanceConnectionName);
|
||||||
|
// if (!string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
|
||||||
|
// throw new Exception(cellInstanceConnectionName);
|
||||||
|
}
|
||||||
|
ModelObjectParameterDefinition[] paths = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Path.");
|
||||||
|
if (paths.Length < 4)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
if (isDuplicator)
|
||||||
|
_MesEntity = string.Empty;
|
||||||
|
else
|
||||||
|
_MesEntity = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".Alias"));
|
||||||
|
_TracePath = (from l in paths where l.Name.EndsWith("Trace") select l.Value).FirstOrDefault();
|
||||||
|
_VillachPath = (from l in paths where l.Name.EndsWith("Villach") select l.Value).FirstOrDefault();
|
||||||
|
_ProgressPath = (from l in paths where l.Name.EndsWith("Progress") select l.Value).FirstOrDefault();
|
||||||
|
_EventName = eventName;
|
||||||
|
_EventNameFileRead = eventNameFileRead;
|
||||||
|
_EquipmentType = parameterizedModelObjectDefinitionTypeAppended;
|
||||||
|
long breakAfterSeconds;
|
||||||
|
if (_FileConnectorConfiguration is null)
|
||||||
|
breakAfterSeconds = 360;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased)
|
||||||
|
breakAfterSeconds = Math.Abs(_FileConnectorConfiguration.FileHandleTimeout.Value);
|
||||||
|
else if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.FileWatcher)
|
||||||
|
breakAfterSeconds = Math.Abs(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value);
|
||||||
|
else
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
_BreakAfterSeconds = breakAfterSeconds;
|
||||||
|
UpdateLastTicksDuration(breakAfterSeconds * 10000000);
|
||||||
|
if (_IsDuplicator)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_FileConnectorConfiguration.TargetFileLocation) || string.IsNullOrEmpty(_FileConnectorConfiguration.ErrorTargetFileLocation))
|
||||||
|
throw new Exception("_Configuration is empty?");
|
||||||
|
if (_FileConnectorConfiguration.TargetFileLocation.Contains('%') || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains('%'))
|
||||||
|
throw new Exception("_Configuration is incorrect for a duplicator!");
|
||||||
|
// if (_FileConnectorConfiguration is not null)
|
||||||
|
// {
|
||||||
|
// if (string.IsNullOrEmpty(_FileConnectorConfiguration.SourceDirectoryCloaking))
|
||||||
|
// throw new Exception("SourceDirectoryCloaking is empty?");
|
||||||
|
// if (!_FileConnectorConfiguration.SourceDirectoryCloaking.StartsWith("~"))
|
||||||
|
// throw new Exception("SourceDirectoryCloaking is incorrect for a duplicator!");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string GetPropertyValue(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyName)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
List<string> results = (from l in modelObjectParameters where l.Name == propertyName select l.Value).ToList();
|
||||||
|
if (results.Count != 1)
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
result = results[0];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
|
||||||
|
{
|
||||||
|
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
|
||||||
|
if (!results.Any())
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
|
||||||
|
{
|
||||||
|
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
|
||||||
|
if (!results.Any())
|
||||||
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void UpdateLastTicksDuration(long ticksDuration)
|
||||||
|
{
|
||||||
|
if (ticksDuration < 50000000)
|
||||||
|
ticksDuration = 50000000;
|
||||||
|
_LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WaitForThread(Thread thread, List<Exception> threadExceptions)
|
||||||
|
{
|
||||||
|
if (thread is not null)
|
||||||
|
{
|
||||||
|
ThreadState threadState;
|
||||||
|
for (short i = 0; i < short.MaxValue; i++)
|
||||||
|
{
|
||||||
|
if (thread is null)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
threadState = thread.ThreadState;
|
||||||
|
if (threadState is not ThreadState.Running and not 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CreateProgressDirectory(string[] exceptionLines)
|
||||||
|
{
|
||||||
|
string progressDirectory;
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
if (_Hyphens == 0)
|
||||||
|
progressDirectory = Path.Combine(_ProgressPath, _CellInstanceConnectionName);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = stringBuilder.Clear();
|
||||||
|
for (int i = 0; i < _Hyphens; i++)
|
||||||
|
{
|
||||||
|
if (i > 0 && (i % 2) == 0)
|
||||||
|
_ = stringBuilder.Append(' ');
|
||||||
|
_ = stringBuilder.Append('-');
|
||||||
|
}
|
||||||
|
progressDirectory = string.Concat(_ProgressPath, @"\", (_Hyphens + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim();
|
||||||
|
}
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
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 not null)
|
||||||
|
{
|
||||||
|
string fileName = string.Concat(progressDirectory, @"\readme.txt");
|
||||||
|
try
|
||||||
|
{ File.WriteAllLines(fileName, exceptionLines); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||||
|
{
|
||||||
|
string[] results;
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!to.EndsWith(@"\"))
|
||||||
|
_ = string.Concat(to, @"\");
|
||||||
|
if (!isErrorFile)
|
||||||
|
results = Array.Empty<string>();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
|
||||||
|
Shared0449(to, results);
|
||||||
|
}
|
||||||
|
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any())
|
||||||
|
{
|
||||||
|
string itemFile;
|
||||||
|
List<string> directories = new();
|
||||||
|
foreach (FileInfo sourceFile in extractResults.Item4)
|
||||||
|
{
|
||||||
|
if (sourceFile.FullName != _Logistics.ReportFullPath)
|
||||||
|
{
|
||||||
|
itemFile = sourceFile.FullName.Replace(from, to);
|
||||||
|
Shared1880(itemFile, directories, sourceFile, isErrorFile);
|
||||||
|
}
|
||||||
|
else if (!isErrorFile && _Logistics is not null)
|
||||||
|
Shared1811(to, sourceFile);
|
||||||
|
}
|
||||||
|
Shared0231(directories);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static IEnumerable<string> GetDirectoriesRecursively(string path, string directoryNameSegment = null)
|
||||||
|
{
|
||||||
|
Queue<string> queue = new();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string GetProcessedDirectory(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory)
|
||||||
|
{
|
||||||
|
string result = duplicateDirectory;
|
||||||
|
string logisticsSequence = logistics.Sequence.ToString();
|
||||||
|
string[] matchDirectories;
|
||||||
|
if (!_IsEAFHosted)
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string WriteScopeInfo(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory, List<Tuple<Properties.IScopeInfo, string>> 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<Properties.IScopeInfo, string> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static string GetTupleFile(Logistics logistics, Properties.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List<Tuple<Properties.IScopeInfo, string>> tuples)
|
||||||
|
{
|
||||||
|
bool check;
|
||||||
|
long preWait;
|
||||||
|
string tupleFile;
|
||||||
|
List<string> duplicateFiles = new();
|
||||||
|
StringBuilder stringBuilder = new();
|
||||||
|
List<int> consumedFileIndices = new();
|
||||||
|
bool moreThanAnHour = _BreakAfterSeconds > 3600;
|
||||||
|
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<Properties.IScopeInfo, string> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SetFileParameter(string key, string value)
|
||||||
|
{
|
||||||
|
if (_FileConnectorConfiguration is null || _FileConnectorConfiguration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.TargetFileName.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileName.Contains(string.Concat("%", key, "%")))
|
||||||
|
{
|
||||||
|
if (_FileParameter.ContainsKey(key))
|
||||||
|
_FileParameter[key] = value;
|
||||||
|
else
|
||||||
|
_FileParameter.Add(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
|
||||||
|
{
|
||||||
|
string directory;
|
||||||
|
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
|
||||||
|
directory = Path.Combine(_VillachPath, _EquipmentType, "Target");
|
||||||
|
else
|
||||||
|
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName);
|
||||||
|
if (!Directory.Exists(directory))
|
||||||
|
_ = Directory.CreateDirectory(directory);
|
||||||
|
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
|
||||||
|
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
|
||||||
|
File.WriteAllText(file, lines);
|
||||||
|
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||||
|
{
|
||||||
|
bool isErrorFile = exception is not null;
|
||||||
|
if (!isErrorFile && _IsDuplicator)
|
||||||
|
{
|
||||||
|
if (_IsEAFHosted && !string.IsNullOrEmpty(_ProgressPath))
|
||||||
|
CreateProgressDirectory(exceptionLines: null);
|
||||||
|
}
|
||||||
|
if (!_IsEAFHosted)
|
||||||
|
{
|
||||||
|
string to;
|
||||||
|
if (!_FileConnectorConfiguration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||||
|
to = _FileConnectorConfiguration.TargetFileLocation;
|
||||||
|
else
|
||||||
|
to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
|
||||||
|
foreach (KeyValuePair<string, string> keyValuePair in _FileParameter)
|
||||||
|
to = to.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value);
|
||||||
|
if (to.Contains('%'))
|
||||||
|
_Log.Debug("Can't debug without EAF Hosting");
|
||||||
|
else
|
||||||
|
_ = Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
||||||
|
{
|
||||||
|
object value;
|
||||||
|
string description;
|
||||||
|
List<object[]> list;
|
||||||
|
for (int i = 0; i < extractResults.Item3.Length; i++)
|
||||||
|
{
|
||||||
|
_Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
|
||||||
|
foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
|
||||||
|
{
|
||||||
|
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
|
||||||
|
description = string.Empty;
|
||||||
|
else
|
||||||
|
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
|
||||||
|
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
|
||||||
|
value = jsonProperty.Value.ToString();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = new List<object[]>();
|
||||||
|
for (int z = 0; z < extractResults.Item3.Length; z++)
|
||||||
|
list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() });
|
||||||
|
value = list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_UseCyclicalForDescription)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
||||||
|
{
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||||
|
if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation))
|
||||||
|
results = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] segments;
|
||||||
|
string[] matches = null;
|
||||||
|
foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters)
|
||||||
|
{
|
||||||
|
segments = subSourceFileFilter.Split('\\');
|
||||||
|
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||||
|
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
|
||||||
|
else
|
||||||
|
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
|
||||||
|
if (matches.Any())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (matches is null || !matches.Any())
|
||||||
|
results = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ReportFullPath = matches[0];
|
||||||
|
results = fileRead.GetExtractResult(_ReportFullPath, _EventName);
|
||||||
|
if (!_IsEAFHosted)
|
||||||
|
TriggerEvents(results, headerNames, keyValuePairs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Dictionary<Test, List<Properties.IDescription>> GetKeyValuePairs(List<Properties.IDescription> descriptions)
|
||||||
|
{
|
||||||
|
Dictionary<Test, List<Properties.IDescription>> results = new();
|
||||||
|
Test testKey;
|
||||||
|
for (int i = 0; i < descriptions.Count; i++)
|
||||||
|
{
|
||||||
|
testKey = (Test)descriptions[i].Test;
|
||||||
|
if (!results.ContainsKey(testKey))
|
||||||
|
results.Add(testKey, new List<Properties.IDescription>());
|
||||||
|
results[testKey].Add(descriptions[i]);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
|
||||||
|
{
|
||||||
|
List<Properties.IDescription> results = new();
|
||||||
|
Duplicator.Description description;
|
||||||
|
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
||||||
|
foreach (JsonElement jsonElement in jsonElements)
|
||||||
|
{
|
||||||
|
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||||
|
throw new Exception();
|
||||||
|
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions);
|
||||||
|
results.Add(description);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> GetTuple(IFileRead fileRead, IEnumerable<Properties.IDescription> descriptions, bool extra = false)
|
||||||
|
{
|
||||||
|
Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> result;
|
||||||
|
Dictionary<Test, List<Properties.IDescription>> keyValuePairs = GetKeyValuePairs(descriptions.ToList());
|
||||||
|
Test[] tests = (from l in keyValuePairs select l.Key).ToArray();
|
||||||
|
fileRead.CheckTests(tests, extra);
|
||||||
|
result = new Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>>(tests, keyValuePairs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Shared0449(string to, string[] exceptionLines)
|
||||||
|
{
|
||||||
|
if (_IsDuplicator)
|
||||||
|
CreateProgressDirectory(exceptionLines: null);
|
||||||
|
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); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Shared1880(string itemFile, List<string> directories, FileInfo sourceFile, bool isErrorFile)
|
||||||
|
{
|
||||||
|
string itemDirectory;
|
||||||
|
directories.Add(Path.GetDirectoryName(sourceFile.FullName));
|
||||||
|
itemDirectory = Path.GetDirectoryName(itemFile);
|
||||||
|
FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum;
|
||||||
|
if (!isErrorFile)
|
||||||
|
processingModeEnum = _FileConnectorConfiguration.PostProcessingMode.Value;
|
||||||
|
else
|
||||||
|
processingModeEnum = _FileConnectorConfiguration.ErrorPostProcessingMode.Value;
|
||||||
|
if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory))
|
||||||
|
{
|
||||||
|
_ = Directory.CreateDirectory(itemDirectory);
|
||||||
|
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||||
|
Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime);
|
||||||
|
}
|
||||||
|
if (_IsEAFHosted)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Shared1811(string to, FileInfo sourceFile)
|
||||||
|
{
|
||||||
|
if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength)
|
||||||
|
{
|
||||||
|
string directoryName = Path.GetFileName(to);
|
||||||
|
string jobIdDirectory = Path.GetDirectoryName(to);
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Shared0231(List<string> directories)
|
||||||
|
{
|
||||||
|
if (_FileConnectorConfiguration.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<Tuple<Properties.IScopeInfo, string>> tuples, string duplicateFile)
|
||||||
|
{
|
||||||
|
if (!isDummyRun && _IsEAFHosted)
|
||||||
|
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks;
|
||||||
|
for (short i = 0; i < short.MaxValue; i++)
|
||||||
|
{
|
||||||
|
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter)
|
||||||
|
break;
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string[] Shared1567(string reportFullPath, List<Tuple<Properties.IScopeInfo, string>> tuples)
|
||||||
|
{
|
||||||
|
string[] results;
|
||||||
|
string historicalText;
|
||||||
|
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||||
|
string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID);
|
||||||
|
if (!Directory.Exists(jobIdDirectory))
|
||||||
|
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||||
|
string[] matchDirectories;
|
||||||
|
if (!_IsEAFHosted)
|
||||||
|
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<Properties.IScopeInfo, string> tuple in tuples)
|
||||||
|
{
|
||||||
|
fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc");
|
||||||
|
if (_IsEAFHosted)
|
||||||
|
File.WriteAllText(fileName, tuple.Item2);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (File.Exists(fileName))
|
||||||
|
{
|
||||||
|
historicalText = File.ReadAllText(fileName);
|
||||||
|
if (tuple.Item2 != historicalText)
|
||||||
|
throw new Exception("File doesn't match historical!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results = matchDirectories;
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2022-05-13 -> Shared - FileRead
|
@ -1,16 +0,0 @@
|
|||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Adaptation.Shared
|
|
||||||
{
|
|
||||||
public interface IProcessData
|
|
||||||
{
|
|
||||||
|
|
||||||
Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configData, List<FileInfo> fileInfoCollection);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
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<IProcessDataDescription> GetDescription(ILogic logic, ConfigDataBase configDataBase, List<Test> tests, IProcessData iProcessData);
|
|
||||||
List<string> GetDetailNames(ILogic logic, ConfigDataBase configDataBase);
|
|
||||||
List<string> GetHeaderNames(ILogic logic, ConfigDataBase configDataBase);
|
|
||||||
List<string> GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test);
|
|
||||||
List<string> GetNames(ILogic logic, ConfigDataBase configDataBase);
|
|
||||||
List<string> GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase);
|
|
||||||
List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase);
|
|
||||||
string GetEventDescription();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,239 +0,0 @@
|
|||||||
using Adaptation.Shared.Metrology;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Adaptation.Shared
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class IQSRecord
|
|
||||||
{
|
|
||||||
|
|
||||||
public string SID { get; protected set; }
|
|
||||||
public string Part { get; protected set; }
|
|
||||||
public string Process { get; protected set; }
|
|
||||||
public string Lot { get; protected set; }
|
|
||||||
public string SampleSize { get; protected set; }
|
|
||||||
public string ParameterName { get; protected set; }
|
|
||||||
public string TestNumber { get; protected set; }
|
|
||||||
public string ParameterValue { get; protected set; }
|
|
||||||
public string WaferID { get; protected set; }
|
|
||||||
public string WaferScribe { get; protected set; }
|
|
||||||
public string Pocket { get; protected set; }
|
|
||||||
public string EpiThicknessMean { get; protected set; }
|
|
||||||
public string WaferRegion { get; protected set; }
|
|
||||||
public string ToolID { get; protected set; }
|
|
||||||
public string EmployeeID { get; protected set; }
|
|
||||||
public string EmployeeName { get; protected set; }
|
|
||||||
public string Date { get; protected set; }
|
|
||||||
public Column Column { get; protected set; }
|
|
||||||
|
|
||||||
public IQSRecord(object sID, object part, object process, object lot, object sampleSize, object parameterName, object testNumber, object parameterValue, object waferID, object waferScribe, object pocket, object epiThicknessMean, object waferRegion, object toolID, object employeeID, object employeeName, object date, Dictionary<string, Column> keyValuePairs)
|
|
||||||
{
|
|
||||||
if (sID is null)
|
|
||||||
SID = string.Empty;
|
|
||||||
else
|
|
||||||
SID = sID.ToString();
|
|
||||||
if (part is null)
|
|
||||||
Part = string.Empty;
|
|
||||||
else
|
|
||||||
Part = part.ToString();
|
|
||||||
if (process is null)
|
|
||||||
Process = string.Empty;
|
|
||||||
else
|
|
||||||
Process = process.ToString();
|
|
||||||
if (lot is null)
|
|
||||||
Lot = string.Empty;
|
|
||||||
else
|
|
||||||
Lot = lot.ToString();
|
|
||||||
if (sampleSize is null)
|
|
||||||
SampleSize = string.Empty;
|
|
||||||
else
|
|
||||||
SampleSize = sampleSize.ToString();
|
|
||||||
if (parameterName is null)
|
|
||||||
ParameterName = string.Empty;
|
|
||||||
else
|
|
||||||
ParameterName = parameterName.ToString();
|
|
||||||
if (testNumber is null)
|
|
||||||
TestNumber = string.Empty;
|
|
||||||
else
|
|
||||||
TestNumber = testNumber.ToString();
|
|
||||||
if (parameterValue is null)
|
|
||||||
ParameterValue = string.Empty;
|
|
||||||
else
|
|
||||||
ParameterValue = parameterValue.ToString();
|
|
||||||
if (waferID is null)
|
|
||||||
WaferID = string.Empty;
|
|
||||||
else
|
|
||||||
WaferID = waferID.ToString();
|
|
||||||
if (waferScribe is null)
|
|
||||||
WaferScribe = string.Empty;
|
|
||||||
else
|
|
||||||
WaferScribe = waferScribe.ToString();
|
|
||||||
if (pocket is null)
|
|
||||||
Pocket = string.Empty;
|
|
||||||
else
|
|
||||||
Pocket = pocket.ToString();
|
|
||||||
if (epiThicknessMean is null)
|
|
||||||
EpiThicknessMean = string.Empty;
|
|
||||||
else
|
|
||||||
EpiThicknessMean = epiThicknessMean.ToString();
|
|
||||||
if (waferRegion is null)
|
|
||||||
WaferRegion = string.Empty;
|
|
||||||
else
|
|
||||||
WaferRegion = waferRegion.ToString();
|
|
||||||
if (toolID is null)
|
|
||||||
ToolID = string.Empty;
|
|
||||||
else
|
|
||||||
ToolID = toolID.ToString();
|
|
||||||
if (employeeID is null)
|
|
||||||
EmployeeID = string.Empty;
|
|
||||||
else
|
|
||||||
EmployeeID = employeeID.ToString();
|
|
||||||
if (employeeName is null)
|
|
||||||
EmployeeName = string.Empty;
|
|
||||||
else
|
|
||||||
EmployeeName = employeeName.ToString();
|
|
||||||
if (date is null)
|
|
||||||
Date = string.Empty;
|
|
||||||
else
|
|
||||||
Date = date.ToString();
|
|
||||||
if (parameterName is null || !keyValuePairs.ContainsKey(parameterName.ToString()))
|
|
||||||
Column = Column.AFM_Roughness;
|
|
||||||
else
|
|
||||||
Column = keyValuePairs[parameterName.ToString()];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetBaseTableJoins()
|
|
||||||
{
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
result.Append(" from [irmnspc].[dbo].sgrp_ext se ").
|
|
||||||
Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test ").
|
|
||||||
Append(" join [irmnspc].[dbo].part_dat pd on se.f_part = pd.f_part ").
|
|
||||||
Append(" join [irmnspc].[dbo].part_lot pl on se.f_lot = pl.f_lot ").
|
|
||||||
Append(" join [irmnspc].[dbo].prcs_dat pr on se.f_prcs = pr.f_prcs ").
|
|
||||||
Append(" join [irmnspc].[dbo].empl_inf em on se.f_empl = em.f_empl ");
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static StringBuilder GetIqsRecordsSinceSql()
|
|
||||||
{
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
result.Append(" select ").
|
|
||||||
Append(" se.f_sgrp [sid], concat(se.f_sgrp, ', ', td.f_name, ', ', pd.f_name, ', ', pl.f_name, ', ', pr.f_name, ', ', em.f_name, ', ', se.f_sgtm) [csv] ").
|
|
||||||
Append(GetBaseTableJoins()).
|
|
||||||
Append(" where se.f_sgrp >= 1543459064 ").
|
|
||||||
Append(" and se.f_sgrp > ( @lastSID - 20 ) ").
|
|
||||||
Append(" /* and dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) >= '2019-08-25 00:00:00.000' */ ").
|
|
||||||
Append(" and td.f_name = @key ").
|
|
||||||
Append(" group by se.f_sgrp, td.f_name, pd.f_name, pl.f_name, pr.f_name, em.f_name, se.f_sgtm ").
|
|
||||||
Append(" order by se.f_sgrp, pd.f_name, td.f_name ");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static StringBuilder GetIqsRecordsSql()
|
|
||||||
{
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
result.Append(" select ").
|
|
||||||
Append(" ta.id [SID], ").
|
|
||||||
Append(" ta.ms [Part], ").
|
|
||||||
Append(" ta.pr [Process], ").
|
|
||||||
Append(" ta.lt [Lot], ").
|
|
||||||
Append(" ta.sz [Sample Size], ").
|
|
||||||
Append(" ta.pn [Parameter Name], ").
|
|
||||||
Append(" ta.tn [Test Number], ").
|
|
||||||
Append(" ta.pv [Parameter Value], ").
|
|
||||||
Append(" tb.v1337859646 [Wafer ID], ").
|
|
||||||
Append(" tb.v1337859592 [Wafer Scribe], ").
|
|
||||||
Append(" tb.v1342510661 [Pocket], ").
|
|
||||||
Append(" tb.v1340294286 [Epi Thickness Mean], ").
|
|
||||||
Append(" tb.v1345566180 [Wafer Region], ").
|
|
||||||
Append(" tb.v1363881711 [Tool ID], ").
|
|
||||||
Append(" ta.em [Employee ID], ").
|
|
||||||
Append(" ta.en [Employee Name], ").
|
|
||||||
Append(" ta.dt [Date] ").
|
|
||||||
Append(" from ( ").
|
|
||||||
Append(" select ").
|
|
||||||
Append(" se.f_sgrp id, ").
|
|
||||||
Append(" se.f_sgsz sz, ").
|
|
||||||
Append(" concat(se.f_tsno, '.', se.f_sbno) tn, ").
|
|
||||||
Append(" se.f_val pv, ").
|
|
||||||
Append(" se.f_empl em, ").
|
|
||||||
Append(" dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) dt, ").
|
|
||||||
Append(" td.f_name pn, ").
|
|
||||||
Append(" pd.f_name as ms, ").
|
|
||||||
Append(" pl.f_name lt, ").
|
|
||||||
Append(" pr.f_name pr, ").
|
|
||||||
Append(" em.f_name en ").
|
|
||||||
Append(GetBaseTableJoins()).
|
|
||||||
Append(" where se.f_sgrp = @sid ").
|
|
||||||
Append(" ) as ta ").
|
|
||||||
Append(" join ( ").
|
|
||||||
Append(" select ").
|
|
||||||
Append(" se.f_sgrp id, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1337859646 then dd.f_name end) as v1337859646, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1337859592 then dd.f_name end) as v1337859592, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1342510661 then dd.f_name end) as v1342510661, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1340294286 then dd.f_name end) as v1340294286, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1345566180 then dd.f_name end) as v1345566180, ").
|
|
||||||
Append(" max(case when dd.f_dsgp = 1363881711 then dd.f_name end) as v1363881711 ").
|
|
||||||
Append(" from [irmnspc].[dbo].sgrp_ext se ").
|
|
||||||
Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test ").
|
|
||||||
Append(" join [irmnspc].[dbo].sgrp_dsc sd on se.f_sgrp = sd.f_sgrp ").
|
|
||||||
Append(" join [irmnspc].[dbo].desc_dat dd on sd.f_desc = dd.f_desc ").
|
|
||||||
Append(" and isnull(dd.f_name, '') <> '' ").
|
|
||||||
Append(" where se.f_sgrp = @sid ").
|
|
||||||
Append(" and dd.f_dsgp in (1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) ").
|
|
||||||
Append(" group by se.f_sgrp ").
|
|
||||||
Append(" ) tb on ta.id = tb.id ").
|
|
||||||
Append(" order by ta.id desc, ta.ms, ta.pr, ta.lt, ta.sz, ta.tn, ta.dt, ta.pn ");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<IQSRecord> GetIqsRecords(Dictionary<int, List<object>> rawData, int count)
|
|
||||||
{
|
|
||||||
List<IQSRecord> results = new List<IQSRecord>();
|
|
||||||
IQSRecord iqsRecord;
|
|
||||||
List<object> c0 = rawData[0];
|
|
||||||
List<object> c1 = rawData[1];
|
|
||||||
List<object> c2 = rawData[2];
|
|
||||||
List<object> c3 = rawData[3];
|
|
||||||
List<object> c4 = rawData[4];
|
|
||||||
List<object> c5 = rawData[5];
|
|
||||||
List<object> c6 = rawData[6];
|
|
||||||
List<object> c7 = rawData[7];
|
|
||||||
List<object> c8 = rawData[8];
|
|
||||||
List<object> c9 = rawData[9];
|
|
||||||
List<object> cA = rawData[10];
|
|
||||||
List<object> cB = rawData[11];
|
|
||||||
List<object> cC = rawData[12];
|
|
||||||
List<object> cD = rawData[13];
|
|
||||||
List<object> cE = rawData[14];
|
|
||||||
List<object> cF = rawData[15];
|
|
||||||
List<object> cG = rawData[16];
|
|
||||||
if (c0.Any())
|
|
||||||
{
|
|
||||||
Array array = Enum.GetValues(typeof(Column));
|
|
||||||
Dictionary<string, Column> keyValuePairs = new Dictionary<string, Column>();
|
|
||||||
foreach (Column column in array)
|
|
||||||
keyValuePairs.Add(column.GetDiplayName(), column);
|
|
||||||
for (int i = 0; i < c0.Count; i++)
|
|
||||||
{
|
|
||||||
iqsRecord = new IQSRecord(c0[i], c1[i], c2[i], c3[i], c4[i], c5[i], c6[i], c7[i], c8[i], c9[i], cA[i], cB[i], cC[i], cD[i], cE[i], cF[i], cG[i], keyValuePairs);
|
|
||||||
results.Add(iqsRecord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
//(1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) ").
|
|
||||||
//return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, WaferID, WaferScribe, Pocket, EpiThicknessMean, WaferRegion, ToolID, EmployeeID, EmployeeName, Date);
|
|
||||||
return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, EmployeeID, EmployeeName, Date);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,171 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,242 +1,208 @@
|
|||||||
using System;
|
using Adaptation.Shared.Methods;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Adaptation.Shared
|
namespace Adaptation.Shared;
|
||||||
|
|
||||||
|
public class Logistics : ILogistics
|
||||||
{
|
{
|
||||||
|
|
||||||
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; set; } //Reactor (duplicate but I want it in the logistics)
|
||||||
|
public string MID { get; set; } //Lot & Pocket || Lot
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
public List<string> Logistics1 { get; set; }
|
||||||
|
public List<Logistics2> Logistics2 { get; set; }
|
||||||
|
|
||||||
|
public Logistics(IFileRead fileRead)
|
||||||
{
|
{
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
NullData = null;
|
||||||
|
Sequence = dateTime.Ticks;
|
||||||
|
DateTimeFromSequence = dateTime;
|
||||||
|
JobID = fileRead.CellInstanceName;
|
||||||
|
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||||
|
MesEntity = DefaultMesEntity(dateTime);
|
||||||
|
ReportFullPath = string.Empty;
|
||||||
|
ProcessJobID = nameof(ProcessJobID);
|
||||||
|
MID = nameof(MID);
|
||||||
|
Tags = new List<string>();
|
||||||
|
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||||
|
Logistics2 = new List<Logistics2>();
|
||||||
|
}
|
||||||
|
|
||||||
public object NullData { get; private set; }
|
public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
|
||||||
public string JobID { get; private set; } //CellName
|
{
|
||||||
public long Sequence { get; private set; } //Ticks
|
if (string.IsNullOrEmpty(fileRead.CellInstanceName))
|
||||||
public DateTime DateTimeFromSequence { get; private set; }
|
throw new Exception();
|
||||||
public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; }
|
if (string.IsNullOrEmpty(fileRead.MesEntity))
|
||||||
public string MesEntity { get; private set; } //SPC
|
throw new Exception();
|
||||||
public string ReportFullPath { get; private set; } //Extract file
|
NullData = fileRead.NullData;
|
||||||
public string ProcessJobID { get; internal set; } //Reactor (duplicate but I want it in the logistics)
|
FileInfo fileInfo = new(reportFullPath);
|
||||||
public string MID { get; internal set; } //Lot & Pocket || Lot
|
DateTime dateTime = fileInfo.LastWriteTime;
|
||||||
public List<string> Tags { get; internal set; }
|
if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value)
|
||||||
public List<string> Logistics1 { get; internal set; }
|
dateTime = dateTime.AddTicks(-1);
|
||||||
public List<Logistics2> Logistics2 { get; internal set; }
|
JobID = fileRead.CellInstanceName;
|
||||||
|
Sequence = dateTime.Ticks;
|
||||||
public Logistics()
|
DateTimeFromSequence = dateTime;
|
||||||
|
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||||
|
MesEntity = fileRead.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<string>();
|
||||||
|
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||||
|
Logistics2 = new List<Logistics2>();
|
||||||
|
}
|
||||||
|
|
||||||
|
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"))
|
||||||
{
|
{
|
||||||
DateTime dateTime = DateTime.Now;
|
|
||||||
NullData = null;
|
NullData = null;
|
||||||
JobID = Description.GetCellName();
|
JobID = "null";
|
||||||
|
dateTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||||
Sequence = dateTime.Ticks;
|
Sequence = dateTime.Ticks;
|
||||||
DateTimeFromSequence = dateTime;
|
DateTimeFromSequence = dateTime;
|
||||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||||
MesEntity = DefaultMesEntity(dateTime);
|
MesEntity = DefaultMesEntity(dateTime);
|
||||||
ReportFullPath = string.Empty;
|
ReportFullPath = reportFullPath;
|
||||||
ProcessJobID = nameof(ProcessJobID);
|
ProcessJobID = "R##";
|
||||||
MID = nameof(MID);
|
MID = "null";
|
||||||
Tags = new List<string>();
|
Tags = new List<string>();
|
||||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||||
Logistics2 = new List<Logistics2>();
|
Logistics2 = new List<Logistics2>();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
public Logistics(object nullData, Dictionary<string, string> cellNames, Dictionary<string, string> mesEntities, FileInfo fileInfo, bool useSplitForMID, int? fileInfoLength = null)
|
|
||||||
{
|
{
|
||||||
NullData = nullData;
|
string logistics1Line1 = Logistics1[0];
|
||||||
string mesEntity = string.Empty;
|
key = "NULL_DATA=";
|
||||||
string jobID = Description.GetCellName();
|
if (!logistics1Line1.Contains(key))
|
||||||
DateTime dateTime = fileInfo.LastWriteTime;
|
NullData = null;
|
||||||
if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value)
|
else
|
||||||
dateTime = dateTime.AddTicks(-1);
|
|
||||||
if (string.IsNullOrEmpty(jobID))
|
|
||||||
{
|
{
|
||||||
if (cellNames.Count == 1)
|
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
jobID = cellNames.ElementAt(0).Key;
|
NullData = segments[1].Split(';')[0];
|
||||||
else
|
}
|
||||||
{
|
key = "JOBID=";
|
||||||
foreach (var element in cellNames)
|
if (!logistics1Line1.Contains(key))
|
||||||
{
|
JobID = "null";
|
||||||
if (fileInfo.FullName.IndexOf(element.Key, StringComparison.OrdinalIgnoreCase) > -1 || fileInfo.FullName.IndexOf(element.Value, StringComparison.OrdinalIgnoreCase) > -1)
|
else
|
||||||
{
|
{
|
||||||
jobID = element.Key;
|
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
break;
|
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);
|
||||||
}
|
}
|
||||||
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;
|
Sequence = dateTime.Ticks;
|
||||||
DateTimeFromSequence = dateTime;
|
DateTimeFromSequence = dateTime;
|
||||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||||
MesEntity = mesEntity;
|
DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||||
ReportFullPath = fileInfo.FullName;
|
if (TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
||||||
ProcessJobID = nameof(ProcessJobID);
|
|
||||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
|
|
||||||
if (useSplitForMID)
|
|
||||||
{
|
{
|
||||||
if (fileNameWithoutExtension.IndexOf(".") > -1)
|
if (lastWriteTime != dateTime)
|
||||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim();
|
try
|
||||||
if (fileNameWithoutExtension.IndexOf("_") > -1)
|
{ File.SetLastWriteTime(reportFullPath, dateTime); }
|
||||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim();
|
catch (Exception) { }
|
||||||
if (fileNameWithoutExtension.IndexOf("-") > -1)
|
|
||||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim();
|
|
||||||
}
|
}
|
||||||
MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower());
|
key = "MES_ENTITY=";
|
||||||
Tags = new List<string>();
|
if (!logistics1Line1.Contains(key))
|
||||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
|
||||||
Logistics2 = new List<Logistics2>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
MesEntity = DefaultMesEntity(dateTime);
|
||||||
ReportFullPath = reportFullPath;
|
|
||||||
ProcessJobID = "R##";
|
|
||||||
MID = "null";
|
|
||||||
Tags = new List<string>();
|
|
||||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
|
||||||
Logistics2 = new List<Logistics2>();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string logistics1Line1 = Logistics1[0];
|
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
key = "NULL_DATA=";
|
MesEntity = segments[1].Split(';')[0];
|
||||||
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;
|
ReportFullPath = reportFullPath;
|
||||||
Tags = new List<string>();
|
key = "PROCESS_JOBID=";
|
||||||
Logistics2 = new List<Logistics2>();
|
if (!logistics1Line1.Contains(key))
|
||||||
for (int i = 1; i < Logistics1.Count(); i++)
|
ProcessJobID = "R##";
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
{
|
ProcessJobID = segments[1].Split(';')[0];
|
||||||
logistics2 = new Logistics2(Logistics1[i]);
|
|
||||||
Logistics2.Add(logistics2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (int i = Logistics1.Count() - 1; i > -1; i--)
|
key = "MID=";
|
||||||
|
if (!logistics1Line1.Contains(key))
|
||||||
|
MID = "null";
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
Logistics1.RemoveAt(i);
|
MID = segments[1].Split(';')[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logistics2 logistics2;
|
||||||
public Logistics ShallowCopy()
|
Tags = new List<string>();
|
||||||
|
Logistics2 = new List<Logistics2>();
|
||||||
|
for (int i = 1; i < Logistics1.Count; i++)
|
||||||
{
|
{
|
||||||
return (Logistics)this.MemberwiseClone();
|
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
||||||
|
{
|
||||||
|
logistics2 = new Logistics2(Logistics1[i]);
|
||||||
|
Logistics2.Add(logistics2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
for (int i = Logistics1.Count - 1; i > -1; i--)
|
||||||
private string DefaultMesEntity(DateTime dateTime)
|
|
||||||
{
|
{
|
||||||
return string.Concat(dateTime.Ticks, "_MES_ENTITY");
|
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
||||||
}
|
Logistics1.RemoveAt(i);
|
||||||
|
|
||||||
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<string>();
|
|
||||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
|
||||||
Logistics2 = new List<Logistics2>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Logistics ShallowCopy() => (Logistics)MemberwiseClone();
|
||||||
|
|
||||||
|
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
|
||||||
|
|
||||||
|
internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2);
|
||||||
|
|
||||||
|
internal string GetPocketNumberViaMostCommonMethod() => 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<string>();
|
||||||
|
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||||
|
Logistics2 = new List<Logistics2>();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,80 +1,78 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Adaptation.Shared
|
namespace Adaptation.Shared;
|
||||||
|
|
||||||
|
public class Logistics2 : Methods.ILogistics2
|
||||||
{
|
{
|
||||||
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;
|
||||||
public string MID { get; private set; }
|
string[] segments;
|
||||||
public string RunNumber { get; private set; }
|
key = "JOBID=";
|
||||||
public string SatelliteGroup { get; private set; }
|
if (!logistics2.Contains(key))
|
||||||
public string PartNumber { get; private set; }
|
MID = "null";
|
||||||
public string PocketNumber { get; private set; }
|
else
|
||||||
public string WaferLot { get; private set; }
|
|
||||||
public string Recipe { get; private set; }
|
|
||||||
|
|
||||||
public Logistics2(string logistics2)
|
|
||||||
{
|
{
|
||||||
string key;
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
string[] segments;
|
MID = segments[1].Split(';')[0];
|
||||||
key = "JOBID=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "MID=";
|
||||||
MID = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
RunNumber = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
MID = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
RunNumber = segments[1].Split(';')[0];
|
||||||
key = "MID=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "INFO=";
|
||||||
RunNumber = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
SatelliteGroup = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
RunNumber = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
SatelliteGroup = segments[1].Split(';')[0];
|
||||||
key = "INFO=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "PRODUCT=";
|
||||||
SatelliteGroup = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
PartNumber = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
SatelliteGroup = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
PartNumber = segments[1].Split(';')[0];
|
||||||
key = "PRODUCT=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "CHAMBER=";
|
||||||
PartNumber = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
PocketNumber = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
PartNumber = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
PocketNumber = segments[1].Split(';')[0];
|
||||||
key = "CHAMBER=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "WAFER_ID=";
|
||||||
PocketNumber = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
WaferLot = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
PocketNumber = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
WaferLot = segments[1].Split(';')[0];
|
||||||
key = "WAFER_ID=";
|
}
|
||||||
if (!logistics2.Contains(key))
|
key = "PPID=";
|
||||||
WaferLot = "null";
|
if (!logistics2.Contains(key))
|
||||||
else
|
Recipe = "null";
|
||||||
{
|
else
|
||||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
{
|
||||||
WaferLot = segments[1].Split(';')[0];
|
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
Recipe = 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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
22
Adaptation/Shared/Methods/IDescription.cs
Normal file
22
Adaptation/Shared/Methods/IDescription.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.Shared.Methods;
|
||||||
|
|
||||||
|
public interface IDescription
|
||||||
|
{
|
||||||
|
|
||||||
|
string GetEventDescription();
|
||||||
|
List<string> GetDetailNames();
|
||||||
|
List<string> GetHeaderNames();
|
||||||
|
IDescription GetDisplayNames();
|
||||||
|
List<string> GetParameterNames();
|
||||||
|
List<string> GetPairedParameterNames();
|
||||||
|
List<string> GetIgnoreParameterNames(Test test);
|
||||||
|
List<string> GetNames(IFileRead fileRead, Logistics logistics);
|
||||||
|
JsonProperty[] GetDefault(IFileRead fileRead, Logistics logistics);
|
||||||
|
Dictionary<string, string> GetDisplayNamesJsonElement(IFileRead fileRead);
|
||||||
|
IDescription GetDefaultDescription(IFileRead fileRead, Logistics logistics);
|
||||||
|
List<IDescription> GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData);
|
||||||
|
|
||||||
|
}
|
23
Adaptation/Shared/Methods/IFileRead.cs
Normal file
23
Adaptation/Shared/Methods/IFileRead.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Adaptation.Shared.Methods;
|
||||||
|
|
||||||
|
public interface IFileRead : Properties.IFileRead
|
||||||
|
{
|
||||||
|
|
||||||
|
void WaitForThread();
|
||||||
|
JsonProperty[] GetDefault();
|
||||||
|
string GetEventDescription();
|
||||||
|
List<string> GetHeaderNames();
|
||||||
|
void CheckTests(Test[] tests, bool extra);
|
||||||
|
Dictionary<string, string> GetDisplayNamesJsonElement();
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract();
|
||||||
|
List<IDescription> GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData);
|
||||||
|
void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null);
|
||||||
|
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
|
||||||
|
string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception);
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user