Browse Source

bug fix:wafer累计未正常更新

jiangjy 1 month ago
parent
commit
fa7c12b235

+ 120 - 102
FrameworkLocal/Common/SubstrateTrackings/WaferManager.cs

@@ -11,12 +11,13 @@ using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.DBCore;
 using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.Utilities;
+using SciChart.Core.Extensions;
 
 namespace MECF.Framework.Common.SubstrateTrackings
 {
     public class WaferManager : Singleton<WaferManager>
     {
-         Dictionary<string, WaferInfo> _dict = new Dictionary<string, WaferInfo>();
+        Dictionary<string, WaferInfo> _dict = new Dictionary<string, WaferInfo>();
 
         object _lockerWaferList = new object();
 
@@ -73,7 +74,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
         public bool Serialize()
         {
-            if(!_needSerialize) return true;
+            if (!_needSerialize) return true;
             _needSerialize = false;
             try
             {
@@ -145,7 +146,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             Deserialize();
             _thread = new PeriodicJob(1000, Serialize, $"SerializeMonitorHandler", true);
         }
- 
+
         public void SubscribeLocation(string module, int slotNumber)
         {
             ModuleName mod;
@@ -177,7 +178,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
         {
             if (_locationWafers[moduleFrom][slotFrom].IsEmpty)
             {
-                LOG.Write(string.Format("Invalid wafer move, no wafer at source, {0}{1}=>{2}{3}", moduleFrom, slotFrom+1, moduleTo, slotTo+1));
+                LOG.Write(string.Format("Invalid wafer move, no wafer at source, {0}{1}=>{2}{3}", moduleFrom, slotFrom + 1, moduleTo, slotTo + 1));
                 return;
             }
 
@@ -196,12 +197,12 @@ namespace MECF.Framework.Common.SubstrateTrackings
             UpdateWaferHistory(moduleTo, slotTo, SubstAccessType.Arrive);
             DeleteWaferForMove(moduleFrom, slotFrom);
 
-            if(needHistory)
+            if (needHistory)
                 EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferMoved, waferOrigin, moduleFrom.ToString(), slotFrom + 1, moduleTo.ToString(), slotTo + 1);
 
             WaferMoveHistoryRecorder.WaferMoved(wafer.InnerId.ToString(), moduleTo.ToString(), slotTo, wafer.Status.ToString());
 
-            if(needHistory)
+            if (needHistory)
                 EV.Notify(EventWaferLeft, new SerializableDictionary<string, string>()
                 {
                     {"SLOT_NO", (slotFrom+1).ToString("D2")},
@@ -212,10 +213,10 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 });
             if (ModuleHelper.IsLoadPort(moduleFrom))
             {
-                
+
                 UpdateWaferTransportState(wafer.WaferID, SubstrateTransportStatus.AtWork);
 
-                UpdateWaferE90State(wafer.WaferID, EnumE90Status.InProcess);              
+                UpdateWaferE90State(wafer.WaferID, EnumE90Status.InProcess);
 
             }
             if (needHistory)
@@ -230,15 +231,15 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             if (ModuleHelper.IsLoadPort(moduleTo))
             {
-                
 
-                if(wafer.SubstE90Status == EnumE90Status.InProcess)
+
+                if (wafer.SubstE90Status == EnumE90Status.InProcess)
                     UpdateWaferE90State(wafer.WaferID, EnumE90Status.Processed);
 
 
                 if (moduleTo == (ModuleName)wafer.OriginStation && wafer.SubstE90Status != EnumE90Status.Processed)
                     UpdateWaferTransportState(wafer.WaferID, SubstrateTransportStatus.AtSource);
-                else 
+                else
                     UpdateWaferTransportState(wafer.WaferID, SubstrateTransportStatus.AtDestination);
 
 
@@ -335,9 +336,9 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
         private string GetCarrierID(ModuleName module)
         {
-            if (!ModuleHelper.IsLoadPort(module)) 
+            if (!ModuleHelper.IsLoadPort(module))
                 return "";
-            if(DATA.Poll($"{module.ToString()}.CarrierId") == null)
+            if (DATA.Poll($"{module.ToString()}.CarrierId") == null)
                 return "";
             return DATA.Poll($"{module.ToString()}.CarrierId").ToString();
         }
@@ -351,7 +352,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
         {
             if (!_locationWafers.ContainsKey(module))
                 return null;
-            return _locationWafers[module].Values.ToArray() ;
+            return _locationWafers[module].Values.ToArray();
 
         }
 
@@ -362,8 +363,8 @@ namespace MECF.Framework.Common.SubstrateTrackings
             {
                 foreach (var waferInfo in moduleWafer.Value)
                 {
-                    if (waferInfo.Value!=null && !waferInfo.Value.IsEmpty 
-                                              && (waferInfo.Value.ProcessJob!=null) 
+                    if (waferInfo.Value != null && !waferInfo.Value.IsEmpty
+                                              && (waferInfo.Value.ProcessJob != null)
                         && waferInfo.Value.ProcessJob.Name == jobName)
                         wafers.Add(waferInfo.Value);
 
@@ -432,7 +433,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 foreach (var wafer in locationWafer.Value)
                 {
                     if (wafer.Value.OriginCarrierID == Originalcarrier && wafer.Value.OriginSlot == Originalslot)
-                        ret.Add(wafer.Value);                        
+                        ret.Add(wafer.Value);
                 }
             }
             return ret.ToArray();
@@ -440,7 +441,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
         public string GetWaferID(ModuleName module, int slot)
         {
-            return IsWaferSlotLocationValid(module, slot) ? _locationWafers[module][slot].WaferID: "";
+            return IsWaferSlotLocationValid(module, slot) ? _locationWafers[module][slot].WaferID : "";
         }
         public WaferSize GetWaferSize(ModuleName module, int slot)
         {
@@ -462,7 +463,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
         }
         public bool CheckWaferIsDummy(ModuleName module, int slot)
         {
-            return IsWaferSlotLocationValid(module, slot) && !_locationWafers[module][slot].IsEmpty 
+            return IsWaferSlotLocationValid(module, slot) && !_locationWafers[module][slot].IsEmpty
                                                           && _locationWafers[module][slot].Status == WaferStatus.Dummy;
         }
 
@@ -532,14 +533,14 @@ namespace MECF.Framework.Common.SubstrateTrackings
         }
         public bool CheckWafer(ModuleName module, int slot, WaferStatus state)
         {
-            return IsWaferSlotLocationValid(module, slot) && (_locationWafers[module][slot].Status==state);
+            return IsWaferSlotLocationValid(module, slot) && (_locationWafers[module][slot].Status == state);
         }
 
         public WaferInfo CreateWafer(ModuleName module, int slot, WaferStatus state, WaferType waferType = WaferType.None, string lotId = "")
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
-                LOG.Write(string.Format("Invalid wafer create, invalid parameter, {0},{1}", module, slot+1));
+                LOG.Write(string.Format("Invalid wafer create, invalid parameter, {0},{1}", module, slot + 1));
                 return null;
             }
 
@@ -560,13 +561,13 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
 
             lock (_lockerWaferList)
-            {                
+            {
                 _locationWafers[module][slot].Status = state;
                 _locationWafers[module][slot].ProcessState = EnumWaferProcessStatus.Idle;
                 _locationWafers[module][slot].SubstE90Status = EnumE90Status.NeedProcessing;
 
 
-                _locationWafers[module][slot].WaferID = GenerateWaferId(module, slot,carrierID);
+                _locationWafers[module][slot].WaferID = GenerateWaferId(module, slot, carrierID);
                 _locationWafers[module][slot].WaferOrigin = GenerateOrigin(module, slot);
 
                 _locationWafers[module][slot].Station = (int)module;
@@ -588,12 +589,12 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _locationWafers[module][slot].WaferType = waferType;
 
                 SubstHistory hist = new SubstHistory(module.ToString(), slot, DateTime.Now, SubstAccessType.Create);
-                _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };    
-                 
+                _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };
+
                 _dict[_locationWafers[module][slot].WaferID] = _locationWafers[module][slot];
-                
-                
-                
+
+
+
                 //EV.Notify(Event_STS_Occupied, new SerializableDictionary<string, object>()
                 //{
                 //    {SubstLocID,module.ToString()},
@@ -612,7 +613,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
-            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot+1}.");
+            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot + 1}.");
             return _locationWafers[module][slot];
         }
 
@@ -620,7 +621,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
-                LOG.Write(string.Format("Invalid wafer create, invalid parameter, {0},{1}", module, slot+1));
+                LOG.Write(string.Format("Invalid wafer create, invalid parameter, {0},{1}", module, slot + 1));
                 return null;
             }
 
@@ -641,13 +642,13 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
 
             lock (_lockerWaferList)
-            {                
+            {
                 _locationWafers[module][slot].Status = state;
                 _locationWafers[module][slot].ProcessState = EnumWaferProcessStatus.Idle;
                 _locationWafers[module][slot].SubstE90Status = EnumE90Status.NeedProcessing;
 
 
-                _locationWafers[module][slot].WaferID = GenerateWaferId(originModule, originSlot,carrierID);
+                _locationWafers[module][slot].WaferID = GenerateWaferId(originModule, originSlot, carrierID);
                 _locationWafers[module][slot].WaferOrigin = GenerateOrigin(originModule, originSlot);
 
                 _locationWafers[module][slot].Station = (int)module;
@@ -669,12 +670,12 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _locationWafers[module][slot].WaferType = waferType;
 
                 SubstHistory hist = new SubstHistory(module.ToString(), slot, DateTime.Now, SubstAccessType.Create);
-                _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };    
-                 
+                _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };
+
                 _dict[_locationWafers[module][slot].WaferID] = _locationWafers[module][slot];
-                
-                
-                
+
+
+
                 //EV.Notify(Event_STS_Occupied, new SerializableDictionary<string, object>()
                 //{
                 //    {SubstLocID,module.ToString()},
@@ -693,11 +694,11 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             //Serialize();
             _needSerialize = true;
-            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot+1}.");
+            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot + 1}.");
             return _locationWafers[module][slot];
         }
 
-        public WaferInfo CreateWafer(ModuleName module, int slot, WaferStatus state,WaferSize wz)
+        public WaferInfo CreateWafer(ModuleName module, int slot, WaferStatus state, WaferSize wz)
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
@@ -751,13 +752,13 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };
 
                 _dict[_locationWafers[module][slot].WaferID] = _locationWafers[module][slot];
-                
+
 
             }
             UpdateWaferE90State(_locationWafers[module][slot].WaferID, EnumE90Status.NeedProcessing);
             UpdateWaferTransportState(_locationWafers[module][slot].WaferID, SubstrateTransportStatus.AtSource);
 
-            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot+1} wafersize:{wz}.");
+            EV.PostInfoLog("System", $"Create wafer successfully on {module} slot:{slot + 1} wafersize:{wz}.");
             WaferDataRecorder.CreateWafer(_locationWafers[module][slot].InnerId.ToString(), carrierInnerId, module.ToString(), slot, _locationWafers[module][slot].WaferID, _locationWafers[module][slot].ProcessState.ToString());
 
             //Serialize();
@@ -772,7 +773,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             {
                 for (int i = 0; i < count; i++)
                 {
-                    int slot = slotFrom+i;
+                    int slot = slotFrom + i;
                     if (!IsWaferSlotLocationValid(module, slot))
                     {
                         LOG.Write(string.Format("Invalid wafer delete, invalid parameter, {0},{1}", module, slot + 1));
@@ -837,15 +838,15 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
         public void ManualDeleteWafer(ModuleName module, int slotFrom, int count = 1)
         {
-            
-                for (int i = 0; i < count; i++)
+
+            for (int i = 0; i < count; i++)
+            {
+                int slot = slotFrom + i;
+                if (!IsWaferSlotLocationValid(module, slot))
                 {
-                    int slot = slotFrom + i;
-                    if (!IsWaferSlotLocationValid(module, slot))
-                    {
-                        LOG.Write(string.Format("Invalid wafer delete, invalid parameter, {0},{1}", module, slot + 1));
-                        continue;
-                    }
+                    LOG.Write(string.Format("Invalid wafer delete, invalid parameter, {0},{1}", module, slot + 1));
+                    continue;
+                }
                 //    EV.Notify(Event_STS_Unoccupied, new SerializableDictionary<string, object>()
                 //{
                 //    {SubstLocID,module.ToString()},
@@ -853,9 +854,9 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 //    {SubstLocState,0}
                 //});
 
-                    UpdateWaferE90State(_locationWafers[module][slot].WaferID, EnumE90Status.Lost);
-                    UpdateWaferTransportState(_locationWafers[module][slot].WaferID,  SubstrateTransportStatus.None);
-                    UpdateWaferHistory(module, slotFrom, SubstAccessType.Delete);
+                UpdateWaferE90State(_locationWafers[module][slot].WaferID, EnumE90Status.Lost);
+                UpdateWaferTransportState(_locationWafers[module][slot].WaferID, SubstrateTransportStatus.None);
+                UpdateWaferHistory(module, slotFrom, SubstAccessType.Delete);
 
                 lock (_lockerWaferList)
                 {
@@ -890,7 +891,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             _needSerialize = true;
         }
 
-        public void UpdateWaferDestination(ModuleName module, int slot, string destCarrierID,int destslot)
+        public void UpdateWaferDestination(ModuleName module, int slot, string destCarrierID, int destslot)
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
@@ -999,8 +1000,8 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _locationWafers[module][slot].T7CodeScore = t7CodeScore;
                 _locationWafers[module][slot].ImageFileName = fileName;
                 _locationWafers[module][slot].ImageFilePath = filePath;
-                
-                WaferDataRecorder.SetWaferT7CodeWithScoreAndFileName(_locationWafers[module][slot].InnerId.ToString(), t7Code,t7CodeScore, fileName, filePath);
+
+                WaferDataRecorder.SetWaferT7CodeWithScoreAndFileName(_locationWafers[module][slot].InnerId.ToString(), t7Code, t7CodeScore, fileName, filePath);
             }
             //Serialize();
             _needSerialize = true;
@@ -1036,7 +1037,24 @@ namespace MECF.Framework.Common.SubstrateTrackings
             //Serialize();
             _needSerialize = true;
         }
+        public List<WaferInfo> GetAllWafers()
+        {
+            List<WaferInfo> result = new List<WaferInfo>();
+            lock (_lockerWaferList)
+            {
+                if (_locationWafers != null)
+                {
+                    foreach (var item in _locationWafers.Values)
+                    {
+                        result.AddRange(item.Values.Select(a => a).ToList());
+                    }
+                }
+
 
+            }
+            return result;
+
+        }
         public void UpdateWaferStatistics(ModuleName module, int slot, float useCount, float useTime, float useThick)
         {
             if (!IsWaferSlotLocationValid(module, slot))
@@ -1164,14 +1182,14 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             lock (_lockerWaferList)
             {
-                _locationWafers[module][slot].WaferID = waferId;                
+                _locationWafers[module][slot].WaferID = waferId;
             }
             UpdateWaferHistory(module, slot, SubstAccessType.UpdateWaferID);
             //Serialize();
             _needSerialize = true;
         }
 
-        public void UpdateWaferJodID(ModuleName module, int slot, string pjID,string cjID)
+        public void UpdateWaferJodID(ModuleName module, int slot, string pjID, string cjID)
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
@@ -1191,20 +1209,20 @@ namespace MECF.Framework.Common.SubstrateTrackings
         public void SlotMapVerifyOK(ModuleName module)
         {
             WaferInfo[] wafers = GetWafers(module);
-            foreach(WaferInfo wafer in wafers)
+            foreach (WaferInfo wafer in wafers)
             {
                 lock (_lockerWaferList)
                 {
-                    if (wafer.IsEmpty) continue;                   
-                    
-                  
+                    if (wafer.IsEmpty) continue;
+
+
                 }              //Serialize();
-                
+
 
             }
             _needSerialize = true;
         }
-        public void UpdateWaferTransportState(string waferid,SubstrateTransportStatus ststate)
+        public void UpdateWaferTransportState(string waferid, SubstrateTransportStatus ststate)
         {
             if (string.IsNullOrEmpty(waferid)) return;
             WaferInfo[] wafers = GetWafer(waferid);
@@ -1228,10 +1246,10 @@ namespace MECF.Framework.Common.SubstrateTrackings
                     {SubstState,(int)wafer.SubstTransStatus},
                      };
 
-                    if (ststate == SubstrateTransportStatus.AtWork) EV.Notify(Event_STS_AtWork,dvid );
-                  
+                    if (ststate == SubstrateTransportStatus.AtWork) EV.Notify(Event_STS_AtWork, dvid);
+
                     if (ststate == SubstrateTransportStatus.AtDestination) EV.Notify(Event_STS_AtDestination, dvid);
-                    
+
                     if (ststate == SubstrateTransportStatus.AtSource) EV.Notify(Event_STS_AtSourcs, dvid);
 
                     if (ststate == SubstrateTransportStatus.None) EV.Notify(Event_STS_Deleted, dvid);
@@ -1246,7 +1264,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
             _needSerialize = true;
         }
 
-        
+
         public void UpdateWaferE90State(string waferid, EnumE90Status E90state)
         {
             if (string.IsNullOrEmpty(waferid)) return;
@@ -1265,8 +1283,8 @@ namespace MECF.Framework.Common.SubstrateTrackings
                         currentcid = CarrierManager.Instance.GetCarrier(((ModuleName)wafer.Station).ToString()).CarrierId;
 
                     SECsDataItem data = new SECsDataItem(SECsFormat.List);
-                    data.Add("SourceCarrier", wafer.OriginCarrierID??"");
-                    data.Add("SourceSlot", (wafer.OriginSlot+1).ToString());
+                    data.Add("SourceCarrier", wafer.OriginCarrierID ?? "");
+                    data.Add("SourceSlot", (wafer.OriginSlot + 1).ToString());
                     data.Add("CurrentCarrier", currentcid ?? "");
                     data.Add("CurrentSlot", (wafer.Slot + 1).ToString());
                     data.Add("LaserMark1", wafer.LaserMarker ?? "");
@@ -1284,7 +1302,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                         {SubstLocID,((ModuleName)wafer.Station).ToString()},
                         {SubstProcState,(int)wafer.SubstE90Status},
                         {SubstState,(int)wafer.SubstTransStatus},
-                        {SubstSource,((ModuleName)(wafer.OriginStation)).ToString() },                    
+                        {SubstSource,((ModuleName)(wafer.OriginStation)).ToString() },
                         {SubstSourceCarrierID,wafer.OriginCarrierID  },
                         {SubstSourceSlot,wafer.OriginSlot +1 },
                         {SubstCurrentSlot,wafer.Slot+1 },
@@ -1299,10 +1317,10 @@ namespace MECF.Framework.Common.SubstrateTrackings
                         {"PORT_ID",wafer.Station},
                         {"SubstInfoList",data }
                      };
-                    if (E90state ==  EnumE90Status.InProcess) EV.Notify(Event_STS_InProcessing,dvid );
+                    if (E90state == EnumE90Status.InProcess) EV.Notify(Event_STS_InProcessing, dvid);
                     if (E90state == EnumE90Status.NeedProcessing) EV.Notify(Event_STS_NeedProcessing, dvid);
                     if (E90state == EnumE90Status.Processed) EV.Notify(Event_STS_Processed, dvid);
-                    if (E90state == EnumE90Status.Aborted) EV.Notify(Event_STS_Aborted, dvid);                    
+                    if (E90state == EnumE90Status.Aborted) EV.Notify(Event_STS_Aborted, dvid);
                     if (E90state == EnumE90Status.Lost) EV.Notify(Event_STS_Lost, dvid);
                     if (E90state == EnumE90Status.Rejected) EV.Notify(Event_STS_Rejected, dvid);
                     if (E90state == EnumE90Status.Skipped) EV.Notify(Event_STS_Skipped, dvid);
@@ -1311,25 +1329,25 @@ namespace MECF.Framework.Common.SubstrateTrackings
             }
             //Serialize();
             _needSerialize = true;
-           
+
         }
 
-        public void UpdateWaferE90State(ModuleName module,int slot, EnumE90Status E90state)
+        public void UpdateWaferE90State(ModuleName module, int slot, EnumE90Status E90state)
         {
-            
-            WaferInfo wafer = GetWafer(module,slot);
+
+            WaferInfo wafer = GetWafer(module, slot);
             if (wafer.IsEmpty) return;
 
             lock (_lockerWaferList)
             {
-               
-                    //_locationWafers[(ModuleName)wafer.Station][wafer.Slot].SubstE90Status = E90state;
-                    wafer.SubstE90Status = E90state;
-                    string currentcid = "";
-                    if (ModuleHelper.IsLoadPort((ModuleName)wafer.Station))
-                        currentcid = CarrierManager.Instance.GetCarrier(((ModuleName)wafer.Station).ToString()).CarrierId;
 
-                    var dvid = new SerializableDictionary<string, object>()
+                //_locationWafers[(ModuleName)wafer.Station][wafer.Slot].SubstE90Status = E90state;
+                wafer.SubstE90Status = E90state;
+                string currentcid = "";
+                if (ModuleHelper.IsLoadPort((ModuleName)wafer.Station))
+                    currentcid = CarrierManager.Instance.GetCarrier(((ModuleName)wafer.Station).ToString()).CarrierId;
+
+                var dvid = new SerializableDictionary<string, object>()
                     {
                     {SubstID, wafer.WaferID},
                     {LotID, wafer.LotId},
@@ -1348,15 +1366,15 @@ namespace MECF.Framework.Common.SubstrateTrackings
                         {"CarrierID",currentcid }
 
                      };
-                    if (E90state == EnumE90Status.InProcess) EV.Notify(Event_STS_InProcessing, dvid);
-                    if (E90state == EnumE90Status.NeedProcessing) EV.Notify(Event_STS_NeedProcessing, dvid);
-                    if (E90state == EnumE90Status.Processed) EV.Notify(Event_STS_Processed, dvid);
-                    if (E90state == EnumE90Status.Aborted) EV.Notify(Event_STS_Aborted, dvid);
-                    if (E90state == EnumE90Status.Lost) EV.Notify(Event_STS_Lost, dvid);
-                    if (E90state == EnumE90Status.Rejected) EV.Notify(Event_STS_Rejected, dvid);
-                    if (E90state == EnumE90Status.Skipped) EV.Notify(Event_STS_Skipped, dvid);
-                    if (E90state == EnumE90Status.Stopped) EV.Notify(Event_STS_Stopped, dvid);
-               
+                if (E90state == EnumE90Status.InProcess) EV.Notify(Event_STS_InProcessing, dvid);
+                if (E90state == EnumE90Status.NeedProcessing) EV.Notify(Event_STS_NeedProcessing, dvid);
+                if (E90state == EnumE90Status.Processed) EV.Notify(Event_STS_Processed, dvid);
+                if (E90state == EnumE90Status.Aborted) EV.Notify(Event_STS_Aborted, dvid);
+                if (E90state == EnumE90Status.Lost) EV.Notify(Event_STS_Lost, dvid);
+                if (E90state == EnumE90Status.Rejected) EV.Notify(Event_STS_Rejected, dvid);
+                if (E90state == EnumE90Status.Skipped) EV.Notify(Event_STS_Skipped, dvid);
+                if (E90state == EnumE90Status.Stopped) EV.Notify(Event_STS_Stopped, dvid);
+
             }
             //Serialize();
             _needSerialize = true;
@@ -1374,15 +1392,15 @@ namespace MECF.Framework.Common.SubstrateTrackings
             lock (_lockerWaferList)
             {
                 SubstHistory hist = new SubstHistory(module.ToString(), slot, DateTime.Now, accesstype);
-               
-                if (_locationWafers[module][slot].SubstHists == null) 
+
+                if (_locationWafers[module][slot].SubstHists == null)
                     _locationWafers[module][slot].SubstHists = new SubstHistory[] { hist };
 
                 else
                 {
-                    _locationWafers[module][slot].SubstHists = _locationWafers[module][slot].SubstHists.Concat(new SubstHistory[]{ hist}).ToArray();
+                    _locationWafers[module][slot].SubstHists = _locationWafers[module][slot].SubstHists.Concat(new SubstHistory[] { hist }).ToArray();
                 }
-                                
+
             }
             //Serialize();
             _needSerialize = true;
@@ -1482,7 +1500,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
 
             return _locationWafers[module][slot];
         }
-        public bool CheckWaferSize(ModuleName module, int slot,WaferSize size)
+        public bool CheckWaferSize(ModuleName module, int slot, WaferSize size)
         {
             if (!IsWaferSlotLocationValid(module, slot))
             {
@@ -1507,7 +1525,7 @@ namespace MECF.Framework.Common.SubstrateTrackings
                 _needSerialize = true;
                 return true;
             }
-          
+
             return oldSize == size;
         }
 
@@ -1530,15 +1548,15 @@ namespace MECF.Framework.Common.SubstrateTrackings
             return true;
         }
 
-        private string GenerateWaferId(ModuleName module, int slot,string carrierID)
-        {            
+        private string GenerateWaferId(ModuleName module, int slot, string carrierID)
+        {
             string carrierinfor = "";
             //5 + 2(unit) + 2(slot) + time(18) + index{5}     
             if (string.IsNullOrEmpty(carrierID))
                 carrierinfor = module.ToString() + DateTime.Now.ToString("yyyyMMddHHmmssffff");
             else carrierinfor = carrierID;
 
-            return string.Format($"{carrierinfor}.{(slot+1).ToString("00")}");
+            return string.Format($"{carrierinfor}.{(slot + 1).ToString("00")}");
         }
         private string GenerateOrigin(ModuleName module, int slot)
         {

+ 1 - 1
Furnace/FurnaceRT/Equipments/Jobs/AutoTransfer.cs

@@ -1735,7 +1735,7 @@ namespace FurnaceRT.Equipments.Jobs
                             continue;
                         GetWaferSlotsAndWaferType(carrier, out List<int> slots, out WaferType waferType);
 
-                        if (slots != null && GetWaferCountRelatedToWaferRobot(waferType, false) <= slots.Count && CheckCarrierCanPickFromStocker(ModuleName.CarrierRobot) && fims.Unload(pj.IsN2PurgeMode, "Charging"))
+                        if (fims != null && slots != null && GetWaferCountRelatedToWaferRobot(waferType, false) <= slots.Count && CheckCarrierCanPickFromStocker(ModuleName.CarrierRobot) && fims.Unload(pj.IsN2PurgeMode, "Charging"))
                         {
                             return;
                         }

+ 8 - 16
Furnace/FurnaceRT/Equipments/PMs/PMScheduleMaintenance.cs

@@ -134,30 +134,22 @@ namespace FurnaceRT.Equipments.PMs
 
                     case MaintenanceProcessingCommandEnum.JobAutoStart:
                         break;
-                    //case MaintenanceProcessingCommandEnum.JobProhibition:
-                    //    break;
-                    //case MaintenanceProcessingCommandEnum.JobManualStart:
-                    //    break;
+                        //case MaintenanceProcessingCommandEnum.JobProhibition:
+                        //    break;
+                        //case MaintenanceProcessingCommandEnum.JobManualStart:
+                        //    break;
                 }
             }
         }
 
         #region Carrier/Wafer
-
-        public void UpdateSEDWafer()
+     
+        public void UpdateSEDWafer(List<WaferInfo> waferInfos)
         {
-            var ccc = BinarySerializer<Dictionary<ModuleName, Dictionary<int, WaferInfo>>>.FromStream("WaferManager");
-            if (ccc == null)
+            if (waferInfos == null)
                 return;
 
 
-            List<WaferInfo> waferInfos = new List<WaferInfo>();
-
-
-            foreach (var moduleWafers in ccc)
-            {
-                waferInfos.AddRange(moduleWafers.Value.Select(a => a.Value));
-            }
             if (waferInfos.Any(a => a.WaferType == WaferType.ED))
             {
 
@@ -486,7 +478,7 @@ namespace FurnaceRT.Equipments.PMs
             string message = $"{item.Item}-{item.Display} {item.AdditionInformationDisplay}  {item.CurrentValue} limit is ({item.StartValue}~{item.LimitValue}) times";
 
 
-            bool isWarning = item.CurrentValue > item.StartValue && item.CurrentValue < item.LimitValue;
+            bool isWarning = item.CurrentValue >= item.StartValue && item.CurrentValue < item.LimitValue;
             bool isAlarm = item.CurrentValue >= item.LimitValue;
             if (isWarning)
             {

+ 2 - 2
Furnace/FurnaceRT/Equipments/PMs/RecipeExecutions/Process.cs

@@ -755,7 +755,6 @@ namespace FurnaceRT.Equipments.PMs.RecipeExecutions
 
                                         WaferManager.Instance.UpdateWaferStatistics(ModuleHelper.Converter(Module), i, useCount, useTime, useThick);
                                     }
-
                                     PMModule.UpdateRecipeThickness(PMModule.RecipeRunningInfo.RecipeName, thickness);
                                     PMModule.UpdateRecipeStepFre(stepName);
                                     PMModule.UpdateRecipeStepRunTime(stepName, stepTime);
@@ -788,7 +787,8 @@ namespace FurnaceRT.Equipments.PMs.RecipeExecutions
                                     WaferManager.Instance.UpdateWaferStatistics(ModuleHelper.Converter(Module), i, useCount, useTime, useThick);
 
                                 }
-                                PMModule.UpdateSEDWafer();
+                                PMModule.UpdateSEDWafer(WaferManager.Instance.GetAllWafers());
+
 
                                 if (PMModule.IsHeaterProfile && !PMModule.IsHeaterProfileSuccess)
                                     EV.PostWarningLog(PMModule.Module, "Auto profile failed");

+ 1 - 0
Furnace/FurnaceRT/Equipments/Systems/EquipmentManager.cs

@@ -1391,6 +1391,7 @@ namespace FurnaceRT.Equipments.Systems
                 if (WaferManager.Instance.CheckHasWafer(chamber, slot))
                 {
                     WaferManager.Instance.UpdateWaferStatistics(chamber, slot, useCount, useThick, UseTime);
+                    (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).UpdateSEDWafer(WaferManager.Instance.GetAllWafers());
                 }
             }
             if (carrier != null)

+ 2 - 2
Furnace/FurnaceUI/Views/Scheduled/ScheduledMaintenanceMonitorView.xaml

@@ -467,7 +467,7 @@ Text="{Binding DataContext.EditModel.StartValue, Mode=TwoWay, RelativeSource={Re
                                         <i:EventTrigger EventName="PreviewMouseUp">
                                             <cal:ActionMessage MethodName="TimeSelect">
                                                 <cal:Parameter Value="StepTime"></cal:Parameter>
-                                                <cal:Parameter Value="CurrentValue"></cal:Parameter>
+                                                <cal:Parameter Value="StartValue"></cal:Parameter>
                                             </cal:ActionMessage>
                                         </i:EventTrigger>
                                     </i:Interaction.Triggers>
@@ -596,7 +596,7 @@ Text="{Binding DataContext.EditModel.LimitValue, Mode=TwoWay, RelativeSource={Re
                                         <i:EventTrigger EventName="PreviewMouseUp">
                                             <cal:ActionMessage MethodName="TimeSelect">
                                                 <cal:Parameter Value="StepTime"></cal:Parameter>
-                                                <cal:Parameter Value="CurrentValue"></cal:Parameter>
+                                                <cal:Parameter Value="LimitValue"></cal:Parameter>
                                             </cal:ActionMessage>
                                         </i:EventTrigger>
                                     </i:Interaction.Triggers>