[성현모] TRA Recovery 생성
This commit is contained in:
@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Data.SqlClient;
|
||||
using SystemX.Product.TRA.DataManager;
|
||||
using static SystemX.Product.CP.TRA.MainForm;
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
||||
using DevExpress.XtraPrinting;
|
||||
using SystemX.Product.ALIS.Interface;
|
||||
using static SystemX.Product.CP.TRA.Commons;
|
||||
|
||||
namespace SystemX.Product.TRA.UIControl
|
||||
{
|
||||
public partial class UcTRAProdHistHost : UcTRABaseView
|
||||
{
|
||||
public enum eColHide
|
||||
{
|
||||
TestListNo,
|
||||
TestlistFile
|
||||
}
|
||||
|
||||
DMTestHistory DataManager { get; set; }
|
||||
TestHistorySearchOption Option { get; set; }
|
||||
SelectedDataCollection SelectedData { get; set; }
|
||||
|
||||
public DataTable DataResult { get; private set; }
|
||||
|
||||
public delegate void evtDataDetailViewHandler(DetailTestDataCollection data);
|
||||
public event evtDataDetailViewHandler OnDetailSelect;
|
||||
|
||||
private string GridViewGetActiveFilterText;
|
||||
|
||||
public UcTRAProdHistHost()
|
||||
{
|
||||
ContentsType = eContents.ProductHistory;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetSQLConnection(eSelectDataView SelectView, IDataBaseController getDBController)
|
||||
{
|
||||
DataManager = new DMTestHistory(SelectView, getDBController);
|
||||
}
|
||||
|
||||
public DetailTestDataCollection GetSearchInfo(DataRow dtRow)
|
||||
{
|
||||
DetailTestDataCollection drDetail = new DetailTestDataCollection();
|
||||
|
||||
//drDetail.TestID = dtRow[DMTestHistory.eColList.TestID.ToString()].ToString();
|
||||
drDetail.No = Convert.ToInt64(dtRow[DMTestHistory.eColList.No.ToString()]);
|
||||
drDetail.StartTime = DateTime.Parse(dtRow[DMTestHistory.eColList.TestDateTime.ToString()].ToString());
|
||||
drDetail.Duration = Convert.ToInt64(dtRow[DMTestHistory.eColList.Duration.ToString()]);
|
||||
drDetail.StationName = dtRow[DMTestHistory.eColList.StationName.ToString()].ToString();
|
||||
drDetail.HostID = dtRow[DMTestHistory.eColList.Host.ToString()].ToString();
|
||||
drDetail.SectionID = dtRow[DMTestHistory.eColList.Section.ToString()].ToString();
|
||||
drDetail.TestType = dtRow[DMTestHistory.eColList.TestType.ToString()].ToString();
|
||||
drDetail.ProductID = dtRow[DMTestHistory.eColList.ProductID.ToString()].ToString();
|
||||
drDetail.ProductNo = dtRow[DMTestHistory.eColList.ProductNo.ToString()].ToString();
|
||||
drDetail.TestCode = dtRow[DMTestHistory.eColList.TestCode.ToString()].ToString();
|
||||
drDetail.ParentNo = dtRow[DMTestHistory.eColList.ParentNo.ToString()].ToString();
|
||||
drDetail.FileCode = dtRow[DMTestHistory.eColList.FileCode.ToString()].ToString();
|
||||
drDetail.FileVersion = dtRow[DMTestHistory.eColList.FileVersion.ToString()].ToString();
|
||||
drDetail.TestlistFileName = dtRow[DMTestHistory.eColList.TestlistFileName.ToString()].ToString();
|
||||
drDetail.TestListFileNo = dtRow[DMTestHistory.eColList.TestListFileNo.ToString()].ToString();
|
||||
drDetail.TestListVariantNo = dtRow[DMTestHistory.eColList.TestListVariantNo.ToString()].ToString();
|
||||
drDetail.StepVersion = dtRow[DMTestHistory.eColList.StepVersion.ToString()].ToString();
|
||||
drDetail.TestRequestID = dtRow[DMTestHistory.eColList.TestlistReqID.ToString()].ToString();
|
||||
drDetail.TestResult = dtRow[DMTestHistory.eColList.TestResult.ToString()].ToString();
|
||||
|
||||
return drDetail;
|
||||
}
|
||||
|
||||
private void UcTRATestHistHost_Load(object sender, EventArgs e)
|
||||
{
|
||||
Option = new TestHistorySearchOption();
|
||||
|
||||
FrmOptionStationSearch dlgSearch = new FrmOptionStationSearch();
|
||||
|
||||
dlgSearch.ShowDialog();
|
||||
|
||||
if (dlgSearch.DialogResult == DialogResult.OK)
|
||||
Option = dlgSearch.GetSelectedResult();
|
||||
}
|
||||
|
||||
private void gridViewMain_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
DXMouseEventArgs ea = e as DXMouseEventArgs;
|
||||
GridView view = sender as GridView;
|
||||
GridHitInfo info = view.CalcHitInfo(ea.Location);
|
||||
|
||||
if (info.InRow || info.InRowCell)
|
||||
{
|
||||
int nRow = int.MinValue;
|
||||
nRow = info.RowHandle;
|
||||
|
||||
if (nRow < 0)
|
||||
return;
|
||||
|
||||
var dvRow = view.GetRow(nRow);
|
||||
DataRow dtRow = (dvRow as DataRowView).Row;
|
||||
DetailTestDataCollection drDetail = GetSearchInfo(dtRow);
|
||||
|
||||
OnDetailSelect(drDetail);
|
||||
}
|
||||
}
|
||||
|
||||
public List<DetailTestDataCollection> GetResultContents()
|
||||
{
|
||||
List<DetailTestDataCollection> vDetailData = new List<DetailTestDataCollection>();
|
||||
GridView view = gridViewMain as GridView;
|
||||
|
||||
for(int i=0; i<view.RowCount; i++)
|
||||
{
|
||||
DataRow dtRow = (view.GetRow(i) as DataRowView).Row;
|
||||
DetailTestDataCollection dtContent = GetSearchInfo(dtRow);
|
||||
|
||||
vDetailData.Add(dtContent);
|
||||
}
|
||||
|
||||
return vDetailData;
|
||||
}
|
||||
|
||||
public string CreateExportFileName()
|
||||
{
|
||||
string strFileName = $"{this.ContentsType.ToString()}_{SelectedData.ProductNo}_{SelectedData.TestCode}_{SelectedData.StationName}";
|
||||
|
||||
strFileName += $"_{SelectedData.StartTime.ToString("yyyyMMddHHmmss")}-{SelectedData.EndTime.ToString("yyyyMMddHHmmss")}";
|
||||
|
||||
return strFileName;
|
||||
}
|
||||
|
||||
public override void ExportData()
|
||||
{
|
||||
FolderBrowserDialog dlg = new FolderBrowserDialog();
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
string strFileName = CreateExportFileName();
|
||||
string strExpPath = dlg.SelectedPath + "\\" + strFileName;
|
||||
XlsxExportOptionsEx option = new XlsxExportOptionsEx();
|
||||
string strFile = strExpPath + ".xlsx";
|
||||
|
||||
option.ShowGridLines = true;
|
||||
option.ExportType = DevExpress.Export.ExportType.WYSIWYG;
|
||||
option.ExportMode = XlsxExportMode.SingleFile;
|
||||
option.SheetName = "Test History";
|
||||
gridControlMain.ExportToXlsx(strFile, option);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user