Browse Source

Enhance throughput.

sangwq 11 months ago
parent
commit
fe230ec531
1 changed files with 58 additions and 4 deletions
  1. 58 4
      Venus/Venus_RT/Modules/SystemDispatcher.cs

+ 58 - 4
Venus/Venus_RT/Modules/SystemDispatcher.cs

@@ -2415,11 +2415,65 @@ namespace Venus_RT.Modules
 
         private bool IsMovingActionsDone(List<MoveItem> actions)
         {
-            foreach(var ac in actions)
+            if(actions.Count == 1)
             {
-                var task = _lstWaferTasks.Find(wafer => (wafer.currentMod == ac.SourceModule && wafer.currentSlot == ac.SourceSlot) || (wafer.currentMod == ac.DestinationModule && wafer.currentSlot == ac.DestinationSlot));
-                if (task != null && task.movingStatus == RState.Running)
-                    return false; ;
+                if (_lstWaferTasks.Exists(wt => wt.currentMod == actions.First().SourceModule && wt.currentSlot == actions.First().SourceSlot) || 
+                    !_lstWaferTasks.Exists(wt => wt.currentMod == actions.First().DestinationModule && wt.currentSlot == actions.First().DestinationSlot) && 
+                    !ModuleHelper.IsLoadPort(actions.First().DestinationModule))
+                    return false;
+            }
+            else
+            {
+                var slotWafers = new Dictionary<KeyValuePair<ModuleName, int>, bool>();
+                foreach (var ac in actions)
+                {
+                    var scrSlot = new KeyValuePair<ModuleName, int>(ac.SourceModule, ac.SourceSlot);
+                    var destSlot = new KeyValuePair<ModuleName, int>(ac.DestinationModule, ac.DestinationSlot);
+
+                    if (!slotWafers.ContainsKey(scrSlot))
+                    {
+                        slotWafers[scrSlot] = true;
+                    }
+
+                    if (!slotWafers.ContainsKey(destSlot))
+                    {
+                        slotWafers[destSlot] = false;
+                    }
+                }
+
+                // simulate moved result
+                foreach (var ac in actions)
+                {
+                    var scrSlot = new KeyValuePair<ModuleName, int>(ac.SourceModule, ac.SourceSlot);
+                    var destSlot = new KeyValuePair<ModuleName, int>(ac.DestinationModule, ac.DestinationSlot);
+
+                    if (!slotWafers[scrSlot])
+                    {
+                        LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"{slotWafers[scrSlot]} do not has a wafer");
+                    }
+                    else
+                    {
+                        slotWafers[scrSlot] = false;
+                    }
+
+                    if (slotWafers[destSlot])
+                    {
+                        LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"{slotWafers[destSlot]}  has a wafer");
+                    }
+                    else
+                    {
+                        slotWafers[destSlot] = true;
+                    }
+                }
+
+                foreach (var slot in slotWafers)
+                {
+                    if (ModuleHelper.IsLoadPort(slot.Key.Key) && slot.Value)
+                        continue;
+
+                    if (slot.Value != _lstWaferTasks.Exists(wt => wt.currentMod == slot.Key.Key && wt.currentSlot == slot.Key.Value))
+                        return false;
+                }
             }
 
             return true;