Compare commits

...

7 Commits

Author SHA1 Message Date
00b3a5e643 Revert "Setup Setting"
This reverts commit 3e9339195e.
2025-03-14 09:07:45 +09:00
f43ffb1e30 Merge branch 'master' into 20250203_SFTP 2025-03-14 09:06:40 +09:00
9be4b773a5 F1 Change 2025-03-07 11:57:24 +09:00
0790ae42f9 FDC MongoDB 패치(컬럼추가) 2025-03-06 09:40:18 +09:00
0b7f4ba366 HSMS, Workflow Download 2025-03-05 17:08:54 +09:00
933519164e EISLog OpenWindow 2025-03-05 12:59:00 +09:00
3e9339195e Setup Setting 2025-02-27 13:22:31 +09:00
10 changed files with 394 additions and 222 deletions

View File

@@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Windows.Forms.DataVisualization.Charting;
using DDUtilityApp.DATA;
using JWH.DATA;
@@ -11,33 +13,74 @@ namespace DDUtilityApp.LOGPARSER.DATA
public class LogFile : DataTableBase
{
private string m_FullName = string.Empty;
public Account Account { get; set; } = null;
public string Name { get; set; }
public string FullName
{
get { return this.m_FullName; }
set
{
this.m_FullName = value;
this.DirectoryName = Path.GetDirectoryName(value);
this.FileName = Path.GetFileName(value);
this.Name = Path.GetFileNameWithoutExtension(value);
this.Extension = Path.GetExtension(value);
}
}
public string DirectoryName { get; private set; }
public string FileName { get; private set; }
public string Name { get; private set; }
public string Extension { get; private set; }
public long Length { get; set; }
public string Extension { get; set; }
public string FullName { get; set; }
public DateTime CreationTime { get; set; }
public DateTime LastAccessTime { get; set; }
public DateTime LastWriteTime { get; set; }
public string DestFullName { get; set; }
public LogFile()
{
}
public LogFile(string fullName)
{
this.Name = System.IO.Path.GetFileNameWithoutExtension(fullName);
this.FullName = fullName;
this.Extension = System.IO.Path.GetExtension(fullName);
}
public string GetFileSize(FileSizeType format = FileSizeType.Auto)
{
int index = 0;
int nFormat = (int)format;
double value = this.Length;
for (index = 0; index < nFormat; index++)
{
if (format == FileSizeType.Auto && value < 1024) break;
value /= 1024;
}
return $"{value.ToString("N2")} {(FileSizeType)index}";
}
}
public enum FileSizeType
{
Bt = 0,
KB = 1,
MB = 2,
GB = 3,
TB = 4,
Auto = 9,
}
}

View File

@@ -58,15 +58,15 @@
this.panel5 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabLogFiles = new System.Windows.Forms.TabPage();
this.gridLogFiles = new JWH.CONTROL.GridViewEx();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabModelHistory = new System.Windows.Forms.TabPage();
this.gridModelDetail = new JWH.CONTROL.GridViewEx();
this.panel10 = new System.Windows.Forms.Panel();
this.tboxModelDescription = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabWorkflow = new System.Windows.Forms.TabPage();
this.gridWorkflow = new JWH.CONTROL.GridViewEx();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabHSMS = new System.Windows.Forms.TabPage();
this.gridHsms = new JWH.CONTROL.GridViewEx();
this.radStatusStrip1 = new Telerik.WinControls.UI.RadStatusStrip();
this.rstatus1 = new Telerik.WinControls.UI.RadLabelElement();
@@ -92,17 +92,17 @@
this.panel5.SuspendLayout();
this.panel7.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabLogFiles.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).BeginInit();
this.tabPage2.SuspendLayout();
this.tabModelHistory.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).BeginInit();
this.panel10.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabWorkflow.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).BeginInit();
this.tabPage4.SuspendLayout();
this.tabHSMS.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit();
@@ -384,10 +384,10 @@
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabLogFiles);
this.tabControl1.Controls.Add(this.tabModelHistory);
this.tabControl1.Controls.Add(this.tabWorkflow);
this.tabControl1.Controls.Add(this.tabHSMS);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
@@ -397,16 +397,16 @@
this.tabControl1.TabIndex = 6;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
// tabLogFiles
//
this.tabPage1.Controls.Add(this.gridLogFiles);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(539, 463);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Log Files";
this.tabPage1.UseVisualStyleBackColor = true;
this.tabLogFiles.Controls.Add(this.gridLogFiles);
this.tabLogFiles.Location = new System.Drawing.Point(4, 22);
this.tabLogFiles.Name = "tabLogFiles";
this.tabLogFiles.Padding = new System.Windows.Forms.Padding(3);
this.tabLogFiles.Size = new System.Drawing.Size(539, 463);
this.tabLogFiles.TabIndex = 0;
this.tabLogFiles.Text = "Log Files";
this.tabLogFiles.UseVisualStyleBackColor = true;
//
// gridLogFiles
//
@@ -427,17 +427,17 @@
this.gridLogFiles.Size = new System.Drawing.Size(533, 457);
this.gridLogFiles.TabIndex = 3;
//
// tabPage2
// tabModelHistory
//
this.tabPage2.Controls.Add(this.gridModelDetail);
this.tabPage2.Controls.Add(this.panel10);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(539, 463);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Model History";
this.tabPage2.UseVisualStyleBackColor = true;
this.tabModelHistory.Controls.Add(this.gridModelDetail);
this.tabModelHistory.Controls.Add(this.panel10);
this.tabModelHistory.Location = new System.Drawing.Point(4, 22);
this.tabModelHistory.Name = "tabModelHistory";
this.tabModelHistory.Padding = new System.Windows.Forms.Padding(3);
this.tabModelHistory.Size = new System.Drawing.Size(539, 463);
this.tabModelHistory.TabIndex = 1;
this.tabModelHistory.Text = "Model History";
this.tabModelHistory.UseVisualStyleBackColor = true;
//
// gridModelDetail
//
@@ -478,16 +478,16 @@
this.tboxModelDescription.Size = new System.Drawing.Size(533, 96);
this.tboxModelDescription.TabIndex = 0;
//
// tabPage3
// tabWorkflow
//
this.tabPage3.Controls.Add(this.gridWorkflow);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(539, 463);
this.tabPage3.TabIndex = 3;
this.tabPage3.Text = "Workflow";
this.tabPage3.UseVisualStyleBackColor = true;
this.tabWorkflow.Controls.Add(this.gridWorkflow);
this.tabWorkflow.Location = new System.Drawing.Point(4, 22);
this.tabWorkflow.Name = "tabWorkflow";
this.tabWorkflow.Padding = new System.Windows.Forms.Padding(3);
this.tabWorkflow.Size = new System.Drawing.Size(539, 463);
this.tabWorkflow.TabIndex = 3;
this.tabWorkflow.Text = "Workflow";
this.tabWorkflow.UseVisualStyleBackColor = true;
//
// gridWorkflow
//
@@ -508,16 +508,16 @@
this.gridWorkflow.Size = new System.Drawing.Size(533, 457);
this.gridWorkflow.TabIndex = 4;
//
// tabPage4
// tabHSMS
//
this.tabPage4.Controls.Add(this.gridHsms);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(539, 463);
this.tabPage4.TabIndex = 2;
this.tabPage4.Text = "HSMS";
this.tabPage4.UseVisualStyleBackColor = true;
this.tabHSMS.Controls.Add(this.gridHsms);
this.tabHSMS.Location = new System.Drawing.Point(4, 22);
this.tabHSMS.Name = "tabHSMS";
this.tabHSMS.Padding = new System.Windows.Forms.Padding(3);
this.tabHSMS.Size = new System.Drawing.Size(539, 463);
this.tabHSMS.TabIndex = 2;
this.tabHSMS.Text = "HSMS";
this.tabHSMS.UseVisualStyleBackColor = true;
//
// gridHsms
//
@@ -556,6 +556,7 @@
// rstatus1
//
this.rstatus1.Name = "rstatus1";
this.radStatusStrip1.SetSpring(this.rstatus1, false);
this.rstatus1.Text = "";
this.rstatus1.TextWrap = true;
//
@@ -597,18 +598,18 @@
this.panel5.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabLogFiles.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabModelHistory.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).EndInit();
this.panel10.ResumeLayout(false);
this.panel10.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabWorkflow.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).EndInit();
this.tabPage4.ResumeLayout(false);
this.tabHSMS.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).EndInit();
@@ -642,17 +643,17 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkAllEquipment;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabLogFiles;
private JWH.CONTROL.GridViewEx gridLogFiles;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabModelHistory;
private JWH.CONTROL.GridViewEx gridModelDetail;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.TextBox tboxModelDescription;
private Telerik.WinControls.UI.RadStatusStrip radStatusStrip1;
private Telerik.WinControls.UI.RadLabelElement rstatus1;
private System.Windows.Forms.CheckBox chkUseSMB;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabHSMS;
private System.Windows.Forms.TabPage tabWorkflow;
private JWH.CONTROL.GridViewEx gridHsms;
private JWH.CONTROL.GridViewEx gridWorkflow;
}

View File

@@ -8,6 +8,7 @@ using JWH.CONTROL;
using JWH.DATA;
using JWH.NETWORK;
using Org.BouncyCastle.Tls.Crypto;
using Renci.SshNet;
using Renci.SshNet.Sftp;
using System;
using System.Collections.Generic;
@@ -52,8 +53,6 @@ namespace DDUtilityApp.LOGPARSER
public string ServerName { get; set; } = string.Empty;
//public string EquipmentID { get; set; } = string.Empty;
public SECSDefine SECSDefine { get; set; } = null;
#endregion
@@ -79,7 +78,8 @@ namespace DDUtilityApp.LOGPARSER
this.tboxName.ImeMode = ImeMode.Hangul;
this.tboxEquipmentID.ImeMode = ImeMode.Alpha;
this.chkAllEquipment.Checked = GlobalVariable.Instance.FrmEqSelector_AllEquipment;
this.chkUseSMB.Checked = GlobalVariable.Instance.FrmEqSelector_UseSMB;
this.chkUseSMB.Checked = true; // = GlobalVariable.Instance.FrmEqSelector_UseSMB
this.chkUseSMB.Visible = false;
this.tabControl1.SelectedIndex = 0;
this.tboxModelDescription.Font = font;
@@ -140,7 +140,7 @@ namespace DDUtilityApp.LOGPARSER
switch (keyData)
{
case Keys.F1:
Process.Start($"http://jungwoois.dothome.co.kr");
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
break;
case Keys.F6:
this.gridEquipments.BestFitColumns(BestFitColumnMode.DisplayedCells);
@@ -214,27 +214,71 @@ namespace DDUtilityApp.LOGPARSER
/// <param name="e"></param>
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex >= 2)
try
{
int selectIdx = tabControl1.SelectedIndex;
string subPath = tabControl1.SelectedTab.Text.Contains("Workflow") ? "Workflow" : "THiRA_SECSGEM/HSMS";
var equipment = this.Equipment;
//StpClientWrap.Connect();
FtpsClient.Connect();
// SFTP 파일 목록 가져오기
// var rtnObj = StpClientWrap.GetSftpList($"/{equipment.EquipmentID}/{subPath}");
var rtnObj = FtpsClient.GetFtpsList($"/EISLog/{equipment.EquipmentID}/{subPath}");
if (rtnObj == null) return;
GridViewEx grid = tabControl1.SelectedTab.Controls.OfType<GridViewEx>().FirstOrDefault();
if (grid != null)
if (this.tabControl1.SelectedTab == this.tabHSMS)
{
//grid.AutoBinding(GetSftplogFiles(rtnObj));
grid.AutoBinding(GetLogFiles(rtnObj));
if (this.gridHsms.DataSource == null) return;
string remotePath = $"/{this.Account.DefaultPath}/{this.Equipment.EquipmentID}/THiRA_SECSGEM/HSMS";
switch (this.Account.Access)
{
case AccessType.SMB:
break;
case AccessType.FTPS:
{
FtpsClient.Connect();
FtpListItem[] items = FtpsClient.GetFtpsList(remotePath);
this.gridHsms.AutoBinding(this.GetLogFiles(items));
FtpsClient.Disconnect();
}
break;
case AccessType.SFTP:
{
StpClientWrap.Connect();
ISftpFile[] items = (ISftpFile[])StpClientWrap.GetSftpList(remotePath);
this.gridHsms.AutoBinding(this.GetLogFiles(items));
StpClientWrap.Disconnect();
}
break;
case AccessType.FTP:
break;
}
}
else if (this.tabControl1.SelectedTab == this.tabWorkflow)
{
if (this.gridWorkflow.DataSource != null) return;
string remotePath = $"/{this.Account.DefaultPath}/{this.Equipment.EquipmentID}/Workflow";
switch (this.Account.Access)
{
case AccessType.SMB:
break;
case AccessType.FTPS:
{
FtpsClient.Connect();
FtpListItem[] items = FtpsClient.GetFtpsList(remotePath);
LogFile[] logFiles = this.GetLogFiles(items);
this.gridWorkflow.AutoBinding(logFiles);
FtpsClient.Disconnect();
}
break;
case AccessType.SFTP:
{
StpClientWrap.Connect();
ISftpFile[] items = (ISftpFile[])StpClientWrap.GetSftpList(remotePath);
this.gridWorkflow.AutoBinding(this.GetLogFiles(items));
StpClientWrap.Disconnect();
}
break;
case AccessType.FTP:
break;
}
}
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex, true);
}
}
@@ -383,6 +427,9 @@ namespace DDUtilityApp.LOGPARSER
if (this.gridEquipments.SelectedRows.Count < 1) return;
this.gridLogFiles.DataSource = null;
this.gridModelDetail.DataSource = null;
this.gridWorkflow.DataSource = null;
this.gridHsms.DataSource = null;
//if (this.tabControl1.TabPages.Contains(this.tabHSMS)) this.tabControl1.TabPages.Remove(this.tabHSMS);
EisEquipment equipment = this.gridEquipments.SelectedRows[0].DataBoundItem as EisEquipment;
if (equipment == null) return;
@@ -393,6 +440,7 @@ namespace DDUtilityApp.LOGPARSER
string path = string.Empty;
#region [ Model Details ]
// 모델 버전 정보
EisModelDetails[] modelDetails = this.GetModelDetails(equipment);
this.gridModelDetail.AutoBinding(modelDetails);
@@ -415,6 +463,7 @@ namespace DDUtilityApp.LOGPARSER
{
this.tboxModelDescription.Text = modelInfo[0].Description;
}
#endregion
#region [ LogFiles ]
@@ -464,10 +513,8 @@ namespace DDUtilityApp.LOGPARSER
if (ftpFiles != null) this.gridLogFiles.AutoBinding(this.GetLogFiles(ftpFiles));
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
if (FtpsClient.IsDirExists($"{path}/THiRA_SECSGEM/HSMS"))
{ if (!tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Add(tabPage4); }
else
{ if (tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Remove(tabPage4); }
//if (FtpsClient.IsDirExists($"{path}/THiRA_SECSGEM/HSMS") && !this.tabControl1.TabPages.Contains(tabHSMS))
// this.tabControl1.TabPages.Add(this.tabHSMS);
FtpsClient.Disconnect();
}
@@ -482,10 +529,8 @@ namespace DDUtilityApp.LOGPARSER
if (ftpFiles != null) this.gridLogFiles.AutoBinding(this.GetLogFiles(ftpFiles));
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
if (StpClientWrap.IsDirExists($"{path}/THiRA_SECSGEM/HSMS"))
{ if (!tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Add(tabPage4); }
else
{ if (tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Remove(tabPage4); }
//if (StpClientWrap.IsDirExists($"{path}/THiRA_SECSGEM/HSMS") && !this.tabControl1.TabPages.Contains(tabHSMS))
// this.tabControl1.TabPages.Add(this.tabHSMS);
StpClientWrap.Disconnect();
}
@@ -500,6 +545,12 @@ namespace DDUtilityApp.LOGPARSER
#endregion
#region [ Workflow & HSMS ]
this.tabControl1_SelectedIndexChanged(this.tabControl1, new EventArgs());
#endregion
}
catch (Exception ex)
{
@@ -618,16 +669,16 @@ namespace DDUtilityApp.LOGPARSER
if (hsmsEnabled == false)
{
if (tabControl1.TabPages.Contains(tabPage4))
if (tabControl1.TabPages.Contains(tabHSMS))
{
tabControl1.TabPages.Remove(tabPage4);
tabControl1.TabPages.Remove(tabHSMS);
}
}
else
{
if (!tabControl1.TabPages.Contains(tabPage4))
if (!tabControl1.TabPages.Contains(tabHSMS))
{
tabControl1.TabPages.Add(tabPage4);
tabControl1.TabPages.Add(tabHSMS);
}
}
@@ -768,7 +819,7 @@ namespace DDUtilityApp.LOGPARSER
grid.AddColumn("Length");
grid.AddColumn("LastWriteTime");
grid.AddContextMenu("");
//grid.AddContextMenu("");
//grid.AddContextMenu("Open Log", GridEquipments_OpenWindows);
}
@@ -813,28 +864,56 @@ namespace DDUtilityApp.LOGPARSER
/// <param name="e"></param>
private void Grid_CellDoubleClick(object sender, GridViewCellEventArgs e)
{
RadGridView gd = sender.GetType().Name.Contains("GridDataCellElement") ?
((GridDataCellElement)sender)?.RowElement?.GridControl : (GridViewEx)sender;
try
{
List<string> downfiles = new List<string>();
foreach (GridViewRowInfo row in gd.SelectedRows)
{
LogFile item = row.DataBoundItem as LogFile;
var fullPath = item.FullName;
string destPath = GlobalVariable.Instance.DownloadPath;
string destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
FtpsClient.DownloadFtpsFile(fullPath, destFileName);
downfiles.Add(destFileName);
RadGridView grid = sender as RadGridView;
if (grid == null && sender.GetType() == typeof(GridDataCellElement))
{
GridDataCellElement element = sender as GridDataCellElement;
grid = element.RowElement.GridControl;
}
if (grid == null) return;
if (grid == this.gridHsms) destPath = Path.Combine(destPath, "HSMS");
else if (grid == this.gridWorkflow) destPath = Path.Combine(destPath, "Workflow");
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
List<string> downfiles = new List<string>();
foreach (GridViewRowInfo row in grid.SelectedRows)
{
LogFile logFile = row.DataBoundItem as LogFile;
string destFileName = Path.Combine(destPath, logFile.FileName);
switch (this.Account.Access)
{
case AccessType.SMB:
{ }
break;
case AccessType.FTPS:
{
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
downfiles.Add(destFileName);
logFile.DestFullName = destFileName;
}
break;
case AccessType.SFTP:
{
StpClientWrap.DownloadSftpFile(logFile.FullName, destFileName);
downfiles.Add(destFileName);
logFile.DestFullName = destFileName;
}
break;
case AccessType.FTP:
{ }
break;
}
}
MessageBox.Show($"{gd.SelectedRows.Count}개의 파일을 저장하였습니다.");
//System.Diagnostics.Process.Start($"explorer.exe", $"/select,{argument}");
foreach(string command in downfiles)
System.Diagnostics.Process.Start(command);
MessageBox.Show($"{grid.SelectedRows.Count}개의 파일을 저장하였습니다.");
foreach (string file in downfiles)
System.Diagnostics.Process.Start(file);
}
catch (Exception ex)
{
@@ -1232,7 +1311,7 @@ namespace DDUtilityApp.LOGPARSER
foreach (LogFile logFile in logFiles)
{
if (string.Compare(item.FullName, logFile.FullName, true) == 0)
if (string.Compare(item.FileName, logFile.FileName, true) == 0)
{
if (current == null)
{
@@ -1365,9 +1444,7 @@ namespace DDUtilityApp.LOGPARSER
.Select(item => new LogFile
{
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
Length = item.Length,
CreationTime = item.CreationTime,
LastAccessTime = item.LastAccessTime,
@@ -1390,9 +1467,7 @@ namespace DDUtilityApp.LOGPARSER
.Select(item => new LogFile
{
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
Length = item.Size,
CreationTime = item.Modified,
LastAccessTime = item.Modified,
@@ -1415,9 +1490,7 @@ namespace DDUtilityApp.LOGPARSER
.Select(item => new LogFile
{
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
Length = item.Length,
CreationTime = item.LastAccessTime,
LastAccessTime = item.LastAccessTime,
@@ -1440,9 +1513,7 @@ namespace DDUtilityApp.LOGPARSER
.Select(item => new LogFile
{
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
Length = item.Size,
CreationTime = item.Modified,
LastAccessTime = item.Modified,

View File

@@ -40,8 +40,6 @@ namespace DDUtilityApp.LOGPARSER
private bool RadGridControlKey { get; set; } = false;
private Account Account { get; set; } = null;
private StandardCollection StandardCollection { get; set; } = new StandardCollection();
public LogParser LogParser
@@ -254,7 +252,7 @@ namespace DDUtilityApp.LOGPARSER
switch (keyData)
{
case Keys.F1:
Process.Start($"http://192.168.7.221:8081/");
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
break;
case Keys.F2:
this.Location = new Point(0, 0);
@@ -359,8 +357,10 @@ namespace DDUtilityApp.LOGPARSER
int index = -1;
index = this.lviewFiles.SelectedItems[0].Index;
LogFile logFile = this.lviewFiles.Items[index].Tag as LogFile;
if (logFile == null) return;
this.tboxFilename.Text = Path.GetFileName(logFile.FullName);
this.tboxFilename.Text = logFile.FileName;
this.tboxFilename.Tag = logFile;
if (string.IsNullOrEmpty(this.tboxFilename.Text) == false && this.tboxFilename.Text.Length > 6)
{
this.tboxFilename.SelectionStart = this.tboxFilename.Text.Length - 6;
@@ -457,28 +457,25 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
LogFile logFile = this.tboxFilename.Tag as LogFile;
string fileName = this.tboxFilename.Text;
if (string.IsNullOrEmpty(fileName)) return;
foreach (ListViewItem item in this.lviewFiles.Items)
if (string.Compare(item.Text, fileName, true) == 0) return;
if (logFile == null)
LogFile srcLogFile = this.tboxFilename.Tag as LogFile;
if (srcLogFile == null)
{
if (this.lviewFiles.Items.Count < 1) return;
LogFile src = this.lviewFiles.Items[0].Tag as LogFile;
if (src != null)
{
string path = Path.GetDirectoryName(src.FullName);
string fullName = Path.Combine(path, fileName);
logFile = new LogFile(fullName);
logFile.Account = src.Account;
}
srcLogFile = this.lviewFiles.Items[0].Tag as LogFile;
if (srcLogFile == null) return;
}
ListViewItem lviewItem = this.lviewFiles.Items.Add(fileName);
lviewItem.Tag = logFile;
string fullName = Path.Combine(srcLogFile.DirectoryName, fileName);
LogFile newLogFile = new LogFile(fullName) { Account = srcLogFile.Account };
ListViewItem lviewItem = this.lviewFiles.Items.Add(newLogFile.FileName);
lviewItem.Tag = newLogFile;
lviewItem.Checked = true;
}
catch (Exception ex)
@@ -520,7 +517,7 @@ namespace DDUtilityApp.LOGPARSER
this.Cursor = Cursors.WaitCursor;
System.GC.Collect();
this.Parsing();
this.DownLoad_Parsing();
StandardData[] array = this.Filtering(this.StandardCollection.ToArray());
this.grid.AutoBinding(array);
@@ -570,14 +567,15 @@ namespace DDUtilityApp.LOGPARSER
{
if (this.LogParser == null) return;
List<LogFile> lstFileNames = new List<LogFile>();
List<LogFile> lstLogFile = new List<LogFile>();
foreach (ListViewItem item in this.lviewFiles.Items)
{
if (item.Tag != null && item.Tag.GetType() == typeof(LogFile))
lstFileNames.Add((LogFile)item.Tag);
lstLogFile.Add((LogFile)item.Tag);
}
LogFile[] logfiles = this.LogParser.FileSelector(this, lstFileNames.ToArray());
this.Account = this.LogParser.Account;
// LogPaser > FrmEqSelector
LogFile[] logfiles = this.LogParser.FileSelector(this, lstLogFile.ToArray());
if (logfiles == null || logfiles.Length < 1) return;
if (this.chkAutoClear.Checked) this.BtnFileClear_Click(this.btnFileClear, new EventArgs());
@@ -599,7 +597,7 @@ namespace DDUtilityApp.LOGPARSER
foreach (LogFile logfile in logfiles)
{
this.tboxFilename.Tag = logfile;
this.tboxFilename.Text = Path.GetFileName(logfile.FullName);
this.tboxFilename.Text = logfile.FileName;
this.BtnFileAdd_Click(this.btnFileAdd, new EventArgs());
}
this.tboxFilename.Tag = null;
@@ -810,25 +808,20 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
List<string> lstFileName = new List<string>();
List<string> lstFullName = new List<string>();
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
string sourceFileName = lviewItem.Tag as string;
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
LogFile logFile = lviewItem.Tag as LogFile;
if (logFile == null) continue;
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(sourceFileName)}";
if (this.chkDownload.Checked == false) System.IO.File.Copy(sourceFileName, destFileName, true);
sourceFileName = destFileName;
lstFileName.Add(sourceFileName);
lstFullName.Add(logFile.DestFullName);
}
foreach (string filename in lstFileName)
Process.Start(filename);
foreach (string fullName in lstFullName)
Process.Start(fullName);
}
catch (Exception ex)
{
@@ -1298,7 +1291,7 @@ namespace DDUtilityApp.LOGPARSER
/// [CheckPoint] 로그파일을 로컬에 복제(다운로드)후, 데이터를 생성한다
/// </summary>
/// <returns></returns>
private StandardCollection Parsing()
private StandardCollection DownLoad_Parsing()
{
try
{
@@ -1309,7 +1302,6 @@ namespace DDUtilityApp.LOGPARSER
List<string> lstFileName = new List<string>();
string strTitle = string.Empty;
string destPath = string.Empty;
string destFileName = string.Empty;
// Process Unit: File
foreach (ListViewItem lviewItem in this.lviewFiles.Items) //jhlim 20250202
@@ -1325,40 +1317,42 @@ namespace DDUtilityApp.LOGPARSER
FileInfo fileInfo = new FileInfo(logFile.FullName);
if (fileInfo.Exists == false) continue;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB");
else lviewItem.SubItems[1].Text = $"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB";
logFile.Length = fileInfo.Length;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
destFileName = $@"{destPath}{System.IO.Path.GetFileName(logFile.FullName)}";
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
if (logFile.FullName != destFileName)
System.IO.File.Copy(logFile.FullName, destFileName, true);
File.Copy(logFile.FullName, logFile.DestFullName, true);
}
}
break;
case AccessType.FTPS:
{
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
if (FtpsClient._host != logFile.Account.IPAddress)
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
FtpListItem ftpsFileInfo = FtpsClient.GetFileInfo(logFile.FullName);
if (ftpsFileInfo == null) continue;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)ftpsFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
else lviewItem.SubItems[1].Text = $"{((float)ftpsFileInfo.Size / 1024 / 1024).ToString("F2")} MB";
logFile.Length = ftpsFileInfo.Size;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
destFileName = Path.Combine(destPath, $"{logFile.Name}{logFile.Extension}");
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
FtpsClient.DownloadFtpsFile(logFile.FullName, logFile.DestFullName);
}
}
break;
@@ -1368,7 +1362,7 @@ namespace DDUtilityApp.LOGPARSER
break;
}
lstFileName.Add(destFileName);
lstFileName.Add(logFile.DestFullName);
}
if (!string.IsNullOrEmpty(this.tboxEISInfo04.Text)) this.LogParser.ModelID = this.tboxEISInfo04.Text;

View File

@@ -373,16 +373,16 @@ namespace DDUtilityApp.LOGPARSER.PARSER
FrmEqSelector dlg = null;
try
{
List<LogFile> logFiles = new List<LogFile>();
logFiles.AddRange(args);
List<LogFile> lstLogFile = new List<LogFile>();
lstLogFile.AddRange(args);
dlg = new FrmEqSelector();
dlg.Owner = sender;
dlg.Size = sender.Size;
dlg.Size = new System.Drawing.Size(sender.Width - 60, sender.Height - 60);
dlg.StartPosition = FormStartPosition.CenterParent;
dlg.ServerName = this.ServerName;
dlg.Equipment = sender.Equipment;
dlg.SelectedLogFiles = logFiles.ToArray();
dlg.Equipment = sender.Equipment == null ? new EisEquipment() { EquipmentID = this.EquipmentID, Server = new LogServer(this.ServerName)} : sender.Equipment;
dlg.SelectedLogFiles = lstLogFile.ToArray();
DialogResult dlgResult = dlg.ShowDialog();
if (dlgResult != DialogResult.OK) return null;

View File

@@ -112,8 +112,8 @@ namespace DDUtilityApp.LOGPARSER.PARSER
string fileName = string.Empty;
if (args != null && args.Length > 0)
{
directoryName = Path.GetDirectoryName(args[0].Name);
fileName = Path.GetFileName(args[0].Name);
directoryName = args[0].DirectoryName;
fileName = args[0].FileName;
}
OpenFileDialog dlg = new OpenFileDialog();

View File

@@ -28,38 +28,71 @@ namespace JWH.MONGODB
return item;
}
public static List<TraceCollection> GetCollectionData(string collectionName, DateTime dtStart, DateTime dtEnd, TraceCollection condition = null)
public static async void GetCollectionColumns(string collectionName)
{
MongoClient client = new MongoClient(ConnectionString);
IMongoDatabase database = client.GetDatabase(DatabaseName);
IMongoCollection<TraceCollection> collection = database.GetCollection<TraceCollection>(collectionName);
var collection = database.GetCollection<BsonDocument>(collectionName);
// # ALL Data
//var lst = collection.Find(_ => true).ToList();
// # Use BsonDocument
//var filter = new BsonDocument("LotID", "13089570006B");
// # Use Builders.Filter
//var filterBuilder = Builders<TraceCollection>.Filter;
//var filter = filterBuilder.Eq(x => x.LotID, "13109360026B");
var pipeline = new[]
{
new BsonDocument("$project", new BsonDocument("fields", new BsonDocument("$objectToArray", "$$ROOT"))),
new BsonDocument("$unwind", "$fields"),
new BsonDocument("$group", new BsonDocument("_id", BsonNull.Value).Add("uniqueFields", new BsonDocument("$addToSet", "$fields.k")))
};
FilterDefinitionBuilder<TraceCollection> filterBuilder = Builders<TraceCollection>.Filter;
FilterDefinition<TraceCollection> filter = filterBuilder.Gte(x => x.EVENTTIME, dtStart) & filterBuilder.Lt(x => x.EVENTTIME, dtEnd);
if (condition != null)
var result = await collection.Aggregate<BsonDocument>(pipeline).FirstOrDefaultAsync();
if (result != null && result.Contains("uniqueFields"))
{
string[] SkipPropertys = new string[] { "_id", "EVENTTIME" };
foreach (PropertyInfo property in condition.GetType().GetProperties())
var fields = result["uniqueFields"].AsBsonArray.Select(f => f.AsString);
Console.WriteLine("컬렉션의 필드 목록:");
foreach (var field in fields)
{
object value = property.GetValue(condition);
if (value != null)
{
if (property.Name.Equals("LotID")) filter &= filterBuilder.Eq(x => x.LotID, value);
continue;
}
Console.WriteLine(field);
}
}
List<TraceCollection> document = collection.Find(filter).ToList();
}
return document;
public static List<TraceCollection> GetCollectionData(string collectionName, DateTime dtStart, DateTime dtEnd, TraceCollection condition = null)
{
try
{
MongoClient client = new MongoClient(ConnectionString);
IMongoDatabase database = client.GetDatabase(DatabaseName);
IMongoCollection<TraceCollection> collection = database.GetCollection<TraceCollection>(collectionName);
// # ALL Data
//var lst = collection.Find(_ => true).ToList();
// # Use BsonDocument
//var filter = new BsonDocument("LotID", "13089570006B");
// # Use Builders.Filter
//var filterBuilder = Builders<TraceCollection>.Filter;
//var filter = filterBuilder.Eq(x => x.LotID, "13109360026B");
FilterDefinitionBuilder<TraceCollection> filterBuilder = Builders<TraceCollection>.Filter;
FilterDefinition<TraceCollection> filter = filterBuilder.Gte(x => x.EVENTTIME, dtStart) & filterBuilder.Lt(x => x.EVENTTIME, dtEnd);
if (condition != null)
{
string[] SkipPropertys = new string[] { "_id", "EVENTTIME" };
foreach (PropertyInfo property in condition.GetType().GetProperties())
{
object value = property.GetValue(condition);
if (value != null)
{
if (property.Name.Equals("LotID")) filter &= filterBuilder.Eq(x => x.LotID, value);
continue;
}
}
}
List<TraceCollection> document = collection.Find(filter).ToList();
return document;
}
catch (Exception ex)
{
throw ex;
}
}
public static bool GetCollectionSize_Flag = false;
@@ -150,35 +183,52 @@ namespace JWH.MONGODB
public ObjectId _id { get; set; }
public List<object> LotList { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
public DateTime EVENTTIME { get; set; }
public string ProcessID { get; set; }
public string UnitState { get; set; }
public string VIDName { get; set; }
public object Value { get; set; }
public string LotID { get; set; }
public string Sign { get; set; }
public string MaterialID { get; set; }
public List<object> LotList { get; set; }
public string LotID { get; set; }
public string ProductID { get; set; }
public object UnitNO { get; set; }
public string Recipe { get; set; }
public string ProcessID { get; set; }
public object UnitNO { get; set; }
public string VORNR { get; set; }
public string UnitState { get; set; }
public string MaterialID { get; set; }
public string Sign { get; set; }
public string CarrierId { get; set; }
public string PanelId { get; set; }
public string Position { get; set; }
public string MarkingId { get; set; }
public string Step { get; set; }
public double LowerSV { get; set; }
public double UpperSV { get; set; }
public string MongGoUnitName { get; set; }
}
}
}

View File

@@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using JWH;
using JWH.MONGODB;
using MongoDB.Bson;
@@ -101,19 +102,22 @@ namespace DDUtilityApp.MONGO
List<TraceCollection> data = null;
try
{
string collectionName = $"{this.EquipmentID}.{this.VID}";
//FDCMongoDB.GetCollectionColumns(collectionName);
this.Cursor = Cursors.WaitCursor;
this.ssName.Text = "GRID";
DateTime dtStart = this.DateTimeStart;
DateTime dtEnd = this.DateTimeEnd;
data = FDCMongoDB.GetCollectionData($"{this.EquipmentID}.{this.VID}", dtStart, dtEnd);
data = FDCMongoDB.GetCollectionData(collectionName, dtStart, dtEnd);
timeStart = this.StatusLabelDisplay(this.ssStatus01, "수집", timeStart, DateTime.Now);
this.grid.AutoBinding(data.ToArray());
}
catch (Exception ex)
{
throw ex;
XLogger.Instance.Fatal(ex, true);
}
finally
{
@@ -369,6 +373,7 @@ namespace DDUtilityApp.MONGO
this.grid.AddColumn("EVENTTIME", "EventTime");
this.grid.AddColumn("VIDName");
this.grid.AddColumn("Value");
this.grid.AddColumn("Sign");
this.grid.AddColumn("LotID");
this.grid.AddColumn("MaterialID");
this.grid.AddColumn("ProductID");
@@ -377,7 +382,14 @@ namespace DDUtilityApp.MONGO
this.grid.AddColumn("ProcessID");
this.grid.AddColumn("VORNR");
this.grid.AddColumn("UnitState");
this.grid.AddColumn("Sign");
this.grid.AddColumn("Step");
this.grid.AddColumn("LowerSV");
this.grid.AddColumn("UpperSV");
this.grid.AddColumn("CarrierId");
this.grid.AddColumn("PanelId");
this.grid.AddColumn("Position");
this.grid.AddColumn("MarkingId");
this.grid.AddColumn("MongGoUnitName");
}
#endregion

View File

@@ -19,16 +19,16 @@ Global
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|Any CPU.Build.0 = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|x64.ActiveCfg = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|x64.Build.0 = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.Build.0 = Release|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.ActiveCfg = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.Build.0 = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|x64.ActiveCfg = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|x64.Build.0 = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.ActiveCfg = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.Build.0 = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|x64.ActiveCfg = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|x64.Build.0 = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.Build.0 = Release|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.ActiveCfg = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.Build.0 = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|x64.ActiveCfg = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|x64.Build.0 = Release|x64
EndGlobalSection

View File

@@ -1,13 +1,14 @@
using System;
using System.Net;
using FluentFTP;
using Org.BouncyCastle.Crypto.Agreement.JPake;
namespace JWH.NETWORK
{
public static class FtpsClient
{
private static FluentFTP.FtpClient _ftpClient;
private static string _host;
public static string _host { get; private set; }
private static int _port = 990; // FTPS 기본 포트
private static string _userId;
private static string _password;