apc-viewer/APC Viewer/Shared/Metrology/ProcessData.Duplicator.cs
2022-03-29 07:23:13 -07:00

107 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Text.Json;
namespace Shared.Metrology;
public class Duplicator
{
public class Description : IProcessDataDescription
{
public int Test { get; set; }
public int Count { get; set; }
public int Index { get; set; }
//
public string? EventName { get; set; }
public string? NullData { get; set; }
public string? JobID { get; set; }
public string? Sequence { get; set; }
public string? MesEntity { get; set; }
public string? ReportFullPath { get; set; }
public string? ProcessJobID { get; set; }
public string? MID { get; set; }
public string? Date { get; set; } //2021-02-22
public string GetEventDescription() => "File Has been read and parsed";
public List<string> GetHeaderNames(ILogic logic, ConfigDataBase configDataBase)
{
List<string> results = new();
return results;
}
public List<string> GetDetailNames(ILogic logic, ConfigDataBase configDataBase)
{
List<string> results = new();
return results;
}
public List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase)
{
List<string> results = new();
return results;
}
public List<string> GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase)
{
List<string> results = new();
return results;
}
public List<string> GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test)
{
List<string> results = new();
return results;
}
public List<string> GetNames(ILogic logic, ConfigDataBase configDataBase)
{
List<string> results = new();
IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (@object is not JsonElement jsonElement)
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
results.Add(jsonProperty.Name);
return results;
}
public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase)
{
Description result = new();
return result;
}
public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase)
{
Description result = new()
{
Test = -1,
Count = 0,
Index = -1,
//
EventName = configDataBase.GetEventName(),
NullData = string.Empty,
JobID = logic.Logistics.JobID,
Sequence = logic.Logistics.Sequence.ToString(),
MesEntity = logic.Logistics.MesEntity,
ReportFullPath = logic.Logistics.ReportFullPath,
ProcessJobID = logic.Logistics.ProcessJobID,
MID = logic.Logistics.MID,
Date = logic.Logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss"),
};
return result;
}
public List<IProcessDataDescription> GetDescription(ILogic logic, ConfigDataBase configDataBase, List<Test> tests, IProcessData iProcessData)
{
List<IProcessDataDescription> results = new();
return results;
}
}
}