Browse Source

EPD

# Conflicts:
#	Venus/Venus_RT/Devices/EPD/EPDClient.cs
sangwq 1 year ago
parent
commit
e8f7e93461

+ 3 - 1
Venus/Venus_RT/App.config

@@ -62,7 +62,9 @@
 		</services>
 
 		<client>
-			
+			<endpoint address="net.tcp://localhost:9002/PMService" behaviorConfiguration="EndpointBehavior" binding="netTcpBinding" bindingConfiguration="Aitex_netTcpBinding" contract="ClusterInterface.IPmService" name="Client_IPECVDService" />
+			<endpoint address="net.tcp://localhost:9004/PMService" behaviorConfiguration="EndpointBehavior" binding="netTcpBinding" bindingConfiguration="Aitex_netTcpBinding" contract="ClusterInterface.IPmService" name="Client_IIBEService" />
+			<endpoint address="net.tcp://localhost:9006/PMService" behaviorConfiguration="EndpointBehavior" binding="netTcpBinding" bindingConfiguration="Aitex_netTcpBinding" contract="ClusterInterface.IPmService" name="Client_IICPService" />
 			<endpoint address="net.tcp://192.168.10.20:5771/EPDService" behaviorConfiguration="EndpointBehavior" binding="netTcpBinding" bindingConfiguration="Aitex_netTcpBinding" contract="EPInterface.IEPDService" name="Client_IEPDService"/>
 			<endpoint address="net.tcp://192.168.10.20:5773/EPDCallbackService" behaviorConfiguration="EndpointBehavior" binding="netTcpBinding" bindingConfiguration="Aitex_netTcpBinding" contract="EPInterface.IEPDCallbackService" name="Client_IEPDCallbackService" />
 		</client>

+ 5 - 2
Venus/Venus_RT/Devices/EPD/EPDClient.cs

@@ -38,8 +38,11 @@ namespace Venus_RT.Devices.EPD
         private List<string> _cfgFileList;
         public override List<string> CFGFileList { get { return _cfgFileList; }  }
 
+<<<<<<< HEAD
         //public new string Module { get; set; }
         //public new string Name { get; set; }
+=======
+>>>>>>> e736cfa... EPD
         public string EPDVersion { get; private set; }
         public string EPDState { get; private set; }
         public string SensorStatus { get; private set; }
@@ -58,7 +61,7 @@ namespace Venus_RT.Devices.EPD
                 _port = System.Convert.ToInt32(ipaddressValue[1]);
             }
 
-            _channel = SC.GetValue<int>($"{Module}.{Name}.ChannelNumber");
+            _channel = SC.GetValue<int>($"{Module}.EPD.ChannelNumber");
 
             _socketClient = new EPDSocketClient();
             _socketClient.OnConnect += OnConnect;
@@ -96,7 +99,7 @@ namespace Venus_RT.Devices.EPD
 
         public override void RecipeStart(string recipe)
         {
-            _socketClient.RecipeStart(_channel, "");
+            _socketClient.RecipeStart(_channel, recipe);
             _status = EDPStatus.Running;
         }
 

+ 136 - 16
Venus/Venus_RT/Modules/RouteManager.cs

@@ -118,6 +118,9 @@ namespace Venus_RT.Modules
         }
 
         private TMCycle _TMCycle;
+        private AutoCycle _AutoCycle;
+
+        private bool _isWaitUnload;
 
         public RouteManager()
         {
@@ -341,11 +344,9 @@ namespace Venus_RT.Modules
             EFEM?.Initialize();
 
             _TMCycle = new TMCycle();
+            _AutoCycle = new AutoCycle();
 
             BuildTransitionTable();
-
-           
-
             return true;
         }
        
@@ -353,24 +354,55 @@ namespace Venus_RT.Modules
         {
             fsm = new StateMachine<RouteManager>(ModuleName.System.ToString(), (int)RtState.Init, 50);
             //Init sequence
-            Transition(RtState.Init, MSG.HOME, FsmStartHome, RtState.Initializing);
-            Transition(RtState.Idle, MSG.HOME, FsmStartHome, RtState.Initializing);
-            Transition(RtState.Error, MSG.HOME, FsmStartHome, RtState.Initializing);
+            Transition(RtState.Init,            MSG.HOME,               FsmStartHome,               RtState.Initializing);
+            Transition(RtState.Idle,            MSG.HOME,               FsmStartHome,               RtState.Initializing);
+            Transition(RtState.Error,           MSG.HOME,               FsmStartHome,               RtState.Initializing);
 
             ////  EnterExitTransition<RtState, FSM_MSG>(RtState.Initializing, fStartInit, FSM_MSG.NONE, null);
             ///
-            Transition(RtState.Idle, FSM_MSG.TIMER, FsmMonitor, RtState.Idle);
-            Transition(RtState.Init, FSM_MSG.TIMER, FsmMonitor, RtState.Init);
+            Transition(RtState.Idle,            FSM_MSG.TIMER,          FsmMonitor,                 RtState.Idle);
+            Transition(RtState.Init,            FSM_MSG.TIMER,          FsmMonitor,                 RtState.Init);
 
-            Transition(RtState.Initializing, FSM_MSG.TIMER, FsmMonitorHome, RtState.Idle);
-            Transition(RtState.Initializing, MSG.ERROR, FsmError, RtState.Error);
-            Transition(RtState.Initializing, MSG.ABORT, FsmAbort, RtState.Init);
+            Transition(RtState.Initializing,    FSM_MSG.TIMER,          FsmMonitorHome,             RtState.Idle);
+            Transition(RtState.Initializing,    MSG.ERROR,              FsmError,                   RtState.Error);
+            Transition(RtState.Initializing,    MSG.ABORT,              FsmAbort,                   RtState.Init);
 
 
             // TM  Cycle
-            Transition(RtState.Idle,        MSG.TMCycle,        FsmStartTMCycle,        RtState.TMCycle);
-            Transition(RtState.TMCycle,     FSM_MSG.TIMER,      FsmMonitorTMCycle,      RtState.Idle);
-            Transition(RtState.TMCycle,     MSG.StopCycle,      FsmStopTMCycle,               RtState.Idle);
+            Transition(RtState.Idle,            MSG.TMCycle,            FsmStartTMCycle,            RtState.TMCycle);
+            Transition(RtState.TMCycle,         FSM_MSG.TIMER,          FsmMonitorTMCycle,          RtState.Idle);
+            Transition(RtState.TMCycle,         MSG.StopCycle,          FsmStopTMCycle,             RtState.Idle);
+
+            //Auto/manual 
+            Transition(RtState.Idle,            MSG.SetAutoMode,        FsmStartAutoTransfer,       RtState.AutoIdle);
+
+            Transition(RtState.AutoRunning,     FSM_MSG.TIMER,          FsmAutoTransfer,            RtState.Idle);
+            Transition(RtState.AutoRunning,     MSG.ABORT,              FsmAbortAutoTransfer,       RtState.Idle);
+            //Transition(RtState.AutoRunning,   MSG.SetManualMode,      FsmStartSetManualMode,      RtState.Idle);
+            Transition(RtState.AutoRunning,     MSG.JobDone,            FsmJobDone,                 RtState.AutoIdle);
+            //Transition(RtState.AutoRunning,   MSG.CassetteLeave,      fCassetteLeave,             RtState.AutoRunning);   //For unload light control off afer job done
+
+            Transition(RtState.AutoRunning,     MSG.CreateJob,          FsmCreateJob,               RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.StartJob,           FsmStartJob,                RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.PauseJob,           FsmPauseJob,                RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.ResumeJob,          FsmResumeJob,               RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.StopJob,            FsmStopJob,                 RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.AbortJob,           FsmAbortJob,                RtState.AutoRunning);
+
+            Transition(RtState.AutoRunning,     MSG.Map,                FsmMap,                     RtState.AutoRunning);
+
+            Transition(RtState.AutoRunning,     MSG.ResetIdleCleanTime, FsmResetIdleCleanTime,      RtState.AutoRunning);
+            Transition(RtState.AutoRunning,     MSG.ResetIdlePurgeTime, FsmResetIdlePurgeTime,      RtState.AutoRunning);
+
+            Transition(RtState.AutoIdle,        FSM_MSG.TIMER,          FsmMonitorAutoIdle,         RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.SetManualMode,      FsmStartSetManualMode,      RtState.Idle);
+            Transition(RtState.AutoIdle,        MSG.CreateJob,          FsmCreateJob,               RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.StartJob,           FsmStartJob,                RtState.AutoRunning);
+            Transition(RtState.AutoIdle,        MSG.PauseJob,           FsmPauseJob,                RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.ResumeJob,          FsmResumeJob,               RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.StopJob,            FsmStopJob,                 RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.AbortJob,           FsmAbortJob,                RtState.AutoIdle);
+            Transition(RtState.AutoIdle,        MSG.Map,                FsmMap,                     RtState.AutoIdle);
 
         }
 
@@ -452,6 +484,96 @@ namespace Venus_RT.Modules
             _TMCycle.Abort();
             return true;          
         }
+
+        private bool FsmStartAutoTransfer(object[] objs)
+        {
+            return _AutoCycle.Start(objs) == RState.Running;
+        }
+
+        private bool FsmAutoTransfer(object[] objs)
+        {
+            RState ret = _AutoCycle.Monitor();
+
+            if (_AutoCycle.CheckJobJustDone(out string jobInfo))
+            {
+                EV.PostPopDialogMessage(EventLevel.InformationNoDelay, "Job complete", jobInfo);
+            }
+
+            if (_AutoCycle.CheckAllJobDone())
+            {
+                if (!CheckToPostMessage((int)MSG.JobDone))
+                    return false;
+            }
+
+            _isWaitUnload = (bool)DATA.Poll("LP1.NotifyJobDone") || (bool)DATA.Poll("LP2.NotifyJobDone");
+
+            return ret ==  RState.End;
+        }
+
+        private bool FsmAbortAutoTransfer(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmJobDone(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmCreateJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmStartJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmPauseJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmResumeJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmStopJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmAbortJob(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmMap(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmResetIdleCleanTime(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmResetIdlePurgeTime(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmMonitorAutoIdle(object[] objs)
+        {
+            return true;
+        }
+
+        private bool FsmStartSetManualMode(object[] objs)
+        {
+            return true;
+        }
         private void _debugRoutine()
         {
             int flag = 0;
@@ -464,8 +586,6 @@ namespace Venus_RT.Modules
             {
                 PostMsg(MSG.TMCycle);
             }
-
         }
-
     }
 }