EquipmentList.OrderBy

This commit is contained in:
2025-03-05 11:07:18 +09:00
parent fb46e2b17a
commit f92e560e87
6 changed files with 168 additions and 61 deletions

View File

@@ -19,6 +19,9 @@ namespace DDUtilityApp.LOGPARSER.DATA
/// <summary>MES.FacilityName</summary>
public string Facility { get; set; }
/// <summary>MES.FacilityName</summary>
public string OrderByKey { get { return string.IsNullOrEmpty(this.Facility) ? "" : this.Facility.Substring(0, 2); } }
/// <summary>EIS.Line</summary>
public string Line { get; set; }

View File

@@ -1,4 +1,5 @@
using System;
using DDUtilityApp.DATA;
using JWH.DATA;
namespace DDUtilityApp.LOGPARSER.DATA
@@ -10,7 +11,7 @@ namespace DDUtilityApp.LOGPARSER.DATA
public class LogFile : DataTableBase
{
public AccessType Access { get; set; } = AccessType.FTPS;
public Account Account { get; set; } = null;
public string Name { get; set; }

View File

@@ -1143,7 +1143,7 @@ namespace DDUtilityApp.LOGPARSER
}
return equipments.OrderBy(x => x.Line).ThenBy(x => x.ProcessSegmentID).ThenBy(x => x.MesName).ToArray();
return equipments.OrderBy(x => x.OrderByKey).ThenBy(x => x.Line).ThenBy(x => x.ProcessSegmentID).ThenBy(x => x.MesName).ToArray();
}
catch (Exception ex)
{
@@ -1293,6 +1293,8 @@ namespace DDUtilityApp.LOGPARSER
try
{
string connectionString = string.Empty;
connectionString = $@"server=192.168.8.232;database=ddmes;uid=DDB2MESAdmin;pwd=Yhqe4csJXJ4W5$%;";
StringBuilder query = new StringBuilder();
query.AppendLine($" SELECT A.SITEID, ");
query.AppendLine($" A.FACILITYID, ");
@@ -1312,9 +1314,6 @@ namespace DDUtilityApp.LOGPARSER
query.AppendLine($" A.MAKER, ");
query.AppendLine($" A.EQPSTATE, ");
query.AppendLine($" A.LOCATION ");
connectionString = $@"server=192.168.8.232;database=ddmes;uid=DDB2MESAdmin;pwd=Yhqe4csJXJ4W5$%;";
query.AppendLine($" , E.PLANDATE ");
query.AppendLine($" FROM CIM_EQUIPMENT A (nolock) ");
query.AppendLine($" LEFT JOIN CIM_PROCESSSEGMENT B (nolock) ON A.PROCESSSEGMENTID = B.PROCESSSEGMENTID AND A.SITEID = B.SITEID ");
@@ -1365,7 +1364,7 @@ namespace DDUtilityApp.LOGPARSER
LogFile[] logFiles = fileItems
.Select(item => new LogFile
{
Access = AccessType.SMB,
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
@@ -1390,7 +1389,7 @@ namespace DDUtilityApp.LOGPARSER
LogFile[] logFiles = fileItems.Where(item => item.Type == FtpFileSystemObjectType.File)
.Select(item => new LogFile
{
Access = AccessType.FTPS,
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
@@ -1415,7 +1414,7 @@ namespace DDUtilityApp.LOGPARSER
LogFile[] logFiles = fileItems.Where(item => !item.IsDirectory && item.Name != "." && item.Name != "..")
.Select(item => new LogFile
{
Access = AccessType.SFTP,
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
@@ -1440,6 +1439,7 @@ namespace DDUtilityApp.LOGPARSER
LogFile[] logFiles = ((FtpListItem[])fileItems).Where(item => item.Type == FtpFileSystemObjectType.File)
.Select(item => new LogFile
{
Account = this.Account,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),

View File

@@ -473,6 +473,7 @@ namespace DDUtilityApp.LOGPARSER
string path = Path.GetDirectoryName(src.FullName);
string fullName = Path.Combine(path, fileName);
logFile = new LogFile(fullName);
logFile.Account = src.Account;
}
}
@@ -1317,7 +1318,7 @@ namespace DDUtilityApp.LOGPARSER
XLogger.Instance.Info(lviewItem.Text);
LogFile logFile = lviewItem.Tag as LogFile;
switch(logFile.Access)
switch(logFile.Account.Access)
{
case AccessType.SMB:
{
@@ -1342,6 +1343,7 @@ namespace DDUtilityApp.LOGPARSER
break;
case AccessType.FTPS:
{
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
FtpListItem ftpsFileInfo = FtpsClient.GetFileInfo(logFile.FullName);
if (ftpsFileInfo == null) continue;