net6.0 Ready to test

This commit is contained in:
2022-05-09 16:48:57 -07:00
parent 053c873d6b
commit 6c8ad46064
171 changed files with 6547 additions and 48515 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,16 @@
namespace EDAViewer.Singleton.Helper
namespace EDAViewer.Singleton.Helper;
public partial class Background
{
public partial class Background
public partial class EDADatabase
{
public partial class EDADatabase
{
public static string GetEdaDevelopment() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
public static string GetEdaDevelopment()
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
}
public static string GetEdaStaging() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
public static string GetEdaStaging()
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
}
public static string GetEdaProduction()
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
}
}
public static string GetEdaProduction() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
}

View File

@ -1,427 +1,430 @@
using System.Collections.Generic;
using System.Dynamic;
using System.IO;
using System.Text;
using System.Text.Json;
namespace EDAViewer.Singleton.Helper
namespace EDAViewer.Singleton.Helper;
public partial class Background
{
public partial class Background
public class EdaDCP
{
public class EdaDCP
internal static string GetEdaObjectToHtml(string edaObjectFile, Common common)
{
internal static string GetEdaObjectToHtml(string edaObjectFile, Common common)
StringBuilder result = new();
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
_ = result.AppendLine("<!DOCTYPE html>");
_ = result.AppendLine("<html lang=\"en\">");
_ = result.AppendLine("<head>");
_ = result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>");
_ = result.Append("<title>").Append(title).AppendLine("</title>");
_ = result.AppendLine("</head>");
_ = result.AppendLine("<body>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Filename").AppendLine("</th>");
_ = result.AppendLine("</tr>");
_ = result.AppendLine("<tr>");
_ = result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>");
_ = result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>");
_ = result.AppendLine("</tr>");
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Key").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsAttributes)
{
StringBuilder result = new StringBuilder();
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
result.AppendLine("<!DOCTYPE html>");
result.AppendLine("<html lang=\"en\">");
result.AppendLine("<head>");
result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>");
result.Append("<title>").Append(title).AppendLine("</title>");
result.AppendLine("</head>");
result.AppendLine("<body>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>");
result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>");
result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>");
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>");
result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>");
result.Append("<th nowrap>").Append("Filename").AppendLine("</th>");
result.AppendLine("</tr>");
result.AppendLine("<tr>");
result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>");
result.AppendLine("</tr>");
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
result.Append("<th nowrap>").Append("Key").AppendLine("</th>");
result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsAttributes)
if (item.Length > 2 && !item[2].StartsWith("Z_"))
{
if (item.Length > 2 && !item[2].StartsWith("Z_"))
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("ID").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsColumns)
{
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("FullName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Alias").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Description").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Column#").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.Parameters)
{
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.GeneralTriggers)
{
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.StartTriggersDCP)
{
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string?[] item in common.LogisticsTriggers)
{
if (item is null)
continue;
_ = result.AppendLine("<tr>");
foreach (string? value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("<td>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping)
{
_ = result.AppendLine("<tr>");
foreach (string value in keyValuePair.Value)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("</td>");
_ = result.AppendLine("<td>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes)
{
foreach (string[] values in keyValuePair.Value)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("ID").AppendLine("</th>");
result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsColumns)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
result.Append("<th nowrap>").Append("FullName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Alias").AppendLine("</th>");
result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>");
result.Append("<th nowrap>").Append("Description").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>");
result.Append("<th nowrap>").Append("Column#").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.Parameters)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.GeneralTriggers)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.StartTriggersDCP)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsTriggers)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("<td>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>");
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping)
{
result.AppendLine("<tr>");
foreach (string value in keyValuePair.Value)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("</td>");
result.AppendLine("<td>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>");
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes)
{
foreach (string[] values in keyValuePair.Value)
if (values.Length > 0 && !values[0].StartsWith("Z_"))
{
if (values.Length > 0 && !values[0].StartsWith("Z_"))
{
result.AppendLine("<tr>");
foreach (string value in values)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
_ = result.AppendLine("<tr>");
foreach (string value in values)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
}
result.AppendLine("</table>");
result.AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("<table>");
result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>");
result.AppendLine("</tr>");
foreach (string[] item in common.StopTriggersDCP)
{
result.AppendLine("<tr>");
foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>");
}
result.AppendLine("</table>");
result.AppendLine("<hr>");
result.AppendLine("</body>");
result.AppendLine("</html>");
return result.ToString();
_ = result.AppendLine("</table>");
_ = result.AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
private static string ReplaceNull(object @object)
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("<table>");
_ = result.AppendLine("<tr>");
_ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (string[] item in common.StopTriggersDCP)
{
if (@object is null)
return string.Empty;
_ = result.AppendLine("<tr>");
foreach (string value in item)
_ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
_ = result.AppendLine("</tr>");
}
_ = result.AppendLine("</table>");
_ = result.AppendLine("<hr>");
_ = result.AppendLine("</body>");
_ = result.AppendLine("</html>");
return result.ToString();
}
private static string? ReplaceNull(object @object)
{
if (@object is null)
return string.Empty;
else
return @object.ToString();
}
private static void TextResolveEntry(StringBuilder result, dynamic expandoObject, int level, string super, int? i, bool group)
{
level += 1;
foreach (dynamic entry in expandoObject)
{
if (entry.Value is ExpandoObject)
TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group);
else
return @object.ToString();
}
private static void TextResolveEntry(StringBuilder result, dynamic expandoObject, int level, string super, int? i, bool group)
{
level += 1;
foreach (dynamic entry in expandoObject)
{
if (entry.Value is ExpandoObject)
TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group);
if (entry.Value is not ICollection<object>)
{
if (i is null)
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value));
else
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value));
}
else
{
if (!(entry.Value is ICollection<object>))
if (!group)
{
if (i is null)
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value));
else
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value));
}
else
{
if (!group)
for (i = 0; i.Value < entry.Value.Count; i++)
{
for (i = 0; i.Value < entry.Value.Count; i++)
{
if (entry.Value[i.Value] is ExpandoObject)
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
else
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
}
if (entry.Value[i.Value] is ExpandoObject)
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
else
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
}
else
{
for (i = 0; i.Value < entry.Value.Count; i++)
{
if (!(entry.Value[i.Value] is ExpandoObject))
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
}
for (i = 0; i.Value < entry.Value.Count; i++)
{
if (entry.Value[i.Value] is ExpandoObject)
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
}
}
i = null;
}
}
}
level -= 1;
}
internal static string GetText(string edaObjectFile, Common common, string json)
{
StringBuilder result = new StringBuilder();
if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works
{
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
dynamic expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json);
result.AppendLine(title);
result.AppendLine("Loop -> \"Normal\"");
result.AppendLine(edaObjectFile);
result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false);
result.AppendLine();
result.AppendLine();
result.AppendLine();
result.AppendLine(title);
result.AppendLine("Loop -> \"Grouped\"");
result.AppendLine(edaObjectFile);
result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true);
}
return result.ToString();
}
internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias)
{
StringBuilder result = new StringBuilder();
string[] segments;
int? recordStart = null;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine();
result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">");
result.AppendLine(" <RecordTerminator>&lt;13&gt;&lt;10&gt;</RecordTerminator>");
result.AppendLine(" <ColumnSeparator>&lt;9&gt;</ColumnSeparator>");
result.AppendLine(" </General>");
result.AppendLine(" <Fields>");
for (int i = 0; i < common.Parameters.Count; i++)
{
if (recordStart is null && common.Parameters[i][3] == "RECORD_START")
recordStart = i;
if (recordStart.HasValue && common.Parameters[i][0] == "True")
{
if (useAlias && !string.IsNullOrEmpty(common.Parameters[i][3]))
name = common.Parameters[i][3].Replace("'", string.Empty);
else
{
segments = common.Parameters[i][2].Split('/');
name = segments[segments.Length - 1];
for (i = 0; i.Value < entry.Value.Count; i++)
{
if (entry.Value[i.Value] is not ExpandoObject)
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
}
for (i = 0; i.Value < entry.Value.Count; i++)
{
if (entry.Value[i.Value] is ExpandoObject)
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
}
}
result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine();
i = null;
}
}
result.AppendLine(" </Fields>");
result.AppendLine(" <Conditions>");
result.AppendLine(" <Column />");
result.AppendLine(" <Row>");
result.AppendLine(" <Condition>");
result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>");
result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>");
result.AppendLine(" <SkipRowValue>");
result.AppendLine(" </SkipRowValue>");
result.AppendLine(" </Condition>");
result.AppendLine(" </Row>");
result.AppendLine(" </Conditions>");
result.AppendLine("</Format>");
return result.ToString();
}
level -= 1;
if (level == 0)
{ }
}
internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common)
internal static string GetText(string edaObjectFile, Common common, string json)
{
StringBuilder result = new();
if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works
{
StringBuilder result = new StringBuilder();
string parameter;
string[] segments;
string parameterSub35;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
result.AppendLine("ExportFileVersion=1.0.6");
result.AppendLine("ExportFromTabsheet=Para");
result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo");
result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1];
if (parameter.Length < 35)
parameterSub35 = parameter;
else
parameterSub35 = parameter.Substring(0, 35);
result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
}
}
result.AppendLine();
result.AppendLine();
result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1];
result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
}
}
return result.ToString();
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
dynamic? expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json);
_ = result.AppendLine(title);
_ = result.AppendLine("Loop -> \"Normal\"");
_ = result.AppendLine(edaObjectFile);
_ = result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false);
_ = result.AppendLine();
_ = result.AppendLine();
_ = result.AppendLine();
_ = result.AppendLine(title);
_ = result.AppendLine("Loop -> \"Grouped\"");
_ = result.AppendLine(edaObjectFile);
_ = result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true);
}
return result.ToString();
}
internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common)
internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string[] segments;
int? recordStart = null;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
_ = result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
_ = result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine();
_ = result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">");
_ = result.AppendLine(" <RecordTerminator>&lt;13&gt;&lt;10&gt;</RecordTerminator>");
_ = result.AppendLine(" <ColumnSeparator>&lt;9&gt;</ColumnSeparator>");
_ = result.AppendLine(" </General>");
_ = result.AppendLine(" <Fields>");
for (int i = 0; i < common.Parameters.Count; i++)
{
StringBuilder result = new StringBuilder();
string parameter;
string[] segments;
string parameterSub21;
string parameterSub35;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
result.AppendLine("ExportFileVersion=1.0.6");
result.AppendLine("ExportFromTabsheet=Run-Keynumbers");
result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
for (int i = 0; i < common.Parameters.Count; i++)
if (recordStart is null && common.Parameters[i][3] == "RECORD_START")
recordStart = i;
if (recordStart.HasValue && common.Parameters[i][0] == "True")
{
if (common.Parameters[i][0] == "True")
if (useAlias && !string.IsNullOrEmpty(common.Parameters[i][3]))
name = common.Parameters[i][3].Replace("'", string.Empty);
else
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1];
if (parameter.Length < 35)
parameterSub35 = parameter;
else
parameterSub35 = parameter.Substring(0, 35);
if (parameter.Length < 21)
parameterSub21 = parameter;
else
parameterSub21 = parameter.Substring(0, 21);
result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
name = segments[^1];
}
_ = result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine();
}
result.AppendLine();
result.AppendLine();
result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1];
result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
}
}
return result.ToString();
}
_ = result.AppendLine(" </Fields>");
_ = result.AppendLine(" <Conditions>");
_ = result.AppendLine(" <Column />");
_ = result.AppendLine(" <Row>");
_ = result.AppendLine(" <Condition>");
_ = result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>");
_ = result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>");
_ = result.AppendLine(" <SkipRowValue>");
_ = result.AppendLine(" </SkipRowValue>");
_ = result.AppendLine(" </Condition>");
_ = result.AppendLine(" </Row>");
_ = result.AppendLine(" </Conditions>");
_ = result.AppendLine("</Format>");
return result.ToString();
}
internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string parameter;
string[] segments;
string parameterSub35;
_ = result.AppendLine("ExportFileVersion=1.0.6");
_ = result.AppendLine("ExportFromTabsheet=Para");
_ = result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo");
_ = result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
_ = result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[^1];
if (parameter.Length < 35)
parameterSub35 = parameter;
else
parameterSub35 = parameter[..35];
_ = result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
}
}
_ = result.AppendLine();
_ = result.AppendLine();
_ = result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[^1];
_ = result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
}
}
return result.ToString();
}
internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string parameter;
string[] segments;
string parameterSub21;
string parameterSub35;
_ = result.AppendLine("ExportFileVersion=1.0.6");
_ = result.AppendLine("ExportFromTabsheet=Run-Keynumbers");
_ = result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[^1];
if (parameter.Length < 35)
parameterSub35 = parameter;
else
parameterSub35 = parameter[..35];
if (parameter.Length < 21)
parameterSub21 = parameter;
else
parameterSub21 = parameter[..21];
_ = result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
}
}
_ = result.AppendLine();
_ = result.AppendLine();
_ = result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++)
{
if (common.Parameters[i][0] == "True")
{
segments = common.Parameters[i][2].Split('/');
parameter = segments[^1];
_ = result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
}
}
return result.ToString();
}
}

View File

@ -1,164 +1,173 @@
using EDAViewer.Singleton.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EDAViewer.Singleton.Helper
namespace EDAViewer.Singleton.Helper;
[Serializable]
public class Common
{
[Serializable]
public class Common
public string? ConfigurationProductiveState { get; set; }
public string? ConfigurationState { get; set; }
public string? ContainerName { get; set; }
public ModuleInstanceTypeName? ObjectType { get; set; }
public string? UnitName { get; set; }
//
public string Filename { get; set; }
public string StartTimeFormat { get; set; }
public string StoragePath { get; set; }
//
public List<string[]> GeneralTriggers { get; set; }
public List<string[]> LogisticsAttributes { get; set; }
public List<string[]> LogisticsColumns { get; set; }
public string LogisticsEquipmentAlias { get; set; }
public List<string?[]> LogisticsTriggers { get; set; }
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
public List<string[]> Parameters { get; set; }
public string ParametersAsCsv { get; set; }
public string Source { get; set; }
public List<string[]> StartTriggersDCP { get; set; }
public List<string[]> StopTriggersDCP { get; set; }
[Obsolete("Only for DeserializeObject")]
public Common()
{
ObjectType = null;
Parameters = new();
Source = string.Empty;
Filename = string.Empty;
GeneralTriggers = new();
StopTriggersDCP = new();
UnitName = string.Empty;
LogisticsColumns = new();
StartTriggersDCP = new();
LogisticsTriggers = new();
StoragePath = string.Empty;
LogisticsAttributes = new();
ContainerName = string.Empty;
ParametersAsCsv = string.Empty;
StartTimeFormat = string.Empty;
ConfigurationState = string.Empty;
LogisticsEquipmentAlias = string.Empty;
ConfigurationProductiveState = string.Empty;
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
}
public ModuleInstanceTypeName? ObjectType { get; set; }
public string ConfigurationState { get; set; }
public string ConfigurationProductiveState { get; set; }
public string UnitName { get; set; }
public string ContainerName { get; set; }
public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState)
{
Parameters = new();
Source = string.Empty;
Filename = string.Empty;
GeneralTriggers = new();
ObjectType = objectType;
StopTriggersDCP = new();
LogisticsColumns = new();
StartTriggersDCP = new();
LogisticsTriggers = new();
StoragePath = string.Empty;
LogisticsAttributes = new();
ParametersAsCsv = string.Empty;
StartTimeFormat = string.Empty;
UnitName = unitName.ToString();
LogisticsEquipmentAlias = string.Empty;
ContainerName = containerName.ToString();
ConfigurationState = configurationState.ToString();
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
ConfigurationProductiveState = configurationProductiveState.ToString();
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
}
public void Update(PDSFConfiguration configuration)
{
StoragePath = configuration.Settings.StoragePath;
StartTimeFormat = configuration.Settings.StartTimeFormat;
Filename = configuration.Settings.Filename;
//
public string StoragePath { get; set; }
public string StartTimeFormat { get; set; }
public string Filename { get; set; }
//
public string Source { get; set; }
public string LogisticsEquipmentAlias { get; set; }
public List<string[]> LogisticsAttributes { get; set; }
public List<string[]> LogisticsColumns { get; set; }
public List<string[]> Parameters { get; set; }
public string ParametersAsCsv { get; set; }
public List<string[]> GeneralTriggers { get; set; }
public List<string[]> StartTriggersDCP { get; set; }
public List<string[]> LogisticsTriggers { get; set; }
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
public List<string[]> StopTriggersDCP { get; set; }
[Obsolete("Only for DeserializeObject")]
public Common()
Source = configuration.DataCollection.Source;
LogisticsEquipmentAlias = configuration.DataCollection.Logistics.EquipmentAlias;
//if (LogisticsEquipmentAlias == "R47-PLC")
//{ }
foreach (PDSFConfigurationDataCollectionLogisticsAttribute item in (from l in configuration.DataCollection.Logistics.Attributes orderby l.Use descending, l.Order select l))
LogisticsAttributes.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.Key, item.Placeholder });
foreach (PDSFConfigurationDataCollectionLogisticsColumn item in configuration.DataCollection.Logistics.Columns)
LogisticsColumns.Add(new string[] { item.ID.ToString(), item.Prefix });
foreach (PDSFConfigurationDataCollectionParameter1 item in (from l in configuration.DataCollection.VirtualParameters orderby l.Use descending, l.Order select l))
{
ObjectType = null;
ConfigurationState = string.Empty;
ConfigurationProductiveState = string.Empty;
UnitName = string.Empty;
ContainerName = string.Empty;
CommonLogic();
}
public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState)
{
ObjectType = objectType;
ConfigurationState = configurationState.ToString();
ConfigurationProductiveState = configurationProductiveState.ToString();
UnitName = unitName.ToString();
ContainerName = containerName.ToString();
CommonLogic(configurationState.ToString(), configurationProductiveState.ToString(), unitName.ToString(), containerName.ToString());
}
private void CommonLogic(string configurationState = "", string configurationProductiveState = "", string unitName = "", string containerame = "")
{
LogisticsAttributes = new List<string[]>();
LogisticsColumns = new List<string[]>();
Parameters = new List<string[]>();
ParametersAsCsv = string.Empty;
GeneralTriggers = new List<string[]>();
StartTriggersDCP = new List<string[]>();
LogisticsTriggers = new List<string[]>();
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
StopTriggersDCP = new List<string[]>();
}
public void Update(PDSFConfiguration configuration)
{
StoragePath = configuration.Settings.StoragePath;
StartTimeFormat = configuration.Settings.StartTimeFormat;
Filename = configuration.Settings.Filename;
//
Source = configuration.DataCollection.Source;
LogisticsEquipmentAlias = configuration.DataCollection.Logistics.EquipmentAlias;
//if (LogisticsEquipmentAlias == "R47-PLC")
//{ }
foreach (PDSFConfigurationDataCollectionLogisticsAttribute item in (from l in configuration.DataCollection.Logistics.Attributes orderby l.Use descending, l.Order select l))
LogisticsAttributes.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.Key, item.Placeholder });
foreach (PDSFConfigurationDataCollectionLogisticsColumn item in configuration.DataCollection.Logistics.Columns)
LogisticsColumns.Add(new string[] { item.ID.ToString(), item.Prefix });
foreach (PDSFConfigurationDataCollectionParameter1 item in (from l in configuration.DataCollection.VirtualParameters orderby l.Use descending, l.Order select l))
if (string.IsNullOrEmpty(item.Alias) && !string.IsNullOrEmpty(item.Conditions.ConditionModel.Name))
{
if (string.IsNullOrEmpty(item.Alias) && !string.IsNullOrEmpty(item.Conditions.ConditionModel.Name))
{
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
{
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
foreach (PDSFConfigurationDataCollectionParameter item in (from l in configuration.DataCollection.Parameters orderby l.Use descending, l.Order select l))
else
{
if (string.IsNullOrEmpty(item?.Alias) && !string.IsNullOrEmpty(item?.Conditions?.ConditionModel?.Name))
{
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
{
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
}
Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList();
StringBuilder text = new StringBuilder();
//text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
//"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True""
text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\"");
foreach (string[] item in Parameters)
{
for (int i = 0; i < 7; i++)
text.Append("\"").Append(item[i]).Append("\";");
text.Remove(text.Length - 1, 1);
text.AppendLine();
}
ParametersAsCsv = text.ToString();
foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers)
{
foreach (PDSFConfigurationDataCollectionGeneralTriggersVariableModel gv in item.GlobalVariables)
GeneralTriggers.Add(new string[] { item.Name, gv.Name, gv.ParameterName, gv.Formula });
}
{
PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP;
if (!(item is null))
StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() });
}
if (!(configuration.DataCollection.Logistics.Triggers.UpdateTrigger is null))
{
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest)
{
LogisticsTriggers.Add(new string[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() });
if (!(item.Keys.KeyMapping is null))
LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula });
LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new List<string[]>());
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes)
LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula });
}
}
{
PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP;
if (!(item is null))
StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() });
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
}
foreach (PDSFConfigurationDataCollectionParameter item in (from l in configuration.DataCollection.Parameters orderby l.Use descending, l.Order select l))
{
if (string.IsNullOrEmpty(item?.Alias) && !string.IsNullOrEmpty(item?.Conditions?.ConditionModel?.Name))
{
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
else
{
if (item is null)
continue;
if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
}
}
Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList();
StringBuilder text = new();
//text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
//"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True""
_ = text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\"");
foreach (string[] item in Parameters)
{
for (int i = 0; i < 7; i++)
_ = text.Append('"').Append(item[i]).Append("\";");
_ = text.Remove(text.Length - 1, 1);
_ = text.AppendLine();
}
ParametersAsCsv = text.ToString();
foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers)
{
foreach (PDSFConfigurationDataCollectionGeneralTriggersVariableModel gv in item.GlobalVariables)
GeneralTriggers.Add(new string[] { item.Name, gv.Name, gv.ParameterName, gv.Formula });
}
{
PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP;
if (item is not null)
StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() });
}
if (configuration.DataCollection.Logistics.Triggers.UpdateTrigger is not null)
{
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest)
{
LogisticsTriggers.Add(new string?[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() });
if (item.Keys.KeyMapping is not null)
LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula });
LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new());
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes)
LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula });
}
}
{
PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP;
if (item is not null)
StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() });
}
}
}

View File

@ -1,8 +1,6 @@
namespace EDAViewer.Singleton.Helper
{
public enum ModuleInstanceTypeName
{
Pdsf
}
namespace EDAViewer.Singleton.Helper;
public enum ModuleInstanceTypeName
{
Pdsf
}

View File

@ -1,28 +0,0 @@
using EDAViewer.Models;
using Microsoft.Extensions.Logging;
using Shared;
using System;
using System.Collections.Generic;
using System.Net;
namespace EDAViewer.Singleton
{
public interface IBackground : Models.IBackground, IDisposable
{
void ClearMessage();
void SendStatusOk();
string Message { get; }
bool IsPrimaryInstance();
void SetIsPrimaryInstance();
void ClearIsPrimaryInstance();
string WorkingDirectory { get; }
List<Exception> Exceptions { get; }
void Update(ILogger<object> logger);
string GetCountDirectory(string verb);
void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false);
}
}