From 580257fff2f368ed2e3b62dd2ba0c74835a314c2 Mon Sep 17 00:00:00 2001 From: SHM Date: Tue, 10 Feb 2026 13:16:41 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20TRA=20Extract?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemX.Product.CP.TRA.Extract/App.config | 6 ++ .../DBService.cs | 76 +++++++++++++++++++ .../SystemX.Product.CP.TRA.Extract/Program.cs | 17 +++++ .../Properties/AssemblyInfo.cs | 33 ++++++++ .../SystemX.Product.CP.TRA.Extract.csproj | 54 +++++++++++++ CPXV2 TRA JSON/SystemX.Product.CP.TRA.sln | 16 +++- 6 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config create mode 100644 CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs create mode 100644 CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs create mode 100644 CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Properties/AssemblyInfo.cs create mode 100644 CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/SystemX.Product.CP.TRA.Extract.csproj diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config new file mode 100644 index 0000000..aee9adf --- /dev/null +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs new file mode 100644 index 0000000..15265b1 --- /dev/null +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/DBService.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SystemX.Product.CP.TRA.Extract +{ + + public class DBService + { + private string connectionString = "Server=192.168.0.69;Database=CPXV2ShortTermLogJson;User Id=Alis;Password=Kefico!@34;"; + + public void GetLargeData() + { + // 1. 연결 생성 + using (SqlConnection conn = new SqlConnection(connectionString)) + { + try + { + // 2. 실행할 쿼리 작성 (JOIN 포함) + string sql = @"SELECT [TestListFileNo] + ,[StepID] + ,[StepVersion] + ,[StepDesc] + ,[SpecMin] + ,[SpecMax] + ,[Dim] + FROM [CPXV2].[dbo].[VRFY_TestListFileRelease] where StepDesc like 'an10_off' order by testlistfileno"; + + SqlCommand cmd = new SqlCommand(sql, conn); + // 타임아웃 설정 (600만 건은 시간이 걸릴 수 있으므로 0(무제한) 또는 넉넉하게 설정) + cmd.CommandTimeout = 300; + conn.Open(); + + // 3. DataReader로 데이터 읽기 + using (SqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + // 예: 데이터 처리 로직 + var val = Decompression(reader["LogData"].ToString()); + } + } + + //sql = @"SELECT * FROM HIST_LogSummary_2025 as Summary with(nolock) JOIN HIST_TestResult_2025 as Result with(nolock) ON Summary.No = Result.No"; + } + catch (SqlException ex) + { + Console.WriteLine("DB 오류 발생: " + ex.Message); + } + } + } + + public static string Decompression(string compressedDataStr) + { + string result = null; + byte[] buffer = Convert.FromBase64String(compressedDataStr); + using (MemoryStream stream = new MemoryStream(buffer)) + { + using (GZipStream stream2 = new GZipStream(stream, CompressionMode.Decompress)) + { + using (StreamReader streamReader = new StreamReader(stream2)) + { + result = streamReader.ReadToEnd(); + } + } + } + + return result; + } + } +} diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs new file mode 100644 index 0000000..cbbc948 --- /dev/null +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Program.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SystemX.Product.CP.TRA.Extract +{ + internal class Program + { + static void Main(string[] args) + { + DBService dbS = new DBService(); + dbS.GetLargeData(); + } + } +} diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Properties/AssemblyInfo.cs b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ae76e02 --- /dev/null +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("SystemX.Product.CP.TRA.Extract")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SystemX.Product.CP.TRA.Extract")] +[assembly: AssemblyCopyright("Copyright © 2026")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("59074fb3-4828-42de-afb0-77b1cb629511")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/SystemX.Product.CP.TRA.Extract.csproj b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/SystemX.Product.CP.TRA.Extract.csproj new file mode 100644 index 0000000..72065b0 --- /dev/null +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.Extract/SystemX.Product.CP.TRA.Extract.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {59074FB3-4828-42DE-AFB0-77B1CB629511} + Exe + SystemX.Product.CP.TRA.Extract + SystemX.Product.CP.TRA.Extract + v4.8.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.sln b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.sln index ff3be3b..80ab99a 100644 --- a/CPXV2 TRA JSON/SystemX.Product.CP.TRA.sln +++ b/CPXV2 TRA JSON/SystemX.Product.CP.TRA.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33027.164 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36301.6 d17.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{18C1E9B6-823D-49DB-8253-ED32EEA21DB1}" EndProject @@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemX.Product.CP.TRA", "S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemX.Product.CP.TRA.BaseView", "SystemX.Product.CP.TRA.BaseView\SystemX.Product.CP.TRA.BaseView.csproj", "{910BB092-A5F3-4ACE-BBF8-C19434F1FA8E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemX.Product.CP.TRA.Extract", "SystemX.Product.CP.TRA.Extract\SystemX.Product.CP.TRA.Extract.csproj", "{59074FB3-4828-42DE-AFB0-77B1CB629511}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,12 +38,20 @@ Global {910BB092-A5F3-4ACE-BBF8-C19434F1FA8E}.Release|Any CPU.Build.0 = Release|Any CPU {910BB092-A5F3-4ACE-BBF8-C19434F1FA8E}.Release|x64.ActiveCfg = Release|Any CPU {910BB092-A5F3-4ACE-BBF8-C19434F1FA8E}.Release|x64.Build.0 = Release|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Debug|x64.ActiveCfg = Debug|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Debug|x64.Build.0 = Debug|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Release|Any CPU.Build.0 = Release|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Release|x64.ActiveCfg = Release|Any CPU + {59074FB3-4828-42DE-AFB0-77B1CB629511}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - VisualSVNWorkingCopyRoot = . SolutionGuid = {34BF09E0-D510-452D-8E8B-B0D1C6FE25BF} + VisualSVNWorkingCopyRoot = . EndGlobalSection EndGlobal