149 lines
4.3 KiB
C#
149 lines
4.3 KiB
C#
using Aitex.Core.RT.DataCenter;
|
|
using Aitex.Core.RT.OperationCenter;
|
|
using Aitex.Core.RT.SCCore;
|
|
using Aitex.Core.Util;
|
|
using MECF.Framework.Common.Aitex.Core.Common.DeviceData;
|
|
using MECF.Framework.Common.Equipment;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Linq;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow
|
|
{
|
|
[XmlType(typeName: "PMGsaFlow")]
|
|
public class PMAllGsa
|
|
{
|
|
/// <summary>
|
|
/// PM腔体中气体
|
|
/// </summary>
|
|
[XmlElement("GasFlowUnit")]
|
|
public List<GasFlowUnit> GasFlowUnitList { get; set; }
|
|
|
|
public string ModuleName { get; set; }
|
|
|
|
public List<string> GasNameList { get; set; }
|
|
|
|
public List<GasFlowSum> GasFlowSumList { get; set; }
|
|
|
|
private DateTime start;
|
|
private DateTime end;
|
|
|
|
public void Initialize(string moduleName)
|
|
{
|
|
IniGasUnit(moduleName);
|
|
|
|
DATA.Subscribe($"{ModuleName}.PMGasNameList", () => GasNameList);
|
|
DATA.Subscribe($"{ModuleName}.PMGasFlowSumList", () => GasFlowSumList);
|
|
|
|
OP.Subscribe($"{ModuleName}.GasFlowSum.Query", (string cmd, object[] args) => Query(args));
|
|
|
|
var _thread = new PeriodicJob(1000, OnTimer, $"{moduleName}.ModuleGsaFlow", true);
|
|
}
|
|
|
|
private bool OnTimer()
|
|
{
|
|
foreach (var Unit in GasFlowUnitList)
|
|
{
|
|
Unit.GetGasFlowFeedBack();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化单个气体和界面气体统计对象
|
|
/// </summary>
|
|
/// <param name="moduleName"></param>
|
|
private void IniGasUnit(string moduleName)
|
|
{
|
|
ModuleName = moduleName;
|
|
|
|
GasFlowSumList = new();
|
|
|
|
GasNameList = new();
|
|
|
|
//单中气体初始化
|
|
foreach (var unit in GasFlowUnitList)
|
|
{
|
|
unit.Initialize(moduleName);
|
|
//string bbb = aaa.Replace("CD", "")
|
|
string gasName = "";
|
|
if (unit.GasName.Contains("Run"))
|
|
{
|
|
gasName = unit.GasName.Replace("_Run", "");
|
|
}
|
|
else if (unit.GasName.Contains("Vent"))
|
|
{
|
|
gasName = unit.GasName.Replace("_Vent", "");
|
|
}
|
|
|
|
if (!GasNameList.Contains(gasName))
|
|
GasNameList.Add(gasName);
|
|
}
|
|
|
|
foreach (var name in GasNameList)
|
|
{
|
|
GasFlowSumList.Add(new GasFlowSum() { Name = name });
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 气体体积使用查询
|
|
/// </summary>
|
|
/// <param name="objects"></param>
|
|
/// <returns></returns>
|
|
private bool Query(object[] objects)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
string flowName = objects[0].ToString();
|
|
start = Convert.ToDateTime(objects[1]);
|
|
end = Convert.ToDateTime(objects[2]);
|
|
|
|
if (flowName == "All")
|
|
{
|
|
foreach (var item in GasFlowSumList)
|
|
{
|
|
QueryRunVentVolume(item.Name + "_Run");
|
|
QueryRunVentVolume(item.Name + "_Vent");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
QueryRunVentVolume(flowName + "_Run");
|
|
QueryRunVentVolume(flowName + "_Vent");
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
private void QueryRunVentVolume(string flowName)
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
double values = GasFlowSqlHelp.Query(ModuleName, "GasRealTimeFlow." + flowName, start, end);
|
|
foreach (var item in GasFlowSumList)
|
|
{
|
|
if (flowName.Contains(item.Name))
|
|
{
|
|
if (flowName.Contains("Run"))
|
|
item.RunVolume = values * 1.66667 * Math.Pow(10, -7);
|
|
else
|
|
item.VentVolume = values * 1.66667 * Math.Pow(10, -7);
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|