Sic.Framework/MECF.Framework.RT.Equipment.../HardwareUnits/GasFlow/GasFlowManager.cs

98 lines
3.2 KiB
C#
Raw Normal View History

2023-07-11 17:46:32 +08:00
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.Util;
2023-07-12 17:48:06 +08:00
using MECF.Framework.Common.Device.Bases;
2023-07-11 17:46:32 +08:00
using System;
using System.Collections.Generic;
2023-07-12 17:48:06 +08:00
using System.IO;
2023-07-11 17:46:32 +08:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-07-12 17:48:06 +08:00
using System.Xml.Serialization;
using static System.Net.Mime.MediaTypeNames;
2023-07-11 17:46:32 +08:00
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow
{
public class GasFlowManager : Singleton<GasFlowManager>
{
2023-07-12 17:48:06 +08:00
ModuleGsaFlow123 PM1GsaFlow { get; set; }
2023-07-11 17:46:32 +08:00
public GasFlowManager()
{
2023-07-12 17:48:06 +08:00
2023-07-11 17:46:32 +08:00
}
public void Initialize()
{
2023-07-12 17:48:06 +08:00
//PM1GsaFlow = new ModuleGsaFlow123();
//ControlNameValue controlNameValue = new ControlNameValue();
//controlNameValue.Name = "1";
//controlNameValue.Value = 2;
//controlNameValue.ControlName = "123";
//RealtimeGasFlowTrueTableRow realtimeGasFlowTrueTableRow = new RealtimeGasFlowTrueTableRow();
//realtimeGasFlowTrueTableRow.InputList.Add(controlNameValue);
//realtimeGasFlowTrueTableRow.InputList.Add(controlNameValue);
//realtimeGasFlowTrueTableRow.OutputList.Add(controlNameValue);
//GasFlowUnit gasFlowUnit = new GasFlowUnit();
//gasFlowUnit.GasName = "SiH4";
//gasFlowUnit.GasFlowRatioName = "Test";
//gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow);
//gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow);
//gasFlowUnit.GasTrueTableRowList.Add(realtimeGasFlowTrueTableRow);
//PM1GsaFlow.GasFlowUnitList = new List<GasFlowUnit>
//{
// gasFlowUnit,
// gasFlowUnit
//};
//XmlSerializer xml = new XmlSerializer(typeof(ModuleGsaFlow123));
//System.IO.Stream stream = new System.IO.FileStream(" sutudents.xml", System.IO.FileMode.OpenOrCreate);
//xml.Serialize(stream, PM1GsaFlow);
ModuleGsaFlow m= DeserializeFromXml<ModuleGsaFlow>($"Config\\PM\\RealtimeGasFlow\\Test.xml");
PM1GsaFlow = CustomXmlSerializer.Deserialize<ModuleGsaFlow123>(new FileInfo($"Config\\PM\\RealtimeGasFlow\\Test.xml"));
PM1GsaFlow.SetModuleName("PM1");
2023-07-11 17:46:32 +08:00
DATA.Subscribe("GasFlowManagerTest", () => GasFlowManagerTest());
OP.Subscribe("GasFlowManager.QueryUpdate", (string cmd, object[] args) => QueryUpdate());
}
2023-07-12 17:48:06 +08:00
public T DeserializeFromXml<T>(string filePath)
{
try
{
if (!File.Exists(filePath))
throw new ArgumentNullException(filePath + " not Exists");
using (StreamReader reader = new StreamReader(filePath))
{
XmlSerializer xs = new XmlSerializer(typeof(T));
T ret = (T)xs.Deserialize(reader);
return ret;
}
}
catch (Exception ex)
{
return default(T);
}
}
2023-07-11 17:46:32 +08:00
public string GasFlowManagerTest()
{
return DateTime.Now.ToString("");
}
public bool QueryUpdate()
{
return true;
}
}
}