Sic.Framework-Nanjing-Baishi/MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingManager.cs

121 lines
4.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Aitex.Core.RT.Event;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
using System.Windows;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
public class HistoryCoatingManager:Singleton<HistoryCoatingManager>
{
public List<CoatingData> CoatingData { get; set; } = new List<CoatingData>();
HistoryCoatingSqlHelp historyCoatingSqlHelp { get; set; }=new HistoryCoatingSqlHelp();
public HistoryCoatingManager()
{
}
public void Initialize()
{
InitData();
}
private void InitData()
{
OP.Subscribe("HistoryCoatingManager.Grow", (string cmd, object[] args) => Grow(args));
}
public bool Grow(object[] args)//Process完成后更新生长厚度操作对象Tray PM
{
try
{
double GrowthRate = Convert.ToDouble(args[1]);
double Seconds = Convert.ToDouble(args[2]);
if (GrowthRate* Seconds==0)
{
return true;
}
historyCoatingSqlHelp.GrowTray(args[0].ToString(), GrowthRate, Seconds);
historyCoatingSqlHelp.GrowPM(args[3].ToString(), GrowthRate, Seconds);
CheckIsClear(args[0].ToString());
CheckIsClear(args[3].ToString());
return true;
}
catch (Exception ex)
{
EV.PostInfoLog("System", $"CoatingManager.Grow_Error {ex.ToString()}");
return false;
}
}
InspectCleanView inspectCleanView = new InspectCleanView();
private bool CheckIsClear(string id) //检查当前厚度是否大于设定厚度操作对象Tray PM,需要清理时弹窗提示
{
string _uiShowName;
List<string> growList;
//拼接好要提示的内容 查询Coating和MAX数据
if (id.Contains("PM"))
_uiShowName = $"{id} 腔体 ";
else
_uiShowName = $"Tray盘 {id}";
growList = historyCoatingSqlHelp.Get_Coating_MAX(id);
if (growList == null)
return false;
for (int i = 0; i < growList.Count / 2; i++)
{
double _coating = Convert.ToDouble(growList[i * 2]);
double _max = Convert.ToDouble(growList[i * 2 + 1]);
if (_coating > _max)
{
string str = $"{_uiShowName} \r\n Coating={_coating} 大于 MAX={_max}";
//在异步中弹窗
Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
inspectCleanView.AddToolTip(str);
//弹窗提示,不关闭时,文本内容递增,关闭后重新提示
var wins = Application.Current.Windows.OfType<InspectCleanView>().ToArray();
if (wins.Any())
{
foreach (InspectCleanView w in wins)
{
if (w.WindowState == WindowState.Minimized)
w.WindowState = WindowState.Normal;
w.Show();
w.Activate();
}
}
else
{
if (!inspectCleanView.IsActive)
{
inspectCleanView = new InspectCleanView();
inspectCleanView.AddToolTip(str);
inspectCleanView.Show();
}
}
}));
return true;
}
}
return true;
}
}
}