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 { public List CoatingData { get; set; } = new List(); 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)); OP.Subscribe("HistoryCoatingManager.GrowCheck", (string cmd, object[] args) => GrowCheck(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); return true; } catch (Exception ex) { EV.PostInfoLog("System", $"CoatingManager.Grow_Error {ex.ToString()}"); return false; } } public bool GrowCheck(object[] args) { CheckIsClear(args[0].ToString()); CheckIsClear(args[1].ToString()); return true; } InspectCleanView inspectCleanView = new InspectCleanView(); private bool CheckIsClear(string id) //检查当前厚度是否大于设定厚度,操作对象Tray PM,需要清理时弹窗提示 { if (historyCoatingSqlHelp.CheckExceed(id, out string lab)) { //在异步中弹窗 Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { inspectCleanView.AddToolTip(lab); //弹窗提示,不关闭时,文本内容递增,关闭后重新提示 var wins = Application.Current.Windows.OfType().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(lab); inspectCleanView.Show(); } } })); } return true; } } }