Compare commits
	
		
			5 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 365fedce89 | |||
| 9d0d24fb83 | |||
| f15c525ab5 | |||
| 6176cfeb6f | |||
| 90e6be1b3d | 
| @ -109,7 +109,7 @@ dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template | ||||
| dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name | ||||
| dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); | ||||
| dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. | ||||
| dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary | ||||
| dotnet_diagnostic.IDE0005.severity = none # Using directive is unnecessary | ||||
| dotnet_diagnostic.IDE0028.severity = none # IDE0028: Collection initialization can be simplified | ||||
| dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031) | ||||
| dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed | ||||
| @ -121,6 +121,8 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs | ||||
| dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified | ||||
| dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified | ||||
| dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified | ||||
| dotnet_diagnostic.MSTEST0015.severity = none # MSTEST0015: Test method {method} should not be ignored | ||||
| dotnet_diagnostic.MSTEST0037.severity = error # MSTEST0037: Use proper 'Assert' methods | ||||
| dotnet_diagnostic.SYSLIB1045.severity = none # SYSLIB1045: diagnostics for regex source generation | ||||
| dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning | ||||
| dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case | ||||
|  | ||||
							
								
								
									
										37
									
								
								Adaptation/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										37
									
								
								Adaptation/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @ -1,10 +1,43 @@ | ||||
| { | ||||
|   "configurations": [ | ||||
|     { | ||||
|       "mode": "debug", | ||||
|       "name": "Go launch file", | ||||
|       "program": "${file}", | ||||
|       "request": "launch", | ||||
|       "type": "go" | ||||
|     }, | ||||
|     { | ||||
|       "name": "node Launch Current Opened File", | ||||
|       "program": "${file}", | ||||
|       "request": "launch", | ||||
|       "type": "node" | ||||
|     }, | ||||
|     { | ||||
|       "cwd": "${workspaceFolder}", | ||||
|       "internalConsoleOptions": "neverOpen", | ||||
|       "name": "Debug File", | ||||
|       "program": "${file}", | ||||
|       "request": "launch", | ||||
|       "stopOnEntry": false, | ||||
|       "type": "bun", | ||||
|       "watchMode": false | ||||
|     }, | ||||
|     { | ||||
|       "cwd": "${workspaceFolder}", | ||||
|       "internalConsoleOptions": "neverOpen", | ||||
|       "name": "Run File", | ||||
|       "noDebug": true, | ||||
|       "program": "${file}", | ||||
|       "request": "launch", | ||||
|       "type": "bun", | ||||
|       "watchMode": false | ||||
|     }, | ||||
|     { | ||||
|       "name": ".NET Core Attach", | ||||
|       "type": "coreclr", | ||||
|       "processId": 32760, | ||||
|       "request": "attach", | ||||
|       "processId": 32760 | ||||
|       "type": "coreclr" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										151
									
								
								Adaptation/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										151
									
								
								Adaptation/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -1,19 +1,134 @@ | ||||
| { | ||||
|     "version": "2.0.0", | ||||
|     "inputs": [ | ||||
|         { | ||||
|             "default": "Development", | ||||
|             "description": "Which ASP Net Core Environment?", | ||||
|             "id": "ASPNETCORE_ENVIRONMENT", | ||||
|             "options": [ | ||||
|                 "Development", | ||||
|                 "Production" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{AssemblyTitle}", | ||||
|             "description": "What Assembly Title?", | ||||
|             "id": "AssemblyTitle", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.BuildId}", | ||||
|             "description": "Which Build BuildId?", | ||||
|             "id": "Build.BuildId", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Reason}", | ||||
|             "description": "Which Build Reason?", | ||||
|             "id": "Build.Reason", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Id}", | ||||
|             "description": "Which Build Repository Id?", | ||||
|             "id": "Build.Repository.Id", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Name}", | ||||
|             "description": "Which Build Repository Name?", | ||||
|             "id": "Build.Repository.Name", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.SourceVersion}", | ||||
|             "description": "Which Build Source Version?", | ||||
|             "id": "Build.SourceVersion", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "Debug", | ||||
|             "description": "Which Configuration?", | ||||
|             "id": "Configuration", | ||||
|             "options": [ | ||||
|                 "Debug", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "net8.0", | ||||
|             "description": "Which Core Version?", | ||||
|             "id": "CoreVersion", | ||||
|             "options": [ | ||||
|                 "net8.0" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe", | ||||
|             "description": "Which MS Build?", | ||||
|             "id": "MSBuild", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/", | ||||
|             "description": "Which Nuget Source?", | ||||
|             "id": "NugetSource", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "win-x64", | ||||
|             "description": "Which Runtime?", | ||||
|             "id": "Runtime", | ||||
|             "options": [ | ||||
|                 "win-x64", | ||||
|                 "win-x32", | ||||
|                 "linux-x64", | ||||
|                 "linux-x32" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "L:/", | ||||
|             "description": "Which System DefaultWorkingDirectory?", | ||||
|             "id": "System.DefaultWorkingDirectory", | ||||
|             "options": [ | ||||
|                 "L:/", | ||||
|                 "D:/", | ||||
|                 "C:/" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "v4.8", | ||||
|             "description": "Which Core Target Framework Version?", | ||||
|             "id": "TargetFrameworkVersion", | ||||
|             "options": [ | ||||
|                 "v4.8" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{UserSecretsId}", | ||||
|             "description": "Which Core User Secrets Id?", | ||||
|             "id": "UserSecretsId", | ||||
|             "type": "promptString" | ||||
|         } | ||||
|     ], | ||||
|     "tasks": [ | ||||
|         { | ||||
|             "label": "Build", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|                 "build" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test-Debug", | ||||
|             "label": "Test Debug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -24,7 +139,7 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test-Release", | ||||
|             "label": "Test Release", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -50,7 +165,7 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format-Whitespaces", | ||||
|             "label": "Format Whitespaces", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -87,13 +202,33 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Project", | ||||
|             "label": "Code Project", | ||||
|             "type": "shell", | ||||
|             "command": "code ../DEP08CEPIEPSILON.csproj", | ||||
|             "problemMatcher": [] | ||||
|         }, | ||||
|         { | ||||
|             "label": "Git Config", | ||||
|             "label": "Code Read Me", | ||||
|             "type": "shell", | ||||
|             "command": "code ../README.md", | ||||
|             "problemMatcher": [] | ||||
|         }, | ||||
|         { | ||||
|             "label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20", | ||||
|             "type": "shell", | ||||
|             "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe", | ||||
|             "args": [ | ||||
|                 "s", | ||||
|                 "X", | ||||
|                 "L:/DevOps/EAF-Mesa-Integration/DEP08CEPIEPSILON", | ||||
|                 "Day-Helper-2025-03-20", | ||||
|                 "false", | ||||
|                 "4" | ||||
|             ], | ||||
|             "problemMatcher": [] | ||||
|         }, | ||||
|         { | ||||
|             "label": "Code Git Config", | ||||
|             "type": "shell", | ||||
|             "command": "code ../.git/config", | ||||
|             "problemMatcher": [] | ||||
|  | ||||
| @ -1,163 +1 @@ | ||||
| trigger: | ||||
|   branches: | ||||
|     include: | ||||
|       - Development | ||||
|   paths: | ||||
|     include: | ||||
|       - "Adaptation/*" | ||||
|  | ||||
| pool: | ||||
|   name: eaf | ||||
|   demands: DEP08CEPIEPSILON-Development | ||||
|  | ||||
| steps: | ||||
|   - script: | | ||||
|       set coreVersion=net7.0 | ||||
|       echo %coreVersion% | ||||
|       echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion% | ||||
|       echo $(CoreVersion) | ||||
|     displayName: CoreVersion | ||||
|  | ||||
|   - script: | | ||||
|       set configuration=Debug | ||||
|       echo %configuration% | ||||
|       echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|       echo $(Configuration) | ||||
|     displayName: Configuration | ||||
|  | ||||
|   - script: | | ||||
|       set nugetSource=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/index.json;D:/vsts-agent-win-x64-2.210.1-eaf/nuget | ||||
|       echo %nugetSource% | ||||
|       echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% | ||||
|       echo $(NugetSource) | ||||
|     displayName: NugetSource | ||||
|  | ||||
|   - script: | | ||||
|       set gitCommit=$(Build.SourceVersion) | ||||
|       set gitCommitSeven=%gitCommit:~0,7% | ||||
|       echo %gitCommitSeven% | ||||
|       echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven% | ||||
|       echo $(GitCommitSeven) | ||||
|     displayName: GitCommitSeven | ||||
|  | ||||
|   - script: | | ||||
|       echo $(Build.BuildId) | ||||
|       echo $(Build.Reason) | ||||
|       echo $(Build.Repository.Id) | ||||
|       echo $(Build.Repository.Name) | ||||
|       echo $(Build.SourceVersion) | ||||
|       echo $(CoreVersion) | ||||
|       echo $(Configuration) | ||||
|       echo $(NugetSource) | ||||
|       echo $(GitCommitSeven) | ||||
|       REM echo $(pipelinePassword) | ||||
|     displayName: "Echo Check" | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' | ||||
|     displayName: "Nuget Clear" | ||||
|     enabled: false | ||||
|  | ||||
|   - script: | | ||||
|       "C:\program files\dotnet\dotnet.exe" user-secrets init | ||||
|       "C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)" | ||||
|       "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)" | ||||
|       "C:\program files\dotnet\dotnet.exe" user-secrets list | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Safe storage of app secrets - Adaptation" | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)' | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Core Build - Adaptation" | ||||
|  | ||||
|   - powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | ||||
|     workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)" | ||||
|     displayName: "PowerShell Script" | ||||
|     continueOnError: true | ||||
|  | ||||
|   - script: "dotnet test --configuration $(Configuration)" | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Core Test" | ||||
|  | ||||
|   - script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)' | ||||
|     displayName: "Move Results" | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" tool restore' | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Tool Restore" | ||||
|     enabled: false | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Report Generator" | ||||
|     enabled: false | ||||
|  | ||||
|   - task: PublishTestResults@2 | ||||
|     displayName: "Publish Test Results **/*.trx" | ||||
|     inputs: | ||||
|       testResultsFormat: VSTest | ||||
|       testResultsFiles: "**/*.trx" | ||||
|       testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|       searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|   - task: PublishTestResults@2 | ||||
|     displayName: "Publish Test Results */coverage.cobertura.xml" | ||||
|     inputs: | ||||
|       testResultsFormat: VSTest | ||||
|       testResultsFiles: "*/coverage.cobertura.xml" | ||||
|       testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|       searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|   - task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1 | ||||
|     displayName: "Create work item" | ||||
|     inputs: | ||||
|       teamProject: "Mesa_FI" | ||||
|       workItemType: Bug | ||||
|       title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration) | ||||
|       assignedTo: "$(Build.RequestedForId)" | ||||
|     enabled: false | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)' | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Core Publish" | ||||
|     enabled: false | ||||
|  | ||||
|   - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources="$(NugetSource)"' | ||||
|     displayName: "MSBuild Restore" | ||||
|  | ||||
|   - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' | ||||
|     displayName: MSBuild | ||||
|  | ||||
|   - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt' | ||||
|     displayName: "Commit Id" | ||||
|  | ||||
|   - task: CopyFiles@2 | ||||
|     displayName: 'Copy Files to: D:\Framework4.8' | ||||
|     inputs: | ||||
|       Contents: "*$(Build.Repository.Name)*" | ||||
|       SourceFolder: 'bin\$(Configuration)' | ||||
|       TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' | ||||
|       OverWrite: true | ||||
|     enabled: false | ||||
|  | ||||
|   - task: CopyFiles@2 | ||||
|     displayName: 'Copy Files to: Local D EAF Deployment Storage' | ||||
|     inputs: | ||||
|       Contents: "*$(Build.Repository.Name)*" | ||||
|       SourceFolder: 'bin\$(Configuration)' | ||||
|       TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)' | ||||
|       OverWrite: true | ||||
|     enabled: false | ||||
|  | ||||
|   - script: | | ||||
|       "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Core Clean - Tests" | ||||
|  | ||||
|   - script: | | ||||
|       "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) | ||||
|     workingDirectory: Adaptation | ||||
|     displayName: "Core Clean - Adaptation" | ||||
|  | ||||
|   - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|     displayName: "Force Fail" | ||||
|     enabled: false | ||||
| # dotnet nuget push --source https://tfs.intra.infineon.com/tfs/FactoryIntegration/fccf8303-9cf7-4788-a9e0-4042541503fa/_packaging/EAF-Mesa-Integration/nuget/v3/index.json --api-key az D:\vsts-agent-win-x64-2.210.1-eaf\nuget\infineon.mesa.pdf.text.stripper.4.8.0.1.nupkg | ||||
| @ -69,7 +69,7 @@ | ||||
|         <PackageReference Include="System.Text.Json" Version="9.0.0" /> | ||||
|     </ItemGroup> | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.1"><NoWarn>NU1701</NoWarn></PackageReference> | ||||
|         <PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2"><NoWarn>NU1701</NoWarn></PackageReference> | ||||
|     </ItemGroup> | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" /> | ||||
|  | ||||
| @ -1,3 +1,9 @@ | ||||
| # D: | ||||
| # cd D:\EAF-Mesa-Integration | ||||
| # config --url https://tfs.intra.infineon.com/tfs/FactoryIntegration --pool "EAF Mesa Integration" --agent mestsa003-meseafsvc --work _work --runAsService --auth negotiate --userName infineon\phares | ||||
| # D: | ||||
| # cd D:\EAF-Mesa-Integration | ||||
| # config --url https://tfs.intra.infineon.com/tfs/FactoryIntegration --pool "EAF Mesa Integration" --agent mestsa07ec-ecmeseaf --work _work --runAsService --auth negotiate --userName infineon\phares | ||||
| trigger: | ||||
|   branches: | ||||
|     include: | ||||
| @ -6,41 +12,21 @@ trigger: | ||||
|     include: | ||||
|       - "Adaptation/*" | ||||
|  | ||||
| pool: | ||||
|   name: eaf | ||||
|   demands: DEP08CEPIEPSILON | ||||
| stages: | ||||
|   - stage: DevServer | ||||
|     displayName: DevServer | ||||
|  | ||||
| steps: | ||||
|   - script: | | ||||
|       set coreVersion=net7.0 | ||||
|       echo %coreVersion% | ||||
|       echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion% | ||||
|       echo $(CoreVersion) | ||||
|     displayName: CoreVersion | ||||
|     pool: | ||||
|       name: EAF Mesa Integration | ||||
|       demands: DEP08CEPIEPSILON-Development | ||||
|  | ||||
|   - script: | | ||||
|       set configuration=Release | ||||
|       echo %configuration% | ||||
|       echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|       echo $(Configuration) | ||||
|     displayName: Configuration | ||||
|  | ||||
|   - script: | | ||||
|       REM set nugetSource=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/ | ||||
|       set nugetSource=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/index.json;D:/vsts-agent-win-x64-2.210.1-eaf/nuget | ||||
|       echo %nugetSource% | ||||
|       echo ##vso[task.setvariable variable=NugetSource;]%nugetSource% | ||||
|       echo $(NugetSource) | ||||
|     displayName: NugetSource | ||||
|  | ||||
|   - script: | | ||||
|       set gitCommit=$(Build.SourceVersion) | ||||
|       set gitCommitSeven=%gitCommit:~0,7% | ||||
|       echo %gitCommitSeven% | ||||
|       echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven% | ||||
|       echo $(GitCommitSeven) | ||||
|     displayName: GitCommitSeven | ||||
|     variables: | ||||
|       coreVersion: "net8.0" | ||||
|       nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/" | ||||
|  | ||||
|     jobs: | ||||
|       - job: SetupEnvironment | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo $(Build.BuildId) | ||||
|               echo $(Build.Reason) | ||||
| @ -48,10 +34,7 @@ steps: | ||||
|               echo $(Build.Repository.Name) | ||||
|               echo $(Build.SourceVersion) | ||||
|               echo $(CoreVersion) | ||||
|       echo $(Configuration) | ||||
|               echo $(NugetSource) | ||||
|       echo $(GitCommitSeven) | ||||
|       REM echo $(pipelinePassword) | ||||
|             displayName: "Echo Check" | ||||
|  | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' | ||||
| @ -61,21 +44,77 @@ steps: | ||||
|           - script: | | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets init | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)" | ||||
|       "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommitSeven" "$(GitCommitSeven)" | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommit" "$(Build.SourceVersion)" | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets list | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Safe storage of app secrets - Adaptation" | ||||
|  | ||||
|       - job: BuildDebug | ||||
|         dependsOn: | ||||
|           - SetupEnvironment | ||||
|         steps: | ||||
|           - script: | | ||||
|               set configuration=Debug | ||||
|               echo %configuration% | ||||
|               echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|               echo $(Configuration) | ||||
|             displayName: Configuration | ||||
|  | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)' | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Core Build - Adaptation" | ||||
|  | ||||
|       - job: BuildRelease | ||||
|         dependsOn: | ||||
|           - SetupEnvironment | ||||
|         steps: | ||||
|           - script: | | ||||
|               set configuration=Release | ||||
|               echo %configuration% | ||||
|               echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|               echo $(Configuration) | ||||
|             displayName: Configuration | ||||
|  | ||||
|           - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)' | ||||
|             displayName: "MSBuild Restore" | ||||
|  | ||||
|           - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' | ||||
|             displayName: MSBuild | ||||
|  | ||||
|           - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' | ||||
|             displayName: MSBuild | ||||
|  | ||||
|           - script: 'echo $(Build.Repository.Name)-$(Build.BuildId)-$(Build.SourceVersion)>bin\$(Configuration)\$(Build.Repository.Name).txt' | ||||
|             displayName: "Commit Id" | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|             displayName: 'Copy Files to: D:\EAF' | ||||
|             inputs: | ||||
|               Contents: "*$(Build.Repository.Name)*" | ||||
|               SourceFolder: 'bin\$(Configuration)' | ||||
|               TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)' | ||||
|               OverWrite: true | ||||
|             enabled: true | ||||
|  | ||||
|       - job: TestDebug | ||||
|         dependsOn: | ||||
|           - SetupEnvironment | ||||
|           - BuildDebug | ||||
|           - BuildRelease | ||||
|         steps: | ||||
|           - script: | | ||||
|               set configuration=Debug | ||||
|               echo %configuration% | ||||
|               echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|               echo $(Configuration) | ||||
|             displayName: Configuration | ||||
|  | ||||
|           - powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | ||||
|             workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)" | ||||
|             displayName: "PowerShell Script" | ||||
|             continueOnError: true | ||||
|  | ||||
|   - script: "dotnet test --configuration $(Configuration) --runtime win-x86" | ||||
|           - script: "dotnet test --configuration $(Configuration)" | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Core Test" | ||||
|  | ||||
| @ -97,7 +136,7 @@ steps: | ||||
|             inputs: | ||||
|               testResultsFormat: VSTest | ||||
|               testResultsFiles: "**/*.trx" | ||||
|       testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|           - task: PublishTestResults@2 | ||||
| @ -105,60 +144,141 @@ steps: | ||||
|             inputs: | ||||
|               testResultsFormat: VSTest | ||||
|               testResultsFiles: "*/coverage.cobertura.xml" | ||||
|       testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|   - task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1 | ||||
|     displayName: "Create work item" | ||||
|     inputs: | ||||
|       teamProject: "Mesa_FI" | ||||
|       workItemType: Bug | ||||
|       title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration) | ||||
|       assignedTo: "$(Build.RequestedForId)" | ||||
|     enabled: false | ||||
|  | ||||
|   - script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Adaptation --source $(NugetSource)' | ||||
|           - script: | | ||||
|               "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) | ||||
|             workingDirectory: Adaptation | ||||
|     displayName: "Core Publish" | ||||
|             displayName: "Core Clean - Adaptation" | ||||
|  | ||||
|           - script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|             displayName: "Force Fail" | ||||
|             enabled: false | ||||
|  | ||||
|   - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources="$(NugetSource)"' | ||||
|   - stage: ProductionServer | ||||
|     displayName: ProductionServer | ||||
|  | ||||
|     pool: | ||||
|       name: EAF Mesa Integration | ||||
|       demands: DEP08CEPIEPSILON | ||||
|  | ||||
|     variables: | ||||
|       coreVersion: "net8.0" | ||||
|       nugetSource: "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/" | ||||
|  | ||||
|     jobs: | ||||
|       - job: SetupEnvironment | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo $(Build.BuildId) | ||||
|               echo $(Build.Reason) | ||||
|               echo $(Build.Repository.Id) | ||||
|               echo $(Build.Repository.Name) | ||||
|               echo $(Build.SourceVersion) | ||||
|               echo $(CoreVersion) | ||||
|               echo $(NugetSource) | ||||
|             displayName: "Echo Check" | ||||
|  | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" nuget locals all --clear' | ||||
|             displayName: "Nuget Clear" | ||||
|             enabled: false | ||||
|  | ||||
|           - script: | | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets init | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)" | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets set "GitCommit" "$(Build.SourceVersion)" | ||||
|               "C:\program files\dotnet\dotnet.exe" user-secrets list | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Safe storage of app secrets - Adaptation" | ||||
|  | ||||
|       - job: BuildRelease | ||||
|         dependsOn: | ||||
|           - SetupEnvironment | ||||
|         steps: | ||||
|           - script: | | ||||
|               set configuration=Release | ||||
|               echo %configuration% | ||||
|               echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|               echo $(Configuration) | ||||
|             displayName: Configuration | ||||
|  | ||||
|           - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8 /p:RestoreSources=$(NugetSource)' | ||||
|             displayName: "MSBuild Restore" | ||||
|  | ||||
|           - script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=$(Configuration);TargetFrameworkVersion=v4.8' | ||||
|             displayName: MSBuild | ||||
|  | ||||
|   - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)-$(Build.Repository.Name)>bin\$(Configuration)\$(Build.Repository.Name).txt' | ||||
|           - script: 'echo $(Build.Repository.Name)-$(Build.BuildId)-$(Build.SourceVersion)>bin\$(Configuration)\$(Build.Repository.Name).txt' | ||||
|             displayName: "Commit Id" | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|     displayName: 'Copy Files to: D:\Framework4.8' | ||||
|     inputs: | ||||
|       Contents: "*$(Build.Repository.Name)*" | ||||
|       SourceFolder: 'bin\$(Configuration)' | ||||
|       TargetFolder: 'D:\Framework4.8\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)' | ||||
|       OverWrite: true | ||||
|  | ||||
|   - task: CopyFiles@2 | ||||
|     displayName: 'Copy Files to: Local D EAF Deployment Storage' | ||||
|             displayName: 'Copy Files to: D:\EAF' | ||||
|             inputs: | ||||
|               Contents: "*$(Build.Repository.Name)*" | ||||
|               SourceFolder: 'bin\$(Configuration)' | ||||
|               TargetFolder: 'D:\EAF\EAF Deployment Storage\Adaptation_$(Build.Repository.Name)' | ||||
|               OverWrite: true | ||||
|  | ||||
|   - script: | | ||||
|       "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)' | ||||
|             workingDirectory: Adaptation | ||||
|     displayName: "Core Clean - Tests" | ||||
|             displayName: "Core Build - Adaptation" | ||||
|  | ||||
|       - job: TestRelease | ||||
|         dependsOn: | ||||
|           - SetupEnvironment | ||||
|           - BuildRelease | ||||
|         steps: | ||||
|           - script: | | ||||
|               set configuration=Release | ||||
|               echo %configuration% | ||||
|               echo ##vso[task.setvariable variable=Configuration;]%configuration% | ||||
|               echo $(Configuration) | ||||
|             displayName: Configuration | ||||
|  | ||||
|           - powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | ||||
|             workingDirectory: "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)" | ||||
|             displayName: "PowerShell Script" | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: "dotnet test --configuration $(Configuration)" | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Core Test" | ||||
|  | ||||
|           - script: 'move /y "$(System.DefaultWorkingDirectory)/../../../$(Build.Repository.Name)/05_TestResults/TestResults" $(System.DefaultWorkingDirectory)' | ||||
|             displayName: "Move Results" | ||||
|  | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" tool restore' | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Tool Restore" | ||||
|             enabled: false | ||||
|  | ||||
|           - script: '"C:\program files\dotnet\dotnet.exe" ReportGenerator -reports:$(System.DefaultWorkingDirectory)/TestResults/**/coverage.cobertura.xml -targetDir:$(Build.ArtifactStagingDirectory)\Coverage -reportTypes:Html_Dark' | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Report Generator" | ||||
|             enabled: false | ||||
|  | ||||
|           - task: PublishTestResults@2 | ||||
|             displayName: "Publish Test Results **/*.trx" | ||||
|             inputs: | ||||
|               testResultsFormat: VSTest | ||||
|               testResultsFiles: "**/*.trx" | ||||
|               testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|           - task: PublishTestResults@2 | ||||
|             displayName: "Publish Test Results */coverage.cobertura.xml" | ||||
|             inputs: | ||||
|               testResultsFormat: VSTest | ||||
|               testResultsFiles: "*/coverage.cobertura.xml" | ||||
|               testRunTitle: "$(Build.BuildId)-$(Build.SourceVersion)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)" | ||||
|               searchFolder: "$(System.DefaultWorkingDirectory)/TestResults" | ||||
|  | ||||
|           - script: | | ||||
|               "C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration) | ||||
|             workingDirectory: Adaptation | ||||
|             displayName: "Core Clean - Adaptation" | ||||
|     continueOnError: true | ||||
|  | ||||
|   - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|           - script: 'echo $(Build.BuildId)-$(Build.SourceVersion)-bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|             displayName: "Force Fail" | ||||
|     enabled: false | ||||
|             enabled: true | ||||
|  | ||||
							
								
								
									
										133
									
								
								Adaptation/FileHandlers/Aggregation/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								Adaptation/FileHandlers/Aggregation/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,133 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.Aggregation; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -9,17 +9,20 @@ 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, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, int? connectionCount) | ||||
|     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, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, int? connectionCount) | ||||
|     { | ||||
|         IFileRead result = cellInstanceConnectionName switch | ||||
|         { | ||||
|             nameof(R32) => new R32.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R62) => new R62.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R55) => new R55.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R57) => new R57.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R75) => new R75.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R77) => new R77.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(Aggregation) => new Aggregation.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(InfinityQS) => new InfinityQS.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(Log) => new Log.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R2) => new R2.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R3) => new R3.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R4) => new R4.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R5) => new R5.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R6) => new R6.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             nameof(R7) => new R7.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null), | ||||
|             _ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped") | ||||
|         }; | ||||
|         return result; | ||||
|  | ||||
| @ -23,7 +23,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private int _LastDummyRunIndex; | ||||
|     private readonly string[] _CellNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|  | ||||
							
								
								
									
										159
									
								
								Adaptation/FileHandlers/InfinityQS/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								Adaptation/FileHandlers/InfinityQS/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,159 @@ | ||||
| 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.InfinityQS; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly int _IQSVP12Count; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         _IQSVP12Count = int.Parse(GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "IQS.VP12.Count")); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private void CopyAndWriteFile(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat, JsonElement[] jsonElements) | ||||
|     { | ||||
|         string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; | ||||
|         string segment = _Logistics.FileInfo.Name.Split('-')[0].Split('_')[0]; | ||||
|         string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); | ||||
|         string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}"; | ||||
|         string destinationDirectory = Path.Combine(_FileConnectorConfiguration.TargetFileLocation, weekDirectory, day, segment); | ||||
|         if (!Directory.Exists(destinationDirectory)) | ||||
|             _ = Directory.CreateDirectory(destinationDirectory); | ||||
|         string checkFile = Path.Combine(destinationDirectory, _Logistics.FileInfo.Name); | ||||
|         if (File.Exists(checkFile)) | ||||
|             File.Delete(checkFile); | ||||
|         File.Copy(_Logistics.FileInfo.FullName, checkFile); | ||||
|         if (jsonElements.Length != 1 || jsonElements[0].ValueKind != JsonValueKind.Object) | ||||
|             File.Delete(_Logistics.FileInfo.FullName); | ||||
|         else | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 Six six = JsonSerializer.Deserialize(jsonElements[0].GetRawText(), SixSourceGenerationContext.Default.Six) ?? throw new Exception($"{nameof(Six)} deserialization failed"); | ||||
|                 File.Delete(_Logistics.FileInfo.FullName); | ||||
|                 if (six.VP12Count > _IQSVP12Count) | ||||
|                 { | ||||
|                     string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName); | ||||
|                     if (!Directory.Exists(duplicateDirectory)) | ||||
|                         _ = Directory.CreateDirectory(duplicateDirectory); | ||||
|                     string duplicateFile = Path.Combine(duplicateDirectory, $"{Path.GetFileName(reportFullPath)}.xml"); | ||||
|                     string xml = ProcessDataStandardFormat.GetXml(processDataStandardFormat); | ||||
|                     File.WriteAllText(duplicateFile, xml); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception) { File.Delete(_Logistics.FileInfo.FullName); } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             CopyAndWriteFile(reportFullPath, processDataStandardFormat, jsonElements); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										41
									
								
								Adaptation/FileHandlers/InfinityQS/Six.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								Adaptation/FileHandlers/InfinityQS/Six.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,41 @@ | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.InfinityQS; | ||||
|  | ||||
| #nullable enable | ||||
|  | ||||
| internal class Six | ||||
| { | ||||
|  | ||||
|     [JsonConstructor] | ||||
|     public Six( | ||||
|         string id153, | ||||
|         string id176, | ||||
|         string id221, | ||||
|         string id222, | ||||
|         string id223, | ||||
|         int vp12Count | ||||
|     ) | ||||
|     { | ||||
|         ID153 = id153; | ||||
|         ID176 = id176; | ||||
|         ID221 = id221; | ||||
|         ID222 = id222; | ||||
|         ID223 = id223; | ||||
|         VP12Count = vp12Count; | ||||
|     } | ||||
|  | ||||
|     [JsonPropertyName("id153")] public string ID153 { get; } | ||||
|     [JsonPropertyName("id176")] public string ID176 { get; } | ||||
|     [JsonPropertyName("id221")] public string ID221 { get; } | ||||
|     [JsonPropertyName("id222")] public string ID222 { get; } | ||||
|     [JsonPropertyName("id223")] public string ID223 { get; } | ||||
|     [JsonPropertyName("vp12_count")] public int VP12Count { get; } | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString)] | ||||
| [JsonSerializable(typeof(Six))] | ||||
| internal partial class SixSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
							
								
								
									
										133
									
								
								Adaptation/FileHandlers/Log/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								Adaptation/FileHandlers/Log/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,133 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.Log; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -11,7 +11,7 @@ using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
| 
 | ||||
| namespace Adaptation.FileHandlers.R32; | ||||
| namespace Adaptation.FileHandlers.R2; | ||||
| 
 | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
| @ -20,7 +20,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
| 
 | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
| @ -159,7 +159,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|         return new(results); | ||||
|     } | ||||
| 
 | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
| @ -201,13 +201,13 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
| @ -223,15 +223,15 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, pdsf.Item1); | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
| 
 | ||||
| @ -11,7 +11,7 @@ using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
| 
 | ||||
| namespace Adaptation.FileHandlers.R55; | ||||
| namespace Adaptation.FileHandlers.R3; | ||||
| 
 | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
| @ -20,7 +20,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
| 
 | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
| @ -159,7 +159,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|         return new(results); | ||||
|     } | ||||
| 
 | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
| @ -201,13 +201,13 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
| @ -223,15 +223,15 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, pdsf.Item1); | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
| 
 | ||||
| @ -11,7 +11,7 @@ using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
| 
 | ||||
| namespace Adaptation.FileHandlers.R57; | ||||
| namespace Adaptation.FileHandlers.R4; | ||||
| 
 | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
| @ -20,7 +20,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
| 
 | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
| @ -159,7 +159,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|         return new(results); | ||||
|     } | ||||
| 
 | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
| @ -201,13 +201,13 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
| @ -223,15 +223,15 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, pdsf.Item1); | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
| 
 | ||||
| @ -11,7 +11,7 @@ using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
| 
 | ||||
| namespace Adaptation.FileHandlers.R62; | ||||
| namespace Adaptation.FileHandlers.R5; | ||||
| 
 | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
| @ -20,7 +20,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
| 
 | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
| @ -159,7 +159,7 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|         return new(results); | ||||
|     } | ||||
| 
 | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
| @ -201,13 +201,13 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
| @ -223,15 +223,15 @@ public class FileRead : Shared.FileRead, IFileRead | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, pdsf.Item1); | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
| 
 | ||||
							
								
								
									
										238
									
								
								Adaptation/FileHandlers/R6/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								Adaptation/FileHandlers/R6/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,238 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.Globalization; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.R6; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly string _KeyColumn; | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         _KeyColumn = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.KeyColumn"); | ||||
|         _TimestampFormat = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.TimestampFormat"); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private static int? GetKeyColumnIndex(string[] columns, string keyColumn) | ||||
|     { | ||||
| #nullable enable | ||||
|         int? result = null; | ||||
|         for (int i = 0; i < columns.Length; i++) | ||||
|         { | ||||
|             if (columns[i] != keyColumn) | ||||
|                 continue; | ||||
|             result = i; | ||||
|             break; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex) | ||||
|     { | ||||
|         List<string> results = new(); | ||||
|         string[] values; | ||||
|         string? systemState; | ||||
|         string keyColumnValue; | ||||
|         for (int i = 7; i < lines.Count; i++) | ||||
|         { | ||||
|             values = lines[i].Split('\t'); | ||||
|             if (values.Length != columns.Length) | ||||
|                 continue; | ||||
|             keyColumnValue = values[keyColumnIndex]; | ||||
|             if (string.IsNullOrEmpty(keyColumnValue)) | ||||
|                 continue; | ||||
|             if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState)) | ||||
|                 continue; | ||||
|             if (results.Contains(systemState)) | ||||
|                 continue; | ||||
|             results.Add(systemState); | ||||
|         } | ||||
|         return new(results); | ||||
|     } | ||||
|  | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
|         string[] columns; | ||||
|         DateTime dateTime; | ||||
|         List<string> lines; | ||||
|         string systemState; | ||||
|         int? keyColumnIndex; | ||||
|         string checkFileName; | ||||
|         List<string> headerLines = new(); | ||||
|         ReadOnlyCollection<string> systemStateValues; | ||||
|         string missingKeyDirectory = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, "Missing-Key"); | ||||
|         if (!Directory.Exists(missingKeyDirectory)) | ||||
|             _ = Directory.CreateDirectory(missingKeyDirectory); | ||||
|         string fileName = Path.GetFileName(reportFullPath); | ||||
|         string[] segments = fileName.Split('_'); | ||||
|         for (int z = 0; z < 1; z++) | ||||
|         { | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             equipment = segments[0]; | ||||
|             timestamp = segments[1].Split('.')[0]; | ||||
|             if (timestamp.Length != _TimestampFormat.Length) | ||||
|                 continue; | ||||
|             headerLines.Clear(); | ||||
|             lines = File.ReadAllLines(reportFullPath).ToList(); | ||||
|             if (lines.Count < 8) | ||||
|                 continue; | ||||
|             for (int i = 0; i < 6; i++) | ||||
|             { | ||||
|                 headerLines.Add(lines[0]); | ||||
|                 lines.RemoveAt(0); | ||||
|             } | ||||
|             if (lines[0].Length < 1 || lines[0][0] != '"' || !lines[0].StartsWith("\"Time\"")) | ||||
|                 continue; | ||||
|             columns = lines[0].Split('\t'); | ||||
|             if (columns.Length < 3) | ||||
|                 continue; | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
|             systemState = string.Join("-", systemStateValues); | ||||
|             checkFileName = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, $"{equipment}-{timestamp}-{systemState}.pdsf"); | ||||
|             File.WriteAllLines(checkFileName, lines); | ||||
|             // File.Delete(reportFullPath); | ||||
|             if (DateTime.TryParseExact(timestamp, _TimestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) | ||||
|                 File.SetLastWriteTime(checkFileName, dateTime); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										238
									
								
								Adaptation/FileHandlers/R7/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								Adaptation/FileHandlers/R7/FileRead.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,238 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.Globalization; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.R7; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly string _KeyColumn; | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         _KeyColumn = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.KeyColumn"); | ||||
|         _TimestampFormat = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.TimestampFormat"); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private static int? GetKeyColumnIndex(string[] columns, string keyColumn) | ||||
|     { | ||||
| #nullable enable | ||||
|         int? result = null; | ||||
|         for (int i = 0; i < columns.Length; i++) | ||||
|         { | ||||
|             if (columns[i] != keyColumn) | ||||
|                 continue; | ||||
|             result = i; | ||||
|             break; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex) | ||||
|     { | ||||
|         List<string> results = new(); | ||||
|         string[] values; | ||||
|         string? systemState; | ||||
|         string keyColumnValue; | ||||
|         for (int i = 7; i < lines.Count; i++) | ||||
|         { | ||||
|             values = lines[i].Split('\t'); | ||||
|             if (values.Length != columns.Length) | ||||
|                 continue; | ||||
|             keyColumnValue = values[keyColumnIndex]; | ||||
|             if (string.IsNullOrEmpty(keyColumnValue)) | ||||
|                 continue; | ||||
|             if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState)) | ||||
|                 continue; | ||||
|             if (results.Contains(systemState)) | ||||
|                 continue; | ||||
|             results.Add(systemState); | ||||
|         } | ||||
|         return new(results); | ||||
|     } | ||||
|  | ||||
|     private void CopyFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
|         string[] columns; | ||||
|         DateTime dateTime; | ||||
|         List<string> lines; | ||||
|         string systemState; | ||||
|         int? keyColumnIndex; | ||||
|         string checkFileName; | ||||
|         List<string> headerLines = new(); | ||||
|         ReadOnlyCollection<string> systemStateValues; | ||||
|         string missingKeyDirectory = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, "Missing-Key"); | ||||
|         if (!Directory.Exists(missingKeyDirectory)) | ||||
|             _ = Directory.CreateDirectory(missingKeyDirectory); | ||||
|         string fileName = Path.GetFileName(reportFullPath); | ||||
|         string[] segments = fileName.Split('_'); | ||||
|         for (int z = 0; z < 1; z++) | ||||
|         { | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             equipment = segments[0]; | ||||
|             timestamp = segments[1].Split('.')[0]; | ||||
|             if (timestamp.Length != _TimestampFormat.Length) | ||||
|                 continue; | ||||
|             headerLines.Clear(); | ||||
|             lines = File.ReadAllLines(reportFullPath).ToList(); | ||||
|             if (lines.Count < 8) | ||||
|                 continue; | ||||
|             for (int i = 0; i < 6; i++) | ||||
|             { | ||||
|                 headerLines.Add(lines[0]); | ||||
|                 lines.RemoveAt(0); | ||||
|             } | ||||
|             if (lines[0].Length < 1 || lines[0][0] != '"' || !lines[0].StartsWith("\"Time\"")) | ||||
|                 continue; | ||||
|             columns = lines[0].Split('\t'); | ||||
|             if (columns.Length < 3) | ||||
|                 continue; | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Copy(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
|             systemState = string.Join("-", systemStateValues); | ||||
|             checkFileName = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, $"{equipment}-{timestamp}-{systemState}.pdsf"); | ||||
|             File.WriteAllLines(checkFileName, lines); | ||||
|             // File.Delete(reportFullPath); | ||||
|             if (DateTime.TryParseExact(timestamp, _TimestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) | ||||
|                 File.SetLastWriteTime(checkFileName, dateTime); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime _) | ||||
|     { | ||||
|         Tuple<string, Test[], JsonElement[], List<FileInfo>> results; | ||||
|         ProcessDataStandardFormat processDataStandardFormat = ProcessDataStandardFormat.GetProcessDataStandardFormat(reportFullPath); | ||||
|         _Logistics = new Logistics(reportFullPath, processDataStandardFormat); | ||||
|         SetFileParameterLotIDToLogisticsMID(); | ||||
|         JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(processDataStandardFormat); | ||||
|         List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             CopyFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -1,238 +0,0 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.Globalization; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.R75; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly string _KeyColumn; | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         _KeyColumn = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.KeyColumn"); | ||||
|         _TimestampFormat = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.TimestampFormat"); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private static int? GetKeyColumnIndex(string[] columns, string keyColumn) | ||||
|     { | ||||
| #nullable enable | ||||
|         int? result = null; | ||||
|         for (int i = 0; i < columns.Length; i++) | ||||
|         { | ||||
|             if (columns[i] != keyColumn) | ||||
|                 continue; | ||||
|             result = i; | ||||
|             break; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex) | ||||
|     { | ||||
|         List<string> results = new(); | ||||
|         string[] values; | ||||
|         string? systemState; | ||||
|         string keyColumnValue; | ||||
|         for (int i = 7; i < lines.Count; i++) | ||||
|         { | ||||
|             values = lines[i].Split('\t'); | ||||
|             if (values.Length != columns.Length) | ||||
|                 continue; | ||||
|             keyColumnValue = values[keyColumnIndex]; | ||||
|             if (string.IsNullOrEmpty(keyColumnValue)) | ||||
|                 continue; | ||||
|             if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState)) | ||||
|                 continue; | ||||
|             if (results.Contains(systemState)) | ||||
|                 continue; | ||||
|             results.Add(systemState); | ||||
|         } | ||||
|         return new(results); | ||||
|     } | ||||
|  | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
|         string[] columns; | ||||
|         DateTime dateTime; | ||||
|         List<string> lines; | ||||
|         string systemState; | ||||
|         int? keyColumnIndex; | ||||
|         string checkFileName; | ||||
|         List<string> headerLines = new(); | ||||
|         ReadOnlyCollection<string> systemStateValues; | ||||
|         string missingKeyDirectory = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, "Missing-Key"); | ||||
|         if (!Directory.Exists(missingKeyDirectory)) | ||||
|             _ = Directory.CreateDirectory(missingKeyDirectory); | ||||
|         string fileName = Path.GetFileName(reportFullPath); | ||||
|         string[] segments = fileName.Split('_'); | ||||
|         for (int z = 0; z < 1; z++) | ||||
|         { | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             equipment = segments[0]; | ||||
|             timestamp = segments[1].Split('.')[0]; | ||||
|             if (timestamp.Length != _TimestampFormat.Length) | ||||
|                 continue; | ||||
|             headerLines.Clear(); | ||||
|             lines = File.ReadAllLines(reportFullPath).ToList(); | ||||
|             if (lines.Count < 8) | ||||
|                 continue; | ||||
|             for (int i = 0; i < 6; i++) | ||||
|             { | ||||
|                 headerLines.Add(lines[0]); | ||||
|                 lines.RemoveAt(0); | ||||
|             } | ||||
|             if (lines[0].Length < 1 || lines[0][0] != '"' || !lines[0].StartsWith("\"Time\"")) | ||||
|                 continue; | ||||
|             columns = lines[0].Split('\t'); | ||||
|             if (columns.Length < 3) | ||||
|                 continue; | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
|             systemState = string.Join("-", systemStateValues); | ||||
|             checkFileName = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, $"{equipment}-{timestamp}-{systemState}.pdsf"); | ||||
|             File.WriteAllLines(checkFileName, lines); | ||||
|             // File.Delete(reportFullPath); | ||||
|             if (DateTime.TryParseExact(timestamp, _TimestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) | ||||
|                 File.SetLastWriteTime(checkFileName, dateTime); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, 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); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -1,238 +0,0 @@ | ||||
| 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.Collections.ObjectModel; | ||||
| using System.Globalization; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
|  | ||||
| namespace Adaptation.FileHandlers.R77; | ||||
|  | ||||
| public class FileRead : Shared.FileRead, IFileRead | ||||
| { | ||||
|  | ||||
|     private readonly string _KeyColumn; | ||||
|     private readonly string _TimestampFormat; | ||||
|     private readonly ReadOnlyDictionary<string, string> _SystemStateToNames; | ||||
|  | ||||
|     public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : | ||||
|         base(new Description(), false, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null) | ||||
|     { | ||||
|         _MinFileLength = 10; | ||||
|         _NullData = string.Empty; | ||||
|         _Logistics = new(this); | ||||
|         if (_FileParameter is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (_ModelObjectParameterDefinitions is null) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         if (!_IsDuplicator) | ||||
|             throw new Exception(cellInstanceConnectionName); | ||||
|         string[] segments; | ||||
|         Dictionary<string, string> systemStateToNames = new(); | ||||
|         _KeyColumn = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.KeyColumn"); | ||||
|         _TimestampFormat = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.TimestampFormat"); | ||||
|         ModelObjectParameterDefinition[] systemStates = GetProperties(cellInstanceConnectionName, modelObjectParameters, "ProcessDataStandardFormat.SystemState"); | ||||
|         foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in systemStates) | ||||
|         { | ||||
|             segments = modelObjectParameterDefinition.Value.Split('|'); | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             systemStateToNames.Add(segments[0], segments[1]); | ||||
|         } | ||||
|         _SystemStateToNames = new(systemStateToNames); | ||||
|     } | ||||
|  | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|     } | ||||
|  | ||||
|     private static int? GetKeyColumnIndex(string[] columns, string keyColumn) | ||||
|     { | ||||
| #nullable enable | ||||
|         int? result = null; | ||||
|         for (int i = 0; i < columns.Length; i++) | ||||
|         { | ||||
|             if (columns[i] != keyColumn) | ||||
|                 continue; | ||||
|             result = i; | ||||
|             break; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private ReadOnlyCollection<string> GetSystemStateValues(List<string> lines, string[] columns, int keyColumnIndex) | ||||
|     { | ||||
|         List<string> results = new(); | ||||
|         string[] values; | ||||
|         string? systemState; | ||||
|         string keyColumnValue; | ||||
|         for (int i = 7; i < lines.Count; i++) | ||||
|         { | ||||
|             values = lines[i].Split('\t'); | ||||
|             if (values.Length != columns.Length) | ||||
|                 continue; | ||||
|             keyColumnValue = values[keyColumnIndex]; | ||||
|             if (string.IsNullOrEmpty(keyColumnValue)) | ||||
|                 continue; | ||||
|             if (!_SystemStateToNames.TryGetValue(keyColumnValue, out systemState)) | ||||
|                 continue; | ||||
|             if (results.Contains(systemState)) | ||||
|                 continue; | ||||
|             results.Add(systemState); | ||||
|         } | ||||
|         return new(results); | ||||
|     } | ||||
|  | ||||
|     private void MoveFile(string reportFullPath) | ||||
|     { | ||||
|         string equipment; | ||||
|         string timestamp; | ||||
|         string[] columns; | ||||
|         DateTime dateTime; | ||||
|         List<string> lines; | ||||
|         string systemState; | ||||
|         int? keyColumnIndex; | ||||
|         string checkFileName; | ||||
|         List<string> headerLines = new(); | ||||
|         ReadOnlyCollection<string> systemStateValues; | ||||
|         string missingKeyDirectory = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, "Missing-Key"); | ||||
|         if (!Directory.Exists(missingKeyDirectory)) | ||||
|             _ = Directory.CreateDirectory(missingKeyDirectory); | ||||
|         string fileName = Path.GetFileName(reportFullPath); | ||||
|         string[] segments = fileName.Split('_'); | ||||
|         for (int z = 0; z < 1; z++) | ||||
|         { | ||||
|             if (segments.Length != 2) | ||||
|                 continue; | ||||
|             equipment = segments[0]; | ||||
|             timestamp = segments[1].Split('.')[0]; | ||||
|             if (timestamp.Length != _TimestampFormat.Length) | ||||
|                 continue; | ||||
|             headerLines.Clear(); | ||||
|             lines = File.ReadAllLines(reportFullPath).ToList(); | ||||
|             if (lines.Count < 8) | ||||
|                 continue; | ||||
|             for (int i = 0; i < 6; i++) | ||||
|             { | ||||
|                 headerLines.Add(lines[0]); | ||||
|                 lines.RemoveAt(0); | ||||
|             } | ||||
|             if (lines[0].Length < 1 || lines[0][0] != '"' || !lines[0].StartsWith("\"Time\"")) | ||||
|                 continue; | ||||
|             columns = lines[0].Split('\t'); | ||||
|             if (columns.Length < 3) | ||||
|                 continue; | ||||
|             keyColumnIndex = GetKeyColumnIndex(columns, _KeyColumn); | ||||
|             if (keyColumnIndex is null) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             systemStateValues = GetSystemStateValues(lines, columns, keyColumnIndex.Value); | ||||
|             if (systemStateValues.Count == 0) | ||||
|             { | ||||
|                 File.Move(reportFullPath, Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, missingKeyDirectory, fileName)); | ||||
|                 continue; | ||||
|             } | ||||
|             lines.AddRange(headerLines); | ||||
|             systemState = string.Join("-", systemStateValues); | ||||
|             checkFileName = Path.Combine(_FileConnectorConfiguration.AlternateTargetFolder, $"{equipment}-{timestamp}-{systemState}.pdsf"); | ||||
|             File.WriteAllLines(checkFileName, lines); | ||||
|             // File.Delete(reportFullPath); | ||||
|             if (DateTime.TryParseExact(timestamp, _TimestampFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) | ||||
|                 File.SetLastWriteTime(checkFileName, dateTime); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, 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); | ||||
|         Test[] tests = (from l in descriptions select (Test)l.Test).ToArray(); | ||||
|         if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) | ||||
|             MoveFile(reportFullPath); | ||||
|         results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>()); | ||||
|         return results; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -3,6 +3,7 @@ using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Adaptation.Shared.Duplicator; | ||||
|  | ||||
| @ -12,7 +13,7 @@ public class Description : IDescription, Properties.IDescription | ||||
|     public int Test { get; set; } | ||||
|     public int Count { get; set; } | ||||
|     public int Index { get; set; } | ||||
|     public string Lot { get; set; } | ||||
|     public string RDS { get; set; } | ||||
|     // | ||||
|     public string EventName { get; set; } | ||||
|     public string NullData { get; set; } | ||||
| @ -141,7 +142,7 @@ public class Description : IDescription, Properties.IDescription | ||||
|                     MID = logistics.MID, | ||||
|                     // | ||||
|                     Date = DateTime.Now.ToString(GetDateFormat()), | ||||
|                     Lot = string.Empty, | ||||
|                     RDS = string.Empty, | ||||
|                 }; | ||||
|                 results.Add(description); | ||||
|             } | ||||
| @ -179,3 +180,15 @@ public class Description : IDescription, Properties.IDescription | ||||
|     internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt"; | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] | ||||
| [JsonSerializable(typeof(Description))] | ||||
| internal partial class SharedDescriptionSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] | ||||
| [JsonSerializable(typeof(Description[]))] | ||||
| internal partial class SharedDescriptionArraySourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -35,6 +35,9 @@ public class Logistics : ILogistics | ||||
|     public long Sequence => _Sequence; | ||||
|     public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence; | ||||
|  | ||||
|     private static string DefaultMesEntity(DateTime dateTime) => | ||||
|         string.Concat(dateTime.Ticks, "_MES_ENTITY"); | ||||
|  | ||||
|     public Logistics(IFileRead fileRead) | ||||
|     { | ||||
|         DateTime dateTime = DateTime.Now; | ||||
| @ -84,13 +87,13 @@ public class Logistics : ILogistics | ||||
|         _Logistics2 = new List<Logistics2>(); | ||||
|     } | ||||
|  | ||||
|     public Logistics(string reportFullPath, string logistics) | ||||
|     internal Logistics(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat) | ||||
|     { | ||||
|         string key; | ||||
|         DateTime dateTime; | ||||
|         string[] segments; | ||||
|         _FileInfo = new(reportFullPath); | ||||
|         _Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); | ||||
|         _Logistics1 = processDataStandardFormat.Logistics.ToList(); | ||||
|         if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1")) | ||||
|         { | ||||
|             _NullData = null; | ||||
| @ -190,8 +193,6 @@ public class Logistics : ILogistics | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY"); | ||||
|  | ||||
|     internal void Update(string mid, string processJobID) | ||||
|     { | ||||
|         _MID = mid; | ||||
|  | ||||
| @ -6,23 +6,25 @@ public partial class WS | ||||
|     public class Attachment | ||||
|     { | ||||
|  | ||||
|         public string SubGroupId { get; set; } | ||||
|         public long HeaderId { get; set; } | ||||
|         public string HeaderIdDirectory { get; set; } | ||||
|         public string UniqueId { get; set; } | ||||
|         public string DestinationFileName { get; set; } | ||||
|         public string SourceFileName { get; set; } | ||||
|         public string AttachmentId { get; set; } | ||||
| #nullable enable | ||||
|  | ||||
|         public Attachment(string subGroupId, long headerId, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName) | ||||
|         public long HeaderId { get; set; } | ||||
|         public string UniqueId { get; set; } | ||||
|         public string SubGroupId { get; set; } | ||||
|         public string AttachmentId { get; set; } | ||||
|         public string SourceFileName { get; set; } | ||||
|         public string HeaderIdDirectory { get; set; } | ||||
|         public string DestinationFileName { get; set; } | ||||
|  | ||||
|         public Attachment(Results? results, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName) | ||||
|         { | ||||
|             SubGroupId = subGroupId; | ||||
|             HeaderId = headerId; | ||||
|             HeaderIdDirectory = headerIdDirectory; | ||||
|             UniqueId = uniqueId; | ||||
|             DestinationFileName = destinationFileName; | ||||
|             SourceFileName = sourceFileName; | ||||
|             HeaderIdDirectory = headerIdDirectory; | ||||
|             DestinationFileName = destinationFileName; | ||||
|             AttachmentId = System.Guid.NewGuid().ToString(); | ||||
|             HeaderId = results?.HeaderId is null ? -1 : results.HeaderId.Value; | ||||
|             SubGroupId = results?.SubgroupId is null ? string.Empty : results.SubgroupId.Value.ToString(); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
| @ -1,27 +1,75 @@ | ||||
| using System.Collections.Generic; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Adaptation.Shared.Metrology; | ||||
|  | ||||
| public partial class WS | ||||
| { | ||||
|     // this class represents the response from the Inbound API endpoint | ||||
|  | ||||
|     public class Results | ||||
|     { | ||||
|         // true or false if data was written to the database | ||||
|         public bool Success { get; set; } | ||||
|  | ||||
|         // if true, contains ID of the Header record in the database | ||||
|         public long HeaderID { get; set; } | ||||
| #nullable enable | ||||
|  | ||||
|         // if false, this collection will contain a list of errors | ||||
|         public List<string> Errors { get; set; } | ||||
|         [JsonConstructor] | ||||
|         public Results(List<string>? errors, | ||||
|                        long? headerId, | ||||
|                        long? subgroupId, | ||||
|                        bool? success, | ||||
|                        List<string>? warnings) | ||||
|         { | ||||
|             Errors = errors; | ||||
|             Success = success; | ||||
|             HeaderId = headerId; | ||||
|             Warnings = warnings; | ||||
|             SubgroupId = subgroupId; | ||||
|         } | ||||
|  | ||||
|         // this collection will contain a list of warnings, they will not prevent data from being saved | ||||
|         public List<string> Warnings { get; set; } | ||||
|         [JsonPropertyName("errors")] public List<string>? Errors { get; set; } | ||||
|         [JsonPropertyName("headerID")] public long? HeaderId { get; set; } | ||||
|         [JsonPropertyName("subgroupId")] public long? SubgroupId { get; set; } | ||||
|         [JsonPropertyName("success")] public bool? Success { get; set; } | ||||
|         [JsonPropertyName("warnings")] public List<string>? Warnings { get; set; } | ||||
|  | ||||
|         public override string ToString() | ||||
|         { | ||||
|             string result = JsonSerializer.Serialize(this, ResultsSourceGenerationContext.Default.Results); | ||||
|             return result; | ||||
|         } | ||||
|  | ||||
|         internal static Results Get(Results results, long? subgroupId) => | ||||
|             new(results.Errors, results.HeaderId, subgroupId, results.Success, results.Warnings); | ||||
|  | ||||
|         internal static Results Get(string resultsJson, Exception e) | ||||
|         { | ||||
|             Results results; | ||||
|             Exception? exception = e; | ||||
|             List<string> errors = new(); | ||||
|             StringBuilder stringBuilder = new(); | ||||
|             while (exception is not null) | ||||
|             { | ||||
|                 _ = stringBuilder.AppendLine(exception.Message); | ||||
|                 exception = exception.InnerException; | ||||
|             } | ||||
|             errors.Add(resultsJson); | ||||
|             errors.Add(stringBuilder.ToString()); | ||||
|             results = new(errors: errors, | ||||
|                           headerId: null, | ||||
|                           subgroupId: null, | ||||
|                           success: false, | ||||
|                           warnings: new()); | ||||
|             return results; | ||||
|         } | ||||
|  | ||||
|         // this is just a helper function to make displaying the results easier | ||||
|         public override string ToString() => JsonSerializer.Serialize(this, GetType()); | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true)] | ||||
| [JsonSerializable(typeof(WS.Results))] | ||||
| internal partial class ResultsSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
| @ -10,9 +10,11 @@ namespace Adaptation.Shared.Metrology; | ||||
| public partial class WS | ||||
| { | ||||
|  | ||||
| #nullable enable | ||||
|  | ||||
|     public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120) | ||||
|     { | ||||
|         Results results = new(); | ||||
|         Results? wsResults = null; | ||||
|         string resultsJson = string.Empty; | ||||
|         try | ||||
|         { | ||||
| @ -30,29 +32,20 @@ public partial class WS | ||||
|                 }; | ||||
|                 HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result; | ||||
|                 resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result; | ||||
|                 results = JsonSerializer.Deserialize<Results>(resultsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); | ||||
|                 string checkDirectory = Path.Combine(directory, $"-{results.HeaderID}"); | ||||
|                 wsResults = JsonSerializer.Deserialize(resultsJson, ResultsSourceGenerationContext.Default.Results); | ||||
|                 if (wsResults is null) | ||||
|                     throw new NullReferenceException(nameof(wsResults)); | ||||
|                 string checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}"); | ||||
|                 if (!Directory.Exists(checkDirectory)) | ||||
|                     _ = Directory.CreateDirectory(checkDirectory); | ||||
|                 File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json); | ||||
|             } | ||||
|             if (!results.Success) | ||||
|                 results.Errors.Add(results.ToString()); | ||||
|             if (wsResults.Success is null || !wsResults.Success.Value) | ||||
|                 wsResults.Errors?.Add(wsResults.ToString()); | ||||
|         } | ||||
|         catch (Exception e) | ||||
|         { | ||||
|             Exception exception = e; | ||||
|             StringBuilder stringBuilder = new(); | ||||
|             while (exception is not null) | ||||
|             { | ||||
|                 _ = stringBuilder.AppendLine(exception.Message); | ||||
|                 exception = exception.InnerException; | ||||
|             } | ||||
|             results.Errors ??= new List<string>(); | ||||
|             results.Errors.Add(resultsJson); | ||||
|             results.Errors.Add(stringBuilder.ToString()); | ||||
|         } | ||||
|         return new(resultsJson, results); | ||||
|         { wsResults ??= Results.Get(resultsJson, e); } | ||||
|         return new(resultsJson, wsResults); | ||||
|     } | ||||
|  | ||||
|     public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60) | ||||
| @ -69,16 +62,20 @@ public partial class WS | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void AttachFiles(string url, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null) | ||||
|     public static void AttachFiles(string url, List<Attachment>? headerAttachments = null, List<Attachment>? dataAttachments = null) | ||||
|     { | ||||
|         string directory; | ||||
|         try | ||||
|         { | ||||
|             string? directoryName; | ||||
|             if (headerAttachments is not null) | ||||
|             { | ||||
|                 foreach (Attachment attachment in headerAttachments) | ||||
|                 { | ||||
|                     directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception(); | ||||
|                     directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory); | ||||
|                     if (string.IsNullOrEmpty(directoryName)) | ||||
|                         continue; | ||||
|                     directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception(); | ||||
|                     if (!Directory.Exists(directory)) | ||||
|                         _ = Directory.CreateDirectory(directory); | ||||
|                     File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); | ||||
| @ -88,7 +85,10 @@ public partial class WS | ||||
|             { | ||||
|                 foreach (Attachment attachment in dataAttachments) | ||||
|                 { | ||||
|                     directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception(); | ||||
|                     directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")); | ||||
|                     if (string.IsNullOrEmpty(directoryName)) | ||||
|                         continue; | ||||
|                     directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception(); | ||||
|                     if (!Directory.Exists(directory)) | ||||
|                         _ = Directory.CreateDirectory(directory); | ||||
|                     File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); | ||||
| @ -108,7 +108,7 @@ public partial class WS | ||||
|         } | ||||
|         catch (Exception e) | ||||
|         { | ||||
|             Exception exception = e; | ||||
|             Exception? exception = e; | ||||
|             StringBuilder stringBuilder = new(); | ||||
|             while (exception is not null) | ||||
|             { | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										34
									
								
								Adaptation/Shared/ProcessDataStandardFormatMapping.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Adaptation/Shared/ProcessDataStandardFormatMapping.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Linq; | ||||
|  | ||||
| namespace Adaptation.Shared; | ||||
|  | ||||
| public class ProcessDataStandardFormatMapping | ||||
| { | ||||
|  | ||||
|     public ReadOnlyCollection<int> ColumnIndices { get; private set; } | ||||
|     public ReadOnlyCollection<string> NewColumnNames { get; private set; } | ||||
|     public ReadOnlyCollection<string> OldColumnNames { get; private set; } | ||||
|  | ||||
|     public ProcessDataStandardFormatMapping(ReadOnlyCollection<int> columnIndices, | ||||
|                                             ReadOnlyCollection<string> newColumnNames, | ||||
|                                             ReadOnlyCollection<string> oldColumnNames) | ||||
|     { | ||||
|         ColumnIndices = columnIndices; | ||||
|         NewColumnNames = newColumnNames; | ||||
|         OldColumnNames = oldColumnNames; | ||||
|     } | ||||
|  | ||||
|     internal static ProcessDataStandardFormatMapping Get(string processDataStandardFormatMappingOldColumnNames, string processDataStandardFormatMappingNewColumnNames, string processDataStandardFormatMappingColumnIndices) | ||||
|     { | ||||
|         ProcessDataStandardFormatMapping result; | ||||
|         ReadOnlyCollection<string> newColumnNames = new(processDataStandardFormatMappingNewColumnNames.Split(',')); | ||||
|         ReadOnlyCollection<string> oldColumnNames = new(processDataStandardFormatMappingOldColumnNames.Split(',')); | ||||
|         ReadOnlyCollection<int> columnIndices = new(processDataStandardFormatMappingColumnIndices.Split(',').Select(int.Parse).ToArray()); | ||||
|         result = new(columnIndices: columnIndices, | ||||
|                      newColumnNames: newColumnNames, | ||||
|                      oldColumnNames: oldColumnNames); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -6,6 +6,6 @@ public interface IDescription | ||||
|     int Test { get; } | ||||
|     int Count { get; } | ||||
|     int Index { get; } | ||||
|     string Lot { get; } | ||||
|     string RDS { get; } | ||||
|  | ||||
| } | ||||
| @ -1,4 +1,4 @@ | ||||
| #if true | ||||
| #if v2_59_0 | ||||
| using Adaptation._Tests.Shared; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
|  | ||||
| @ -0,0 +1,152 @@ | ||||
| #if true | ||||
| using Adaptation._Tests.Shared; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System; | ||||
| using System.Diagnostics; | ||||
| using System.IO; | ||||
| using System.Reflection; | ||||
|  | ||||
| namespace Adaptation._Tests.CreateSelfDescription.Production.v2_60_0; | ||||
|  | ||||
| [TestClass] | ||||
| public class DEP08CEPIEPSILON : EAFLoggingUnitTesting | ||||
| { | ||||
|  | ||||
| #pragma warning disable CA2254 | ||||
| #pragma warning disable IDE0060 | ||||
|  | ||||
|     internal static string DummyRoot { get; private set; } | ||||
|     internal static DEP08CEPIEPSILON EAFLoggingUnitTesting { get; private set; } | ||||
|  | ||||
|     static DEP08CEPIEPSILON() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy"; | ||||
|     // static DEP08CEPIEPSILON() => DummyRoot = @"D:\ProgramData\EC_Characterization_Si\Dummy"; | ||||
|  | ||||
|     public DEP08CEPIEPSILON() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) | ||||
|     { | ||||
|         if (EAFLoggingUnitTesting is null) | ||||
|             throw new Exception(); | ||||
|     } | ||||
|  | ||||
|     public DEP08CEPIEPSILON(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitialize(TestContext testContext) | ||||
|     { | ||||
|         EAFLoggingUnitTesting ??= new DEP08CEPIEPSILON(testContext); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize")); | ||||
|         string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName); | ||||
|         File.WriteAllText(fileNameAndText[0], fileNameAndText[1]); | ||||
|         File.WriteAllText(fileNameAndText[2], fileNameAndText[3]); | ||||
|     } | ||||
|  | ||||
|     [ClassCleanup()] | ||||
|     public static void ClassCleanup() | ||||
|     { | ||||
|         EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); | ||||
|         EAFLoggingUnitTesting?.Dispose(); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R32() | ||||
|     { | ||||
|         string check = "R32*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R62() | ||||
|     { | ||||
|         string check = "R62*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R75() | ||||
|     { | ||||
|         string check = "R75*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R77() | ||||
|     { | ||||
|         string check = "R77*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R61() | ||||
|     { | ||||
|         string check = "R61*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R65() | ||||
|     { | ||||
|         string check = "R65*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R29() | ||||
|     { | ||||
|         string check = "R29*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R55() | ||||
|     { | ||||
|         string check = "R55*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__InfinityQS() | ||||
|     { | ||||
|         string check = "*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); | ||||
|         _ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); | ||||
|         EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); | ||||
|     } | ||||
|  | ||||
| } | ||||
| #endif | ||||
| @ -1,4 +1,4 @@ | ||||
| #if true | ||||
| #if v2_59_0 | ||||
| using Adaptation._Tests.Shared; | ||||
| using Adaptation.Shared; | ||||
| using Adaptation.Shared.Methods; | ||||
|  | ||||
							
								
								
									
										116
									
								
								Adaptation/_Tests/Extract/Production/v2.60.0/DEP08CEPIEPSILON.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								Adaptation/_Tests/Extract/Production/v2.60.0/DEP08CEPIEPSILON.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,116 @@ | ||||
| #if true | ||||
| using Adaptation._Tests.Shared; | ||||
| using Adaptation.Shared; | ||||
| using Adaptation.Shared.Methods; | ||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System; | ||||
| using System.Diagnostics; | ||||
| using System.Reflection; | ||||
|  | ||||
| namespace Adaptation._Tests.Extract.Production.v2_60_0; | ||||
|  | ||||
| [TestClass] | ||||
| public class DEP08CEPIEPSILON | ||||
| { | ||||
|  | ||||
| #pragma warning disable CA2254 | ||||
| #pragma warning disable IDE0060 | ||||
|  | ||||
|     private static CreateSelfDescription.Production.v2_60_0.DEP08CEPIEPSILON _DEP08CEPIEPSILON; | ||||
|  | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitialize(TestContext testContext) | ||||
|     { | ||||
|         CreateSelfDescription.Production.v2_60_0.DEP08CEPIEPSILON.ClassInitialize(testContext); | ||||
|         _DEP08CEPIEPSILON = CreateSelfDescription.Production.v2_60_0.DEP08CEPIEPSILON.EAFLoggingUnitTesting; | ||||
|     } | ||||
|  | ||||
|     private static void NonThrowTryCatch() | ||||
|     { | ||||
|         try | ||||
|         { throw new Exception(); } | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R32() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R32(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R62() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R62(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R75() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R75(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R77() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R77(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R61() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R61(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R65() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R65(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R29() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R29(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R29638856695638795511__First() | ||||
|     { | ||||
|         string check = "R29*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R29(); | ||||
|         string[] variables = _DEP08CEPIEPSILON.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false); | ||||
|         IFileRead fileRead = _DEP08CEPIEPSILON.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); | ||||
|         Logistics logistics = new(fileRead); | ||||
|         _ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__R55() => _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__R55(); | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void Production__v2_60_0__DEP08CEPIEPSILON__InfinityQS638895639451629988__First() | ||||
|     { | ||||
|         string check = "*.pdsf"; | ||||
|         MethodBase methodBase = new StackFrame().GetMethod(); | ||||
|         _DEP08CEPIEPSILON.Production__v2_60_0__DEP08CEPIEPSILON__InfinityQS(); | ||||
|         string[] variables = _DEP08CEPIEPSILON.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false); | ||||
|         IFileRead fileRead = _DEP08CEPIEPSILON.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); | ||||
|         Logistics logistics = new(fileRead); | ||||
|         _ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| } | ||||
| #endif | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -51,7 +51,7 @@ public class DEP08CEPIEPSILON : LoggingUnitTesting, IDisposable | ||||
|     public void TestDateTime() | ||||
|     { | ||||
|         DateTime dateTime = DateTime.Now; | ||||
|         Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString()); | ||||
|         Assert.AreEqual(dateTime.ToString(), dateTime.ToString("M/d/yyyy h:mm:ss tt")); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
| @ -64,7 +64,7 @@ public class DEP08CEPIEPSILON : LoggingUnitTesting, IDisposable | ||||
|         StringBuilder results = new(); | ||||
|         (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[] | ||||
|         { | ||||
|             new("DEP08CEPIEPSILON", "v2.59.0"), | ||||
|             new("DEP08CEPIEPSILON", "v2.60.0"), | ||||
|         }; | ||||
|         string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2"; | ||||
|         Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion; | ||||
|  | ||||
							
								
								
									
										94
									
								
								Adaptation/_Tests/Static/eda.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								Adaptation/_Tests/Static/eda.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,94 @@ | ||||
| getValue($('gv.vp12', '')); | ||||
|  | ||||
| function getValue(values) { | ||||
|     let result = null; | ||||
|     if (values != undefined && values.length > 1) { | ||||
|         let collection = values[0] === '|' ? values.substring(1).split('|') : values.split('|'); | ||||
|         let collectionParseFloat = getCollectionParseFloat(collection); | ||||
|         let raw = getMin(collectionParseFloat); | ||||
|         result = roundNumber(raw, 7); | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function getCollectionParseFloat(collection) { | ||||
|     let result = []; | ||||
|     let value; | ||||
|     for (let i = 0; i < collection.length; i++) { | ||||
|         value = parseFloat(collection[i]); | ||||
|         result.push(value); | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function getMin(collection) { | ||||
|     let result = 2147483647; | ||||
|     if (collection && collection.length > 0) { | ||||
|         for (let i = 0; i < collection.length; i++) { | ||||
|             if (collection[i] < result) { | ||||
|                 result = collection[i]; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function getMax(collection) { | ||||
|     let result = -2147483648; | ||||
|     if (collection && collection.length > 0) { | ||||
|         for (let i = 0; i < collection.length; i++) { | ||||
|             if (collection[i] > result) { | ||||
|                 result = collection[i]; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function getSum(collection) { | ||||
|     let result = 0; | ||||
|     if (!collection || collection.length === 0) { | ||||
|         result = 0; | ||||
|     } | ||||
|     else { | ||||
|         for (let i = 0; i < collection.length; i++) { | ||||
|             result += collection[i]; | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function getAverage(collection) { | ||||
|     let result = null; | ||||
|     if (collection == null || collection.length === 0) { | ||||
|         result = 0; | ||||
|     } | ||||
| 	else { | ||||
|         let sum = getSum(collection); | ||||
|         result = sum / collection.length; | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| function roundNumber(number, digits) { | ||||
|     let result; | ||||
|     const multiple = Math.pow(10, digits); | ||||
|     result = Math.round(number * multiple) / multiple; | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| Reactor | ||||
| getContextData('1', 'cds.PROCESS_JOBID', '') | ||||
|  | ||||
| PSN | ||||
| getContextData('1', 'cds.PRODUCT', '') | ||||
|  | ||||
| RDS | ||||
| getContextData('1', 'cds.MID', '') | ||||
|  | ||||
| getValue($('dcp.R61/DEP08CEPIEPSILON_Semi/LL1State', ''), $('dcp.R61/DEP08CEPIEPSILON_Semi/LL2State', '')); | ||||
|  | ||||
| function getValue(id78, id83) { | ||||
|     let result = id78 === '6' ? 'Left' : id83 === '6' ? 'Right' : id78 + '-' + id83; | ||||
|     return result; | ||||
| } | ||||
| @ -103,14 +103,18 @@ | ||||
|     <Compile Include="Adaptation\Eaf\Management\ConfigurationData\CellAutomation\ModelObjectParameterDefinition.cs" /> | ||||
|     <Compile Include="Adaptation\Eaf\Management\ConfigurationData\CellAutomation\ModelObjectParameterType.cs" /> | ||||
|     <Compile Include="Adaptation\Eaf\Management\ConfigurationData\Semiconductor\CellInstances\SecsConnectionConfiguration.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\Aggregation\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\CellInstanceConnectionName.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\Dummy\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R32\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R62\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R55\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R57\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R75\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R77\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\InfinityQS\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\InfinityQS\Six.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\Log\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R2\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R3\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R4\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R5\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R6\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\FileHandlers\R7\FileRead.cs" /> | ||||
|     <Compile Include="Adaptation\Ifx\Eaf\Common\Configuration\ConnectionSetting.cs" /> | ||||
|     <Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\File.cs" /> | ||||
|     <Compile Include="Adaptation\Ifx\Eaf\EquipmentConnector\File\Component\FilePathGenerator.cs" /> | ||||
| @ -141,6 +145,7 @@ | ||||
|     <Compile Include="Adaptation\Shared\Metrology\WS.Results.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\ParameterType.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\ProcessDataStandardFormat.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\ProcessDataStandardFormatMapping.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\Properties\IDescription.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\Properties\IFileRead.cs" /> | ||||
|     <Compile Include="Adaptation\Shared\Properties\ILogistics.cs" /> | ||||
| @ -162,13 +167,13 @@ | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Infineon.EAF.Runtime"> | ||||
|       <Version>2.59.0</Version> | ||||
|       <Version>2.60.0</Version> | ||||
|     </PackageReference> | ||||
|     <PackageReference Include="Microsoft.AspNet.WebApi.Core"> | ||||
|       <Version>5.2.7</Version> | ||||
|     </PackageReference> | ||||
|     <PackageReference Include="System.Text.Json"> | ||||
|       <Version>8.0.3</Version> | ||||
|       <Version>8.0.5</Version> | ||||
|     </PackageReference> | ||||
|     <PackageReference Include="System.Net.WebSockets"> | ||||
|       <Version>4.3.0</Version> | ||||
|  | ||||
| @ -37,7 +37,7 @@ public partial class FileRead : FileReaderHandler, ISMTP | ||||
|     private FilePathGenerator _FilePathGeneratorForTarget; | ||||
|     private readonly List<EquipmentParameter> _EquipmentParameters; | ||||
|     private static readonly Dictionary<string, List<long>> _DummyRuns; | ||||
|     private static readonly Dictionary<long, List<string>> _StaticRuns; | ||||
|     private static readonly Dictionary<long, List<Adaptation.Shared.Metrology.WS.Results>> _StaticRuns; | ||||
|  | ||||
|     static FileRead() | ||||
|     { | ||||
|  | ||||
| @ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||||
| // You can specify all the values or you can default the Build and Revision Numbers | ||||
| // by using the '*' as shown below: | ||||
| // [assembly: AssemblyVersion("1.0.*")] | ||||
| [assembly: AssemblyVersion("2.59.0.0")] | ||||
| [assembly: AssemblyFileVersion("2.59.0.0")] | ||||
| [assembly: AssemblyVersion("2.60.0.0")] | ||||
| [assembly: AssemblyFileVersion("2.60.0.0")] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user