Browse Source

UIWafer信息更新定时器内改成先获取wafer改动模块,根据改动module更新UI的wafer信息,降低通讯占用

huangping 2 weeks ago
parent
commit
06e90ffa2b

+ 1 - 0
FrameworkLocal/Common/DataCenter/IQueryDataService.cs

@@ -145,6 +145,7 @@ namespace MECF.Framework.Common.DataCenter
     [ServiceKnownType(typeof(List<RecipeFileNode>))]
     [ServiceKnownType(typeof(Dictionary<string, List<string>>))]
     [ServiceKnownType(typeof(Dictionary<string, Dictionary<string, string>>))]
+    [ServiceKnownType(typeof(Dictionary<string, bool>))]
 
     public interface IQueryDataService
     {

+ 50 - 16
FrameworkLocal/Common/SubstrateTrackings/WaferManager.cs

@@ -5,6 +5,7 @@ using Aitex.Core.Common;
 using Aitex.Core.RT.DataCenter;
 using Aitex.Core.RT.Event;
 using Aitex.Core.RT.Log;
+using Aitex.Core.RT.OperationCenter;
 using Aitex.Core.Util;
 using FabConnect.SecsGemInterface.Common;
 using MECF.Framework.Common.DataCenter;
@@ -67,6 +68,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
         private PeriodicJob _thread;
         private bool _needSerialize;
+        public Dictionary<string, bool> NeedUpdateModule = new Dictionary<string, bool>();
 
         public WaferManager()
         {
@@ -140,9 +142,19 @@ namespace MECF.Framework.Common.SubstrateTrackings
             //EV.Subscribe(new EventItem("Event", Event_STS_Unoccupied, "Substrate location state is Unoccupied."));
             //EV.Subscribe(new EventItem("Event", Event_STS_Occupied, "Substrate location state is occupied."));
 
-
-
-
+            DATA.Subscribe("System.ChangeWafers", () => NeedUpdateModule);
+            OP.Subscribe("System.UpdateWafersNotify", (string cmd, object[] args) =>
+            {
+                if (args.Length > 0 && args[0] is Dictionary<string, bool> updateModules)
+                {
+                    foreach (var module in updateModules.Keys)
+                    {
+                        if (NeedUpdateModule.ContainsKey(module)) NeedUpdateModule[module] = false;
+                    }
+                    return true;
+                }
+                return false;
+            });
             Deserialize();
             _thread = new PeriodicJob(1000, Serialize, $"SerializeMonitorHandler", true);
         }
@@ -172,6 +184,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
 
             DATA.Subscribe(module.ToString(), "ModuleWaferList", () => _locationWafers[module].Values.ToArray());
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void WaferMoved(ModuleName moduleFrom, int slotFrom, ModuleName moduleTo, int slotTo, bool needHistory = true)
@@ -247,7 +260,8 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             if (needHistory)
                 EV.PostInfoLog("System", $"Wafer:{wafer.WaferID} moved from {moduleFrom} slot:{slotFrom + 1} to {moduleTo} slot:{slotTo + 1}.");
-
+            NeedUpdateModule[moduleFrom.ToString()] = true;
+            NeedUpdateModule[moduleTo.ToString()] = true;
             //Serialize();
             _needSerialize = true;
         }
@@ -328,7 +342,8 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             UpdateWaferProcessStatus(moduleFrom, slotFrom, EnumWaferProcessStatus.Failed);
             UpdateWaferProcessStatus(moduleTo, slotTo, EnumWaferProcessStatus.Failed);
-
+            NeedUpdateModule[moduleFrom.ToString()] = true;
+            NeedUpdateModule[moduleTo.ToString()] = true;
             //Serialize();
             _needSerialize = true;
         }
@@ -610,7 +625,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
 
             WaferDataRecorder.CreateWafer(_locationWafers[module][slot].InnerId.ToString(), carrierInnerId, module.ToString(), slot, _locationWafers[module][slot].WaferID, _locationWafers[module][slot].ProcessState.ToString());
-
+            NeedUpdateModule[module.ToString()] = true;
             //Serialize();
             _needSerialize = true;
             EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot + 1}.");
@@ -694,6 +709,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
             EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot + 1}.");
             return _locationWafers[module][slot];
         }
@@ -763,7 +779,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
-
+            NeedUpdateModule[module.ToString()] = true;
             return _locationWafers[module][slot];
         }
 
@@ -797,7 +813,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                     _dict.Remove(_locationWafers[module][slot].WaferID);
                 }
             }
-
+            NeedUpdateModule[module.ToString()] = true;
             //Serialize();
             _needSerialize = true;
         }
@@ -834,6 +850,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void ManualDeleteWafer(ModuleName module, int slotFrom, int count = 1)
@@ -870,6 +887,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
 
@@ -889,6 +907,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferDestination(ModuleName module, int slot, string destCarrierID, int destslot)
@@ -909,6 +928,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferDestination(ModuleName module, int slot, ModuleName destmodule, int destslot)
@@ -929,6 +949,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
 
@@ -951,6 +972,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferT7Code(ModuleName module, int slot, string T7Code)
@@ -968,6 +990,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdataWaferPPID(ModuleName module, int slot, string PPID)
@@ -985,6 +1008,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferT7CodeWithScoreAndFileName(ModuleName module, int slot, string t7Code, string t7CodeScore, string fileName, string filePath)
@@ -1005,6 +1029,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferTransFlag(ModuleName module, int slot, string flag)
@@ -1021,6 +1046,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferNotch(ModuleName module, int slot, int angle)
@@ -1036,6 +1062,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
         public List<WaferInfo> GetAllWafers()
         {
@@ -1072,6 +1099,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             }
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferInfo(ModuleName module, int slot, float thick)
@@ -1086,6 +1114,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _locationWafers[module][slot].Thick = thick;
             }
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
         public void UpdateWaferProcessStatus(ModuleName module, int slot, EnumWaferProcessStatus status)
         {
@@ -1103,6 +1132,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferProcessStatus(ModuleName module, int slot, EnumWaferProcessStatus processStatus, WaferStatus waferStatus)
@@ -1121,6 +1151,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 WaferDataRecorder.SetWaferStatus(_locationWafers[module][slot].InnerId.ToString(), processStatus.ToString());
             }
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 #pragma warning disable CS0618  
         public void UpdateWaferProcessStatus(ModuleName module, int slot, ProcessStatus status)
@@ -1187,6 +1218,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             UpdateWaferHistory(module, slot, SubstAccessType.UpdateWaferID);
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferJodID(ModuleName module, int slot, string pjID, string cjID)
@@ -1204,6 +1236,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void SlotMapVerifyOK(ModuleName module)
@@ -1220,7 +1253,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
 
             }
-            _needSerialize = true;
+            _needSerialize = true;     
         }
         public void UpdateWaferTransportState(string waferid, SubstrateTransportStatus ststate)
         {
@@ -1260,8 +1293,6 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
-            //Serialize();
-            _needSerialize = true;
         }
 
 
@@ -1328,8 +1359,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 }
             }
             //Serialize();
-            _needSerialize = true;
-
+            _needSerialize = true;         
         }
 
         public void UpdateWaferE90State(ModuleName module, int slot, EnumE90Status E90state)
@@ -1378,7 +1408,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
-
+            NeedUpdateModule[module.ToString()] = true;
         }
 
         public void UpdateWaferHistory(ModuleName module, int slot, SubstAccessType accesstype)
@@ -1404,6 +1434,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
 
 
@@ -1423,6 +1454,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
         public void UpdateWaferHostLM1(ModuleName module, int slot, string lasermark1)
         {
@@ -1438,6 +1470,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
         public void UpdateWaferHostLM2(ModuleName module, int slot, string lasermark2)
         {
@@ -1453,6 +1486,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
+            NeedUpdateModule[module.ToString()] = true;
         }
         public void UpdateWaferProcessStatus(string waferID, EnumWaferProcessStatus status)
         {
@@ -1466,7 +1500,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 }
             }
             //Serialize();
-            _needSerialize = true;
+            _needSerialize = true;      
         }
         public void UpdateWaferProcess(string waferID, string processId)
         {
@@ -1543,7 +1577,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
 
             _needSerialize = true;
-
+            NeedUpdateModule[module.ToString()] = true;
             Serialize();
             return true;
         }

+ 51 - 43
FrameworkLocal/UIClient/ClientBase/ModuleDataMonitor.cs

@@ -8,6 +8,7 @@ using System.Windows.Threading;
 using Aitex.Core.RT.Log;
 using Aitex.Core.Util;
 using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.OperationCenter;
 using RTDefine = Aitex.Core.Common;
  
 namespace MECF.Framework.UI.Client.ClientBase
@@ -38,61 +39,68 @@ namespace MECF.Framework.UI.Client.ClientBase
         {
             try
             {
-                Dictionary<string, object> data  = QueryDataClient.Instance.Service.PollData(_lstWaferDataName);
-
-                if (data != null && Application.Current != null)
+                var changeModule = QueryDataClient.Instance.Service.GetData("System.ChangeWafers");
+                if (changeModule is Dictionary<string, bool> module && module?.Count > 0)
                 {
-                    Application.Current.Dispatcher.Invoke(new Action(() =>
+                    var changedModule = module.Where(r => r.Value);
+                    if (!changedModule.Any()) return true;
+                    InvokeClient.Instance.Service.DoOperation("System.UpdateWafersNotify", changeModule);
+                    Dictionary<string, object> data = QueryDataClient.Instance.Service.PollData(changedModule.Select(r => $"{r.Key}.ModuleWaferList"));
+
+                    if (data != null && Application.Current != null)
                     {
-                        foreach (var waferData in data)
+                        Application.Current.Dispatcher.Invoke(new Action(() =>
                         {
-                            if (!_mapWaferDataModule.ContainsKey(waferData.Key))
-                                continue;
+                            foreach (var waferData in data)
+                            {
+                                if (!_mapWaferDataModule.ContainsKey(waferData.Key))
+                                    continue;
 
-                            RTDefine.WaferInfo[] wafers = waferData.Value as RTDefine.WaferInfo[];
-                            if (wafers == null)
-                                continue;
+                                RTDefine.WaferInfo[] wafers = waferData.Value as RTDefine.WaferInfo[];
+                                if (wafers == null)
+                                    continue;
 
-                            ModuleInfo info = _mapWaferDataModule[waferData.Key];
-                            if (info.WaferManager.Wafers.Count == 0)
-                            {
-                                for (int i = 0; i < wafers.Length; i++)
+                                ModuleInfo info = _mapWaferDataModule[waferData.Key];
+                                if (info.WaferManager.Wafers.Count == 0)
                                 {
-                                    info.WaferManager.Wafers.Add(WaferInfoConverter(wafers[i], info.WaferModuleID, i));
-                                }
+                                    for (int i = 0; i < wafers.Length; i++)
+                                    {
+                                        info.WaferManager.Wafers.Add(WaferInfoConverter(wafers[i], info.WaferModuleID, i));
+                                    }
 
-                                if (info.IsWaferReverseDisplay)
-                                {
-                                     info.WaferManager.Wafers = new ObservableCollection<WaferInfo>(info.WaferManager.Wafers.Reverse());
+                                    if (info.IsWaferReverseDisplay)
+                                    {
+                                        info.WaferManager.Wafers = new ObservableCollection<WaferInfo>(info.WaferManager.Wafers.Reverse());
+                                    }
+                                    continue;
                                 }
-                                continue;
-                            }
 
-                            if (wafers.Length == info.WaferManager.Wafers.Count)
-                            {
-                                int index;
-                                for (int i = 0; i < wafers.Length; i++)
+                                if (wafers.Length == info.WaferManager.Wafers.Count)
                                 {
-                                    if (info.IsWaferReverseDisplay)
-                                        index = wafers.Length - i - 1;
-                                    else
-                                        index = i;
-
-                                    var convertedWafer = WaferInfoConverter(wafers[index], info.WaferModuleID, index);
-                                    info.WaferManager.Wafers[i].WaferStatus = convertedWafer.WaferStatus;
-                                    info.WaferManager.Wafers[i].WaferID = convertedWafer.WaferID;
-                                    info.WaferManager.Wafers[i].SourceName = convertedWafer.SourceName;
-                                    info.WaferManager.Wafers[i].WaferType = convertedWafer.WaferType;
-                                    info.WaferManager.Wafers[i].UseCount = convertedWafer.UseCount;
-                                    info.WaferManager.Wafers[i].UseTime = convertedWafer.UseTime;
-                                    info.WaferManager.Wafers[i].UseThick = convertedWafer.UseThick;
-                                    info.WaferManager.Wafers[i].Thick = convertedWafer.Thick;
-                                    info.WaferManager.Wafers[i].LotId = convertedWafer.LotId;
-                                    info.WaferManager.Wafers[i].ProcessJobID = convertedWafer.ProcessJobID;
+                                    int index;
+                                    for (int i = 0; i < wafers.Length; i++)
+                                    {
+                                        if (info.IsWaferReverseDisplay)
+                                            index = wafers.Length - i - 1;
+                                        else
+                                            index = i;
+
+                                        var convertedWafer = WaferInfoConverter(wafers[index], info.WaferModuleID, index);
+                                        info.WaferManager.Wafers[i].WaferStatus = convertedWafer.WaferStatus;
+                                        info.WaferManager.Wafers[i].WaferID = convertedWafer.WaferID;
+                                        info.WaferManager.Wafers[i].SourceName = convertedWafer.SourceName;
+                                        info.WaferManager.Wafers[i].WaferType = convertedWafer.WaferType;
+                                        info.WaferManager.Wafers[i].UseCount = convertedWafer.UseCount;
+                                        info.WaferManager.Wafers[i].UseTime = convertedWafer.UseTime;
+                                        info.WaferManager.Wafers[i].UseThick = convertedWafer.UseThick;
+                                        info.WaferManager.Wafers[i].Thick = convertedWafer.Thick;
+                                        info.WaferManager.Wafers[i].LotId = convertedWafer.LotId;
+                                        info.WaferManager.Wafers[i].ProcessJobID = convertedWafer.ProcessJobID;
+                                    }
                                 }
                             }
-                        }
-                    }));
+                        }));
+                    }
                 }
             }
             catch (Exception ex)