Compare commits
5 Commits
0b7f4ba366
...
20250203_S
| Author | SHA1 | Date | |
|---|---|---|---|
| 00b3a5e643 | |||
| f43ffb1e30 | |||
| 9be4b773a5 | |||
| 0790ae42f9 | |||
| 3e9339195e |
@@ -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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,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
|
||||
@@ -80,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;
|
||||
|
||||
@@ -141,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);
|
||||
@@ -885,7 +884,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
foreach (GridViewRowInfo row in grid.SelectedRows)
|
||||
{
|
||||
LogFile logFile = row.DataBoundItem as LogFile;
|
||||
string destFileName = Path.Combine(destPath, Path.GetFileName(logFile.FullName));
|
||||
string destFileName = Path.Combine(destPath, logFile.FileName);
|
||||
|
||||
switch (this.Account.Access)
|
||||
{
|
||||
@@ -896,12 +895,14 @@ namespace DDUtilityApp.LOGPARSER
|
||||
{
|
||||
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:
|
||||
@@ -1310,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)
|
||||
{
|
||||
@@ -1443,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,
|
||||
@@ -1468,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,
|
||||
@@ -1493,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,
|
||||
@@ -1518,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,
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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
|
||||
@@ -1318,47 +1310,49 @@ namespace DDUtilityApp.LOGPARSER
|
||||
XLogger.Instance.Info(lviewItem.Text);
|
||||
|
||||
LogFile logFile = lviewItem.Tag as LogFile;
|
||||
switch(this.Account.Access)
|
||||
switch(logFile.Account.Access)
|
||||
{
|
||||
case AccessType.SMB:
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -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 == null ? new EisEquipment() { EquipmentID = this.EquipmentID, Server = new LogServer(this.ServerName)} : sender.Equipment;
|
||||
dlg.SelectedLogFiles = logFiles.ToArray();
|
||||
dlg.SelectedLogFiles = lstLogFile.ToArray();
|
||||
DialogResult dlgResult = dlg.ShowDialog();
|
||||
if (dlgResult != DialogResult.OK) return null;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user