[성현모] TRA Extract

This commit is contained in:
SHM
2026-02-10 13:16:41 +09:00
parent 312a7a942f
commit 580257fff2
6 changed files with 199 additions and 3 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
</configuration>

View File

@ -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;
}
}
}

View File

@ -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();
}
}
}

View File

@ -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")]

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{59074FB3-4828-42DE-AFB0-77B1CB629511}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SystemX.Product.CP.TRA.Extract</RootNamespace>
<AssemblyName>SystemX.Product.CP.TRA.Extract</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DBService.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -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