| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 | 
							- using Aitex.Core.Common;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.DataCenter;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Media;
 
- using System.Xml;
 
- namespace FurnaceUI.DataModule
 
- {
 
-     public class GlobalDataManager : Singleton<GlobalDataManager>
 
-     {
 
-         private int _lpCount = 0;
 
-         public int LPCount
 
-         {
 
-             get
 
-             {
 
-                 if (_lpCount == 0)
 
-                 {
 
-                     string key = "LoadPort.LPCount";
 
-                     if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                     {
 
-                         LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                         _lpCount = 4;
 
-                     }
 
-                     else
 
-                     {
 
-                         int t = (int)QueryDataClient.Instance.Service.GetConfig(key);
 
-                         if (t > 0 && t <= 10) _lpCount = t;
 
-                         else
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key})={t} out of [1,10]");
 
-                             _lpCount = 4;
 
-                         }
 
-                     }
 
-                 }
 
-                 return _lpCount;
 
-             }
 
-         }
 
-         private int _stockerCount = 0;
 
-         public int StockerCount
 
-         {
 
-             get
 
-             {
 
-                 if (_stockerCount == 0)
 
-                 {
 
-                     string key = "System.Stocker.StockerCount";
 
-                     if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                     {
 
-                         LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                         _stockerCount = 18;
 
-                     }
 
-                     else
 
-                     {
 
-                         int t = (int)QueryDataClient.Instance.Service.GetConfig(key);
 
-                         if (t > 0 && t <= 22) _stockerCount = t;
 
-                         else
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key})={t} out of [1,22]");
 
-                             _stockerCount = 18;
 
-                         }
 
-                     }
 
-                 }
 
-                 return _stockerCount;
 
-             }
 
-         }
 
-         private int _stockerCountByLayer = 0;
 
-         public int StockerCountByLayer
 
-         {
 
-             get
 
-             {
 
-                 if (_stockerCountByLayer == 0)
 
-                 {
 
-                     string key = "System.Stocker.StockerCountByLayer";
 
-                     if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                     {
 
-                         LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                         _stockerCountByLayer = 4;
 
-                     }
 
-                     else
 
-                     {
 
-                         int t = (int)QueryDataClient.Instance.Service.GetConfig(key);
 
-                         if (t > 0 && t < 6) _stockerCountByLayer = t;
 
-                         else
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key})={t}");
 
-                             _stockerCountByLayer = 4;
 
-                         }
 
-                     }
 
-                 }
 
-                 return _stockerCountByLayer;
 
-             }
 
-         }
 
-         private int _stockerLayers = 0;
 
-         public int StockerLayers
 
-         {
 
-             get
 
-             {
 
-                 if (_stockerLayers == 0)
 
-                 {
 
-                     string key = "System.Stocker.StockerLayers";
 
-                     if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                     {
 
-                         LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                         _stockerLayers = 4;
 
-                     }
 
-                     else
 
-                     {
 
-                         int t = (int)QueryDataClient.Instance.Service.GetConfig(key);
 
-                         if (t > 0 && t < 5) _stockerLayers = t;
 
-                         else
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key})={t}");
 
-                             _stockerLayers = 4;
 
-                         }
 
-                     }
 
-                 }
 
-                 return _stockerLayers;
 
-             }
 
-         }
 
-         private int _stockerFoupCount;
 
-         /// <summary>
 
-         ///正常情况应该是StockerCountByLayer*StockerLayers
 
-         ///需考虑排除特殊情况
 
-         /// </summary>
 
-         public int StockerFoupCount
 
-         {
 
-             get
 
-             {
 
-                 if (_stockerFoupCount == 0)
 
-                 {
 
-                     string key = "System.Stocker.FoupStockerCount";
 
-                     if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                     {
 
-                         LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                         _stockerFoupCount = 16;
 
-                     }
 
-                     else
 
-                     {
 
-                         int t = (int)QueryDataClient.Instance.Service.GetConfig(key);
 
-                         if (t > 0 && t < 22)
 
-                         {
 
-                             _stockerFoupCount = t;
 
-                         }
 
-                         else
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.LPCount QueryDataClient.Instance.Service.GetConfig({key})={t}");
 
-                             _stockerFoupCount = 16;
 
-                         }
 
-                     }
 
-                 }
 
-                 return _stockerFoupCount;
 
-             }
 
-         }
 
-         private Dictionary<string, WaferTypeInfo> _waferTypes;
 
-         public Dictionary<string, WaferTypeInfo> WaferTypes
 
-         {
 
-             get
 
-             {
 
-                 if (_waferTypes == null || _waferTypes.Count == 0)
 
-                 {
 
-                     List<WaferTypeInfo> types = QueryDataClient.Instance.Service.GetConfigWaferTypes();
 
-                     _waferTypes = new Dictionary<string, WaferTypeInfo>();
 
-                     if (types == null || types.Count == 0)
 
-                     {
 
-                         LOG.Error("GlobalDataManager.WaferTypes: QueryDataClient.Instance.Service.GetWaferTypes not find avalible");
 
-                     }
 
-                     else
 
-                     {
 
-                         foreach (var type in types)
 
-                         {
 
-                             _waferTypes[type.Name] = type;
 
-                         }
 
-                     }
 
-                     //_waferTypes = new Dictionary<string, WaferTypeInfo>();
 
-                     //var config = QueryDataClient.Instance.Service.GetConfigFileContent();
 
-                     //string key = "System.WaferType";
 
-                     //var t = GetWaferInfo(key, config);
 
-                     //if (t == null || t.Count == 0)
 
-                     //{
 
-                     //    LOG.Error($"GlobalDataManager.WaferTypes: QueryDataClient.Instance.Service.GetConfigFileContent not find avalible [{key}]");                         
 
-                     //}
 
-                     //else
 
-                     //{
 
-                     //    foreach (var type in t)
 
-                     //    {
 
-                     //        _waferTypes[type.Name] = type;
 
-                     //    }
 
-                     //}
 
-                 }
 
-                 return _waferTypes;
 
-             }
 
-         }
 
-         private List<WaferTypeInfo> GetWaferInfo(string key, string content)
 
-         {
 
-             XmlDocument xml = new XmlDocument();
 
-             xml.LoadXml(content);
 
-             XmlElement root = xml.DocumentElement;
 
-             XmlNodeList xmlNodeList = xml.SelectNodes("root/configs");
 
-             string[] keys = key.Split('.');
 
-             foreach (XmlElement item in xmlNodeList)
 
-             {
 
-                 if (item.GetAttribute("name") == keys[0])
 
-                 {
 
-                     foreach (XmlElement element in item.ChildNodes)
 
-                     {
 
-                         if (element.GetAttribute("name") == keys[1])
 
-                         {
 
-                             foreach (XmlElement ele in element.ChildNodes)
 
-                             {
 
-                                 BuildPathConfigs(ele.GetAttribute("name"), ele);
 
-                             }
 
-                             break;
 
-                         }
 
-                     }
 
-                     break;
 
-                 }
 
-             }
 
-             List<WaferTypeInfo> wafers = new List<WaferTypeInfo>();
 
-             BrushConverter converter = new BrushConverter();
 
-             foreach (var item in dic)
 
-             {
 
-                 if (string.IsNullOrWhiteSpace(item.Key) || item.Key == "None" || item.Key == "V" || wafers.Find(r => r.Name == item.Key) != null) continue;
 
-                 WaferTypeInfo typeInfo = new WaferTypeInfo() { Name = item.Key };
 
-                 foreach (var r in item.Value)
 
-                 {
 
-                     switch (r.Name)
 
-                     {
 
-                         case "FullName":
 
-                             typeInfo.FullName = string.IsNullOrWhiteSpace(r.Default) ? string.Empty : r.Default.Trim();
 
-                             break;
 
-                         case "AccFilmThick":
 
-                             typeInfo.AccFilmThick = bool.Parse(r.Default);
 
-                             break;
 
-                         case "AlternativeWaferType":
 
-                             typeInfo.AlternativeWaferType = string.IsNullOrWhiteSpace(r.Default) ? string.Empty : r.Default.Trim();
 
-                             break;
 
-                         case "IsReturnWafer":
 
-                             typeInfo.IsReturnWafer = bool.Parse(r.Default);
 
-                             break;
 
-                         case "ReturnWaferType":
 
-                             typeInfo.ReturnWaferType = string.IsNullOrWhiteSpace(r.Default) ? string.Empty : r.Default.Trim();
 
-                             break;
 
-                         case "READY":
 
-                             {
 
-                                 if (string.IsNullOrWhiteSpace(r.Default) || converter.IsValid(r.Default)) typeInfo.ShowColor = r.Default ?? "".Trim();
 
-                                 else typeInfo.ShowColor = "LightGray";//保证颜色有效
 
-                             }
 
-                             break;
 
-                         case "CanProcessContinuously":
 
-                             typeInfo.CanProcessContinuously = bool.Parse(r.Default);
 
-                             break;
 
-                         case "IsDummy":
 
-                             typeInfo.IsDummy = bool.Parse(r.Default);
 
-                             break;
 
-                     }
 
-                 }
 
-                 wafers.Add(typeInfo);
 
-             }
 
-             return wafers;
 
-         }
 
-         private Dictionary<string, List<SCConfigItem>> dic = new Dictionary<string, List<SCConfigItem>>();
 
-         private void BuildPathConfigs(string parentPath, XmlElement configElement)
 
-         {
 
-             //先处理config节点
 
-             XmlNodeList nodeConfigs = configElement.SelectNodes("config");
 
-             List<SCConfigItem> items = new List<SCConfigItem>();
 
-             foreach (XmlElement nodeConfig in nodeConfigs)
 
-             {
 
-                 SCConfigItem item = new SCConfigItem()
 
-                 {
 
-                     Default = nodeConfig.GetAttribute("default"),
 
-                     Name = nodeConfig.GetAttribute("name"),
 
-                     Description = nodeConfig.GetAttribute("description"),
 
-                     Max = nodeConfig.GetAttribute("max"),
 
-                     Min = nodeConfig.GetAttribute("min"),
 
-                     Parameter = nodeConfig.GetAttribute("paramter"),
 
-                     Path = parentPath,
 
-                     Tag = nodeConfig.GetAttribute("tag"),
 
-                     Type = nodeConfig.GetAttribute("type"),
 
-                     Unit = nodeConfig.GetAttribute("unit"),
 
-                 };
 
-                 items.Add(item);
 
-             }
 
-             if (!dic.ContainsKey(parentPath)) dic[parentPath] = items;
 
-             //再处理configs
 
-             XmlNodeList nodeConfigsList = configElement.SelectNodes("configs");
 
-             foreach (XmlElement nodeConfig in nodeConfigsList)
 
-             {
 
-                 BuildPathConfigs(nodeConfig.GetAttribute("name"), nodeConfig);
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 是否需要pick、place过程主界面动画
 
-         /// 应用:手动拖动时,不需要此动画
 
-         /// </summary>
 
-         public bool IsNeedAnimationDisplay { get; set; } = true;
 
-         #region 未找到合理的界面更改配置后如何更新此配置的方式,暂时不用
 
-         private Dictionary<string, string> _stockersType;
 
-         /// <summary>
 
-         /// 存放每个Stocker的配置的WaferType
 
-         /// </summary>
 
-         public Dictionary<string, string> StockersConfigType
 
-         {
 
-             get
 
-             {
 
-                 if (_stockersType == null)
 
-                 {
 
-                     _stockersType = new Dictionary<string, string>();
 
-                     for (Int32 i = 1; i <= StockerCount; i++)
 
-                     {
 
-                         string key = $"System.Stocker.Stocker{i}WaferType";
 
-                         if (QueryDataClient.Instance.Service.GetConfig(key) == null)
 
-                         {
 
-                             LOG.Error($"GlobalDataManager.StockersConfigType QueryDataClient.Instance.Service.GetConfig({key}=null)");
 
-                             _stockersType[$"Stocker{i}"] = "";
 
-                         }
 
-                         else
 
-                         {
 
-                             _stockersType[$"Stocker{i}"] = ((string)QueryDataClient.Instance.Service.GetConfig(key)).Trim();
 
-                         }
 
-                     }
 
-                 }
 
-                 return _stockersType;
 
-             }
 
-             set
 
-             {
 
-                 _stockersType = value;
 
-             }
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |