| 
															
																@@ -115,6 +115,8 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         private int _cycledCount = 0; 
															 | 
															
															 | 
															
																         private int _cycledCount = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         private int _cycledWafer = 0; 
															 | 
															
															 | 
															
																         private int _cycledWafer = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         private float _throughput = 0.0f; 
															 | 
															
															 | 
															
																         private float _throughput = 0.0f; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        private Dictionary<ModuleName, int> _lpCycleWafer = new Dictionary<ModuleName, int>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        private Dictionary<ModuleName, int> _lpCycleCount = new Dictionary<ModuleName, int>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         private Stopwatch _cycleWatch = new Stopwatch(); 
															 | 
															
															 | 
															
																         private Stopwatch _cycleWatch = new Stopwatch(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																         public bool HasJobRunning => _lstControlJobs.Count > 0; 
															 | 
															
															 | 
															
																         public bool HasJobRunning => _lstControlJobs.Count > 0; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -155,6 +157,8 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             _cycledCount = 0; 
															 | 
															
															 | 
															
																             _cycledCount = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             _throughput = 0; 
															 | 
															
															 | 
															
																             _throughput = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             _cycleWatch.Stop(); 
															 | 
															
															 | 
															
																             _cycleWatch.Stop(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            _lpCycleWafer.Clear(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            _lpCycleCount.Clear(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																             return RState.Running; 
															 | 
															
															 | 
															
																             return RState.Running; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -497,6 +501,12 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 _cycleWatch.Restart(); 
															 | 
															
															 | 
															
																                 _cycleWatch.Restart(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             } 
															 | 
															
															 | 
															
																             } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if(!_lpCycleWafer.Keys.Contains(ModuleHelper.Converter(cj.Module))) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                _lpCycleCount.Add(ModuleHelper.Converter(cj.Module), 0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                _lpCycleWafer.Add(ModuleHelper.Converter(cj.Module), 0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+             
															 | 
														
													
												
													
														
															| 
															 | 
															
																             _cycleState = RState.Running; 
															 | 
															
															 | 
															
																             _cycleState = RState.Running; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -2134,6 +2144,8 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     allControlJobComplete = false; 
															 | 
															
															 | 
															
																                     allControlJobComplete = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     continue; 
															 | 
															
															 | 
															
																                     continue; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 } 
															 | 
															
															 | 
															
																                 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                int countProcessed = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (cj.State == EnumControlJobState.Executing) 
															 | 
															
															 | 
															
																                 if (cj.State == EnumControlJobState.Executing) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 { 
															 | 
															
															 | 
															
																                 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     bool allPjCompleted = true; 
															 | 
															
															 | 
															
																                     bool allPjCompleted = true; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -2145,6 +2157,22 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             LOG.Write( eEvent.ERR_ROUTER, ModuleName.System, $"Not find pj named {pjName} in {cj.Name}"); 
															 | 
															
															 | 
															
																                             LOG.Write( eEvent.ERR_ROUTER, ModuleName.System, $"Not find pj named {pjName} in {cj.Name}"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             continue; 
															 | 
															
															 | 
															
																                             continue; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         } 
															 | 
															
															 | 
															
																                         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        // caculate process wafer by process 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        if (_isCycleMode && _cycledCount < (_isCycleMode ? _cycleSetPoint : 0)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            foreach (var pjSlotWafer in pj.SlotWafers) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                WaferInfo wafer = WaferManager.Instance.GetWafer(pjSlotWafer.Item1, pjSlotWafer.Item2); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                if (!wafer.IsEmpty && wafer.ProcessJob != null && wafer.ProcessJob.Sequence != null 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    && !IsWaferNeedGotoModule(wafer, ModuleName.PMA) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    && !IsWaferNeedGotoModule(wafer, ModuleName.PMB) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    && !IsWaferNeedGotoModule(wafer, ModuleName.PMC) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    && !IsWaferNeedGotoModule(wafer, ModuleName.PMD)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    countProcessed++; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         if (pj.State != EnumProcessJobState.Complete && pj.State != EnumProcessJobState.ProcessingComplete) 
															 | 
															
															 | 
															
																                         if (pj.State != EnumProcessJobState.Complete && pj.State != EnumProcessJobState.ProcessingComplete) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         { 
															 | 
															
															 | 
															
																                         { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             allPjCompleted = false; 
															 | 
															
															 | 
															
																                             allPjCompleted = false; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -2177,10 +2205,35 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         if (!(_isCycleMode && _cycledCount < _cycleSetPoint)) 
															 | 
															
															 | 
															
																                         if (!(_isCycleMode && _cycledCount < _cycleSetPoint)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             (Singleton<TransferModule>.Instance.GetScheduler(ModuleHelper.Converter(cj.Module)) as SchedulerLoadPort).NoteJobComplete(); 
															 | 
															
															 | 
															
																                             (Singleton<TransferModule>.Instance.GetScheduler(ModuleHelper.Converter(cj.Module)) as SchedulerLoadPort).NoteJobComplete(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _lpCycleCount[ModuleHelper.Converter(cj.Module)]++; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     } 
															 | 
															
															 | 
															
																                     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 } 
															 | 
															
															 | 
															
																                 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                // caculate total processed wafer and throughput 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                if (_isCycleMode && _cycledCount < (_isCycleMode ? _cycleSetPoint : 0)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    int lpCycleWafer = _lpCycleCount[ModuleHelper.Converter(cj.Module)] * cj.LotWafers.Count + countProcessed; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    if (_lpCycleCount[ModuleHelper.Converter(cj.Module)] != _cycledCount || lpCycleWafer != _lpCycleWafer[ModuleHelper.Converter(cj.Module)]) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _lpCycleWafer[ModuleHelper.Converter(cj.Module)] = lpCycleWafer; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        int totolCycleWafer = _lpCycleWafer.Sum(item => item.Value); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _cycledCount = _lpCycleCount.Sum(item => item.Value); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        if (totolCycleWafer != _cycledWafer) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            _cycledWafer = totolCycleWafer; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            if (_cycledWafer >= 25) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                _throughput = (float)(_cycledWafer / _cycleWatch.Elapsed.TotalHours); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            else 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                _throughput = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                     
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 LoadportCassetteState state = (LoadportCassetteState)DATA.Poll($"{cj.Module}.CassetteState"); 
															 | 
															
															 | 
															
																                 LoadportCassetteState state = (LoadportCassetteState)DATA.Poll($"{cj.Module}.CassetteState"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (cj.State == EnumControlJobState.Completed && state != LoadportCassetteState.Normal) 
															 | 
															
															 | 
															
																                 if (cj.State == EnumControlJobState.Completed && state != LoadportCassetteState.Normal) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 { 
															 | 
															
															 | 
															
																                 { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -2192,36 +2245,9 @@ namespace Venus_RT.Modules 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																             if (_isCycleMode && _cycledCount < (_isCycleMode ? _cycleSetPoint : 0)) 
															 | 
															
															 | 
															
																             if (_isCycleMode && _cycledCount < (_isCycleMode ? _cycleSetPoint : 0)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             { 
															 | 
															
															 | 
															
																             { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                int countPerCycle = 0; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                int countProcessed = 0; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                foreach (var pj in _lstProcessJobs) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    foreach (var pjSlotWafer in pj.SlotWafers) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        countPerCycle++; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        WaferInfo wafer = WaferManager.Instance.GetWafer(pjSlotWafer.Item1, pjSlotWafer.Item2); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        if (!wafer.IsEmpty && !IsWaferNeedGotoModule(wafer, ModuleName.PMA) && !IsWaferNeedGotoModule(wafer, ModuleName.PMB) && !IsWaferNeedGotoModule(wafer, ModuleName.PMC) && !IsWaferNeedGotoModule(wafer, ModuleName.PMD)) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                            countProcessed++; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                int totalCycleWafer = _cycledCount * countPerCycle + countProcessed; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if(_cycledWafer != totalCycleWafer) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    _cycledWafer = totalCycleWafer; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    if(_cycledWafer >= 25) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        _throughput = (float)(_cycledWafer / _cycleWatch.Elapsed.TotalHours); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    else 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        _throughput = 0; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (allControlJobComplete) 
															 | 
															
															 | 
															
																                 if (allControlJobComplete) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 { 
															 | 
															
															 | 
															
																                 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    _cycledCount++; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                   // _cycledCount++; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     if (_cycledCount < _cycleSetPoint) 
															 | 
															
															 | 
															
																                     if (_cycledCount < _cycleSetPoint) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     { 
															 | 
															
															 | 
															
																                     { 
															 |